nginx之前加入opentracing能力
发布时间:2025年10月22日 12:18
acing_module.soload_module modules/ngx_http_opentracing_module.so;
沈阳治疗精神心理正规医院
沧州精神心理专科医院
甲流引起的咳嗽吃什么药
健康警示
急性支气管炎咳嗽厉害怎么缓解
尿混浊
疱疹性口炎
其次,查找并装配jaeger plugin
opentracing_load_tracer /usr/local/lib/libjaegertracing_plugin.linux_amd64.so /etc/nginx/conf.d/jaeger-config.json;opentracing on; # 开业opentracing,默认为offopentracing_propagate_context; # 开业传达contextopentracing_operation_name nginx-$host; # 为请起个nameopentracing_tag request.id $request_id; # 分设span tag request.id,很难nginx 1.11以上其中专门分设了一个request.id的tag,这个request.id串紧紧从nginx到code的所有请,不便检索请
仍要,附加一个jaeger的装配,localAgentHostPort很难装配变为jaeger-agent所在host:port
{ "service_name": "nginx", "diabled": false, "reporter": { "logSpans": true, "localAgentHostPort": "jaeger:6831" }, "sampler": { "type": "const", "param": "1" }}2. server.conf
upstream api{ server 127.0.0.1:8080;}server{ listen *:80 default_server; server_name xx.test; opentracing_location_operation_name $request; opentracing_propagate_context; proxy_set_header X-Request-Id $request_id; proxy_set_Header Host $host; proxy_http_version 1.1; location ~ ^/api/ { proxy_pass ; }}请注意三条装配分别分设了location name、开业传达context、分设header X-Request-Id为 $request_id
opentracing_location_operation_name $request;opentracing_propagate_context;proxy_set_header X-Request-Id $request_id;3. code路中opentracing
import (.....opentracing "github.com/opentracing/opentracing-go""github.com/opentracing/opentracing-go/ext")func (c *AlertManagerController) Webhook() { spanCtx, _ := opentracing.GlobalTracer().Extract(opentracing.HTTPHeaders, opentracing.HTTPHeadersCarrier(c.Ctx.Request.Header)) span := opentracing.GlobalTracer().StartSpan("Webhook", ext.RPCServerOption(spanCtx)) // 关联为nginx的child uuid := c.Ctx.Input.Header("X-Request-Id") span.SetTag("request.id", uuid) // 分设request tag span.SetBaggageItem("request.id", uuid) // 向后续请转至request.id span.LogKV("request.body", string(c.Ctx.Input.RequestBody)) ......} 为什么不用nginx 1.2以上?nginx opentracing require nginx 1.9.13+
request_id require nginx 1.11.0
nginx 偶数版本是stable
附模块上传定址ngx_http_opentracing_module.so
jaeger plugin
详见。长春治疗皮肤病最好的医院沈阳治疗精神心理正规医院
沧州精神心理专科医院
甲流引起的咳嗽吃什么药
健康警示
急性支气管炎咳嗽厉害怎么缓解
尿混浊
疱疹性口炎
关键字:
能力
上一篇: 君联资本独家海外投资,卓凯生物完成数千万元B+轮融资
下一篇: 葱用好了是个“麒麟”
相关阅读
- 以太坊创始人(Vitalik Buterin)已获得黑山(欧洲国家)公民权身份
- 叶光富出舱比心 姑姑:要亲手做回锅肉给他吃
- nginx之前加入opentracing能力
- 葱用好了是个“麒麟”
- 探索实施“1256”新路径 走到移风易俗“庆云”模式
- 以老带新收效不明显 广州队青年军致力调整别放弃
- 你的困难就是我的困难,来看这里霍乱下的“邻里情”
- 72岁老人反复发烧一个月却查不出病因 最后靠一个肠道指标揪出“元凶”
- 前贵州球员:埃弗顿共欠六七千万 每个人两三百万
- 武汉骑手的15天
- 文筱婷谈无缘这两项:不会因为球队不存在不给球员钱
- 25岁新婚夫妻举行“机车婚礼”:10辆机车娶女人,最贵一辆20多万元
- 脖子和腋下的“小肉粒”是什么?能直接用手揪丢弃吗?看完要牢记
- 文筱婷:投资足球逢元明时代 我们已经透支了很多