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

help request: Unable to connect to OpenTelemetry #11969

Open
masaya87266 opened this issue Feb 14, 2025 · 2 comments
Open

help request: Unable to connect to OpenTelemetry #11969

masaya87266 opened this issue Feb 14, 2025 · 2 comments
Labels
question label for questions asked by users user responded

Comments

@masaya87266
Copy link

Description

apisix config.yaml:
plugin_attr:
opentelemetry:
resource:
service.name: APISIX
tenant.id: business_id
collector:
address: host.docker.internal:4318
request_timeout: 3
batch_span_processor:
drop_on_queue_full: false
max_queue_size: 6
batch_timeout: 2
inactive_timeout: 1
max_export_batch_size: 2

api:
{
"uris": [
"/test2/api2"
],
"methods": [
"GET",
"POST",
"PUT",
"DELETE",
"OPTIONS"
],
"enable_websocket": true,
"upstream": {
"type": "roundrobin",
"nodes": {
"host.docker.internal:9900": 1
},
"scheme": "http"
},
"plugins": {
"opentelemetry": {
"sampler": {
"name": "always_on"
}
}
}
}

apisix log:
2025-02-14 14:10:24 2025/02/14 14:10:24 [error] 53#53: *537 lua entry thread aborted: runtime error: bad argument #1 to '?' (invalid value)
2025-02-14 14:10:24 stack traceback:
2025-02-14 14:10:24 coroutine 0:
2025-02-14 14:10:24 [C]: in function 'gsub'
2025-02-14 14:10:24 ...s/share/lua/5.1/opentelemetry/trace/exporter/encoder.lua:22: in function 'hex2bytes'
2025-02-14 14:10:24 ...s/share/lua/5.1/opentelemetry/trace/exporter/encoder.lua:66: in function 'for_otlp'
2025-02-14 14:10:24 ...deps/share/lua/5.1/opentelemetry/trace/exporter/otlp.lua:102: in function 'export_spans'
2025-02-14 14:10:24 ...are/lua/5.1/opentelemetry/trace/batch_span_processor.lua:45: in function 'process_batches'
2025-02-14 14:10:24 ...are/lua/5.1/opentelemetry/trace/batch_span_processor.lua:77: in function <...are/lua/5.1/opentelemetry/trace/batch_span_processor.lua:57>, context: ngx.timer, client: 172.17.0.1, server: 0.0.0.0:9080

Environment

  • APISIX version (run apisix version):3.7.0
  • Operating system (run uname -a):Linux 28634f36056b 5.15.49-linuxkit change: added doc of how to load plugin. #1 SMP PREEMPT Tue Sep 13 07:51:32 UTC 2022 aarch64 GNU/Linux (docker 23.0.5)
  • OpenResty / Nginx version (run openresty -V or nginx -V):nginx version: openresty/1.21.4.2
  • etcd version, if relevant (run curl http://127.0.0.1:9090/v1/server_info):3.5.4
  • APISIX Dashboard version, if relevant:
  • Plugin runner version, for issues related to plugin runners:
  • LuaRocks version, for installation issues (run luarocks --version):
@dosubot dosubot bot added the question label for questions asked by users label Feb 14, 2025
@juzhiyuan
Copy link
Member

Hi @masaya87266, your code snippet indicates that you haven't enabled the OpenTelemetry plugin in the config.yaml file.

Please follow the instructions at https://docs.api7.ai/hub/opentelemetry#enable-opentelemetry-plugin and review your configurations. If it still doesn't work, please share the complete content of your config.yaml file.

@juzhiyuan juzhiyuan added the wait for update wait for the author's response in this issue/PR label Feb 17, 2025
@masaya87266
Copy link
Author

masaya87266 commented Feb 17, 2025

apisix:
  node_listen: 9080              # APISIX listening port
  enable_ipv6: false
  enable_server_tokens: false
  enable_control: true

deployment:
  role: traditional
  admin:
    allow_admin: # http://nginx.org/en/docs/http/ngx_http_access_module.html#allow
      - 0.0.0.0/0              # We need to restrict ip access rules for security. 0.0.0.0/0 is for test.
    admin_listen:
      ip: "0.0.0.0"
      port: 9180
    admin_key:
      - name: "admin"
        key: xxx
        role: admin                 # admin: manage all configuration data

      - name: "viewer"
        key: xxx
        role: viewer

  etcd:
    host:                           # it's possible to define multiple etcd hosts addresses of the same etcd cluster.
      - "xxx"          # multiple etcd address
    prefix: "/xxx"               # apisix configurations prefix
    timeout: 30                     # 30 seconds
    user: xxx
    password: xxx

nginx_config:
  user: root
  error_log_level: error
  http:
    enable_access_log: false
    custom_lua_shared_dict: # add custom shared cache to nginx.conf
      plugin-service-access-redis-cluster-slot-lock: 1m

plugins:
  - opentelemetry

plugin_attr:
  opentelemetry:
    resource:
      service.name: APISIX
      tenant.id: business_id
    collector:
      address: xxx
      request_timeout: 3
    batch_span_processor:
      drop_on_queue_full: false
      max_queue_size: 6
      batch_timeout: 2
      inactive_timeout: 1
      max_export_batch_size: 2

@github-actions github-actions bot added user responded and removed wait for update wait for the author's response in this issue/PR labels Feb 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question label for questions asked by users user responded
Projects
Status: 📋 Backlog
Development

No branches or pull requests

2 participants