From 1bed7968f2dfe494cbed154eaaf648b578ed13be Mon Sep 17 00:00:00 2001 From: Cijo Thomas Date: Thu, 29 Sep 2022 15:08:17 -0700 Subject: [PATCH 1/8] Add runtime metrics to cartservice --- src/cartservice/src/Startup.cs | 5 +++++ src/cartservice/src/cartservice.csproj | 1 + 2 files changed, 6 insertions(+) diff --git a/src/cartservice/src/Startup.cs b/src/cartservice/src/Startup.cs index bafff3e2d9..4e87686916 100644 --- a/src/cartservice/src/Startup.cs +++ b/src/cartservice/src/Startup.cs @@ -9,6 +9,7 @@ using cartservice.cartstore; using cartservice.services; using OpenTelemetry.Trace; +using OpenTelemetry.Metrics; namespace cartservice; @@ -49,6 +50,10 @@ public void ConfigureServices(IServiceCollection services) .AddHttpClientInstrumentation() .AddOtlpExporter()); + services.AddOpenTelemetryMetrics(builder => + builder.AddRuntimeInstrumentation() + .AddOtlpExporter()); + services.AddGrpc(); services.AddGrpcHealthChecks() .AddCheck("Sample", () => HealthCheckResult.Healthy()); diff --git a/src/cartservice/src/cartservice.csproj b/src/cartservice/src/cartservice.csproj index 33ba96d038..13e578df43 100644 --- a/src/cartservice/src/cartservice.csproj +++ b/src/cartservice/src/cartservice.csproj @@ -14,6 +14,7 @@ + From e51e249273988dc2f0be0150ddae93f96183bcda Mon Sep 17 00:00:00 2001 From: Cijo Thomas Date: Thu, 29 Sep 2022 16:16:20 -0700 Subject: [PATCH 2/8] reorder --- src/cartservice/src/Startup.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cartservice/src/Startup.cs b/src/cartservice/src/Startup.cs index 4e87686916..6449897327 100644 --- a/src/cartservice/src/Startup.cs +++ b/src/cartservice/src/Startup.cs @@ -8,8 +8,8 @@ using Microsoft.Extensions.Hosting; using cartservice.cartstore; using cartservice.services; -using OpenTelemetry.Trace; using OpenTelemetry.Metrics; +using OpenTelemetry.Trace; namespace cartservice; From bacf6f325ac2931f484613418132f54780d4fa0e Mon Sep 17 00:00:00 2001 From: Cijo Thomas Date: Thu, 29 Sep 2022 17:34:08 -0700 Subject: [PATCH 3/8] Add http server metrics for cart service --- src/cartservice/src/Startup.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/cartservice/src/Startup.cs b/src/cartservice/src/Startup.cs index 6449897327..c5bcd61334 100644 --- a/src/cartservice/src/Startup.cs +++ b/src/cartservice/src/Startup.cs @@ -52,6 +52,7 @@ public void ConfigureServices(IServiceCollection services) services.AddOpenTelemetryMetrics(builder => builder.AddRuntimeInstrumentation() + .AddAspNetCoreInstrumentation() .AddOtlpExporter()); services.AddGrpc(); From da60f05bdd13b4e12156fb5af9e148ba3668004a Mon Sep 17 00:00:00 2001 From: Cijo Thomas Date: Thu, 29 Sep 2022 17:36:39 -0700 Subject: [PATCH 4/8] update doc --- docs/metric_service_features.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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: | From 159f5c761c56be1a29063470bf9edaf19079fa92 Mon Sep 17 00:00:00 2001 From: Cijo Thomas Date: Thu, 29 Sep 2022 17:39:33 -0700 Subject: [PATCH 5/8] bump version --- src/cartservice/src/Startup.cs | 8 ++++---- src/cartservice/src/cartservice.csproj | 2 +- src/cartservice/src/cartstore/RedisCartStore.cs | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/cartservice/src/Startup.cs b/src/cartservice/src/Startup.cs index c5bcd61334..130e034dbf 100644 --- a/src/cartservice/src/Startup.cs +++ b/src/cartservice/src/Startup.cs @@ -50,10 +50,10 @@ public void ConfigureServices(IServiceCollection services) .AddHttpClientInstrumentation() .AddOtlpExporter()); - services.AddOpenTelemetryMetrics(builder => - builder.AddRuntimeInstrumentation() - .AddAspNetCoreInstrumentation() - .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..f45c0bc926 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) => { From 6a8f76427da840ca83510d58271a5c02165afa4f Mon Sep 17 00:00:00 2001 From: Cijo Thomas Date: Fri, 30 Sep 2022 00:09:33 -0400 Subject: [PATCH 6/8] Update src/cartservice/src/cartstore/RedisCartStore.cs Co-authored-by: Reiley Yang --- src/cartservice/src/cartstore/RedisCartStore.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cartservice/src/cartstore/RedisCartStore.cs b/src/cartservice/src/cartstore/RedisCartStore.cs index f45c0bc926..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 restored successfully"); + Console.WriteLine("Connection to redis was restored successfully."); }; redis.ConnectionFailed += (o, e) => { From b68eac7f3e245861ab4a21ab94ebcbe7e70e17cf Mon Sep 17 00:00:00 2001 From: Cijo Thomas Date: Fri, 30 Sep 2022 00:10:12 -0400 Subject: [PATCH 7/8] Update src/cartservice/src/Startup.cs --- src/cartservice/src/Startup.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cartservice/src/Startup.cs b/src/cartservice/src/Startup.cs index 130e034dbf..73dbc58dd9 100644 --- a/src/cartservice/src/Startup.cs +++ b/src/cartservice/src/Startup.cs @@ -52,7 +52,7 @@ public void ConfigureServices(IServiceCollection services) services.AddOpenTelemetryMetrics(builder => builder.AddRuntimeInstrumentation() - .AddAspNetCoreInstrumentation() + .AddAspNetCoreInstrumentation() .AddOtlpExporter()); services.AddGrpc(); From 7488f819b2c7b155a6522de60b3fad5043ab6c7d Mon Sep 17 00:00:00 2001 From: Cijo Thomas Date: Fri, 30 Sep 2022 00:10:50 -0400 Subject: [PATCH 8/8] Update src/cartservice/src/Startup.cs --- src/cartservice/src/Startup.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cartservice/src/Startup.cs b/src/cartservice/src/Startup.cs index 73dbc58dd9..106d6007f9 100644 --- a/src/cartservice/src/Startup.cs +++ b/src/cartservice/src/Startup.cs @@ -53,7 +53,7 @@ public void ConfigureServices(IServiceCollection services) services.AddOpenTelemetryMetrics(builder => builder.AddRuntimeInstrumentation() .AddAspNetCoreInstrumentation() - .AddOtlpExporter()); + .AddOtlpExporter()); services.AddGrpc(); services.AddGrpcHealthChecks()