diff --git a/observability.go b/observability.go index 0b3cedc..ffc1fea 100644 --- a/observability.go +++ b/observability.go @@ -124,7 +124,7 @@ func newLoggerProvider(ctx context.Context, config OtelConfig, serviceResource * return loggerProvider, nil } -func newServiceResource(ctx context.Context, name string) (*resource.Resource, error) { +func newServiceResource(ctx context.Context, hostData HostData) (*resource.Resource, error) { providerBinary, err := os.Executable() if err != nil { return nil, err @@ -132,8 +132,10 @@ func newServiceResource(ctx context.Context, name string) (*resource.Resource, e return resource.New(ctx, resource.WithAttributes( - semconv.ServiceNameKey.String(filepath.Base(providerBinary)), - semconv.ServiceInstanceIDKey.String(name), + semconv.ServiceNameKey.String(hostData.ProviderKey), + semconv.HostIDKey.String(hostData.HostID), + semconv.ServiceInstanceIDKey.String(hostData.InstanceID), + semconv.ProcessExecutableNameKey.String(filepath.Base(providerBinary)), ), ) } diff --git a/provider.go b/provider.go index 19418f3..2357578 100644 --- a/provider.go +++ b/provider.go @@ -120,7 +120,7 @@ func NewWithHostDataSource(source io.Reader, options ...ProviderHandler) (*Wasmc propagator := newPropagator() otel.SetTextMapPropagator(propagator) - serviceResource, err := newServiceResource(context.Background(), hostData.ProviderKey) + serviceResource, err := newServiceResource(context.Background(), hostData) if err != nil { return nil, err }