diff --git a/CHANGELOG.md b/CHANGELOG.md index ee96a1cabf..c0e227fdfe 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ release. ## Unreleased +* [currencyservice] bring back multistage build + ([#1276](https://github.com/open-telemetry/opentelemetry-demo/pull/1276)) +* [currencyservice]: update opentelemetry-cpp to 1.12.0 + ([#1275](https://github.com/open-telemetry/opentelemetry-demo/pull/1275)) * update loadgenerator dependencies and the base image ([#1274](https://github.com/open-telemetry/opentelemetry-demo/pull/1274)) * add env var for pinning trace-based test tool version @@ -15,6 +19,8 @@ release. ([#1237](https://github.com/open-telemetry/opentelemetry-demo/pull/1237)) * update PHP quoteservice to use 1.0.0 ([#1236](https://github.com/open-telemetry/opentelemetry-demo/pull/1236)) +* [cartservice] Add .NET memory, CPU, and thread metrics + ([#1265](https://github.com/open-telemetry/opentelemetry-demo/pull/1265)) * enable browser traffic in loadgenerator using playwright ([#1266](https://github.com/open-telemetry/opentelemetry-demo/pull/1266)) ## 1.6.0 diff --git a/src/cartservice/src/Program.cs b/src/cartservice/src/Program.cs index 6c7c612391..3a50e9be71 100644 --- a/src/cartservice/src/Program.cs +++ b/src/cartservice/src/Program.cs @@ -59,6 +59,7 @@ .AddHttpClientInstrumentation() .AddOtlpExporter()) .WithMetrics(meterBuilder => meterBuilder + .AddProcessInstrumentation() .AddRuntimeInstrumentation() .AddAspNetCoreInstrumentation() .AddOtlpExporter()); diff --git a/src/cartservice/src/cartservice.csproj b/src/cartservice/src/cartservice.csproj index 3f9e98e27b..0274442663 100644 --- a/src/cartservice/src/cartservice.csproj +++ b/src/cartservice/src/cartservice.csproj @@ -7,13 +7,14 @@ - - + + + diff --git a/src/cartservice/tests/cartservice.tests.csproj b/src/cartservice/tests/cartservice.tests.csproj index 7f68649279..53f364e5a8 100644 --- a/src/cartservice/tests/cartservice.tests.csproj +++ b/src/cartservice/tests/cartservice.tests.csproj @@ -5,9 +5,9 @@ - + - + all diff --git a/src/checkoutservice/main.go b/src/checkoutservice/main.go index 847514b352..1b427882c6 100644 --- a/src/checkoutservice/main.go +++ b/src/checkoutservice/main.go @@ -181,8 +181,7 @@ func main() { } var srv = grpc.NewServer( - grpc.UnaryInterceptor(otelgrpc.UnaryServerInterceptor()), - grpc.StreamInterceptor(otelgrpc.StreamServerInterceptor()), + grpc.StatsHandler(otelgrpc.NewServerHandler()), ) pb.RegisterCheckoutServiceServer(srv, svc) healthpb.RegisterHealthServer(srv, svc) @@ -343,8 +342,7 @@ func (cs *checkoutService) prepareOrderItemsAndShippingQuoteFromCart(ctx context func createClient(ctx context.Context, svcAddr string) (*grpc.ClientConn, error) { return grpc.DialContext(ctx, svcAddr, grpc.WithTransportCredentials(insecure.NewCredentials()), - grpc.WithUnaryInterceptor(otelgrpc.UnaryClientInterceptor()), - grpc.WithStreamInterceptor(otelgrpc.StreamClientInterceptor()), + grpc.WithStatsHandler(otelgrpc.NewClientHandler()), ) } diff --git a/src/currencyservice/Dockerfile b/src/currencyservice/Dockerfile index bb5b998221..3f470fad9c 100644 --- a/src/currencyservice/Dockerfile +++ b/src/currencyservice/Dockerfile @@ -14,22 +14,21 @@ # See the License for the specific language governing permissions and # limitations under the License. -FROM alpine +FROM alpine as builder -RUN apk update -RUN apk add git cmake make g++ grpc-dev re2-dev protobuf-dev c-ares-dev +RUN apk update && apk add git cmake make g++ grpc-dev protobuf-dev -ARG OPENTELEMETRY_CPP_VERSION=1.10.0 +ARG OPENTELEMETRY_CPP_VERSION=1.12.0 RUN git clone https://github.com/open-telemetry/opentelemetry-cpp \ - && cd opentelemetry-cpp/ \ - && git checkout tags/v${OPENTELEMETRY_CPP_VERSION} -b v${OPENTELEMETRY_CPP_VERSION} \ - && mkdir build \ - && cd build \ - && cmake .. -DCMAKE_CXX_STANDARD=17 -DCMAKE_POSITION_INDEPENDENT_CODE=ON \ - -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=OFF \ - -DWITH_EXAMPLES=OFF -DWITH_OTLP_GRPC=ON \ - && make -j$(nproc || sysctl -n hw.ncpu || echo 1) install && cd ../.. && rm -rf opentelemetry-cpp + && cd opentelemetry-cpp/ \ + && git checkout tags/v${OPENTELEMETRY_CPP_VERSION} -b v${OPENTELEMETRY_CPP_VERSION} \ + && mkdir build \ + && cd build \ + && cmake .. -DCMAKE_CXX_STANDARD=17 -DCMAKE_POSITION_INDEPENDENT_CODE=ON \ + -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=OFF \ + -DWITH_EXAMPLES=OFF -DWITH_OTLP_GRPC=ON \ + && make -j$(nproc || sysctl -n hw.ncpu || echo 1) install && cd ../.. COPY . /currencyservice @@ -38,5 +37,11 @@ RUN cd /currencyservice \ && cmake .. \ && make -j$(nproc || sysctl -n hw.ncpu || echo 1) install + +FROM alpine as release + +RUN apk update && apk add grpc-dev protobuf-dev +COPY --from=builder /usr/local /usr/local + EXPOSE ${CURRENCY_SERVICE_PORT} ENTRYPOINT ./usr/local/bin/currencyservice ${CURRENCY_SERVICE_PORT} diff --git a/src/currencyservice/src/meter_common.h b/src/currencyservice/src/meter_common.h index 4deae86fa9..6167e9edfb 100644 --- a/src/currencyservice/src/meter_common.h +++ b/src/currencyservice/src/meter_common.h @@ -26,7 +26,7 @@ namespace otlp_exporter::OtlpGrpcMetricExporterOptions otlpOptions; // Configuration via environment variable not supported yet - otlpOptions.aggregation_temporality = metric_sdk::AggregationTemporality::kDelta; + otlpOptions.aggregation_temporality = otlp_exporter::PreferredAggregationTemporality::kDelta; auto exporter = otlp_exporter::OtlpGrpcMetricExporterFactory::Create(otlpOptions); // Build MeterProvider and Reader diff --git a/src/productcatalogservice/main.go b/src/productcatalogservice/main.go index a8bb74f5c4..4063c1869d 100644 --- a/src/productcatalogservice/main.go +++ b/src/productcatalogservice/main.go @@ -141,8 +141,7 @@ func main() { } srv := grpc.NewServer( - grpc.UnaryInterceptor(otelgrpc.UnaryServerInterceptor()), - grpc.StreamInterceptor(otelgrpc.StreamServerInterceptor()), + grpc.StatsHandler(otelgrpc.NewServerHandler()), ) reflection.Register(srv) @@ -278,7 +277,6 @@ func (p *productCatalog) checkProductFailure(ctx context.Context, id string) boo func createClient(ctx context.Context, svcAddr string) (*grpc.ClientConn, error) { return grpc.DialContext(ctx, svcAddr, grpc.WithTransportCredentials(insecure.NewCredentials()), - grpc.WithUnaryInterceptor(otelgrpc.UnaryClientInterceptor()), - grpc.WithStreamInterceptor(otelgrpc.StreamClientInterceptor()), + grpc.WithStatsHandler(otelgrpc.NewClientHandler()), ) }