AWS XRay 服务地图组件已断开连接

Maj*_*imi 6 java node.js aws-xray distributed-tracing open-telemetry

我正在使用开放遥测导出以下应用程序的跟踪信息:

  1. Nodejs kafka 生产者将消息发送到input-topic. 它使用kafkajs带有库的仪器opentelemetry-instrumentation-kafkajs我正在使用 AWS OTEL for NodeJS example中的示例。这是我的tracer.js
module.exports = () => {
  diag.setLogger(new DiagConsoleLogger(), DiagLogLevel.ERROR);

  // create a provider for activating and tracking with AWS IdGenerator
  const attributes = {
      'service.name': 'nodejs-producer',
      'service.namespace': 'axel'
  }

  let resource = new Resource(attributes)

  const tracerConfig = {
    idGenerator: new AWSXRayIdGenerator(),
    plugins: {
        kafkajs: { enabled: false, path: 'opentelemetry-plugin-kafkajs' }
    },
    resource: resource
  };
  const tracerProvider = new NodeTracerProvider(tracerConfig);

  // add OTLP exporter
  const otlpExporter = new CollectorTraceExporter({
    url: (process.env.OTEL_EXPORTER_OTLP_ENDPOINT) ? process.env.OTEL_EXPORTER_OTLP_ENDPOINT : "localhost:55680"
  });
  tracerProvider.addSpanProcessor(new SimpleSpanProcessor(otlpExporter));
  tracerProvider.addSpanProcessor(new SimpleSpanProcessor(new ConsoleSpanExporter()));

  // Register the tracer with X-Ray propagator
  tracerProvider.register({
    propagator: new AWSXRayPropagator()
  });

  registerInstrumentations({
    tracerProvider,
    instrumentations: [new KafkaJsInstrumentation({})],
  });

  // Return a tracer instance
  return trace.getTracer("awsxray-tests");
}

Run Code Online (Sandbox Code Playgroud)
  1. 读取input-topic并生成 的Java 应用程序final-topic。还使用 AWS OTEL java 代理进行检测。Java 应用程序启动如下:
export OTEL_TRACES_EXPORTER=otlp
export OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4317
export OTEL_PROPAGATORS=xray
export OTEL_RESOURCE_ATTRIBUTES="service.name=otlp-consumer-producer,service.namespace=axel"
export OTEL_METRICS_EXPORTER=none

java -javaagent:"${PWD}/aws-opentelemetry-agent.jar" -jar "${PWD}/target/otlp-consumer-producer.jar"
Run Code Online (Sandbox Code Playgroud)
  1. 我正在使用otel/opentelemetry-collector-contrib具有 AWS XRay 导出器的:
receivers:
  otlp:
    protocols:
      grpc:
        endpoint: 0.0.0.0:4317

exporters:
  awsxray:
    region: 'eu-central-1'
    max_retries: 10

service:
  pipelines:
    traces:
      receivers: [otlp]
      exporters: [awsxray]
Run Code Online (Sandbox Code Playgroud)

我可以从日志消息和 XRay 控制台看到正在发布跟踪(具有正确的父跟踪 ID)。NodeJS 日志消息:

{
  traceId: '60d0c7d4cfc2d86b2df8624cb4bccead',
  parentId: undefined,
  name: 'input-topic',
  id: '3e289f00c4499ae8',
  kind: 3,
  timestamp: 1624295380734468,
  duration: 3787,
  attributes: {
    'messaging.system': 'kafka',
    'messaging.destination': 'input-topic',
    'messaging.destination_kind': 'topic'
  },
  status: { code: 0 },
  events: []
}
Run Code Online (Sandbox Code Playgroud)

和带有标头的 Java 消费者:

Headers([x-amzn-trace-id:Root=1-60d0c7d4-cfc2d86b2df8624cb4bccead;Parent=3e289f00c4499ae8;Sampled=1])
Run Code Online (Sandbox Code Playgroud)

如您所见,父 ID 和根 ID 相互匹配。然而,服务映射是以断开连接的方式构建的: 服务地图

我在这里还缺少哪些其他配置来编译正确的服务映射?