OpenTelemetry

Created:2024-06-01 Last Modified:2024-08-23

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 shown in the table below:

Tag Field Mapping Table, the following table only includes fields that have a mapping relationship

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, any attribute starting with http is considered as 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, only extracting the call information after the domain name
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 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, corresponding 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 Prefer attribute.sw8.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
      • Obtain the IP address of the current application (otel-agent) corresponding to the previous 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, get the IP of the POD; if the Span is generated by a process deployed on a virtual machine, 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 that have a mapping relationship

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 response_code in Tag Field
server_error 服务端异常 span.attribute.http.status_code/span.status.code Refer to the description of response_code in Tag Field
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 --