From b6e75ee44cc41bb8315e5e116cc1ac4807ef5e1d Mon Sep 17 00:00:00 2001 From: Cijo Thomas Date: Fri, 30 Sep 2022 09:23:37 -0700 Subject: [PATCH] [Cart] Added instrumentation for Asp.Net Core (http server) (#394) * Add runtime metrics to cartservice * reorder * Add http server metrics for cart service * update doc * bump version * Update src/cartservice/src/cartstore/RedisCartStore.cs Co-authored-by: Reiley Yang * Update src/cartservice/src/Startup.cs * Update src/cartservice/src/Startup.cs Co-authored-by: Reiley Yang --- docs/metric_service_features.md | 2 +- src/cartservice/src/Startup.cs | 7 ++++--- src/cartservice/src/cartservice.csproj | 2 +- src/cartservice/src/cartstore/RedisCartStore.cs | 2 +- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/docs/metric_service_features.md b/docs/metric_service_features.md index 4d7090fde1..baee69623d 100644 --- a/docs/metric_service_features.md +++ b/docs/metric_service_features.md @@ -9,7 +9,7 @@ Emoji Legend | Service | Language | Instrumentation Libraries | Manual Metric Creation | Collector Agent Metric Transformation | Push Metrics | SLO Metrics | Multiple Manual Metric Instruments | |-----------------|-----------------|---------------------------|------------------------|---------------------------------------|----------------|----------------|------------------------------------| | Ad | Java | :construction: | :construction: | :construction: | :construction: | :construction: | :construction: | -| Cart | .NET | :construction: | :construction: | :construction: | :construction: | :construction: | :construction: | +| Cart | .NET | :100: | :construction: | :construction: | :construction: | :construction: | :construction: | | Checkout | Go | :construction: | :construction: | :construction: | :construction: | :construction: | :construction: | | Currency | C++ | :construction: | :construction: | :construction: | :construction: | :construction: | :construction: | | Email | Ruby | :construction: | :construction: | :construction: | :construction: | :construction: | :construction: | diff --git a/src/cartservice/src/Startup.cs b/src/cartservice/src/Startup.cs index 6449897327..106d6007f9 100644 --- a/src/cartservice/src/Startup.cs +++ b/src/cartservice/src/Startup.cs @@ -50,9 +50,10 @@ public void ConfigureServices(IServiceCollection services) .AddHttpClientInstrumentation() .AddOtlpExporter()); - services.AddOpenTelemetryMetrics(builder => - builder.AddRuntimeInstrumentation() - .AddOtlpExporter()); + services.AddOpenTelemetryMetrics(builder => + builder.AddRuntimeInstrumentation() + .AddAspNetCoreInstrumentation() + .AddOtlpExporter()); services.AddGrpc(); services.AddGrpcHealthChecks() diff --git a/src/cartservice/src/cartservice.csproj b/src/cartservice/src/cartservice.csproj index 13e578df43..d95eb38944 100644 --- a/src/cartservice/src/cartservice.csproj +++ b/src/cartservice/src/cartservice.csproj @@ -8,7 +8,7 @@ - + diff --git a/src/cartservice/src/cartstore/RedisCartStore.cs b/src/cartservice/src/cartstore/RedisCartStore.cs index 66669c7fb6..4d9a047568 100644 --- a/src/cartservice/src/cartstore/RedisCartStore.cs +++ b/src/cartservice/src/cartstore/RedisCartStore.cs @@ -101,7 +101,7 @@ private void EnsureRedisConnected() redis.ConnectionRestored += (o, e) => { isRedisConnectionOpened = true; - Console.WriteLine("Connection to redis was retored successfully"); + Console.WriteLine("Connection to redis was restored successfully."); }; redis.ConnectionFailed += (o, e) => {