|
| 1 | +/* |
| 2 | + * Copyright The OpenTelemetry Authors |
| 3 | + * |
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | + * you may not use this file except in compliance with the License. |
| 6 | + * You may obtain a copy of the License at |
| 7 | + * |
| 8 | + * https://www.apache.org/licenses/LICENSE-2.0 |
| 9 | + * |
| 10 | + * Unless required by applicable law or agreed to in writing, software |
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | + * See the License for the specific language governing permissions and |
| 14 | + * limitations under the License. |
| 15 | + */ |
| 16 | + |
| 17 | +/** |
| 18 | + * messaging attribute names defined by the Opetelemetry Semantic Conventions specification |
| 19 | + * https://github.com/open-telemetry/opentelemetry-specification/blob/master/specification/trace/semantic_conventions/messaging.md |
| 20 | + */ |
| 21 | +export const MessagingAttribute = { |
| 22 | + /** |
| 23 | + * A string identifying the messaging system. |
| 24 | + * example: kafka, rabbitmq, sqs, sns |
| 25 | + * |
| 26 | + * @remarks |
| 27 | + * Required. |
| 28 | + */ |
| 29 | + MESSAGING_SYSTEM: 'messaging.system', |
| 30 | + |
| 31 | + /** |
| 32 | + * The message destination name. This might be equal to the span name but is required nevertheless. |
| 33 | + * example: MyQueue, MyTopic |
| 34 | + * |
| 35 | + * @remarks |
| 36 | + * Required. |
| 37 | + */ |
| 38 | + MESSAGING_DESTINATION: 'messaging.destination', |
| 39 | + |
| 40 | + /** |
| 41 | + * The kind of message destination |
| 42 | + * allowed values: queue, topic, |
| 43 | + * |
| 44 | + * @remarks |
| 45 | + * Required only if the message destination is either a queue or topic. |
| 46 | + */ |
| 47 | + MESSAGING_DESTINATION_KIND: 'messaging.destination_kind', |
| 48 | + |
| 49 | + /** |
| 50 | + * A boolean that is true if the message destination is temporary |
| 51 | + * |
| 52 | + * @remarks |
| 53 | + * Conditional If missing, it is assumed to be false. |
| 54 | + */ |
| 55 | + MESSAGING_TEMP_DESTINATION: 'messaging.temp_destination', |
| 56 | + |
| 57 | + /** |
| 58 | + * The kind of message destination |
| 59 | + * allowed values: queue, topic, |
| 60 | + * |
| 61 | + * @remarks |
| 62 | + * Required only if the message destination is either a queue or topic. |
| 63 | + */ |
| 64 | + MESSAGING_PROTOCOL: 'messaging.protocol', |
| 65 | + |
| 66 | + /** |
| 67 | + * The version of the transport protocol. |
| 68 | + * |
| 69 | + * @remarks |
| 70 | + * Optional. |
| 71 | + */ |
| 72 | + MESSAGING_PROTOCOL_VERSION: 'messaging.protocol_version', |
| 73 | + |
| 74 | + /** |
| 75 | + * Connection string. |
| 76 | + * example: https://queue.amazonaws.com/80398EXAMPLE/MyQueue |
| 77 | + * |
| 78 | + * @remarks |
| 79 | + * Optional. |
| 80 | + */ |
| 81 | + MESSAGING_URL: 'messaging.url', |
| 82 | + |
| 83 | + /** |
| 84 | + * A value used by the messaging system as an identifier for the message, represented as a string. |
| 85 | + * |
| 86 | + * @remarks |
| 87 | + * Optional. |
| 88 | + */ |
| 89 | + MESSAGING_MESSAGE_ID: 'messaging.message_id', |
| 90 | + |
| 91 | + /** |
| 92 | + * The conversation ID identifying the conversation to which the message belongs, represented as a string. Sometimes called "Correlation ID". |
| 93 | + * |
| 94 | + * @remarks |
| 95 | + * Optional. |
| 96 | + */ |
| 97 | + MESSAGING_CONVERSATION_ID: 'messaging.conversation_id', |
| 98 | + |
| 99 | + /** |
| 100 | + * 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. |
| 101 | + * Should be number. |
| 102 | + * |
| 103 | + * @remarks |
| 104 | + * Optional. |
| 105 | + */ |
| 106 | + MESSAGING_MESSAGE_PAYLOAD_SIZE_BYTES: 'messaging.message_payload_size_bytes', |
| 107 | + |
| 108 | + /** |
| 109 | + * The compressed size of the message payload in bytes. |
| 110 | + * Should be number. |
| 111 | + * |
| 112 | + * @remarks |
| 113 | + * Optional. |
| 114 | + */ |
| 115 | + MESSAGING_MESSAGE_PAYLOAD_COMPRESSED_SIZE_BYTES: |
| 116 | + 'messaging.message_payload_compressed_size_bytes', |
| 117 | + |
| 118 | + /** |
| 119 | + * For message consumers only. |
| 120 | + * allowed values: receive, process, |
| 121 | + * |
| 122 | + * @remarks |
| 123 | + * Optional. |
| 124 | + */ |
| 125 | + MESSAGING_OPERATION: 'messaging.operation', |
| 126 | + |
| 127 | + // System specific attributes |
| 128 | + MESSAGING_RABBITMQ_ROUTING_KEY: 'messaging.rabbitmq.routing_key', |
| 129 | + MESSAGING_KAFKA_MESSAGE_KEY: 'messaging.kafka.message_key', |
| 130 | + MESSAGING_KAFKA_CONSUMER_GROUP: 'messaging.kafka.consumer_group', |
| 131 | + MESSAGING_KAFKA_CLIENT_ID: 'messaging.kafka.client_id', |
| 132 | + MESSAGING_KAFKA_PARTITION: 'messaging.kafka.partition', |
| 133 | + MESSAGING_KAFKA_TOMBSTONE: 'messaging.kafka.tombstone', |
| 134 | +}; |
| 135 | + |
| 136 | +export const MessagingOperationName = { |
| 137 | + /** |
| 138 | + * A message is sent to a destination by a message producer/client. |
| 139 | + */ |
| 140 | + SEND: 'send', |
| 141 | + |
| 142 | + /** |
| 143 | + * A message is received from a destination by a message consumer/server. |
| 144 | + */ |
| 145 | + RECEIVE: 'receive', |
| 146 | + |
| 147 | + /** |
| 148 | + * A message that was previously received from a destination is processed by a message consumer/server. |
| 149 | + */ |
| 150 | + PROCESS: 'process', |
| 151 | +}; |
0 commit comments