Using OpenTelemetry Service Built-in Tags In Tracing

TOC

Feature Overview

A Span Tag refers to key-value pair data attached to a Span, providing specific contextual information for each Span to help developers more easily understand and analyze the characteristics and impact of each operation.

Tags consist of a key and a value, where the key must be of string type, and the value can be a string, boolean, or number.

Tag Categories

Metadata

KeyDescriptionExample Value
internal.span.formatThe data format of the Internal Span.otlp
otel.status_codeThe status of the Span.ERROR
span.kindThe type of Span:
- client: Indicates that the Span is an outbound call (client operation), i.e., a client initiated a request to a service or resource.
- server: Indicates that the Span is an inbound call (server operation), i.e., a server received and processed a request from a client.
- internal: Indicates an internal operation within the application, not involving operations with a remote parent or child.
client

HTTP Request Information

KeyDescriptionExample Value
http.flavorThe version of the HTTP protocol.1.1
http.methodThe HTTP request method.GET
http.response_content_lengthA field in the HTTP request header that specifies the length of the request or response body in bytes.12
http.routeThe API./get/{code}
http.schemeThe type of HTTP protocol.http
http.status_codeThe HTTP status code.200
http.targetThe target path of the HTTP request, typically including the path of the resource and possible query parameters./get/200?foo=bar
http.urlThe URL of the request.
Note: Only visible for the client Span kind.
http://calendar-app:9090/calendar
http.user_agentThe User-Agent request header, a characteristic string that helps the server and peers identify the application, operating system, vendor, and version of the requesting user agent.okhttp/4.10.0
upstreamURLPathThe URL path of the upstream service, specifying the path of the resource that should be handled by the upstream service, including possible query parameters./get/200?foo=bar

Service

KeyDescriptionExample Value
inner.client.cluster.nameThe name of the cluster.global
inner.client.env.typeThe type of service.vm, k8s
inner.client.ms.nameThe name of the service.notes-app
inner.client.ms.namespaceThe namespace where the service is located.otel-ns
net.host.nameThe network host name.calendar-app
net.host.portThe network host port.9090
net.sock.host.addrThe address of the host connected by the network socket.10.3.0.118
net.sock.peer.addrThe peer address of the network socket.10.3.0.117
net.sock.peer.portThe peer port number of the network socket.44794
net.transportThe network transport protocol.ip_tcp
thread.idThe unique identifier of the thread.30
thread.nameThe name of the thread.http-nio-9090-exec-9

Middleware

KeyDescriptionExample Value
db.systemType of middleware. Currently supported types include: mysql, oracle, postgresql, redis.mysql
db.connection_stringConnection string. This is an expression containing parameters needed for application to connect with a database server, including server instance, database name, and authentication details.oracle:thin://oracle11g:1521
dn.nameDatabase name.db1
db.sql.tableName of the database table.students
db.operationType of database operation.SELECT
db.statementDatabase query statement.SET redis ?
select student0_.id as id1_0_0_, student0_.age as age2_0_0_ from students student0_ where student0_.id=?
net.peer.nameName of the middleware service.pg.ns
net.peer.portPort of the middleware service.5432
net.sock.peer.nameName of the Redis service.redis
net.sock.peer.addrIP address of the Redis service.10.4.199.164
net.sock.peer.portPort of the Redis service.6379

Process

KeyDescriptionExample Value
cluster.nameName of the cluster.global
container.idID of the container.b960b4f13d0e28fdc296195c4c7c57152fa4e689bb473bf8718ec817a7eea481
container.nameName of the container.notes-app
host.archArchitecture of the host.amd64
host.nameName of the host.notes-app-deploy-5f6557bc88-zk7cz
ms.nameName of the service.notes-app
ms.namespaceName of the namespace where the service is located.otel-ns
os.descriptionDescription of the operating system.Linux 3.10.0-1160.11.1.el7.x86\_64
os.typeType of the operating system.linux
otel.library.nameName of the Java library.io.opentelemetry.tomcat-7.0
otel.library.versionVersion of the Java library.1.24.0-alpha
process.command_lineCommand line parameters of the Java process./usr/local/openjdk-11/bin/java \-javaagent:/agent-22wwn/opentelemetry-javaagent-ext.jar -Dotel.instrumentation.runtime-metrics.experimental-metrics.enabled=true
process.executable.pathExecutable file path of the Java process./usr/local/openjdk-11/bin/java
process.pidIdentifier of the process.7
process.runtime.descriptionDescription of the process' runtime environment.Oracle Corporation OpenJDK 64-Bit Server VM 11.0.16+8
process.runtime.nameName of the process' runtime environment.OpenJDK Runtime Environment
process.runtime.versionVersion of the process' runtime environment.11.0.16+8
telemetry.auto.versionVersion of the Telemetry Auto.1.24.0
telemetry.sdk.languageLanguage of the Telemetry SDK.java
telemetry.sdk.nameName of the Telemetry SDK.opentelemetry
telemetry.sdk.versionVersion of the Telemetry SDK.