forked from open-telemetry/opentelemetry-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfeature_flag_attributes.py
More file actions
134 lines (115 loc) · 5.17 KB
/
feature_flag_attributes.py
File metadata and controls
134 lines (115 loc) · 5.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
# Copyright The OpenTelemetry Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from enum import Enum
from typing import Final
from typing_extensions import deprecated
FEATURE_FLAG_CONTEXT_ID: Final = "feature_flag.context.id"
"""
The unique identifier for the flag evaluation context. For example, the targeting key.
"""
FEATURE_FLAG_ERROR_MESSAGE: Final = "feature_flag.error.message"
"""
A message providing more detail about an error that occurred during feature flag evaluation in human-readable form.
"""
FEATURE_FLAG_EVALUATION_ERROR_MESSAGE: Final = (
"feature_flag.evaluation.error.message"
)
"""
Deprecated: Replaced by `feature_flag.error.message`.
"""
FEATURE_FLAG_EVALUATION_REASON: Final = "feature_flag.evaluation.reason"
"""
Deprecated: Replaced by `feature_flag.result.reason`.
"""
FEATURE_FLAG_KEY: Final = "feature_flag.key"
"""
The lookup key of the feature flag.
"""
FEATURE_FLAG_PROVIDER_NAME: Final = "feature_flag.provider.name"
"""
Identifies the feature flag provider.
"""
FEATURE_FLAG_RESULT_REASON: Final = "feature_flag.result.reason"
"""
The reason code which shows how a feature flag value was determined.
"""
FEATURE_FLAG_RESULT_VALUE: Final = "feature_flag.result.value"
"""
The evaluated value of the feature flag.
Note: With some feature flag providers, feature flag results can be quite large or contain private or sensitive details.
Because of this, `feature_flag.result.variant` is often the preferred attribute if it is available.
It may be desirable to redact or otherwise limit the size and scope of `feature_flag.result.value` if possible.
Because the evaluated flag value is unstructured and may be any type, it is left to the instrumentation author to determine how best to achieve this.
"""
FEATURE_FLAG_RESULT_VARIANT: Final = "feature_flag.result.variant"
"""
A semantic identifier for an evaluated flag value.
Note: A semantic identifier, commonly referred to as a variant, provides a means
for referring to a value without including the value itself. This can
provide additional context for understanding the meaning behind a value.
For example, the variant `red` maybe be used for the value `#c05543`.
"""
FEATURE_FLAG_SET_ID: Final = "feature_flag.set.id"
"""
The identifier of the [flag set](https://openfeature.dev/specification/glossary/#flag-set) to which the feature flag belongs.
"""
FEATURE_FLAG_VARIANT: Final = "feature_flag.variant"
"""
Deprecated: Replaced by `feature_flag.result.variant`.
"""
FEATURE_FLAG_VERSION: Final = "feature_flag.version"
"""
The version of the ruleset used during the evaluation. This may be any stable value which uniquely identifies the ruleset.
"""
@deprecated(
"The attribute feature_flag.evaluation.reason is deprecated - Replaced by `feature_flag.result.reason`"
)
class FeatureFlagEvaluationReasonValues(Enum):
STATIC = "static"
"""The resolved value is static (no dynamic evaluation)."""
DEFAULT = "default"
"""The resolved value fell back to a pre-configured value (no dynamic evaluation occurred or dynamic evaluation yielded no result)."""
TARGETING_MATCH = "targeting_match"
"""The resolved value was the result of a dynamic evaluation, such as a rule or specific user-targeting."""
SPLIT = "split"
"""The resolved value was the result of pseudorandom assignment."""
CACHED = "cached"
"""The resolved value was retrieved from cache."""
DISABLED = "disabled"
"""The resolved value was the result of the flag being disabled in the management system."""
UNKNOWN = "unknown"
"""The reason for the resolved value could not be determined."""
STALE = "stale"
"""The resolved value is non-authoritative or possibly out of date."""
ERROR = "error"
"""The resolved value was the result of an error."""
class FeatureFlagResultReasonValues(Enum):
STATIC = "static"
"""The resolved value is static (no dynamic evaluation)."""
DEFAULT = "default"
"""The resolved value fell back to a pre-configured value (no dynamic evaluation occurred or dynamic evaluation yielded no result)."""
TARGETING_MATCH = "targeting_match"
"""The resolved value was the result of a dynamic evaluation, such as a rule or specific user-targeting."""
SPLIT = "split"
"""The resolved value was the result of pseudorandom assignment."""
CACHED = "cached"
"""The resolved value was retrieved from cache."""
DISABLED = "disabled"
"""The resolved value was the result of the flag being disabled in the management system."""
UNKNOWN = "unknown"
"""The reason for the resolved value could not be determined."""
STALE = "stale"
"""The resolved value is non-authoritative or possibly out of date."""
ERROR = "error"
"""The resolved value was the result of an error."""