APISIX接入jaeger-collecter踩坑记录
·
按照官方文档接入 jaeger-collecter
其中,第一步和第二部都没问题
第一步:设置数据上报,修改conf/config.yaml
plugin_attr:
opentelemetry:
resource:
service.name: APISIX
tenant.id: business_id
collector:
address: 192.168.8.211:4318(这里改成jaeger-collecter的ip+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
第二步:启用opentelemetry插件,还是修改conf/config.yaml
plugins:
- ... # plugin you need
- opentelemetry
这时候重启APISIX服务
第三步:在路由上启用 opentelemetry 插件
就是这一步踩了坑
踩坑1: 全局启用OpenTelemetry插件,返回404 Route Not Found,没啥作用
curl 'http://127.0.0.1:9080/apisix/admin/global_rules/1' \
-H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' \
-X PUT -d '{
"plugins": {
"opentelemetry": {
"sampler": {
"name": "always_on"
}
}
}
}'
踩坑2:按照官方文档,指定路由,也根本没效果
curl http://127.0.0.1:9180/apisix/admin/routes/1 \
-H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
{
"methods": ["GET"],
"uris": [
"/uid/*"
],
"plugins": {
"opentelemetry": {
"sampler": {
"name": "always_on"
}
}
},
"upstream": {
"type": "roundrobin",
"nodes": {
"127.0.0.1:1980": 1
}
}
}'
最终解决:
上述请求APISIX接口来启用OpenTelemetry插件,不是太方便,后面我就直接在APISIX dashboard上面可视化添加路由,然后在第三步插件配置中,找到opentelemetry插件,启用,然后点击编辑,其中如果你的APISIX网关作为请求入口,那sampler.options.root这块一定要配置,我就是缺了这个导致看起来没生效
{
"_meta": {
"disable": false
},
"sampler": {
"name": "always_on",
"options": {
"fraction": 1,
"root": {
"name": "always_on",
"options": {
"fraction": 1
}
}
}
}
}
更多推荐




所有评论(0)