Skip to content

Commit a92cba0

Browse files
fix!: Remove error message from dimension (#496)
Signed-off-by: Kavindu Dodanduwa <[email protected]>
1 parent 48d3cdf commit a92cba0

File tree

4 files changed

+1
-10
lines changed

4 files changed

+1
-10
lines changed

hooks/open-telemetry/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ Below are the metrics extracted by this hook and dimensions they carry:
9797
|----------------------------------------|---------------------------------|--------------|----------------------------------------------------------|
9898
| feature_flag.evaluation_requests_total | Number of evaluation requests | {request} | key & provider name |
9999
| feature_flag.evaluation_success_total | Flag evaluation successes | {impression} | key, provider name, reason, variant & custom dimensions* |
100-
| feature_flag.evaluation_error_total | Flag evaluation errors | Counter | key, provider name, exception |
100+
| feature_flag.evaluation_error_total | Flag evaluation errors | Counter | key, provider name |
101101
| feature_flag.evaluation_active_count | Active flag evaluations counter | Counter | key |
102102

103103
Consider the following code example for usage,

hooks/open-telemetry/src/main/java/dev/openfeature/contrib/hooks/otel/MetricsHook.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
import java.util.Optional;
2020
import java.util.function.Function;
2121

22-
import static dev.openfeature.contrib.hooks.otel.OTelCommons.ERROR_KEY;
2322
import static dev.openfeature.contrib.hooks.otel.OTelCommons.REASON_KEY;
2423
import static dev.openfeature.contrib.hooks.otel.OTelCommons.flagKeyAttributeKey;
2524
import static dev.openfeature.contrib.hooks.otel.OTelCommons.providerNameAttributeKey;
@@ -122,14 +121,9 @@ public void after(HookContext ctx, FlagEvaluationDetails details, Map hints) {
122121
@Override
123122
public void error(HookContext ctx, Exception error, Map hints) {
124123
final AttributesBuilder attributesBuilder = Attributes.builder();
125-
126124
attributesBuilder.put(flagKeyAttributeKey, ctx.getFlagKey());
127125
attributesBuilder.put(providerNameAttributeKey, ctx.getProviderMetadata().getName());
128126

129-
if (error.getMessage() != null) {
130-
attributesBuilder.put(ERROR_KEY, error.getMessage());
131-
}
132-
133127
evaluationErrorCounter.add(+1, attributesBuilder.build());
134128
}
135129

hooks/open-telemetry/src/main/java/dev/openfeature/contrib/hooks/otel/OTelCommons.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,4 @@ class OTelCommons {
1414

1515
// Define non convention attribute keys
1616
static final String REASON_KEY = "reason";
17-
static final String ERROR_KEY = "exception";
1817
}

hooks/open-telemetry/src/test/java/dev/openfeature/contrib/hooks/otel/MetricsHookTest.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
import java.util.List;
1919
import java.util.Optional;
2020

21-
import static dev.openfeature.contrib.hooks.otel.OTelCommons.ERROR_KEY;
2221
import static dev.openfeature.contrib.hooks.otel.OTelCommons.REASON_KEY;
2322
import static dev.openfeature.contrib.hooks.otel.OTelCommons.flagKeyAttributeKey;
2423
import static dev.openfeature.contrib.hooks.otel.OTelCommons.providerNameAttributeKey;
@@ -173,7 +172,6 @@ public void error_stage_validation() {
173172

174173
assertThat(attributes.get(flagKeyAttributeKey)).isEqualTo("key");
175174
assertThat(attributes.get(providerNameAttributeKey)).isEqualTo("UnitTest");
176-
assertThat(attributes.get(AttributeKey.stringKey(ERROR_KEY))).isEqualTo("some_exception");
177175
}
178176

179177

0 commit comments

Comments
 (0)