Skip to content

Commit

Permalink
[Cart] Added instrumentation for Asp.Net Core (http server) (#394)
Browse files Browse the repository at this point in the history
* 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 <reyang@microsoft.com>

* Update src/cartservice/src/Startup.cs

* Update src/cartservice/src/Startup.cs

Co-authored-by: Reiley Yang <reyang@microsoft.com>
  • Loading branch information
cijothomas and reyang committed Sep 30, 2022
1 parent 6d9b7ce commit b6e75ee
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion docs/metric_service_features.md
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down
7 changes: 4 additions & 3 deletions src/cartservice/src/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion src/cartservice/src/cartservice.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<PackageReference Include="Grpc.AspNetCore" Version="2.44.0" />
<PackageReference Include="Grpc.AspNetCore.HealthChecks" Version="2.46.0" />
<PackageReference Include="StackExchange.Redis" Version="2.5.43" />
<PackageReference Include="OpenTelemetry.Exporter.OpenTelemetryProtocol" Version="1.3.0" />
<PackageReference Include="OpenTelemetry.Exporter.OpenTelemetryProtocol" Version="1.3.1" />
<PackageReference Include="OpenTelemetry.Extensions.Hosting" Version="1.0.0-rc9.4" />
<PackageReference Include="OpenTelemetry.Instrumentation.AspNetCore" Version="1.0.0-rc9.4" />
<PackageReference Include="OpenTelemetry.Instrumentation.GrpcNetClient" Version="1.0.0-rc9.4" />
Expand Down
2 changes: 1 addition & 1 deletion src/cartservice/src/cartstore/RedisCartStore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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) =>
{
Expand Down

0 comments on commit b6e75ee

Please sign in to comment.