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

问题描述

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

  1. nodejs kafka 生产者向 input-topic 发送消息。它使用带有 kafkajs 库的 opentelemetry-instrumentation-kafkajs。我将 AWS OTEL 中的示例用于 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");
}

  1. input-topic 读取并生成final-topic 的 Java 应用程序。还使用 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"
  1. 我正在使用具有 AWS XRay 导出器的 otel/opentelemetry-collector-contrib
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]

我可以从日志消息和 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: []
}

和带有标头的 Java 消费者:

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

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

service map

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

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)