event.go (7884B)
1 // Copyright The OpenTelemetry Authors 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 // Code generated from semantic convention specification. DO NOT EDIT. 16 17 package semconv // import "go.opentelemetry.io/otel/semconv/v1.17.0" 18 19 import "go.opentelemetry.io/otel/attribute" 20 21 // This semantic convention defines the attributes used to represent a feature 22 // flag evaluation as an event. 23 const ( 24 // FeatureFlagKeyKey is the attribute Key conforming to the 25 // "feature_flag.key" semantic conventions. It represents the unique 26 // identifier of the feature flag. 27 // 28 // Type: string 29 // RequirementLevel: Required 30 // Stability: stable 31 // Examples: 'logo-color' 32 FeatureFlagKeyKey = attribute.Key("feature_flag.key") 33 34 // FeatureFlagProviderNameKey is the attribute Key conforming to the 35 // "feature_flag.provider_name" semantic conventions. It represents the 36 // name of the service provider that performs the flag evaluation. 37 // 38 // Type: string 39 // RequirementLevel: Recommended 40 // Stability: stable 41 // Examples: 'Flag Manager' 42 FeatureFlagProviderNameKey = attribute.Key("feature_flag.provider_name") 43 44 // FeatureFlagVariantKey is the attribute Key conforming to the 45 // "feature_flag.variant" semantic conventions. It represents the sHOULD be 46 // a semantic identifier for a value. If one is unavailable, a stringified 47 // version of the value can be used. 48 // 49 // Type: string 50 // RequirementLevel: Recommended 51 // Stability: stable 52 // Examples: 'red', 'true', 'on' 53 // Note: A semantic identifier, commonly referred to as a variant, provides 54 // a means 55 // for referring to a value without including the value itself. This can 56 // provide additional context for understanding the meaning behind a value. 57 // For example, the variant `red` maybe be used for the value `#c05543`. 58 // 59 // A stringified version of the value can be used in situations where a 60 // semantic identifier is unavailable. String representation of the value 61 // should be determined by the implementer. 62 FeatureFlagVariantKey = attribute.Key("feature_flag.variant") 63 ) 64 65 // FeatureFlagKey returns an attribute KeyValue conforming to the 66 // "feature_flag.key" semantic conventions. It represents the unique identifier 67 // of the feature flag. 68 func FeatureFlagKey(val string) attribute.KeyValue { 69 return FeatureFlagKeyKey.String(val) 70 } 71 72 // FeatureFlagProviderName returns an attribute KeyValue conforming to the 73 // "feature_flag.provider_name" semantic conventions. It represents the name of 74 // the service provider that performs the flag evaluation. 75 func FeatureFlagProviderName(val string) attribute.KeyValue { 76 return FeatureFlagProviderNameKey.String(val) 77 } 78 79 // FeatureFlagVariant returns an attribute KeyValue conforming to the 80 // "feature_flag.variant" semantic conventions. It represents the sHOULD be a 81 // semantic identifier for a value. If one is unavailable, a stringified 82 // version of the value can be used. 83 func FeatureFlagVariant(val string) attribute.KeyValue { 84 return FeatureFlagVariantKey.String(val) 85 } 86 87 // RPC received/sent message. 88 const ( 89 // MessageTypeKey is the attribute Key conforming to the "message.type" 90 // semantic conventions. It represents the whether this is a received or 91 // sent message. 92 // 93 // Type: Enum 94 // RequirementLevel: Optional 95 // Stability: stable 96 MessageTypeKey = attribute.Key("message.type") 97 98 // MessageIDKey is the attribute Key conforming to the "message.id" 99 // semantic conventions. It represents the mUST be calculated as two 100 // different counters starting from `1` one for sent messages and one for 101 // received message. 102 // 103 // Type: int 104 // RequirementLevel: Optional 105 // Stability: stable 106 // Note: This way we guarantee that the values will be consistent between 107 // different implementations. 108 MessageIDKey = attribute.Key("message.id") 109 110 // MessageCompressedSizeKey is the attribute Key conforming to the 111 // "message.compressed_size" semantic conventions. It represents the 112 // compressed size of the message in bytes. 113 // 114 // Type: int 115 // RequirementLevel: Optional 116 // Stability: stable 117 MessageCompressedSizeKey = attribute.Key("message.compressed_size") 118 119 // MessageUncompressedSizeKey is the attribute Key conforming to the 120 // "message.uncompressed_size" semantic conventions. It represents the 121 // uncompressed size of the message in bytes. 122 // 123 // Type: int 124 // RequirementLevel: Optional 125 // Stability: stable 126 MessageUncompressedSizeKey = attribute.Key("message.uncompressed_size") 127 ) 128 129 var ( 130 // sent 131 MessageTypeSent = MessageTypeKey.String("SENT") 132 // received 133 MessageTypeReceived = MessageTypeKey.String("RECEIVED") 134 ) 135 136 // MessageID returns an attribute KeyValue conforming to the "message.id" 137 // semantic conventions. It represents the mUST be calculated as two different 138 // counters starting from `1` one for sent messages and one for received 139 // message. 140 func MessageID(val int) attribute.KeyValue { 141 return MessageIDKey.Int(val) 142 } 143 144 // MessageCompressedSize returns an attribute KeyValue conforming to the 145 // "message.compressed_size" semantic conventions. It represents the compressed 146 // size of the message in bytes. 147 func MessageCompressedSize(val int) attribute.KeyValue { 148 return MessageCompressedSizeKey.Int(val) 149 } 150 151 // MessageUncompressedSize returns an attribute KeyValue conforming to the 152 // "message.uncompressed_size" semantic conventions. It represents the 153 // uncompressed size of the message in bytes. 154 func MessageUncompressedSize(val int) attribute.KeyValue { 155 return MessageUncompressedSizeKey.Int(val) 156 } 157 158 // The attributes used to report a single exception associated with a span. 159 const ( 160 // ExceptionEscapedKey is the attribute Key conforming to the 161 // "exception.escaped" semantic conventions. It represents the sHOULD be 162 // set to true if the exception event is recorded at a point where it is 163 // known that the exception is escaping the scope of the span. 164 // 165 // Type: boolean 166 // RequirementLevel: Optional 167 // Stability: stable 168 // Note: An exception is considered to have escaped (or left) the scope of 169 // a span, 170 // if that span is ended while the exception is still logically "in 171 // flight". 172 // This may be actually "in flight" in some languages (e.g. if the 173 // exception 174 // is passed to a Context manager's `__exit__` method in Python) but will 175 // usually be caught at the point of recording the exception in most 176 // languages. 177 // 178 // It is usually not possible to determine at the point where an exception 179 // is thrown 180 // whether it will escape the scope of a span. 181 // However, it is trivial to know that an exception 182 // will escape, if one checks for an active exception just before ending 183 // the span, 184 // as done in the [example above](#recording-an-exception). 185 // 186 // It follows that an exception may still escape the scope of the span 187 // even if the `exception.escaped` attribute was not set or set to false, 188 // since the event might have been recorded at a time where it was not 189 // clear whether the exception will escape. 190 ExceptionEscapedKey = attribute.Key("exception.escaped") 191 ) 192 193 // ExceptionEscaped returns an attribute KeyValue conforming to the 194 // "exception.escaped" semantic conventions. It represents the sHOULD be set to 195 // true if the exception event is recorded at a point where it is known that 196 // the exception is escaping the scope of the span. 197 func ExceptionEscaped(val bool) attribute.KeyValue { 198 return ExceptionEscapedKey.Bool(val) 199 }