3

I have a nestjs application with open telemetry setup using the AzureMonitorTraceExporter. (v1.0.0-beta.10).

Internally we're using Prisma ORM with auto instrumentation in order to trace our db calls. When viewing traces through jaeger locally all span attributes are showing properly, however when exploring traces through appinsight all db.statement attributes are missing.

Here's an overview of the span :

items to be sent [
  Span {
    attributes: {
      'db.statement': 'SELECT "■■■■■■"."■■■■■■■■"."■■■■■■■", "■■■■■■■"."■■■■■■■■■■■■■■■■"."■■■■■■■■■■■■■■■" FROM "■■■■■■■"."■■■■■■■■■■■■■■■■■■" WHERE "■■■■■■■"."■■■■■■■■■■■■■■■■"."■■■■■■■■" = $1 LIMIT $2 OFFSET $3 /* traceparent=■■■■■■■■■■■■■■ */'
    },
    links: [],
    events: [],
    status: { code: 0 },
    endTime: [ 1669233370, 398610283 ],
    _ended: true,
    _duration: [ 0, 730381 ],
    name: 'prisma:engine:db_query',
    _spanContext: {
      traceId: '■■■■■■■■■■■■■■■■■■■',
      spanId: '■■■■■■■■■■■■■■■■■',
      traceFlags: 1
    },
    parentSpanId: '■■■■■■■■■■■■■■■■■',
    kind: 0,
    startTime: [ 1669233370, 397879902 ],
    resource: Resource { attributes: [Object] },
    instrumentationLibrary: { name: 'prisma', version: undefined, schemaUrl: undefined },
    _spanLimits: {
      attributeValueLengthLimit: Infinity,
      attributeCountLimit: 128,
      linkCountLimit: 128,
      eventCountLimit: 128
    },
    _spanProcessor: MultiSpanProcessor { _spanProcessors: [Array] },
    _attributeValueLengthLimit: Infinity
  }
]

Any idea why appinsight would get rid of this attribute ?

I've tried various versions of the AzureMonitorTraceExporter package along with simply using the appInsight nodejs SDK (though with the later all prisma:engine:* traces are just gone altogether alongside other ones).

I would expect to have my db.statement attributes be displayed in the custom attributes section when exploring traces (just like they do when viewing them through Jaeger or Tempo.

hparquet
  • 41
  • 3
  • Did you had a look at this troubleshoot tracing section in prisma: https://www.prisma.io/docs/concepts/components/prisma-client/opentelemetry-tracing#troubleshoot-tracing ? It seems you are facing the same issue. – Nurul Sundarani Nov 25 '22 at 15:24

1 Answers1

1

The attribute db.statement will be mapped to the Data field of the dependency in Application Insights. This is the description of the Data field:

This field is the command initiated by this dependency call. Examples are SQL statement and HTTP URL with all query parameters.

See here for the relevant code in the exporter that does the mapping.

Johannes Tax
  • 106
  • 1