Add missing resource attributes detectors

This commit is contained in:
Romain 2025-07-07 15:36:04 +02:00 committed by GitHub
parent 9862cd6780
commit 91331415ce
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 12 additions and 4 deletions

View File

@ -209,7 +209,11 @@ func newOpenTelemetryMeterProvider(ctx context.Context, config *types.OTLP) (*sd
res, err := resource.New(ctx,
resource.WithAttributes(semconv.ServiceNameKey.String(config.ServiceName)),
resource.WithAttributes(semconv.ServiceVersionKey.String(version.Version)),
resource.WithContainer(),
resource.WithFromEnv(),
resource.WithHost(),
resource.WithOS(),
resource.WithProcess(),
resource.WithTelemetrySDK(),
)
if err != nil {

View File

@ -189,10 +189,12 @@ func (o *OTelLog) NewLoggerProvider() (*otelsdk.LoggerProvider, error) {
res, err := resource.New(context.Background(),
resource.WithAttributes(attr...),
resource.WithContainer(),
resource.WithFromEnv(),
resource.WithHost(),
resource.WithOS(),
resource.WithProcess(),
resource.WithTelemetrySDK(),
resource.WithOSType(),
resource.WithProcessCommandArgs(),
)
if err != nil {
return nil, fmt.Errorf("building resource: %w", err)

View File

@ -61,10 +61,12 @@ func (c *OTelTracing) Setup(serviceName string, sampleRate float64, resourceAttr
res, err := resource.New(context.Background(),
resource.WithAttributes(attr...),
resource.WithContainer(),
resource.WithFromEnv(),
resource.WithHost(),
resource.WithOS(),
resource.WithProcess(),
resource.WithTelemetrySDK(),
resource.WithOSType(),
resource.WithProcessCommandArgs(),
)
if err != nil {
return nil, nil, fmt.Errorf("building resource: %w", err)