microsoft/teams.net

Public

mirrored from https://github.com/microsoft/teams.netAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
fix/msal-agentic-cache

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

core/src/Microsoft.Teams.Apps/Diagnostics/AppsTelemetry.cs

55lines · modecode

1// Copyright (c) Microsoft Corporation.
2// Licensed under the MIT License.
3
4using System.Diagnostics;
5using System.Diagnostics.Metrics;
6
7namespace Microsoft.Teams.Apps.Diagnostics;
8
9/// <summary>
10/// Singletons for the Apps-level <see cref="ActivitySource"/>, <see cref="Meter"/>, and instruments.
11/// Internal to <c>Microsoft.Teams.Apps</c>.
12/// </summary>
13internal static class AppsTelemetry
14{
15 private const string s_version = ThisAssembly.NuGetPackageVersion;
16
17 public static readonly ActivitySource Source =
18 new(TeamsBotApplicationTelemetry.ActivitySourceName, s_version);
19
20 public static readonly Meter Meter =
21 new(TeamsBotApplicationTelemetry.MeterName, s_version);
22
23 public static readonly Counter<long> HandlerDispatched =
24 Meter.CreateCounter<long>(Metrics.HandlerDispatched, description: "Total handler invocations dispatched by the router.");
25
26 public static readonly Histogram<double> HandlerDuration =
27 Meter.CreateHistogram<double>(Metrics.HandlerDuration, unit: "ms", description: "Duration of individual handler invocations.");
28
29 public static readonly Counter<long> HandlerFailures =
30 Meter.CreateCounter<long>(Metrics.HandlerFailures, description: "Total handler invocations that threw an exception.");
31
32 public static readonly Counter<long> HandlerUnmatched =
33 Meter.CreateCounter<long>(Metrics.HandlerUnmatched, description: "Total activities that found no matching route.");
34
35 public static class Spans
36 {
37 public const string Handler = "handler";
38 }
39
40 public static class Tags
41 {
42 public const string HandlerType = "handler.type";
43 public const string HandlerDispatch = "handler.dispatch";
44 public const string ActivityType = "activity.type";
45 public const string InvokeName = "invoke.name";
46 }
47
48 public static class Metrics
49 {
50 public const string HandlerDispatched = "teams.handler.dispatched";
51 public const string HandlerDuration = "teams.handler.duration";
52 public const string HandlerFailures = "teams.handler.failures";
53 public const string HandlerUnmatched = "teams.handler.unmatched";
54 }
55}
56