Skip to content

Commit 5c83fbf

Browse files
committed
Added WithContainer and WithSchemaURL options to resource
1 parent 3ab80f0 commit 5c83fbf

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

internal/grpcinject/opentelemetry.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ package grpcinject
1818

1919
import (
2020
"context"
21+
"errors"
22+
"log"
2123
"net"
2224
"strconv"
2325
"time"
@@ -35,8 +37,10 @@ func OpenTelemetry(config *config.Config, localAddr net.Addr, publicAddr string)
3537
resOptions := []resource.Option{
3638
resource.WithHost(),
3739
resource.WithOS(),
40+
resource.WithContainer(),
3841
resource.WithProcess(),
3942
resource.WithTelemetrySDK(),
43+
resource.WithSchemaURL(semconv.SchemaURL),
4044
resource.WithAttributes(semconv.ServiceName(config.OpenTelemetry.ServiceName)),
4145
}
4246

@@ -79,7 +83,9 @@ func OpenTelemetry(config *config.Config, localAddr net.Addr, publicAddr string)
7983
res, err := resource.New(ctx, resOptions...)
8084
cancel()
8185

82-
if err != nil {
86+
if errors.Is(err, resource.ErrPartialResource) || errors.Is(err, resource.ErrSchemaURLConflict) {
87+
log.Println(err)
88+
} else if err != nil {
8389
return err
8490
}
8591

0 commit comments

Comments
 (0)