File tree Expand file tree Collapse file tree 4 files changed +10
-2
lines changed Expand file tree Collapse file tree 4 files changed +10
-2
lines changed Original file line number Diff line number Diff line change 5
5
<NoWarn >$(NoWarn);NU1507</NoWarn >
6
6
</PropertyGroup >
7
7
<ItemGroup >
8
+ <PackageVersion Include =" Azure.Monitor.OpenTelemetry.Exporter" Version =" 1.4.0" />
8
9
<PackageVersion Include =" Basic.CompilerLog.Util" Version =" 0.9.9" />
9
10
<PackageVersion Include =" AwesomeAssertions" Version =" $(AwesomeAssertionsVersion)" />
10
11
<PackageVersion Include =" BenchmarkDotNet" Version =" $(BenchmarkDotNetPackageVersion)" />
161
162
<PackageVersion Include =" Microsoft.Build.Utilities.Core" Version =" $(MicrosoftBuildMinimumVersion)" />
162
163
<PackageVersion Include =" Microsoft.NET.StringTools" Version =" $(MicrosoftBuildMinimumVersion)" />
163
164
</ItemGroup >
164
- </Project >
165
+ </Project >
Original file line number Diff line number Diff line change 1
1
// Licensed to the .NET Foundation under one or more agreements.
2
2
// The .NET Foundation licenses this file to you under the MIT license.
3
3
4
+ using Azure . Monitor . OpenTelemetry . Exporter ;
4
5
using System . CommandLine ;
5
6
using System . CommandLine . Parsing ;
6
7
using System . Diagnostics ;
@@ -59,6 +60,7 @@ static Program()
59
60
. AddHttpClientInstrumentation ( )
60
61
. AddRuntimeInstrumentation ( )
61
62
. AddOtlpExporter ( )
63
+ . AddAzureMonitorMetricExporter ( o => o . ConnectionString = Telemetry . Telemetry . ConnectionString )
62
64
. Build ( ) ;
63
65
tracerProvider = Sdk . CreateTracerProviderBuilder ( )
64
66
. ConfigureResource ( r =>
@@ -68,6 +70,10 @@ static Program()
68
70
. AddSource ( Activities . Source . Name )
69
71
. AddHttpClientInstrumentation ( )
70
72
. AddOtlpExporter ( )
73
+ . AddAzureMonitorTraceExporter ( o => {
74
+ o . ConnectionString = Telemetry . Telemetry . ConnectionString ;
75
+ o . EnableLiveMetrics = false ;
76
+ } )
71
77
. SetSampler ( new AlwaysOnSampler ( ) )
72
78
. Build ( ) ;
73
79
( var s_parentActivityContext , var s_activityKind ) = DeriveParentActivityContextFromEnv ( ) ;
Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ public class Telemetry : ITelemetry
14
14
private static FrozenDictionary < string , object ? > _commonProperties = new TelemetryCommonProperties ( ) . GetTelemetryCommonProperties ( ) ;
15
15
private Task ? _trackEventTask ;
16
16
17
- private const string ConnectionString = "InstrumentationKey=74cc1c9e-3e6e-4d05-b3fc-dde9101d0254" ;
17
+ public static string ConnectionString = "InstrumentationKey=74cc1c9e-3e6e-4d05-b3fc-dde9101d0254" ;
18
18
19
19
public bool Enabled { get ; }
20
20
Original file line number Diff line number Diff line change 50
50
</ItemGroup >
51
51
52
52
<ItemGroup >
53
+ <PackageReference Include =" Azure.Monitor.OpenTelemetry.Exporter" />
53
54
<PackageReference Include =" Microsoft.Extensions.FileSystemGlobbing" />
54
55
<PackageReference Include =" Microsoft.VisualStudio.SolutionPersistence" />
55
56
<PackageReference Include =" Newtonsoft.Json" />
You can’t perform that action at this time.
0 commit comments