Skip to content

Commit

Permalink
feat: add depreacted event (#812)
Browse files Browse the repository at this point in the history
  • Loading branch information
aeneasr authored Sep 25, 2024
1 parent 6220172 commit b4941ae
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions otelx/semconv/deprecated.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// Copyright © 2024 Ory Corp
// SPDX-License-Identifier: Apache-2.0

package semconv

import (
"context"

otelattr "go.opentelemetry.io/otel/attribute"
"go.opentelemetry.io/otel/trace"
)

func NewDeprecatedFeatureUsedEvent(ctx context.Context, deprecatedCodeFeatureID string) (string, trace.EventOption) {
return DeprecatedFeatureUsed.String(),
trace.WithAttributes(
append(
AttributesFromContext(ctx),
AttrDeprecatedFeatureID(deprecatedCodeFeatureID),
)...,
)
}

const (
AttributeKeyDeprecatedCodePathIDAttributeKey AttributeKey = "DeprecatedFeatureID"
DeprecatedFeatureUsed Event = "DeprecatedFeatureUsed"
)

func AttrDeprecatedFeatureID(id string) otelattr.KeyValue {
return otelattr.String(AttributeKeyDeprecatedCodePathIDAttributeKey.String(), id)
}

0 comments on commit b4941ae

Please sign in to comment.