Skip to content

Azure Service Bus process does not propagate correctly to OpenTelemetry context #24273

Open

Description

  • @azure/service-bus version 7.6.0:
  • @azure/opentelemetry-instrumentation-azure-sdk version 1.0.0-beta.2:

What version of Node are you using?

node:14-bullseye

What did you do?

I've configured OpenTelemetry with Http, Pino, and Azure

registerInstrumentations({
    instrumentations: [
      new AmqplibInstrumentation(),
      new HttpInstrumentation(),
      createAzureSdkInstrumentation(),
      new PinoInstrumentation({
        // Optional hook to insert additional context to log object.
        logHook(span, record) {
          record.serviceName = provider.resource.attributes['service.name'];
        },
      }),
    ],
    tracerProvider: provider,
  });

What did you expect to see?

My service receives a message from a Service Bus queue and then sends a HTTP request using axios.

I see two spans
outgoing HTTP

{
  traceId: '2095dd62400a82860393f4c6c53d3b0d',
  parentId: undefined,
  name: 'HTTP POST',
  id: 'b25eee0923f67418',
  kind: 2,
  timestamp: 1671396663524882,
  duration: 204522,
  attributes: {
    'http.url': 'http://recipient-simulator:3000/invoices/notification',
    'http.method': 'POST',
    'http.target': '/invoices/notification',
    'net.peer.name': 'recipient-simulator',
    'http.host': 'recipient-simulator:3000',
    'http.user_agent': 'axios/1.2.1',
    'net.peer.ip': '10.0.5.91',
    'net.peer.port': 3000,
    'http.response_content_length_uncompressed': 2,
    'http.status_code': 200,
    'http.status_text': 'OK',
    'http.flavor': '1.1',
    'net.transport': 'ip_tcp'
  },
  status: { code: 0 },
  events: [],
  links: []
}

and incoming processMessage span

{
  traceId: '4bc168c107a57b1c2b464ace9d8ae362',
  parentId: undefined,
  name: 'Azure.ServiceBus.process',
  id: 'e96981b3c2778fee',
  kind: 4,
  timestamp: 1671396663444552,
  duration: 376578,
  attributes: {
    'az.namespace': 'Microsoft.ServiceBus',
    'message_bus.destination': 'devel-basket-payout-queue',
    'peer.address': 'my-service-bus.servicebus.windows.net'
  },
  status: { code: 1 },
  events: [],
  links: []
}

What did you see instead?

The spans seem to be in wrong order and the outgoing HTTP request should inherit trace parent from the Azure.ServiceBus.process span

package.json

     "@azure/service-bus": "7.6.0",
    "@azure/opentelemetry-instrumentation-azure-sdk": "1.0.0-beta.2",
    "@opentelemetry/api": "1.3.0",
    "@opentelemetry/sdk-trace-node": "1.8.0",
    "@opentelemetry/instrumentation-http": "0.34.0",
    "@opentelemetry/instrumentation-pino": "0.33.0",
    "@opentelemetry/exporter-trace-otlp-http": "0.34.0",
    "@opentelemetry/propagator-b3": "1.8.0",
    "@opentelemetry/instrumentation-amqplib":"0.32.0",
    "axios": "^1.2.1",
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Labels

ClientThis issue points to a problem in the data-plane of the library.OpenTelemetryOpenTelemetry instrumentation (not Monitor-specific). For the issues related to the @azure/opeService BusbugThis issue requires a change to an existing behavior in the product in order to be resolved.customer-reportedIssues that are reported by GitHub users external to the Azure organization.needs-team-attentionWorkflow: This issue needs attention from Azure service team or SDK team

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions