Module trace

Expand description

§Trace Semantic Conventions

The trace semantic conventions define a set of standardized attributes to be used in Spans.

§Usage

use opentelemetry::KeyValue;
use opentelemetry::{global, trace::Tracer as _};
use opentelemetry_semantic_conventions as semconv;

let tracer = global::tracer("my-component");
let _span = tracer
    .span_builder("span-name")
    .with_attributes([
        KeyValue::new(semconv::trace::CLIENT_ADDRESS, "example.org"),
        KeyValue::new(semconv::trace::CLIENT_PORT, 80i64),
    ])
    .start(&tracer);

Constants§

ANDROID_APP_STATE
This attribute represents the state of the application.
AWS_DYNAMODB_ATTRIBUTES_TO_GET
The value of the AttributesToGet request parameter.
AWS_DYNAMODB_ATTRIBUTE_DEFINITIONS
The JSON-serialized value of each item in the AttributeDefinitions request field.
AWS_DYNAMODB_CONSISTENT_READ
The value of the ConsistentRead request parameter.
AWS_DYNAMODB_CONSUMED_CAPACITY
The JSON-serialized value of each item in the ConsumedCapacity response field.
AWS_DYNAMODB_COUNT
The value of the Count response parameter.
AWS_DYNAMODB_EXCLUSIVE_START_TABLE
The value of the ExclusiveStartTableName request parameter.
AWS_DYNAMODB_GLOBAL_SECONDARY_INDEXES
The JSON-serialized value of each item of the GlobalSecondaryIndexes request field
AWS_DYNAMODB_GLOBAL_SECONDARY_INDEX_UPDATES
The JSON-serialized value of each item in the GlobalSecondaryIndexUpdates request field.
AWS_DYNAMODB_INDEX_NAME
The value of the IndexName request parameter.
AWS_DYNAMODB_ITEM_COLLECTION_METRICS
The JSON-serialized value of the ItemCollectionMetrics response field.
AWS_DYNAMODB_LIMIT
The value of the Limit request parameter.
AWS_DYNAMODB_LOCAL_SECONDARY_INDEXES
The JSON-serialized value of each item of the LocalSecondaryIndexes request field.
AWS_DYNAMODB_PROJECTION
The value of the ProjectionExpression request parameter.
AWS_DYNAMODB_PROVISIONED_READ_CAPACITY
The value of the ProvisionedThroughput.ReadCapacityUnits request parameter.
AWS_DYNAMODB_PROVISIONED_WRITE_CAPACITY
The value of the ProvisionedThroughput.WriteCapacityUnits request parameter.
AWS_DYNAMODB_SCANNED_COUNT
The value of the ScannedCount response parameter.
AWS_DYNAMODB_SCAN_FORWARD
The value of the ScanIndexForward request parameter.
AWS_DYNAMODB_SEGMENT
The value of the Segment request parameter.
AWS_DYNAMODB_SELECT
The value of the Select request parameter.
AWS_DYNAMODB_TABLE_COUNT
The number of items in the TableNames response parameter.
AWS_DYNAMODB_TABLE_NAMES
The keys in the RequestItems object field.
AWS_DYNAMODB_TOTAL_SEGMENTS
The value of the TotalSegments request parameter.
AWS_EXTENDED_REQUEST_ID
The AWS extended request ID as returned in the response header x-amz-id-2.
AWS_LAMBDA_INVOKED_ARN
The full invoked ARN as provided on the Context passed to the function (Lambda-Runtime-Invoked-Function-Arn header on the /runtime/invocation/next applicable).
AWS_REQUEST_ID
The AWS request ID as returned in the response headers x-amzn-requestid, x-amzn-request-id or x-amz-request-id.
AWS_S3_BUCKET
The S3 bucket name the request refers to. Corresponds to the --bucket parameter of the S3 API operations.
AWS_S3_COPY_SOURCE
The source object (in the form bucket/key) for the copy operation.
AWS_S3_DELETE
The delete request container that specifies the objects to be deleted.
AWS_S3_KEY
The S3 object key the request refers to. Corresponds to the --key parameter of the S3 API operations.
AWS_S3_PART_NUMBER
The part number of the part being uploaded in a multipart-upload operation. This is a positive integer between 1 and 10,000.
AWS_S3_UPLOAD_ID
Upload ID that identifies the multipart upload.
AZURE_CLIENT_ID
The unique identifier of the client instance.
AZURE_COSMOSDB_CONNECTION_MODE
Cosmos client connection mode.
AZURE_COSMOSDB_CONSISTENCY_LEVEL
Account or request consistency level.
AZURE_COSMOSDB_OPERATION_CONTACTED_REGIONS
List of regions contacted during operation in the order that they were contacted. If there is more than one region listed, it indicates that the operation was performed on multiple regions i.e. cross-regional call.
AZURE_COSMOSDB_OPERATION_REQUEST_CHARGE
The number of request units consumed by the operation.
AZURE_COSMOSDB_REQUEST_BODY_SIZE
Request payload size in bytes.
AZURE_COSMOSDB_RESPONSE_SUB_STATUS_CODE
Cosmos DB sub status code.
AZ_NAMESPACE
Azure Resource Provider Namespace as recognized by the client.
AZ_SERVICE_REQUEST_ID
The unique identifier of the service request. It’s generated by the Azure service and returned with the response.
CASSANDRA_CONSISTENCY_LEVEL
The consistency level of the query. Based on consistency values from CQL.
CASSANDRA_COORDINATOR_DC
The data center of the coordinating node for a query.
CASSANDRA_COORDINATOR_ID
The ID of the coordinating node for a query.
CASSANDRA_PAGE_SIZE
The fetch size used for paging, i.e. how many rows will be returned at once.
CASSANDRA_QUERY_IDEMPOTENT
Whether or not the query is idempotent.
CASSANDRA_SPECULATIVE_EXECUTION_COUNT
The number of times a query was speculatively executed. Not set or 0 if the query was not executed speculatively.
CLIENT_ADDRESS
Client address - domain name if available without reverse DNS lookup; otherwise, IP address or Unix domain socket name.
CLIENT_PORT
Client port number.
CLOUD_RESOURCE_ID
Cloud provider-specific native identifier of the monitored cloud resource (e.g. an ARN on AWS, a fully qualified resource ID on Azure, a full resource name on GCP)
DB_COLLECTION_NAME
The name of a collection (table, container) within the database.
DB_NAMESPACE
The name of the database, fully qualified within the server address and port.
DB_OPERATION_BATCH_SIZE
The number of queries included in a batch operation.
DB_OPERATION_NAME
The name of the operation or command being executed.
DB_OPERATION_PARAMETER
A database operation parameter, with <key> being the parameter name, and the attribute value being a string representation of the parameter value.
DB_QUERY_SUMMARY
Low cardinality representation of a database query text.
DB_QUERY_TEXT
The database query being executed.
DB_RESPONSE_RETURNED_ROWS
Number of rows returned by the operation.
DB_RESPONSE_STATUS_CODE
Database response status code.
DB_SYSTEM_NAME
The database management system (DBMS) product as identified by the client instrumentation.
ELASTICSEARCH_NODE_NAME
Represents the human-readable identifier of the node/instance to which a request was routed.
ERROR_TYPE
Describes a class of error the operation ended with.
EXCEPTION_ESCAPED
Indicates that the exception is escaping the scope of the span.
EXCEPTION_MESSAGE
The exception message.
EXCEPTION_STACKTRACE
A stacktrace as a string in the natural representation for the language runtime. The representation is to be determined and documented by each language SIG.
EXCEPTION_TYPE
The type of the exception (its fully-qualified class name, if applicable). The dynamic type of the exception should be preferred over the static type in languages that support it.
FAAS_COLDSTART
A boolean that is true if the serverless function is executed for the first time (aka cold-start).
FAAS_CRON
A string containing the schedule period as Cron Expression.
FAAS_DOCUMENT_COLLECTION
The name of the source on which the triggering operation was performed. For example, in Cloud Storage or S3 corresponds to the bucket name, and in Cosmos DB to the database name.
FAAS_DOCUMENT_NAME
The document name/table subjected to the operation. For example, in Cloud Storage or S3 is the name of the file, and in Cosmos DB the table name.
FAAS_DOCUMENT_OPERATION
Describes the type of the operation that was performed on the data.
FAAS_DOCUMENT_TIME
A string containing the time when the data was accessed in the ISO 8601 format expressed in UTC.
FAAS_INVOKED_NAME
The name of the invoked function.
FAAS_INVOKED_PROVIDER
The cloud provider of the invoked function.
FAAS_INVOKED_REGION
The cloud region of the invoked function.
FAAS_TIME
A string containing the function invocation time in the ISO 8601 format expressed in UTC.
FAAS_TRIGGER
Type of the trigger which caused this function invocation.
FEATURE_FLAG_CONTEXT_ID
The unique identifier for the flag evaluation context. For example, the targeting key.
FEATURE_FLAG_EVALUATION_ERROR_MESSAGE
A message explaining the nature of an error occurring during flag evaluation.
FEATURE_FLAG_EVALUATION_REASON
The reason code which shows how a feature flag value was determined.
FEATURE_FLAG_KEY
The lookup key of the feature flag.
FEATURE_FLAG_PROVIDER_NAME
Identifies the feature flag provider.
FEATURE_FLAG_SET_ID
The identifier of the flag set to which the feature flag belongs.
FEATURE_FLAG_VARIANT
A semantic identifier for an evaluated flag value.
FEATURE_FLAG_VERSION
The version of the ruleset used during the evaluation. This may be any stable value which uniquely identifies the ruleset.
GEN_AI_AGENT_DESCRIPTION
Free-form description of the GenAI agent provided by the application.
GEN_AI_AGENT_ID
The unique identifier of the GenAI agent.
GEN_AI_AGENT_NAME
Human-readable name of the GenAI agent provided by the application.
GEN_AI_OPENAI_REQUEST_SERVICE_TIER
The service tier requested. May be a specific tier, default, or auto.
GEN_AI_OPENAI_RESPONSE_SERVICE_TIER
The service tier used for the response.
GEN_AI_OPENAI_RESPONSE_SYSTEM_FINGERPRINT
A fingerprint to track any eventual change in the Generative AI environment.
GEN_AI_OPERATION_NAME
The name of the operation being performed.
GEN_AI_OUTPUT_TYPE
Represents the content type requested by the client.
GEN_AI_REQUEST_CHOICE_COUNT
The target number of candidate completions to return.
GEN_AI_REQUEST_ENCODING_FORMATS
The encoding formats requested in an embeddings operation, if specified.
GEN_AI_REQUEST_FREQUENCY_PENALTY
The frequency penalty setting for the GenAI request.
GEN_AI_REQUEST_MAX_TOKENS
The maximum number of tokens the model generates for a request.
GEN_AI_REQUEST_MODEL
The name of the GenAI model a request is being made to.
GEN_AI_REQUEST_PRESENCE_PENALTY
The presence penalty setting for the GenAI request.
GEN_AI_REQUEST_SEED
Requests with same seed value more likely to return same result.
GEN_AI_REQUEST_STOP_SEQUENCES
List of sequences that the model will use to stop generating further tokens.
GEN_AI_REQUEST_TEMPERATURE
The temperature setting for the GenAI request.
GEN_AI_REQUEST_TOP_K
The top_k sampling setting for the GenAI request.
GEN_AI_REQUEST_TOP_P
The top_p sampling setting for the GenAI request.
GEN_AI_RESPONSE_FINISH_REASONS
Array of reasons the model stopped generating tokens, corresponding to each generation received.
GEN_AI_RESPONSE_ID
The unique identifier for the completion.
GEN_AI_RESPONSE_MODEL
The name of the model that generated the response.
GEN_AI_SYSTEM
The Generative AI product as identified by the client or server instrumentation.
GEN_AI_TOOL_CALL_ID
The tool call identifier.
GEN_AI_TOOL_NAME
Name of the tool utilized by the agent.
GEN_AI_USAGE_INPUT_TOKENS
The number of tokens used in the GenAI input (prompt).
GEN_AI_USAGE_OUTPUT_TOKENS
The number of tokens used in the GenAI response (completion).
GRAPHQL_DOCUMENT
The GraphQL document being executed.
GRAPHQL_OPERATION_NAME
The name of the operation being executed.
GRAPHQL_OPERATION_TYPE
The type of the operation being executed.
HTTP_REQUEST_BODY_SIZE
The size of the request payload body in bytes. This is the number of bytes transferred excluding headers and is often, but not always, present as the Content-Length header. For requests using transport encoding, this should be the compressed size.
HTTP_REQUEST_HEADER
HTTP request headers, <key> being the normalized HTTP Header name (lowercase), the value being the header values.
HTTP_REQUEST_METHOD
HTTP request method.
HTTP_REQUEST_METHOD_ORIGINAL
Original HTTP method sent by the client in the request line.
HTTP_REQUEST_RESEND_COUNT
The ordinal number of request resending attempt (for any reason, including redirects).
HTTP_REQUEST_SIZE
The total size of the request in bytes. This should be the total number of bytes sent over the wire, including the request line (HTTP/1.1), framing (HTTP/2 and HTTP/3), headers, and request body if any.
HTTP_RESPONSE_BODY_SIZE
The size of the response payload body in bytes. This is the number of bytes transferred excluding headers and is often, but not always, present as the Content-Length header. For requests using transport encoding, this should be the compressed size.
HTTP_RESPONSE_HEADER
HTTP response headers, <key> being the normalized HTTP Header name (lowercase), the value being the header values.
HTTP_RESPONSE_SIZE
The total size of the response in bytes. This should be the total number of bytes sent over the wire, including the status line (HTTP/1.1), framing (HTTP/2 and HTTP/3), headers, and response body and trailers if any.
HTTP_RESPONSE_STATUS_CODE
HTTP response status code.
HTTP_ROUTE
The matched route, that is, the path template in the format used by the respective server framework.
IOS_APP_STATE
This attribute represents the state of the application.
NETWORK_LOCAL_ADDRESS
Local address of the network connection - IP address or Unix domain socket name.
NETWORK_LOCAL_PORT
Local port number of the network connection.
NETWORK_PEER_ADDRESS
Peer address of the network connection - IP address or Unix domain socket name.
NETWORK_PEER_PORT
Peer port number of the network connection.
NETWORK_PROTOCOL_NAME
OSI application layer or non-OSI equivalent.
NETWORK_PROTOCOL_VERSION
The actual version of the protocol used for network communication.
NETWORK_TRANSPORT
OSI transport layer or inter-process communication method.
NETWORK_TYPE
OSI network layer or non-OSI equivalent.
PROCESS_COMMAND_ARGS
All the command arguments (including the command/executable itself) as received by the process. On Linux-based systems (and some other Unixoid systems supporting procfs), can be set according to the list of null-delimited strings extracted from proc/[pid]/cmdline. For libc-based executables, this would be the full argv vector passed to main.
PROCESS_EXECUTABLE_NAME
The name of the process executable. On Linux based systems, this SHOULD be set to the base name of the target of /proc/[pid]/exe. On Windows, this SHOULD be set to the base name of GetProcessImageFileNameW.
PROCESS_EXECUTABLE_PATH
The full path to the process executable. On Linux based systems, can be set to the target of proc/[pid]/exe. On Windows, can be set to the result of GetProcessImageFileNameW.
PROCESS_EXIT_CODE
The exit code of the process.
PROCESS_PID
Process identifier (PID).
RPC_MESSAGE_COMPRESSED_SIZE
Compressed size of the message in bytes.
RPC_MESSAGE_ID
MUST be calculated as two different counters starting from 1 one for sent messages and one for received message.
RPC_MESSAGE_TYPE
Whether this is a received or sent message.
RPC_MESSAGE_UNCOMPRESSED_SIZE
Uncompressed size of the message in bytes.
RPC_METHOD
The name of the (logical) method being called, must be equal to the $method part in the span name.
RPC_SERVICE
The full (logical) name of the service being called, including its package name, if applicable.
RPC_SYSTEM
A string identifying the remoting system. See below for a list of well-known identifiers.
SERVER_ADDRESS
Server domain name if available without reverse DNS lookup; otherwise, IP address or Unix domain socket name.
SERVER_PORT
Server port number.
SESSION_ID
A unique id to identify a session.
SESSION_PREVIOUS_ID
The previous session.id for this user, when known.
URL_FULL
Absolute URL describing a network resource according to RFC3986
URL_PATH
The URI path component
URL_QUERY
The URI query component
URL_SCHEME
The URI scheme component identifying the used protocol.
URL_TEMPLATE
The low-cardinality template of an absolute path reference.
USER_AGENT_ORIGINAL
Value of the HTTP User-Agent header sent by the client.
USER_AGENT_SYNTHETIC_TYPE
Specifies the category of synthetic traffic, such as tests or bots.