Skip to content

Commit

Permalink
fix(otelx): distinguish workspace and project API keys (#813)
Browse files Browse the repository at this point in the history
  • Loading branch information
zepatrik authored Sep 25, 2024
1 parent 3ac7fe8 commit 6220172
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions otelx/semconv/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ const (
AttributeKeyWorkspace AttributeKey = "WorkspaceID"
AttributeKeySubscriptionID AttributeKey = "SubscriptionID"
AttributeKeyProjectEnvironment AttributeKey = "ProjectEnvironment"
AttributeKeyAPIKeyID AttributeKey = "APIKeyID"
AttributeKeyWorkspaceAPIKeyID AttributeKey = "WorkspaceAPIKeyID"
AttributeKeyProjectAPIKeyID AttributeKey = "ProjectAPIKeyID"
)

func AttrIdentityID[V string | uuid.UUID](val V) otelattr.KeyValue {
Expand Down Expand Up @@ -76,8 +77,12 @@ func AttrGeoLocation(val httpx.GeoLocation) []otelattr.KeyValue {
return geoLocationAttributes
}

func AttrAPIKeyID[V string | uuid.UUID](val V) otelattr.KeyValue {
return otelattr.String(AttributeKeyAPIKeyID.String(), uuidOrString(val))
func AttrWorkspaceAPIKeyID[V string | uuid.UUID](val V) otelattr.KeyValue {
return otelattr.String(AttributeKeyWorkspaceAPIKeyID.String(), uuidOrString(val))
}

func AttrProjectAPIKeyID[V string | uuid.UUID](val V) otelattr.KeyValue {
return otelattr.String(AttributeKeyProjectAPIKeyID.String(), uuidOrString(val))
}

func uuidOrString[V string | uuid.UUID](val V) string {
Expand Down

0 comments on commit 6220172

Please sign in to comment.