日志报文改造规范如何有效制定?

目前大家都是基于google的dapper论文制定的日志采集项,但是需要根据实际的业务场景进行优化和调整,不但考虑目前的日志报文的改造字段,还需要考虑一定长度的预留字段,为将来的灰度发布、服务治理等项目预留。...显示全部

目前大家都是基于google的dapper论文制定的日志采集项,但是需要根据实际的业务场景进行优化和调整,不但考虑目前的日志报文的改造字段,还需要考虑一定长度的预留字段,为将来的灰度发布、服务治理等项目预留。

收起
参与15

查看其它 3 个回答ljosef的回答

ljosefljosef系统架构师某股份制银行

我们目前对于链路日志主要围绕Java非侵入式应用进行,agent会处理全局traceid,segmentid和spanid,构造唯一的链路标识、服务访问路径、HTTP请求类型、应用名称、应用实例标识等信息。一个完整的链路日志如下;

{"globalTraceIds":110176672196214784",// 全局traceId"segment":{"traceSegmentId":110176672196214786,// 当前段SegmentId"spans":[{"spanId":0// 当前段中的spanId"parentSpanId":-1,// 父spanId"refs": [// 父段的引用{"parentTraceSegmentId":110176672196214786,// 父段TraceSegmentId"parentSpanId":1,// 父段SegmentId中的哪个spanId产生的当前端段"parentAppInstanceId":"192.168.0.1-8888",// 父应用实例标识, ip-pid"entryAppInstanceId":"192.168.0.2-8888",// id of first application instance in this distributed trace"type":"CROSS_PROCESS"// 产生当前段的类型"networkAddress":"192.168.0.10:1234"// 父段peerHost"entryService":"/hello",// Operation/Service name of the first one in this distributed trace"parentService":"/test"// Operation/Service name of the parent one in this distributed trace}],"startTime":1572337748267,// 开始时间"endTime":1572337748269,// 结束时间"serviceName":"/test",// 服务名"spanLayer":"Http",// span层类型"componentId":14,// 组件ID(SpringMVC)"spanType":"Entry",// span类型(Entry、Exit、Local)"isError":true,// 是否异常"tags":[// tags{"key":"url","value":"http:\/\/localhost:9090\/hello"},{"key":"http.method","value":"GET"}],"logs":{// 日志字段"time":1572337748267,"data":[{"key":"key","value":"value"" }]}}],"appGroupId":"xxx",// 应用分组名称(整体项目名称/系统名称)"appId":"xxx",// 应用名称 (项目中的一个子系统名称/微服务名称)"appInstanceId":"192.168.0.1-8888"// 应用实例标识, ip-pid}}

银行 · 2021-03-24
浏览816

回答者

ljosef
系统架构师某股份制银行
擅长领域: 云计算容器容器云

ljosef 最近回答过的问题

回答状态

  • 发布时间:2021-03-24
  • 关注会员:5 人
  • 回答浏览:816
  • X社区推广