Skip to content

Commit 5677f83

Browse files
committed
fix: only have 1 telemetry handler
1 parent da9dcf8 commit 5677f83

File tree

5 files changed

+22
-12
lines changed

5 files changed

+22
-12
lines changed

Catglobe.CgScript.Common/CgScriptTelemetry.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ public static class CgScriptTelemetry
1010
/// <summary>
1111
/// Name of source
1212
/// </summary>
13-
public const string TelemetrySourceName = "Catglobe.CgScript";
13+
internal const string TelemetrySourceName = "Catglobe.CgScript";
1414
/// <summary>
1515
/// ActivitySource for CgScript
1616
/// </summary>
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
using OpenTelemetry.Trace;
2+
3+
namespace Catglobe.CgScript.Common;
4+
5+
/// <summary>
6+
/// Setup methods
7+
/// </summary>
8+
public static class HostExtensions
9+
{
10+
/// <summary>
11+
/// Register the CgScript telemetry source
12+
/// </summary>
13+
public static TracerProviderBuilder AddCgScriptInstrumentation(this TracerProviderBuilder builder) => builder.AddSource(CgScriptTelemetry.TelemetrySourceName);
14+
15+
}
16+

Catglobe.CgScript.Deployment/HostExtensions.cs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,5 @@ private static IServiceCollection AddCommonCgScript(IServiceCollection services)
5151
return services;
5252
}
5353

54-
/// <summary>
55-
/// Register the CgScript telemetry source
56-
/// </summary>
57-
public static TracerProviderBuilder AddCgScriptInstrumentation(this TracerProviderBuilder builder) => builder.AddSource(CgScriptTelemetry.TelemetrySourceName);
58-
5954
}
6055

Catglobe.CgScript.Runtime/HostExtensions.cs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,5 @@ private static IServiceCollection AddCommonCgScript(IServiceCollection services,
4848
.AddHttpMessageHandler<CgScriptAuthHandler>();
4949
return services;
5050
}
51-
52-
/// <summary>
53-
/// Register the CgScript telemetry source
54-
/// </summary>
55-
public static TracerProviderBuilder AddCgScriptInstrumentation(this TracerProviderBuilder builder) => builder.AddSource(CgScriptTelemetry.TelemetrySourceName);
5651
}
5752

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,7 @@ using OpenTelemetry.Trace;
382382
383383
var builder = WebApplication.CreateBuilder(args);
384384
385-
builder.Services.AddOpenTelemetryTracing(tracerProviderBuilder =>
385+
builder.Services.AddOpenTelemetry().WithTracing(tracerProviderBuilder =>
386386
{
387387
tracerProviderBuilder
388388
.AddAspNetCoreInstrumentation()
@@ -430,3 +430,7 @@ See supported scopes in your Catglobe site `https://mysite.catglobe.com/.well-kn
430430
## Can I use AOT compilation for my C# with this library?
431431

432432
Yes
433+
434+
## Can I make a request during authentication?
435+
436+
Yes, e.g. in `OnTicketReceived`, you can set the `httpContext.Items["access_token"]` and that will be used to make the next request.

0 commit comments

Comments
 (0)