20 lines
406 B
Go
20 lines
406 B
Go
package telemetry
|
|
|
|
import (
|
|
"go.opentelemetry.io/otel/sdk/resource"
|
|
semconv "go.opentelemetry.io/otel/semconv/v1.26.0"
|
|
)
|
|
|
|
func newResource(serviceName string) (*resource.Resource, error) {
|
|
otelResource, err := resource.Merge(resource.Default(),
|
|
resource.NewWithAttributes(semconv.SchemaURL,
|
|
semconv.ServiceName(serviceName),
|
|
))
|
|
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return otelResource, nil
|
|
}
|