Skip to content

Commit b6e75ee

Browse files
cijothomasreyang
andauthored
[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 <[email protected]> * Update src/cartservice/src/Startup.cs * Update src/cartservice/src/Startup.cs Co-authored-by: Reiley Yang <[email protected]>
1 parent 6d9b7ce commit b6e75ee

File tree

4 files changed

+7
-6
lines changed

4 files changed

+7
-6
lines changed

docs/metric_service_features.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Emoji Legend
99
| Service | Language | Instrumentation Libraries | Manual Metric Creation | Collector Agent Metric Transformation | Push Metrics | SLO Metrics | Multiple Manual Metric Instruments |
1010
|-----------------|-----------------|---------------------------|------------------------|---------------------------------------|----------------|----------------|------------------------------------|
1111
| Ad | Java | :construction: | :construction: | :construction: | :construction: | :construction: | :construction: |
12-
| Cart | .NET | :construction: | :construction: | :construction: | :construction: | :construction: | :construction: |
12+
| Cart | .NET | :100: | :construction: | :construction: | :construction: | :construction: | :construction: |
1313
| Checkout | Go | :construction: | :construction: | :construction: | :construction: | :construction: | :construction: |
1414
| Currency | C++ | :construction: | :construction: | :construction: | :construction: | :construction: | :construction: |
1515
| Email | Ruby | :construction: | :construction: | :construction: | :construction: | :construction: | :construction: |

src/cartservice/src/Startup.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,10 @@ public void ConfigureServices(IServiceCollection services)
5050
.AddHttpClientInstrumentation()
5151
.AddOtlpExporter());
5252

53-
services.AddOpenTelemetryMetrics(builder =>
54-
builder.AddRuntimeInstrumentation()
55-
.AddOtlpExporter());
53+
services.AddOpenTelemetryMetrics(builder =>
54+
builder.AddRuntimeInstrumentation()
55+
.AddAspNetCoreInstrumentation()
56+
.AddOtlpExporter());
5657

5758
services.AddGrpc();
5859
services.AddGrpcHealthChecks()

src/cartservice/src/cartservice.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<PackageReference Include="Grpc.AspNetCore" Version="2.44.0" />
99
<PackageReference Include="Grpc.AspNetCore.HealthChecks" Version="2.46.0" />
1010
<PackageReference Include="StackExchange.Redis" Version="2.5.43" />
11-
<PackageReference Include="OpenTelemetry.Exporter.OpenTelemetryProtocol" Version="1.3.0" />
11+
<PackageReference Include="OpenTelemetry.Exporter.OpenTelemetryProtocol" Version="1.3.1" />
1212
<PackageReference Include="OpenTelemetry.Extensions.Hosting" Version="1.0.0-rc9.4" />
1313
<PackageReference Include="OpenTelemetry.Instrumentation.AspNetCore" Version="1.0.0-rc9.4" />
1414
<PackageReference Include="OpenTelemetry.Instrumentation.GrpcNetClient" Version="1.0.0-rc9.4" />

src/cartservice/src/cartstore/RedisCartStore.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ private void EnsureRedisConnected()
101101
redis.ConnectionRestored += (o, e) =>
102102
{
103103
isRedisConnectionOpened = true;
104-
Console.WriteLine("Connection to redis was retored successfully");
104+
Console.WriteLine("Connection to redis was restored successfully.");
105105
};
106106
redis.ConnectionFailed += (o, e) =>
107107
{

0 commit comments

Comments
 (0)