Skip to content

Commit ae49b81

Browse files
committed
chore: clean
Signed-off-by: Lukas Reining <[email protected]>11 Signed-off-by: Lukas Reining <[email protected]>
1 parent 31574b3 commit ae49b81

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed

libs/hooks/open-telemetry/src/lib/otel-hook.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,7 @@ import type { Attributes } from '@opentelemetry/api';
55
type EvaluationEvent = { name: string; attributes: Attributes };
66
type TelemetryAttributesNames = [keyof typeof TelemetryAttribute][number] | string;
77

8-
export type AttributeMapper = (
9-
hookContext: HookContext,
10-
evaluationDetails?: EvaluationDetails<FlagValue>,
11-
) => Attributes;
8+
export type AttributeMapper = (hookContext: HookContext, evaluationDetails: EvaluationDetails<FlagValue>) => Attributes;
129

1310
export type EventMutator = (event: EvaluationEvent) => EvaluationEvent;
1411

@@ -56,7 +53,7 @@ export abstract class OpenTelemetryHook {
5653
protected safeEventMutator: EventMutator;
5754

5855
protected constructor(options?: OpenTelemetryHookOptions, logger?: Logger) {
59-
this.safeAttributeMapper = (hookContext: HookContext, evaluationDetails?: EvaluationDetails<FlagValue>) => {
56+
this.safeAttributeMapper = (hookContext: HookContext, evaluationDetails: EvaluationDetails<FlagValue>) => {
6057
try {
6158
return options?.attributeMapper?.(hookContext, evaluationDetails) || {};
6259
} catch (err) {

libs/hooks/open-telemetry/src/lib/traces/tracing-hook.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ describe('OpenTelemetry Hooks', () => {
134134
const hook: BaseHook = new EventHook({
135135
attributeMapper: (context, evalDetails) => ({
136136
key: context.context?.targetingKey,
137-
custom: evalDetails?.flagMetadata.foo,
137+
custom: evalDetails.flagMetadata.foo,
138138
}),
139139
});
140140
hook.before?.(hookContext);
@@ -251,7 +251,7 @@ describe('OpenTelemetry Hooks', () => {
251251
const hook: BaseHook = new SpanEventHook({
252252
attributeMapper: (context, evalDetails) => ({
253253
key: context.context?.targetingKey,
254-
custom: evalDetails?.flagMetadata.foo,
254+
custom: evalDetails.flagMetadata.foo,
255255
}),
256256
});
257257
const span = tracer.startSpan('test-span');
@@ -396,7 +396,7 @@ describe('OpenTelemetry Hooks', () => {
396396
const hook: BaseHook = new SpanHook({
397397
attributeMapper: (context, evalDetails) => ({
398398
key: context.context?.targetingKey,
399-
custom: evalDetails?.flagMetadata.foo,
399+
custom: evalDetails.flagMetadata.foo,
400400
}),
401401
});
402402

0 commit comments

Comments
 (0)