generated from TBD54566975/tbd-project-template
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
initializes otel metric collection for ftl dev and introduces a coupl…
…e shared otel metric attributes
- Loading branch information
1 parent
48ea4a6
commit 4f2a0ff
Showing
2 changed files
with
24 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package metrics | ||
|
||
import ( | ||
"github.com/TBD54566975/ftl/backend/schema" | ||
"go.opentelemetry.io/otel/attribute" | ||
) | ||
|
||
// FeatureNameAttribute identifies the feature (e.g. verb) that the associated | ||
// metric originates from. The entire module qualified name is used: | ||
// e.g. {module.verb} | ||
func FeatureNameAttribute(ref schema.Ref) attribute.KeyValue { | ||
return attribute.String("ftl.feature.name", ref.Name) | ||
} | ||
|
||
// DestinationVerbAttribute identifies the target verb associated metric. This | ||
// attribute is relevant for metrics involving verb invocations. The entire | ||
// module qualified name is used: e.g. {module.verb} | ||
func DestinationVerbAttribute(ref schema.Ref) attribute.KeyValue { | ||
return attribute.String("ftl.dest.verb", ref.Name) | ||
} |