Skip to content

Commit

Permalink
Add source and meter
Browse files Browse the repository at this point in the history
  • Loading branch information
julianocosta89 committed Dec 12, 2024
1 parent 04538b7 commit 28ed0f4
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 2 additions & 0 deletions src/cartservice/src/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,15 @@
builder.Services.AddOpenTelemetry()
.ConfigureResource(appResourceBuilder)
.WithTracing(tracerBuilder => tracerBuilder
.AddSource("OpenTelemetry.Demo.Cart.Source")
.AddRedisInstrumentation(
options => options.SetVerboseDatabaseStatements = true)
.AddAspNetCoreInstrumentation()
.AddGrpcClientInstrumentation()
.AddHttpClientInstrumentation()
.AddOtlpExporter())
.WithMetrics(meterBuilder => meterBuilder
.AddMeter("OpenTelemetry.Demo.Cart.Meter")
.AddProcessInstrumentation()
.AddRuntimeInstrumentation()
.AddAspNetCoreInstrumentation()
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 @@ -30,7 +30,7 @@
<PackageReference Include="StackExchange.Redis" Version="2.8.22" />
<PackageReference Include="OpenFeature.Contrib.Providers.Flagd" Version="0.3.0" />
<PackageReference Include="OpenFeature.Contrib.Hooks.Otel" Version="0.2.0" />
<PackageReference Include="OpenFeature" Version="2.1.0" />
<PackageReference Include="OpenFeature" Version="2.1.0" />
</ItemGroup>

<ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions src/cartservice/src/cartstore/ValkeyCartStore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ public class ValkeyCartStore : ICartStore
private readonly byte[] _emptyCartBytes;
private readonly string _connectionString;

private static readonly ActivitySource CartActivitySource = new("OpenTelemetry.Demo.Cart");
private static readonly Meter CartMeter = new Meter("OpenTelemetry.Demo.Cart");
private static readonly ActivitySource CartActivitySource = new("OpenTelemetry.Demo.Cart.Source");
private static readonly Meter CartMeter = new Meter("OpenTelemetry.Demo.Cart.Meter");
private static readonly Histogram<long> addItemHistogram = CartMeter.CreateHistogram<long>("app.cart.add_item.latency");
private static readonly Histogram<long> getCartHistogram = CartMeter.CreateHistogram<long>("app.cart.get_cart.latency");

Expand Down

0 comments on commit 28ed0f4

Please sign in to comment.