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