链路追踪服务提供了ARMS OpenTelemetry Collector、开源OpenTelemetry SDK/Collector、Jaeger SDK/Agent、Zipkin和Skywalking客户端的接入方式。本文介绍了各地域接入点域名以及不同端口对应的数据上报协议。

直接上报

公有云各区域接入点域名

说明 如果应用部署于阿里云生产环境,请选择内网接入点,否则选择公网接入点。
地域 Region ID 阿里云内网Endpoint 公网Endpoint
华东1(杭州) cn-hangzhou tracing-analysis-dc-hz-internal.aliyuncs.com tracing-analysis-dc-hz.aliyuncs.com
华东2(上海) cn-shanghai tracing-analysis-dc-sh-internal.aliyuncs.com tracing-analysis-dc-sh.aliyuncs.com
华北1(青岛) cn-qingdao tracing-analysis-dc-qd-internal.aliyuncs.com tracing-analysis-dc-qd.aliyuncs.com
华北2(北京) cn-beijing tracing-analysis-dc-bj-internal.aliyuncs.com tracing-analysis-dc-bj.aliyuncs.com
华北 3(张家口) cn-zhangjiakou tracing-analysis-dc-zb-internal.aliyuncs.com tracing-analysis-dc-zb.aliyuncs.com
华北5(呼和浩特) cn-huhehaote tracing-cn-huhehaote-internal.arms.aliyuncs.com tracing-cn-huhehaote.arms.aliyuncs.com
华北6(乌兰察布) cn-wulanchabu tracing-cn-wulanchabu-internal.arms.aliyuncs.com tracing-cn-wulanchabu.arms.aliyuncs.com
华南1(深圳) cn-shenzhen tracing-analysis-dc-sz-internal.aliyuncs.com tracing-analysis-dc-sz.aliyuncs.com
华南2(河源) cn-heyuan tracing-cn-heyuan-internal.arms.aliyuncs.com tracing-cn-heyuan.arms.aliyuncs.com
华南3(广州) cn-guangzhou tracing-cn-guangzhou-internal.arms.aliyuncs.com tracing-cn-guangzhou.arms.aliyuncs.com
西南1(成都) cn-chengdu tracing-cn-chengdu-internal.arms.aliyuncs.com tracing-cn-chengdu.arms.aliyuncs.com
中国(香港) cn-hongkong tracing-analysis-dc-hk-internal.aliyuncs.com tracing-analysis-dc-hk.aliyuncs.com
日本(东京) ap-northeast-1 tracing-analysis-dc-jp-internal.aliyuncs.com tracing-analysis-dc-jp.aliyuncs.com
新加坡 ap-southeast-1 tracing-analysis-dc-sg-internal.aliyuncs.com tracing-analysis-dc-sg.aliyuncs.com
澳大利亚(悉尼) ap-southeast-2 tracing-ap-southeast-2-internal.arms.aliyuncs.com tracing-ap-southeast-2.arms.aliyuncs.com
马来西亚(吉隆坡) ap-southeast-3 tracing-ap-southeast-3-internal.arms.aliyuncs.com tracing-ap-southeast-3.arms.aliyuncs.com
印度尼西亚(雅加达) ap-southeast-5 tracing-analysis-dc-indonesia-internal.aliyuncs.com tracing-analysis-dc-indonesia.aliyuncs.com
德国(法兰克福) eu-central-1 tracing-analysis-dc-frankfurt-internal.aliyuncs.com tracing-analysis-dc-frankfurt.aliyuncs.com
英国(伦敦) eu-west-1 tracing-analysis-dc-lundun-internal.aliyuncs.com tracing-analysis-dc-lundun.aliyuncs.com
美国(硅谷) us-west-1 tracing-analysis-dc-usw-internal.aliyuncs.com tracing-analysis-dc-usw.aliyuncs.com
美国(弗吉尼亚) us-east-1 tracing-us-east-1-internal.arms.aliyuncs.com tracing-us-east-1.arms.aliyuncs.com
印度(孟买) ap-south-1 tracing-ap-south-1-internal.arms.aliyuncs.com tracing-ap-south-1.arms.aliyuncs.com

不同端口支持的协议

端口号 协议 说明
80
  • OpenTelemetry HTTP
  • Jaeger HTTP
  • Jaeger Remote Sampling
  • Zipkin HTTP
通过URL后缀区分不同协议。
  • OpenTelemetry HTTP:/api/otlp/traces
  • Jaeger HTTP:/api/traces
  • Jaeger Remote Sampling:/api/sampling
  • Zipkin HTTP:
    • v1:/api/v1/spans
    • v2:/api/v2/spans
443
  • OpenTelemetry HTTPS
  • Jaeger HTTPS
  • Jaeger Remote Sampling
  • Zipkin HTTPS
通过URL后缀区分不同协议。
  • OpenTelemetry HTTPS:/api/otlp/traces
  • Jaeger HTTPS:/api/traces
  • Jaeger Remote Sampling:/api/sampling
  • Zipkin HTTPS:
    • v1:/api/v1/spans
    • v2:/api/v2/spans
1883
  • Jaeger gRPC
  • Skywalking gRPC
8000 Skywalking v8 gRPC
8090 OpenTelemetry gRPC

通过ARMS OpenTelemetry Collector转发

说明 对于ACK集群应用,建议通过ARMS OpenTelemetry Collector上报应用数据。ARMS OpenTelemetry Collector支持本地集群内的链路采样与指标无损统计,在降低链路传输、存储成本的同时,不影响监控或告警指标的准确性。更多信息,请参见ARMS OpenTelemetry Collector

默认Receivers配置说明

组件安装后默认配置的Receivers包括OTLP、Jaeger和Zipkin,端口与开源保持一致。

Receivers protocols port
OTLP gRPC 4317
http 4318
Jaeger gRPC 14250
thrift_http 14268
Zipkin 9411

将应用数据上报到ARMS OpenTelemetry Collector

组件安装后会在arms-prom命名空间下默认创建名称为otel-collector-service的Service资源,用于将Receivers中不同组件的相应端口进行暴露。Trace上报的Endpoint格式为otel-collector-service.arms-prom:<port>,其中otel-collector-service是ARMS OpenTelemetry Collector的Service名称,arms-prom是其所在的命名空间。

示例:将生成的Traces通过OTLP的gRPC协议上报到ARMS OpenTelemetry Collector中。
func initProvider() func() {
    ctx := context.Background()

    endpoint := "otel-collector-service.arms-prom:4317"

    if !ok {
        log.Fatalf("Cannot init OpenTelemetry, exit")
        os.Exit(-1)
    }

    metricClient := otlpmetricgrpc.NewClient(
        otlpmetricgrpc.WithInsecure(),
        otlpmetricgrpc.WithEndpoint(endpoint))
    metricExp, err := otlpmetric.New(ctx, metricClient)
    handleErr(err, "Failed to create the collector metric exporter")

    pusher := controller.New(
        processor.NewFactory(
            simple.NewWithExactDistribution(),
            metricExp,
        ),
        controller.WithExporter(metricExp),
        controller.WithCollectPeriod(2*time.Second),
    )
    global.SetMeterProvider(pusher)

    err = pusher.Start(ctx)
    handleErr(err, "Failed to start metric pusher")

    serviceName, ok := common.GetClientServiceName()
    if !ok {
        serviceName = common.ClientServiceName
    }

    headers := map[string]string{"Authentication": ""}
    traceClient := otlptracegrpc.NewClient(
        otlptracegrpc.WithInsecure(),
        otlptracegrpc.WithEndpoint(otelAgentAddr),
        otlptracegrpc.WithHeaders(headers), // 鉴权信息
        otlptracegrpc.WithDialOption(grpc.WithBlock()))
    log.Println("start to connect to server")
    traceExp, err := otlptrace.New(ctx, traceClient)
    handleErr(err, "Failed to create the collector trace exporter")

    res, err := resource.New(ctx,
        resource.WithFromEnv(),
        resource.WithProcess(),
        resource.WithTelemetrySDK(),
        resource.WithHost(),
        resource.WithAttributes(
            // the service name used to display traces in backends
            semconv.ServiceNameKey.String(serviceName),
        ),
    )
    handleErr(err, "failed to create resource")

    bsp := sdktrace.NewBatchSpanProcessor(traceExp)
    tracerProvider := sdktrace.NewTracerProvider(
        sdktrace.WithSampler(sdktrace.AlwaysSample()),
        sdktrace.WithResource(res),
        sdktrace.WithSpanProcessor(bsp),
    )

    // set global propagator to tracecontext (the default is no-op).
    otel.SetTextMapPropagator(propagation.TraceContext{})
    otel.SetTracerProvider(tracerProvider)

    log.Println("OTEL init success")

    return func() {
        cxt, cancel := context.WithTimeout(ctx, time.Second)
        defer cancel()
        if err := traceExp.Shutdown(cxt); err != nil {
            otel.Handle(err)
        }
        // pushes any last exports to the receiver
        if err := pusher.Stop(cxt); err != nil {
            otel.Handle(err)
        }
    }
}

获取鉴权Token

在开通链路追踪服务后,您可以在控制台获得Token用作上报数据鉴权,获取方法如下。

  1. 登录ARMS控制台,在左侧导航栏选择应用监控 > 应用列表
  2. 应用列表页面顶部选择目标地域,然后单击目标链路追踪应用名称。
    说明 语言列显示Java图标图标的应用为接入应用监控的应用,显示-图标的应用为接入链路追踪的应用。
  3. 在弹出的页面中,单击左侧导航栏上方的返回图标图标,返回上一层。
  4. 在左侧导航栏单击集群配置,然后在右侧页面单击接入点信息页签。
  5. 在页面顶部选择需要接入的地域,然后在集群信息区域打开显示Token开关。
  6. 客户端采集工具区域单击需要使用的链路数据采集客户端。
  7. 在下方表格的相关信息列中,单击接入点信息末尾的复制图标。
    Jaeger接入点信息
    • OpenTelemetry HTTP、Zipkin HTTP和Jaeger HTTP:将Token作为HTTP URL的一部分。
    • Skywalking gRPC、OpenTelemetry gRPC和Jaeger gRPC:将Authentication=<token>作为gRPC的metadata提供给服务端鉴权。