2022-07-18 10:42:32 +02:00
|
|
|
package otel
|
|
|
|
|
|
|
|
import (
|
|
|
|
"go.opentelemetry.io/otel/attribute"
|
|
|
|
"go.opentelemetry.io/otel/sdk/resource"
|
2023-04-06 08:29:55 +02:00
|
|
|
semconv "go.opentelemetry.io/otel/semconv/v1.17.0"
|
2022-07-18 10:42:32 +02:00
|
|
|
|
|
|
|
"github.com/zitadel/zitadel/cmd/build"
|
|
|
|
)
|
|
|
|
|
|
|
|
func ResourceWithService() (*resource.Resource, error) {
|
|
|
|
attributes := []attribute.KeyValue{
|
|
|
|
semconv.ServiceNameKey.String("ZITADEL"),
|
|
|
|
}
|
|
|
|
if build.Version() != "" {
|
|
|
|
attributes = append(attributes, semconv.ServiceVersionKey.String(build.Version()))
|
|
|
|
}
|
|
|
|
return resource.Merge(
|
|
|
|
resource.Default(),
|
2023-04-06 08:29:55 +02:00
|
|
|
resource.NewWithAttributes("", attributes...),
|
2022-07-18 10:42:32 +02:00
|
|
|
)
|
|
|
|
}
|