event.go 7.7 KB

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