forked from dotnet/fsharp
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Hacks to make telemetry work in incremental builder
- Loading branch information
1 parent
30fd578
commit 16fcfd4
Showing
4 changed files
with
40 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 29 additions & 2 deletions
31
tests/benchmarks/FCSBenchmarks/CompilerServiceBenchmarks/Program.fs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,34 @@ | ||
open BenchmarkDotNet.Running | ||
open BenchmarkDotNet.Configs | ||
open BenchmarkDotNet.Running | ||
open FSharp.Compiler.Benchmarks | ||
open OpenTelemetry | ||
open OpenTelemetry.Resources | ||
open OpenTelemetry.Trace | ||
|
||
open FSharp.Compiler.Diagnostics.Activity | ||
|
||
[<EntryPoint>] | ||
let main args = | ||
BenchmarkSwitcher.FromAssembly(typeof<DecentlySizedStandAloneFileBenchmark>.Assembly).Run(args) |> ignore | ||
let b = DecentlySizedStandAloneFileBenchmark() | ||
|
||
// eventually this would need to only export to the OLTP collector, and even then only if configured. always-on is no good. | ||
// when this configuration becomes opt-in, we'll also need to safely check activities around every StartActivity call, because those could | ||
// be null | ||
use tracerProvider = | ||
Sdk.CreateTracerProviderBuilder() | ||
.AddSource(activitySourceName) | ||
.SetResourceBuilder(ResourceBuilder.CreateDefault().AddService(serviceName ="program", serviceVersion = "42.42.42.44")) | ||
.AddOtlpExporter() | ||
.AddZipkinExporter() | ||
.Build(); | ||
use mainActivity = activitySource.StartActivity("main") | ||
|
||
let forceCleanup() = | ||
mainActivity.Dispose() | ||
activitySource.Dispose() | ||
tracerProvider.Dispose() | ||
|
||
b.Setup() | ||
b.Run() | ||
forceCleanup() | ||
0 |