OpenTelemetry

Created:2024-06-01 Last Modified:2025-08-29

This document was translated by ChatGPT

By parsing the OpenTelemetry protocol, the fields in the OpenTelemetry protocol data structure are mapped to the corresponding fields in l7_flow_log. The mapping relationship is shown in the table below:

Tag Field Mapping Table — only fields with mapping relationships are included below

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 属性标签 resource./span.attributes --
ip IP 地址 span.attribute.app.host.ip/attribute.net.peer.ip See detailed explanation in the following section
l7_protocol 应用协议 span.attribute.http.scheme/db.system/rpc.system/messaging.system/messaging.protocol Mapped to the corresponding enum value; if any attribute starts with http, it is considered HTTP protocol
l7_protocol_str 应用协议 span.attribute.http.scheme/db.system/rpc.system/messaging.system/messaging.protocol If span.attribute.http.scheme exists, read it; if not but l7_protocol is HTTP, default to HTTP
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 If span.attribute.http.target exists, read it; if not, extract from http.url after the domain
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; OK: STATUS_CODE_OK; Server error: STATUS_CODE_ERROR --
response_code 响应码 span.attribute.http.status_code/span.status.code Prefer 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 use 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 resource.attribute.sw8.trace_id/span.attribute.sw8.trace_id/span.trace_id Priority: resource.attribute.sw8.trace_id > span.attribute.sw8.trace_id > span.trace_id
span_id SpanID span.span_id/attribute.sw8.segment_id-attribute.sw8.span_id Prefer 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 Prefer attribute.sw8.segment_id-attribute.sw8.parent_span_id
span_kind Span 类型 span.span_kind --
events 事件 span.events Saved as a JSON-formatted string
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
      • Use a k8s attributes processor plugin (opens new window) to obtain the IP address of the upper-level source of the current application (otel-agent), i.e., the source of the Span. For example: if the Span is generated by a POD, get the POD's IP; if the Span is generated by a process deployed on a virtual machine, get the VM's IP.
    • span.attribute.net.peer.ip corresponds to ip_1; all others correspond to ip_0

Metrics Field Mapping Table — only fields with mapping relationships are included below

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 errors + Server errors
client_error 客户端异常 span.attribute.http.status_code/span.status.code See response_code in Tag fields
server_error 服务端异常 span.attribute.http.status_code/span.status.code See response_code in Tag fields
error_ratio 异常比例 -- Errors / Responses
client_error_ratio 客户端异常比例 -- Client errors / Responses
server_error_ratio 服务端异常比例 -- Server errors / Responses
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 --