Skip to content

Commit

Permalink
chore(analytics): better error messaging
Browse files Browse the repository at this point in the history
  • Loading branch information
yquansah committed Feb 2, 2024
1 parent b708a23 commit 6b3cbec
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions internal/server/analytics/sink.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"go.uber.org/zap"
)

var errorNotFound = errors.New("event not found")
var errNotTransformable = errors.New("event not transformable into evaluation response")

type AnalyticsStoreMutator interface {
IncrementFlagEvaluationCounts(ctx context.Context, responses []*EvaluationResponse) error
Expand Down Expand Up @@ -54,7 +54,7 @@ func transformSpanEventToEvaluationResponse(event sdktrace.Event) (*EvaluationRe
}
}

return nil, errorNotFound
return nil, errNotTransformable
}

// ExportSpans transforms the spans into []*EvaluationResponse which the mutator takes to store into an analytics store.
Expand All @@ -64,7 +64,7 @@ func (a *AnalyticsSinkSpanExporter) ExportSpans(ctx context.Context, spans []sdk
for _, span := range spans {
for _, event := range span.Events() {
evaluationResponse, err := transformSpanEventToEvaluationResponse(event)
if err != nil && !errors.Is(err, errorNotFound) {
if err != nil && !errors.Is(err, errNotTransformable) {
a.logger.Error("event not decodable into evaluation response", zap.Error(err))
continue
}
Expand Down

0 comments on commit 6b3cbec

Please sign in to comment.