OpenTelemetry

Created:2024-06-01 Last Modified:2024-06-24

This document was translated by ChatGPT

By parsing the OpenTelemetry protocol, the fields of the OpenTelemetry protocol data structure are mapped to the corresponding fields in l7_flow_log. The mapping relationship is as follows:

Tag Field Mapping Table, the following table only includes fields with mapping relationships

Name Chinese OpenTelemetry Data Structure Description
start_time 开始时间 span.start_time_unix_nano --
end_time 结束时间 span.end_time_unix_nano --
protocol 网络协议 span.attribute.net.transport Mapped to the corresponding enum value
attributes Misc.butes resource./span.attributes --
ip IP 地址 span.attribute.app.host.ip/attribute.net.peer.ip Detailed explanation in the following paragraphs
l7_protocol 应用协议 span.attribute.http.scheme/db.system/rpc.system/messaging.system/messaging.protocol Mapped to the corresponding enum value
l7_protocol_str 应用协议 span.attribute.http.scheme/db.system/rpc.system/messaging.system/messaging.protocol --
version 协议版本 span.attribute.http.flavor --
type 日志类型 会话 --
request_type 请求类型 span.attribute.http.method/db.operation/rpc.method --
request_domain 请求域名 span.attribute.http.host/db.connection_string --
request_resource 请求资源 attribute.http.target/db.statement/messaging.url/rpc.service --
request_id 请求 ID
response_status 响应状态 Response code=span.attribute.http.status_code Refer to HTTP protocol definition; Response code=span.status.code, Unknown: STATUS_CODE_UNSET; Normal: STATUS_CODE_OK; Server error: STATUS_CODE_ERROR --
response_code 响应码 span.attribute.http.status_code/span.status.code Preferably use span.attribute.http.status_code
response_exception 响应异常 Response code=span.attribute.http.status_code Refer to HTTP protocol definition; Response code=span.status.code, then corresponds to span.status.message --
service_name 服务名称 resource./span.attribute.service.name --
service_instance_id 服务实例 resource./span.attribute.service.instance.id --
endpoint 端点 span.name --
trace_id TraceID span.trace_id/attribute.sw8.trace_id Preferably use attribute.sw8.trace_id
span_id SpanID span.span_id/attribute.sw8.segment_id-attribute.sw8.span_id Preferably use attribute.sw8.segment_id-attribute.sw8.span_id
parent_span_id ParentSpanID span.parent_span_id/attribute.sw8.segment_id-attribute.sw8.parent_span_id Preferably use attribute.sw8.segment_id-attribute.sw8.parent_span_id
span_kind Span 类型 span.span_kind --
observation_point 观测点 span.spankind.SPAN_KIND_CLIENT/SPAN_KIND_PRODUCER: Client application (c-app); span.spankind.SPAN_KIND_SERVER/SPAN_KIND_CONSUMER: Server application (s-app); span.spankind.SPAN_KIND_UNSPECIFIED/SPAN_KIND_INTERNAL: Application (app) --
  • observation_point = c-app
    • span.attribute.app.host.ip corresponds to ip_0; all others correspond to ip_1
      • Obtain the IP address of the current application (otel-agent) corresponding to the upper level (i.e., the source of the Span) through a k8s attributes processor plugin (opens new window), for example: if the Span is generated by a POD, then get the IP of the POD; if the Span is generated by a process deployed on a virtual machine, then get the IP of the virtual machine
    • span.attribute.net.peer.ip corresponds to ip_1; all others correspond to ip_0

Metrics Field Mapping Table, the following table only includes fields with mapping relationships

Name Chinese OpenTelemetry Data Structure Description
request 请求 Number of Spans --
response 响应 Number of Spans --
session_length 会话长度 Request length + Response length
request_length 请求长度 span.attribute.http.request_content_length --
request_length 响应长度 span.attribute.http.response_content_length --
sql_affected_rows SQL 影响行数 span.attribute.db.cassandra.page_size --
log_count 日志总量 Number of Spans Number of Request Log lines
error 异常 -- Client error + Server error
client_error 客户端异常 span.attribute.http.status_code/span.status.code Refer to the description of Tag field response_code
server_error 服务端异常 span.attribute.http.status_code/span.status.code Refer to the description of Tag field response_code
error_ratio 异常比例 -- Error / Response
client_error_ratio 客户端异常比例 -- Client error / Response
server_error_ratio 服务端异常比例 -- Server error / Response
message.uncompressed_size -- span.attribute.message.uncompressed_size --
messaging.message_payload_size_bytes -- span.attribute.messaging.message_payload_size_bytes --
messaging.message_payload_compressed_size_bytes -- span.attribute.messaging.message_payload_compressed_size_bytes --