Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add resource detectors to product catalog service #677

Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -180,3 +180,5 @@ significant modifications will be credited to OpenTelemetry Authors.
([#669](https://github.com/open-telemetry/opentelemetry-demo/pull/669))
* Add resource detectors to accounting service
([#676](https://github.com/open-telemetry/opentelemetry-demo/pull/676))
* Add resource detectors to product catalog service
([#677](https://github.com/open-telemetry/opentelemetry-demo/pull/677))
5 changes: 4 additions & 1 deletion docs/services/productcatalogservice.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@ func initTracerProvider() *sdktrace.TracerProvider {
if err != nil {
log.Fatalf("OTLP Trace gRPC Creation: %v", err)
}
tp := sdktrace.NewTracerProvider(sdktrace.WithBatcher(exporter))
tp := sdktrace.NewTracerProvider(
sdktrace.WithBatcher(exporter),
sdktrace.WithResource(initResource()),
)
otel.SetTracerProvider(tp)
otel.SetTextMapPropagator(propagation.NewCompositeTextMapPropagator(propagation.TraceContext{}, propagation.Baggage{}))
return tp
Expand Down
6 changes: 3 additions & 3 deletions src/productcatalogservice/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

FROM golang:1.17.7-alpine AS builder
FROM golang:1.19.2-alpine AS builder

WORKDIR /usr/src/app/

Expand All @@ -23,8 +23,8 @@ COPY ./src/productcatalogservice/ ./
COPY ./pb/ ./proto/

RUN go mod download
RUN go get google.golang.org/protobuf/cmd/protoc-gen-go
RUN go get google.golang.org/grpc/cmd/protoc-gen-go-grpc
RUN go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.28
RUN go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1.2

# Build executable
RUN protoc -I ./proto/ ./proto/demo.proto --go_out=./ --go-grpc_out=./
Expand Down
38 changes: 20 additions & 18 deletions src/productcatalogservice/go.mod
Original file line number Diff line number Diff line change
@@ -1,36 +1,38 @@
module github.com/opentelemetry/opentelemetry-demo/src/productcatalogservice

go 1.17
go 1.19

require (
github.com/golang/protobuf v1.5.2 // indirect
github.com/google/go-cmp v0.5.7
github.com/google/go-cmp v0.5.9
github.com/sirupsen/logrus v1.8.1
golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd // indirect
google.golang.org/grpc v1.44.0
golang.org/x/net v0.5.0 // indirect
google.golang.org/grpc v1.51.0
)

require (
go.opentelemetry.io/otel/sdk v1.4.1
google.golang.org/protobuf v1.27.1
go.opentelemetry.io/otel/sdk v1.11.2
google.golang.org/protobuf v1.28.1
)

require (
github.com/cenkalti/backoff/v4 v4.1.2 // indirect
github.com/go-logr/logr v1.2.2 // indirect
github.com/cenkalti/backoff/v4 v4.2.0 // indirect
github.com/go-logr/logr v1.2.3 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/grpc-ecosystem/grpc-gateway v1.16.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.4.1 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.4.1 // indirect
go.opentelemetry.io/otel/trace v1.4.1 // indirect
go.opentelemetry.io/proto/otlp v0.12.0 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.15.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.11.2 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.11.2 // indirect
go.opentelemetry.io/otel/metric v0.34.0 // indirect
go.opentelemetry.io/otel/trace v1.11.2 // indirect
go.opentelemetry.io/proto/otlp v0.19.0 // indirect
)

require (
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.29.0
go.opentelemetry.io/otel v1.4.1
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.4.1
golang.org/x/sys v0.0.0-20220114195835-da31bd327af9 // indirect
golang.org/x/text v0.3.7 // indirect
google.golang.org/genproto v0.0.0-20220126215142-9970aeb2e350 // indirect
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.37.0
go.opentelemetry.io/otel v1.11.2
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.11.2
golang.org/x/sys v0.4.0 // indirect
golang.org/x/text v0.6.0 // indirect
google.golang.org/genproto v0.0.0-20230106154932-a12b697841d9 // indirect
)
Loading