microsoft/teams.net
Publicmirrored fromhttps://github.com/microsoft/teams.netAvailable
core/src/Microsoft.Teams.Apps/Diagnostics/TeamsBotApplicationTelemetry.cs
36lines · modecode
| 1 | // Copyright (c) Microsoft Corporation. |
| 2 | // Licensed under the MIT License. |
| 3 | |
| 4 | namespace Microsoft.Teams.Apps.Diagnostics; |
| 5 | |
| 6 | /// <summary> |
| 7 | /// Names of the <see cref="System.Diagnostics.ActivitySource"/> and <see cref="System.Diagnostics.Metrics.Meter"/> |
| 8 | /// emitted by <c>Microsoft.Teams.Apps</c>. |
| 9 | /// </summary> |
| 10 | /// <remarks> |
| 11 | /// Consumers register these names with their OpenTelemetry tracer and meter providers so that the |
| 12 | /// Teams-application-level spans (<c>handler</c>) flow to configured exporters. Lower-level layers |
| 13 | /// (<c>Microsoft.Teams.Core</c>) publish their own source/meter; register them all to capture the full |
| 14 | /// bot pipeline. |
| 15 | /// <code> |
| 16 | /// builder.Services.AddOpenTelemetry() |
| 17 | /// .WithTracing(t => t |
| 18 | /// .AddSource(CoreTelemetryNames.ActivitySourceName) |
| 19 | /// .AddSource(TeamsBotApplicationTelemetry.ActivitySourceName)) |
| 20 | /// .WithMetrics(m => m |
| 21 | /// .AddMeter(CoreTelemetryNames.MeterName) |
| 22 | /// .AddMeter(TeamsBotApplicationTelemetry.MeterName)); |
| 23 | /// </code> |
| 24 | /// </remarks> |
| 25 | public static class TeamsBotApplicationTelemetry |
| 26 | { |
| 27 | /// <summary> |
| 28 | /// Name of the <see cref="System.Diagnostics.ActivitySource"/> that emits Apps-level spans. |
| 29 | /// </summary> |
| 30 | public const string ActivitySourceName = "Microsoft.Teams.Apps"; |
| 31 | |
| 32 | /// <summary> |
| 33 | /// Name of the <see cref="System.Diagnostics.Metrics.Meter"/> that emits Apps-level metrics. |
| 34 | /// </summary> |
| 35 | public const string MeterName = "Microsoft.Teams.Apps"; |
| 36 | } |
| 37 | |