Skip to content

SigNoz is an open-source, OpenTelemetry-native observability platform for your team and their AI agents. Get logs, metrics, and traces in one tool with features like APM, distributed tracing, log management, infra monitoring, etc. Combined with SigNoz MCP and a native AI teammate (in SigNoz Cloud) it helps you build more resilient apps.

fix: set correct openapi response struct for span mapper list (#12094)

Nityananda Gohain891106d1cad8
diff --git a/docs/api/openapi.yml b/docs/api/openapi.yml
index 9e8c2e3bc5..3741f977d7 100644
--- a/docs/api/openapi.yml
+++ b/docs/api/openapi.yml
@@ -8048,6 +8048,15 @@ components:
required:
- items
type: object
+ SpantypesGettableSpanMappers:
+ properties:
+ items:
+ items:
+ $ref: '#/components/schemas/SpantypesSpanMapper'
+ type: array
+ required:
+ - items
+ type: object
SpantypesGettableTraceAggregations:
properties:
aggregations:
@@ -8200,7 +8209,7 @@ components:
type: boolean
fieldContext:
$ref: '#/components/schemas/SpantypesFieldContext'
- group_id:
+ groupId:
type: string
id:
type: string
@@ -8213,7 +8222,7 @@ components:
type: string
required:
- id
- - group_id
+ - groupId
- name
- fieldContext
- config
@@ -13792,7 +13801,7 @@ paths:
schema:
properties:
data:
- $ref: '#/components/schemas/SpantypesGettableSpanMapperGroups'
+ $ref: '#/components/schemas/SpantypesGettableSpanMappers'
status:
type: string
required:
diff --git a/frontend/src/api/generated/services/sigNoz.schemas.ts b/frontend/src/api/generated/services/sigNoz.schemas.ts
index 7f201bd37e..39bc0012ac 100644
--- a/frontend/src/api/generated/services/sigNoz.schemas.ts
+++ b/frontend/src/api/generated/services/sigNoz.schemas.ts
@@ -9258,6 +9258,76 @@ export interface SpantypesGettableSpanMapperGroupsDTO {
items: SpantypesSpanMapperGroupDTO[];
}
+export enum SpantypesSpanMapperOperationDTO {
+ move = 'move',
+ copy = 'copy',
+}
+export interface SpantypesSpanMapperSourceDTO {
+ context: SpantypesFieldContextDTO;
+ /**
+ * @type string
+ */
+ key: string;
+ operation: SpantypesSpanMapperOperationDTO;
+ /**
+ * @type integer
+ */
+ priority: number;
+}
+
+export interface SpantypesSpanMapperConfigDTO {
+ /**
+ * @type array,null
+ */
+ sources: SpantypesSpanMapperSourceDTO[] | null;
+}
+
+export interface SpantypesSpanMapperDTO {
+ config: SpantypesSpanMapperConfigDTO;
+ /**
+ * @type string
+ * @format date-time
+ */
+ createdAt?: string;
+ /**
+ * @type string
+ */
+ createdBy?: string;
+ /**
+ * @type boolean
+ */
+ enabled: boolean;
+ fieldContext: SpantypesFieldContextDTO;
+ /**
+ * @type string
+ */
+ groupId: string;
+ /**
+ * @type string
+ */
+ id: string;
+ /**
+ * @type string
+ */
+ name: string;
+ /**
+ * @type string
+ * @format date-time
+ */
+ updatedAt?: string;
+ /**
+ * @type string
+ */
+ updatedBy?: string;
+}
+
+export interface SpantypesGettableSpanMappersDTO {
+ /**
+ * @type array
+ */
+ items: SpantypesSpanMapperDTO[];
+}
+
export enum SpantypesSpanAggregationTypeDTO {
span_count = 'span_count',
execution_time_percentage = 'execution_time_percentage',
@@ -9504,30 +9574,6 @@ export interface SpantypesPostableFlamegraphDTO {
selectedSpanId?: string;
}
-export enum SpantypesSpanMapperOperationDTO {
- move = 'move',
- copy = 'copy',
-}
-export interface SpantypesSpanMapperSourceDTO {
- context: SpantypesFieldContextDTO;
- /**
- * @type string
- */
- key: string;
- operation: SpantypesSpanMapperOperationDTO;
- /**
- * @type integer
- */
- priority: number;
-}
-
-export interface SpantypesSpanMapperConfigDTO {
- /**
- * @type array,null
- */
- sources: SpantypesSpanMapperSourceDTO[] | null;
-}
-
export interface SpantypesPostableSpanMapperDTO {
config: SpantypesSpanMapperConfigDTO;
/**
@@ -9576,45 +9622,6 @@ export interface SpantypesPostableWaterfallDTO {
uncollapsedSpans?: string[] | null;
}
-export interface SpantypesSpanMapperDTO {
- config: SpantypesSpanMapperConfigDTO;
- /**
- * @type string
- * @format date-time
- */
- createdAt?: string;
- /**
- * @type string
- */
- createdBy?: string;
- /**
- * @type boolean
- */
- enabled: boolean;
- fieldContext: SpantypesFieldContextDTO;
- /**
- * @type string
- */
- group_id: string;
- /**
- * @type string
- */
- id: string;
- /**
- * @type string
- */
- name: string;
- /**
- * @type string
- * @format date-time
- */
- updatedAt?: string;
- /**
- * @type string
- */
- updatedBy?: string;
-}
-
export interface SpantypesUpdatableSpanMapperDTO {
config?: SpantypesSpanMapperConfigDTO;
/**
@@ -10916,7 +10923,7 @@ export type ListSpanMappersPathParameters = {
groupId: string;
};
export type ListSpanMappers200 = {
- data: SpantypesGettableSpanMapperGroupsDTO;
+ data: SpantypesGettableSpanMappersDTO;
/**
* @type string
*/
diff --git a/frontend/src/container/LLMObservability/AttributeMapping/__tests__/fixtures.ts b/frontend/src/container/LLMObservability/AttributeMapping/__tests__/fixtures.ts
index f39324eb83..ff71b11ae0 100644
--- a/frontend/src/container/LLMObservability/AttributeMapping/__tests__/fixtures.ts
+++ b/frontend/src/container/LLMObservability/AttributeMapping/__tests__/fixtures.ts
@@ -30,7 +30,7 @@ export function makeGroup(overrides: Partial<MapperGroup> = {}): MapperGroup {
export function makeMapper(overrides: Partial<Mapper> = {}): Mapper {
return {
id: 'mapper-1',
- group_id: 'group-1',
+ groupId: 'group-1',
name: 'gen_ai.request.model',
enabled: true,
fieldContext: FieldContext.attribute,
@@ -89,5 +89,5 @@ export const mockGroups: MapperGroup[] = [
];
export const mockMappers: Mapper[] = [
- makeMapper({ id: 'mapper-1', group_id: 'group-1' }),
+ makeMapper({ id: 'mapper-1', groupId: 'group-1' }),
];
diff --git a/pkg/apiserver/signozapiserver/spanmapper.go b/pkg/apiserver/signozapiserver/spanmapper.go
index 23bd807d87..f8c2875f56 100644
--- a/pkg/apiserver/signozapiserver/spanmapper.go
+++ b/pkg/apiserver/signozapiserver/spanmapper.go
@@ -98,7 +98,7 @@ func (provider *provider) addSpanMapperRoutes(router *mux.Router) error {
Description: "Returns all mappers belonging to a mapping group.",
Request: nil,
RequestContentType: "",
- Response: new(spantypes.GettableSpanMapperGroups),
+ Response: new(spantypes.GettableSpanMappers),
ResponseContentType: "application/json",
SuccessStatusCode: http.StatusOK,
ErrorStatusCodes: []int{http.StatusBadRequest, http.StatusNotFound},
diff --git a/pkg/types/spantypes/mapper.go b/pkg/types/spantypes/mapper.go
index 8ebe019746..def1c60397 100644
--- a/pkg/types/spantypes/mapper.go
+++ b/pkg/types/spantypes/mapper.go
@@ -54,7 +54,7 @@ type SpanMapper struct {
types.UserAuditable
ID valuer.UUID `json:"id" required:"true"`
- GroupID valuer.UUID `json:"group_id" required:"true"`
+ GroupID valuer.UUID `json:"groupId" required:"true"`
Name string `json:"name" required:"true"`
FieldContext FieldContext `json:"fieldContext" required:"true"`
Config SpanMapperConfig `json:"config" required:"true"`
@@ -63,7 +63,7 @@ type SpanMapper struct {
type PostableSpanMapper struct {
Name string `json:"name" required:"true"`
- FieldContext FieldContext `json:"fieldContext" required:"true"`
+ FieldContext FieldContext `json:"fieldContext" required:"true"`
Config SpanMapperConfig `json:"config" required:"true"`
Enabled bool `json:"enabled"`
}