From 5baca907842bf32267266a8c12b0dffdd54a599c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Thallis?= Date: Sun, 4 Feb 2024 18:00:40 -0300 Subject: [PATCH] update and delete conventions Create following the BREAKINGs of OTEL spec https://github.com/open-telemetry/opentelemetry-specification/blob/main/CHANGELOG.md --- .../include/logs.hrl | 6 - .../include/resource.hrl | 2 +- .../include/trace.hrl | 55 +++---- .../semantic_conventions/logs.ex | 18 +-- .../semantic_conventions/resource.ex | 4 +- .../semantic_conventions/trace.ex | 144 +++++++----------- 6 files changed, 84 insertions(+), 145 deletions(-) diff --git a/apps/opentelemetry_semantic_conventions/include/logs.hrl b/apps/opentelemetry_semantic_conventions/include/logs.hrl index 2f9a6cce..f07ea93c 100644 --- a/apps/opentelemetry_semantic_conventions/include/logs.hrl +++ b/apps/opentelemetry_semantic_conventions/include/logs.hrl @@ -3,9 +3,3 @@ %% The name identifies the event -define(EVENT_NAME, 'event.name'). - -%% The domain identifies the context in which an event happened. An event name is unique only within a domain -%% An `event.name` is supposed to be unique only in the context of an -%% `event.domain`, so this allows for two events in different domains to -%% have same `event.name`, yet be unrelated events --define(EVENT_DOMAIN, 'event.domain'). diff --git a/apps/opentelemetry_semantic_conventions/include/resource.hrl b/apps/opentelemetry_semantic_conventions/include/resource.hrl index 171e44b1..06e8a51f 100644 --- a/apps/opentelemetry_semantic_conventions/include/resource.hrl +++ b/apps/opentelemetry_semantic_conventions/include/resource.hrl @@ -156,7 +156,7 @@ %% * **AWS Lambda:** Use the (full) log stream name -define(FAAS_INSTANCE, 'faas.instance'). -%% The amount of memory available to the serverless function in MiB +%% The amount of memory available to the serverless function in Bytes %% It's recommended to set this attribute since e.g. too little memory can easily stop a Java AWS Lambda function from working correctly. On AWS Lambda, the environment variable `AWS_LAMBDA_FUNCTION_MEMORY_SIZE` provides this information -define(FAAS_MAX_MEMORY, 'faas.max_memory'). diff --git a/apps/opentelemetry_semantic_conventions/include/trace.hrl b/apps/opentelemetry_semantic_conventions/include/trace.hrl index 3824a9eb..7f3b8b17 100644 --- a/apps/opentelemetry_semantic_conventions/include/trace.hrl +++ b/apps/opentelemetry_semantic_conventions/include/trace.hrl @@ -146,8 +146,8 @@ %% call to invoke the lambda, which is often HTTP) -define(FAAS_TRIGGER, 'faas.trigger'). -%% The execution ID of the current function execution --define(FAAS_EXECUTION, 'faas.execution'). +%% The invocation ID of the current function invocation +-define(FAAS_EXECUTION, 'faas.invocation_id'). %% 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 -define(FAAS_DOCUMENT_COLLECTION, 'faas.document.collection'). @@ -259,35 +259,26 @@ %% A string identifying the messaging system -define(MESSAGING_SYSTEM, 'messaging.system'). -%% The message destination name. This might be equal to the span name but is required nevertheless --define(MESSAGING_DESTINATION, 'messaging.destination'). - -%% The kind of message destination --define(MESSAGING_DESTINATION_KIND, 'messaging.destination_kind'). +%% The message destination name. +-define(MESSAGING_DESTINATION, 'messaging.destination.name'). %% A boolean that is true if the message destination is temporary --define(MESSAGING_TEMP_DESTINATION, 'messaging.temp_destination'). +-define(MESSAGING_TEMP_DESTINATION, 'messaging.destination.temporary'). %% The name of the transport protocol --define(MESSAGING_PROTOCOL, 'messaging.protocol'). +-define(MESSAGING_PROTOCOL, 'network.protocol.name'). %% The version of the transport protocol --define(MESSAGING_PROTOCOL_VERSION, 'messaging.protocol_version'). - -%% Connection string --define(MESSAGING_URL, 'messaging.url'). +-define(MESSAGING_PROTOCOL_VERSION, 'network.protocol.version'). %% A value used by the messaging system as an identifier for the message, represented as a string --define(MESSAGING_MESSAGE_ID, 'messaging.message_id'). +-define(MESSAGING_MESSAGE_ID, 'messaging.message.id'). %% The [conversation ID](#conversations) identifying the conversation to which the message belongs, represented as a string. Sometimes called "Correlation ID" --define(MESSAGING_CONVERSATION_ID, 'messaging.conversation_id'). - -%% The (uncompressed) size of the message payload in bytes. Also use this attribute if it is unknown whether the compressed or uncompressed payload size is reported --define(MESSAGING_MESSAGE_PAYLOAD_SIZE_BYTES, 'messaging.message_payload_size_bytes'). +-define(MESSAGING_CONVERSATION_ID, 'messaging.message.conversation_id'). -%% The compressed size of the message payload in bytes --define(MESSAGING_MESSAGE_PAYLOAD_COMPRESSED_SIZE_BYTES, 'messaging.message_payload_compressed_size_bytes'). +%% The size of the message body in bytes. This can refer to both the compressed or uncompressed body size. If both sizes are known, the uncompressed body size should be used +-define(MESSAGING_MESSAGE_PAYLOAD_SIZE_BYTES, 'messaging.message.body.size'). %% A string containing the function invocation time in the [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format expressed in [UTC](https://www.w3.org/TR/NOTE-datetime) -define(FAAS_TIME, 'faas.time'). @@ -434,30 +425,30 @@ %% The value may be sanitized to exclude sensitive information -define(GRAPHQL_DOCUMENT, 'graphql.document'). -%% A string identifying the kind of message consumption as defined in the [Operation names](#operation-names) section above. If the operation is "send", this attribute MUST NOT be set, since the operation can be inferred from the span kind in that case +%% A string identifying the kind of message consumption as defined in the [Operation names](#operation-names) section above. -define(MESSAGING_OPERATION, 'messaging.operation'). -%% The identifier for the consumer receiving a message. For Kafka, set it to `{messaging.kafka.consumer_group} - {messaging.kafka.client_id}`, if both are present, or only `messaging.kafka.consumer_group`. For brokers, such as RabbitMQ and Artemis, set it to the `client_id` of the client consuming the message --define(MESSAGING_CONSUMER_ID, 'messaging.consumer_id'). +%% The identifier for the consumer receiving a message. For Kafka, set it to `{messaging.kafka.consumer.group} - {messaging.kafka.client_id}`, if both are present, or only `messaging.kafka.consumer.group`. For brokers, such as RabbitMQ and Artemis, set it to the `client_id` of the client consuming the message +-define(MESSAGING_CONSUMER_ID, 'messaging.consumer.id'). %% RabbitMQ message routing key --define(MESSAGING_RABBITMQ_ROUTING_KEY, 'messaging.rabbitmq.routing_key'). +-define(MESSAGING_RABBITMQ_ROUTING_KEY, 'messaging.rabbitmq.destination.routing_key'). -%% Message keys in Kafka are used for grouping alike messages to ensure they're processed on the same partition. They differ from `messaging.message_id` in that they're not unique. If the key is `null`, the attribute MUST NOT be set + %% Message keys in Kafka are used for grouping alike messages to ensure they're processed on the same partition. They differ from `messaging.message.id` in that they're not unique. If the key is `null`, the attribute MUST NOT be set %% If the key type is not string, it's string representation has to be supplied for the attribute. If the key has no unambiguous, canonical string form, don't include its value --define(MESSAGING_KAFKA_MESSAGE_KEY, 'messaging.kafka.message_key'). +-define(MESSAGING_KAFKA_MESSAGE_KEY, 'messaging.kafka.message.key'). %% Name of the Kafka Consumer Group that is handling the message. Only applies to consumers, not producers --define(MESSAGING_KAFKA_CONSUMER_GROUP, 'messaging.kafka.consumer_group'). +-define(MESSAGING_KAFKA_CONSUMER_GROUP, 'messaging.kafka.consumer.group'). %% Client Id for the Consumer or Producer that is handling the message -define(MESSAGING_KAFKA_CLIENT_ID, 'messaging.kafka.client_id'). %% Partition the message is sent to --define(MESSAGING_KAFKA_PARTITION, 'messaging.kafka.partition'). +-define(MESSAGING_KAFKA_PARTITION, 'messaging.kafka.destination.partition'). %% A boolean that is true if the message is a tombstone --define(MESSAGING_KAFKA_TOMBSTONE, 'messaging.kafka.tombstone'). +-define(MESSAGING_KAFKA_TOMBSTONE, 'messaging.kafka.message.tombstone'). %% Namespace of RocketMQ resources, resources in different namespaces are individual -define(MESSAGING_ROCKETMQ_NAMESPACE, 'messaging.rocketmq.namespace'). @@ -469,13 +460,13 @@ -define(MESSAGING_ROCKETMQ_CLIENT_ID, 'messaging.rocketmq.client_id'). %% Type of message --define(MESSAGING_ROCKETMQ_MESSAGE_TYPE, 'messaging.rocketmq.message_type'). +-define(MESSAGING_ROCKETMQ_MESSAGE_TYPE, 'messaging.rocketmq.message.type'). %% The secondary classifier of message besides topic --define(MESSAGING_ROCKETMQ_MESSAGE_TAG, 'messaging.rocketmq.message_tag'). +-define(MESSAGING_ROCKETMQ_MESSAGE_TAG, 'messaging.rocketmq.message.tag'). %% Key(s) of message, another way to mark message besides message id --define(MESSAGING_ROCKETMQ_MESSAGE_KEYS, 'messaging.rocketmq.message_keys'). +-define(MESSAGING_ROCKETMQ_MESSAGE_KEYS, 'messaging.rocketmq.message.keys'). %% Model of message consumption. This only applies to consumer spans -define(MESSAGING_ROCKETMQ_CONSUMPTION_MODEL, 'messaging.rocketmq.consumption_model'). diff --git a/apps/opentelemetry_semantic_conventions/lib/open_telemetry/semantic_conventions/logs.ex b/apps/opentelemetry_semantic_conventions/lib/open_telemetry/semantic_conventions/logs.ex index e15c8af2..b5835f87 100644 --- a/apps/opentelemetry_semantic_conventions/lib/open_telemetry/semantic_conventions/logs.ex +++ b/apps/opentelemetry_semantic_conventions/lib/open_telemetry/semantic_conventions/logs.ex @@ -19,20 +19,4 @@ defmodule OpenTelemetry.SemanticConventions.Logs do def event_name do :"event.name" end - @doc """ - The domain identifies the context in which an event happened. An event name is unique only within a domain - - ### Notes - - An `event.name` is supposed to be unique only in the context of an - `event.domain`, so this allows for two events in different domains to - have same `event.name`, yet be unrelated events - - iex> OpenTelemetry.SemanticConventions.Logs.event_domain() - :"event.domain" - """ - @spec event_domain :: :"event.domain" - def event_domain do - :"event.domain" - end -end \ No newline at end of file +end diff --git a/apps/opentelemetry_semantic_conventions/lib/open_telemetry/semantic_conventions/resource.ex b/apps/opentelemetry_semantic_conventions/lib/open_telemetry/semantic_conventions/resource.ex index 7ac6f642..23ad248c 100644 --- a/apps/opentelemetry_semantic_conventions/lib/open_telemetry/semantic_conventions/resource.ex +++ b/apps/opentelemetry_semantic_conventions/lib/open_telemetry/semantic_conventions/resource.ex @@ -447,7 +447,7 @@ defmodule OpenTelemetry.SemanticConventions.Resource do :"faas.instance" end @doc """ - The amount of memory available to the serverless function in MiB + The amount of memory available to the serverless function in Bytes ### Notes @@ -1002,4 +1002,4 @@ defmodule OpenTelemetry.SemanticConventions.Resource do def webengine_description do :"webengine.description" end -end \ No newline at end of file +end diff --git a/apps/opentelemetry_semantic_conventions/lib/open_telemetry/semantic_conventions/trace.ex b/apps/opentelemetry_semantic_conventions/lib/open_telemetry/semantic_conventions/trace.ex index d15d8c25..d3a4da9d 100644 --- a/apps/opentelemetry_semantic_conventions/lib/open_telemetry/semantic_conventions/trace.ex +++ b/apps/opentelemetry_semantic_conventions/lib/open_telemetry/semantic_conventions/trace.ex @@ -447,14 +447,14 @@ defmodule OpenTelemetry.SemanticConventions.Trace do :"faas.trigger" end @doc """ - The execution ID of the current function execution + The invocation ID of the current function invocation iex> OpenTelemetry.SemanticConventions.Trace.faas_execution() - :"faas.execution" + :"faas.invocation_id" """ - @spec faas_execution :: :"faas.execution" + @spec faas_execution :: :"faas.invocation_id" def faas_execution do - :"faas.execution" + :"faas.invocation_id" end @doc """ 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 @@ -774,104 +774,74 @@ defmodule OpenTelemetry.SemanticConventions.Trace do :"messaging.system" end @doc """ - The message destination name. This might be equal to the span name but is required nevertheless + The message destination name. iex> OpenTelemetry.SemanticConventions.Trace.messaging_destination() - :"messaging.destination" + :"messaging.destination.name" """ - @spec messaging_destination :: :"messaging.destination" + @spec messaging_destination :: :"messaging.destination.name" def messaging_destination do - :"messaging.destination" - end - @doc """ - The kind of message destination - - iex> OpenTelemetry.SemanticConventions.Trace.messaging_destination_kind() - :"messaging.destination_kind" - """ - @spec messaging_destination_kind :: :"messaging.destination_kind" - def messaging_destination_kind do - :"messaging.destination_kind" + :"messaging.destination.name" end @doc """ A boolean that is true if the message destination is temporary iex> OpenTelemetry.SemanticConventions.Trace.messaging_temp_destination() - :"messaging.temp_destination" + :"messaging.destination.temporary" """ - @spec messaging_temp_destination :: :"messaging.temp_destination" + @spec messaging_temp_destination :: :"messaging.destination.temporary" def messaging_temp_destination do - :"messaging.temp_destination" + :"messaging.destination.temporary" end @doc """ The name of the transport protocol iex> OpenTelemetry.SemanticConventions.Trace.messaging_protocol() - :"messaging.protocol" + :"network.protocol.name" """ - @spec messaging_protocol :: :"messaging.protocol" + @spec messaging_protocol :: :"network.protocol.name" def messaging_protocol do - :"messaging.protocol" + :"network.protocol.name" end @doc """ The version of the transport protocol iex> OpenTelemetry.SemanticConventions.Trace.messaging_protocol_version() - :"messaging.protocol_version" + :"network.protocol.version" """ - @spec messaging_protocol_version :: :"messaging.protocol_version" + @spec messaging_protocol_version :: :"network.protocol.version" def messaging_protocol_version do - :"messaging.protocol_version" - end - @doc """ - Connection string - - iex> OpenTelemetry.SemanticConventions.Trace.messaging_url() - :"messaging.url" - """ - @spec messaging_url :: :"messaging.url" - def messaging_url do - :"messaging.url" + :"network.protocol.version" end @doc """ A value used by the messaging system as an identifier for the message, represented as a string iex> OpenTelemetry.SemanticConventions.Trace.messaging_message_id() - :"messaging.message_id" + :"messaging.message.id" """ - @spec messaging_message_id :: :"messaging.message_id" + @spec messaging_message_id :: :"messaging.message.id" def messaging_message_id do - :"messaging.message_id" + :"messaging.message.id" end @doc """ The [conversation ID](#conversations) identifying the conversation to which the message belongs, represented as a string. Sometimes called "Correlation ID" iex> OpenTelemetry.SemanticConventions.Trace.messaging_conversation_id() - :"messaging.conversation_id" + :"messaging.message.conversation_id" """ - @spec messaging_conversation_id :: :"messaging.conversation_id" + @spec messaging_conversation_id :: :"messaging.message.conversation_id" def messaging_conversation_id do - :"messaging.conversation_id" + :"messaging.message.conversation_id" end @doc """ - The (uncompressed) size of the message payload in bytes. Also use this attribute if it is unknown whether the compressed or uncompressed payload size is reported + The size of the message body in bytes. This can refer to both the compressed or uncompressed body size. If both sizes are known, the uncompressed body size should be used iex> OpenTelemetry.SemanticConventions.Trace.messaging_message_payload_size_bytes() - :"messaging.message_payload_size_bytes" + :"messaging.message.body.size" """ - @spec messaging_message_payload_size_bytes :: :"messaging.message_payload_size_bytes" + @spec messaging_message_payload_size_bytes :: :"messaging.message.body.size" def messaging_message_payload_size_bytes do - :"messaging.message_payload_size_bytes" - end - @doc """ - The compressed size of the message payload in bytes - - iex> OpenTelemetry.SemanticConventions.Trace.messaging_message_payload_compressed_size_bytes() - :"messaging.message_payload_compressed_size_bytes" - """ - @spec messaging_message_payload_compressed_size_bytes :: :"messaging.message_payload_compressed_size_bytes" - def messaging_message_payload_compressed_size_bytes do - :"messaging.message_payload_compressed_size_bytes" + :"messaging.message.body.size" end @doc """ A string containing the function invocation time in the [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format expressed in [UTC](https://www.w3.org/TR/NOTE-datetime) @@ -1362,7 +1332,7 @@ defmodule OpenTelemetry.SemanticConventions.Trace do :"graphql.document" end @doc """ - A string identifying the kind of message consumption as defined in the [Operation names](#operation-names) section above. If the operation is "send", this attribute MUST NOT be set, since the operation can be inferred from the span kind in that case + A string identifying the kind of message consumption as defined in the [Operation names](#operation-names) section above. iex> OpenTelemetry.SemanticConventions.Trace.messaging_operation() :"messaging.operation" @@ -1372,24 +1342,24 @@ defmodule OpenTelemetry.SemanticConventions.Trace do :"messaging.operation" end @doc """ - The identifier for the consumer receiving a message. For Kafka, set it to `{messaging.kafka.consumer_group} - {messaging.kafka.client_id}`, if both are present, or only `messaging.kafka.consumer_group`. For brokers, such as RabbitMQ and Artemis, set it to the `client_id` of the client consuming the message + The identifier for the consumer receiving a message. For Kafka, set it to `{messaging.kafka.consumer.group} - {messaging.kafka.client_id}`, if both are present, or only `messaging.kafka.consumer.group`. For brokers, such as RabbitMQ and Artemis, set it to the `client_id` of the client consuming the message iex> OpenTelemetry.SemanticConventions.Trace.messaging_consumer_id() - :"messaging.consumer_id" + :"messaging.consumer.id" """ - @spec messaging_consumer_id :: :"messaging.consumer_id" + @spec messaging_consumer_id :: :"messaging.consumer.id" def messaging_consumer_id do - :"messaging.consumer_id" + :"messaging.consumer.id" end @doc """ RabbitMQ message routing key iex> OpenTelemetry.SemanticConventions.Trace.messaging_rabbitmq_routing_key() - :"messaging.rabbitmq.routing_key" + :"messaging.rabbitmq.destination.routing_key" """ - @spec messaging_rabbitmq_routing_key :: :"messaging.rabbitmq.routing_key" + @spec messaging_rabbitmq_routing_key :: :"messaging.rabbitmq.destination.routing_key" def messaging_rabbitmq_routing_key do - :"messaging.rabbitmq.routing_key" + :"messaging.rabbitmq.destination.routing_key" end @doc """ Message keys in Kafka are used for grouping alike messages to ensure they're processed on the same partition. They differ from `messaging.message_id` in that they're not unique. If the key is `null`, the attribute MUST NOT be set @@ -1399,21 +1369,21 @@ defmodule OpenTelemetry.SemanticConventions.Trace do If the key type is not string, it's string representation has to be supplied for the attribute. If the key has no unambiguous, canonical string form, don't include its value iex> OpenTelemetry.SemanticConventions.Trace.messaging_kafka_message_key() - :"messaging.kafka.message_key" + :"messaging.kafka.message.key" """ - @spec messaging_kafka_message_key :: :"messaging.kafka.message_key" + @spec messaging_kafka_message_key :: :"messaging.kafka.message.key" def messaging_kafka_message_key do - :"messaging.kafka.message_key" + :"messaging.kafka.message.key" end @doc """ Name of the Kafka Consumer Group that is handling the message. Only applies to consumers, not producers iex> OpenTelemetry.SemanticConventions.Trace.messaging_kafka_consumer_group() - :"messaging.kafka.consumer_group" + :"messaging.kafka.consumer.group" """ - @spec messaging_kafka_consumer_group :: :"messaging.kafka.consumer_group" + @spec messaging_kafka_consumer_group :: :"messaging.kafka.consumer.group" def messaging_kafka_consumer_group do - :"messaging.kafka.consumer_group" + :"messaging.kafka.consumer.group" end @doc """ Client Id for the Consumer or Producer that is handling the message @@ -1429,21 +1399,21 @@ defmodule OpenTelemetry.SemanticConventions.Trace do Partition the message is sent to iex> OpenTelemetry.SemanticConventions.Trace.messaging_kafka_partition() - :"messaging.kafka.partition" + :"messaging.kafka.destination.partition" """ - @spec messaging_kafka_partition :: :"messaging.kafka.partition" + @spec messaging_kafka_partition :: :"messaging.kafka.destination.partition" def messaging_kafka_partition do - :"messaging.kafka.partition" + :"messaging.kafka.destination.partition" end @doc """ A boolean that is true if the message is a tombstone iex> OpenTelemetry.SemanticConventions.Trace.messaging_kafka_tombstone() - :"messaging.kafka.tombstone" + :"messaging.kafka.message.tombstone" """ - @spec messaging_kafka_tombstone :: :"messaging.kafka.tombstone" + @spec messaging_kafka_tombstone :: :"messaging.kafka.message.tombstone" def messaging_kafka_tombstone do - :"messaging.kafka.tombstone" + :"messaging.kafka.message.tombstone" end @doc """ Namespace of RocketMQ resources, resources in different namespaces are individual @@ -1479,31 +1449,31 @@ defmodule OpenTelemetry.SemanticConventions.Trace do Type of message iex> OpenTelemetry.SemanticConventions.Trace.messaging_rocketmq_message_type() - :"messaging.rocketmq.message_type" + :"messaging.rocketmq.message.type" """ - @spec messaging_rocketmq_message_type :: :"messaging.rocketmq.message_type" + @spec messaging_rocketmq_message_type :: :"messaging.rocketmq.message.type" def messaging_rocketmq_message_type do - :"messaging.rocketmq.message_type" + :"messaging.rocketmq.message.type" end @doc """ The secondary classifier of message besides topic iex> OpenTelemetry.SemanticConventions.Trace.messaging_rocketmq_message_tag() - :"messaging.rocketmq.message_tag" + :"messaging.rocketmq.message.tag" """ - @spec messaging_rocketmq_message_tag :: :"messaging.rocketmq.message_tag" + @spec messaging_rocketmq_message_tag :: :"messaging.rocketmq.message.tag" def messaging_rocketmq_message_tag do - :"messaging.rocketmq.message_tag" + :"messaging.rocketmq.message.tag" end @doc """ Key(s) of message, another way to mark message besides message id iex> OpenTelemetry.SemanticConventions.Trace.messaging_rocketmq_message_keys() - :"messaging.rocketmq.message_keys" + :"messaging.rocketmq.message.keys" """ - @spec messaging_rocketmq_message_keys :: :"messaging.rocketmq.message_keys" + @spec messaging_rocketmq_message_keys :: :"messaging.rocketmq.message.keys" def messaging_rocketmq_message_keys do - :"messaging.rocketmq.message_keys" + :"messaging.rocketmq.message.keys" end @doc """ Model of message consumption. This only applies to consumer spans @@ -1609,4 +1579,4 @@ defmodule OpenTelemetry.SemanticConventions.Trace do def message_uncompressed_size do :"message.uncompressed_size" end -end \ No newline at end of file +end