Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jaeger Exporter filters out links having a different link span id than the parent id #2718

Closed
shaicantor opened this issue Jan 16, 2022 · 1 comment · Fixed by #2731
Closed
Assignees
Labels
bug Something isn't working

Comments

@shaicantor
Copy link

Please answer these questions before submitting a bug report.

What version of OpenTelemetry are you using?

@opentelemetry/[email protected]
@opentelemetry/[email protected]
@opentelemetry/[email protected]
@opentelemetry/[email protected]
@opentelemetry/[email protected]

What version of Node are you using?

16.11.1

Please provide the code you used to setup the OpenTelemetry SDK

tracing.js

const { getNodeAutoInstrumentations } = require("@opentelemetry/auto-instrumentations-node");
const { JaegerExporter } = require("@opentelemetry/exporter-jaeger");
const { SemanticResourceAttributes } = require('@opentelemetry/semantic-conventions');
const { Resource } = require('@opentelemetry/resources');
const { NodeTracerProvider } = require('@opentelemetry/sdk-trace-node');
const { BatchSpanProcessor, SimpleSpanProcessor } = require('@opentelemetry/sdk-trace-base');
const { registerInstrumentations } = require('@opentelemetry/instrumentation');
const {AwsInstrumentation} = require("@opentelemetry/instrumentation-aws-sdk");
const { CollectorTraceExporter } = require('@opentelemetry/exporter-collector');

const jaegerExporter = new JaegerExporter();
const tracerProvider = new NodeTracerProvider({
    resource: new Resource({
        [SemanticResourceAttributes.SERVICE_NAME]: JSON.parse(process.env.pm2_env)["SERVICE"]
    })
});

tracerProvider.addSpanProcessor(new SimpleSpanProcessor(jaegerExporter));
tracerProvider.register();
registerInstrumentations({
    tracerProvider: tracerProvider,
    instrumentations: [new AwsInstrumentation({}), getNodeAutoInstrumentations()],
});

What did you do?

  • I provisioned an EC2 instance containing docker.
  • Ran jaeger all-in-one - docker run -d -e COLLECTOR_ZIPKIN_HOST_PORT=:9411 -p 5775:5775/udp -p 6831:6831/udp -p 6832:6832/udp -p 5778:5778 -p 16686:16686 -p 14268:14268 -p 14269:14269 -p 14250:14250 -p 9411:9411 jaegertracing/all-in-one:local
  • started my node.js applications using pm2 using --require tracing.js (the file from above)
  • In my architecture I have a producer sending messages to SQS and a consumer receiving messages from SQS.

What did you expect to see?

  • The instrumentation-aws-sdk implements parent child schemas according to the spec here
Process P: | Span Prod1 | Span Prod2 |
--
Process C:                      | Span Recv1 |
                                        | Span Proc1 |
                                               | Span Proc2 |
Field or Attribute Span Prod1 Span Prod2 Span Recv1 Span Proc1 Span Proc2
Span name "Q send" "Q send" "Q receive" "Q process" "Q process"
Parent Span Recv1 Span Recv1
Links Span Prod1 Span Prod2
SpanKind PRODUCER PRODUCER CONSUMER CONSUMER CONSUMER
Status Ok Ok Ok Ok Ok
net.peer.name "ms" "ms" "ms" "ms" "ms"
net.peer.port 1234 1234 1234 1234 1234
messaging.system "rabbitmq" "rabbitmq" "rabbitmq" "rabbitmq" "rabbitmq"
messaging.destination "Q" "Q" "Q" "Q" "Q"
messaging.destination_kind "queue" "queue" "queue" "queue" "queue"
messaging.operation "receive" "process" "process"
messaging.message_id "a1" "a2" "a1" "a2"
function spanLinksToThriftRefs(
  links: Link[],
  parentSpanId?: string
): ThriftReference[] {
  return links
    .map((link): ThriftReference | null => {
      if (link.context.spanId === parentSpanId) {
        const refType = ThriftReferenceType.FOLLOWS_FROM;
        const traceId = link.context.traceId;
        const traceIdHigh = Utils.encodeInt64(traceId.slice(0, 16));
        const traceIdLow = Utils.encodeInt64(traceId.slice(16));
        const spanId = Utils.encodeInt64(link.context.spanId);
        return { traceIdLow, traceIdHigh, spanId, refType };
      }
      return null;
    })
    .filter(ref => !!ref) as ThriftReference[];
}

To test it, I removed the condition and got this which is what I expected.
image

What did you see instead?

I saw a span without the reference to the desired span in a different trace.

Additional context

@shaicantor shaicantor added the bug Something isn't working label Jan 16, 2022
@blumamir
Copy link
Member

reference to the expected behavior in specification:
https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/sdk_exporters/jaeger.md#links

I think we need to revisit this code and identify implementation gaps from the spec

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants