From d736bdcc0b42c2f97796af87ca2fd2dad5ba92e8 Mon Sep 17 00:00:00 2001 From: Jon Johnson <113393155+jonathanj-square@users.noreply.github.com> Date: Tue, 23 Jul 2024 17:12:50 -0700 Subject: [PATCH] feat: initializes otel metric collection for ftl dev and introduces a couple shared otel metric attributes (#2140) --- internal/observability/metrics/attributes.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 internal/observability/metrics/attributes.go diff --git a/internal/observability/metrics/attributes.go b/internal/observability/metrics/attributes.go new file mode 100644 index 0000000000..b254d35870 --- /dev/null +++ b/internal/observability/metrics/attributes.go @@ -0,0 +1,18 @@ +package metrics + +import ( + "github.com/TBD54566975/ftl/backend/schema" + "go.opentelemetry.io/otel/attribute" +) + +// ModuleNameAttribute identifies the name of the module that the associated +// metric originates from. +func ModuleNameAttribute(name string) attribute.KeyValue { + return attribute.String("ftl.module.name", name) +} + +// VerbRefAttribute identifies the verb that the associated metric originates +// from. The entire module qualified name is used: e.g. {module.verb} +func VerbRefAttribute(ref schema.Ref) attribute.KeyValue { + return attribute.String("ftl.verb.ref", ref.Name) +}