apache / apisix

The Cloud-Native API Gateway
https://apisix.apache.org/blog/
Apache License 2.0
14.43k stars 2.51k forks source link

help request: Cannot use opentelemetry collect monitor data and get error: nginx: [emerg] unknown "opentelemetry_context_traceparent" variable #11632

Open ahululu opened 1 week ago

ahululu commented 1 week ago

Description

plugins:

pluginAttrs: opentelemetry: set_ngx_var: true resource: service: name: APISIX tenant: id: business_id collector: address: datadog.default.svc.cluster.local:4318 request_timeout: 3 request_headers: foo: bar batch_span_processor: drop_on_queue_full: false max_queue_size: 6 batch_timeout: 2 inactive_timeout: 1 max_export_batch_size: 2

logs:

-- Enable access log or not, default true

enableAccessLog: true

-- Access log path

accessLog: "/dev/stdout"

-- Access log format

accessLogFormat: '$opentelemetry_context_traceparent $opentelemetry_trace_id $opentelemetry_span_id $remote_addr - $remote_user [$time_local] $http_host \"$request\" $status $body_bytes_sent $request_time \"$http_referer\" \"$http_user_agent\" $upstream_addr $upstream_status $upstream_response_time \"$upstream_scheme://$upstream_host$upstream_uri\"'

-- Allows setting json or default characters escaping in variables

accessLogFormatEscape: default

-- Error log path

errorLog: "/dev/stderr"

-- Error log level

errorLogLevel: "warn"


- update chart and get error
```bash
❯ kubectl logs -f apisix-perf-test-xx-sdbzj                                 
Defaulted container "apisix" out of: apisix, wait-etcd (init), init-sysctl (init)
/usr/local/openresty//luajit/bin/luajit ./apisix/cli/apisix.lua init

WARNING: using fixed Admin API token has security risk.
Please modify "admin_key" in conf/config.yaml .

/usr/local/openresty//luajit/bin/luajit ./apisix/cli/apisix.lua init_etcd
2024/10/09 10:54:26 [warn] 1#1: low address bits of 127.0.0.1/24 are meaningless in /usr/local/apisix/conf/nginx.conf:272
nginx: [warn] low address bits of 127.0.0.1/24 are meaningless in /usr/local/apisix/conf/nginx.conf:272
2024/10/09 10:54:26 [emerg] 1#1: unknown "opentelemetry_context_traceparent" variable
nginx: [emerg] unknown "opentelemetry_context_traceparent" variable

Environment

ahululu commented 6 days ago

Preliminary findings are related to the apisix version。

wklken commented 5 hours ago

the variables of otel were introduced starting from version 3.6.0.

https://github.com/apache/apisix/blob/master/CHANGELOG.md#360