Skip to content

Commit

Permalink
chore: added some comments around the bespoke bits.
Browse files Browse the repository at this point in the history
  • Loading branch information
kieronlanning committed Apr 6, 2024
1 parent d471839 commit 97ea88b
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,15 @@

namespace SampleApp.Host.Interfaces.Services;

/*
* A multi-target interface that defines
* the telemetry methods for the WeatherService, including
* Activities, Events, Logs, and Metrics.
*
* As it's multi-target, each target needs to be
* explicitly defined.
*/

[ActivitySource]
[Logger]
[Meter]
Expand Down
4 changes: 4 additions & 0 deletions samples/SampleApp/SampleApp.Host/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ public static void Main(string[] args) {
builder.Services.AddMetrics();

// Add services to the container.

// This is a generated method that adds the
// IWeatherServiceTelemetry interface to the container
// as a singleton.
builder.Services.AddIWeatherServiceTelemetry();
builder.Services.AddTransient<IWeatherService, WeatherService>();

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using Purview.Telemetry.Activities;

// Default activity source name for the application.
[assembly: ActivitySourceGeneration("sample-weather-app")]
4 changes: 2 additions & 2 deletions samples/SampleApp/SampleApp.ServiceDefaults/Extensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public static IHostApplicationBuilder ConfigureOpenTelemetry(this IHostApplicati
.AddProcessInstrumentation()
.AddRuntimeInstrumentation()
.AddMeter([
"WeatherServiceTelemetry"
"WeatherServiceTelemetry" // This is the name of the meter
]);
})
.WithTracing(tracing => {
Expand All @@ -54,7 +54,7 @@ public static IHostApplicationBuilder ConfigureOpenTelemetry(this IHostApplicati
.AddGrpcClientInstrumentation()
.AddHttpClientInstrumentation()
.AddSource([
"sample-weather-app"
"sample-weather-app" // This is the name of the activity source
])
;
});
Expand Down

0 comments on commit 97ea88b

Please sign in to comment.