Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
safesparrow committed Aug 30, 2022
1 parent 906ed7a commit 01e165b
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 4 deletions.
2 changes: 2 additions & 0 deletions src/Compiler/FSharp.Compiler.Service.fsproj
Expand Up @@ -502,6 +502,8 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="OpenTelemetry.Exporter.OpenTelemetryProtocol" Version="1.1.0" />
<PackageReference Include="OpenTelemetry.Exporter.Zipkin" Version="1.1.0" />
<PackageReference Include="System.Runtime.Loader" Version="$(SystemRuntimeLoaderVersion)" />
<PackageReference Include="System.Collections.Immutable" Version="$(SystemCollectionsImmutableVersion)" />
<PackageReference Include="System.Diagnostics.DiagnosticSource" Version="$(SystemdiagnosticsDiagnosticSourceVersion)" />
Expand Down
25 changes: 25 additions & 0 deletions src/Compiler/Service/service.fs
Expand Up @@ -35,6 +35,8 @@ open FSharp.Compiler.Text
open FSharp.Compiler.Text.Range
open FSharp.Compiler.TcGlobals
open FSharp.Compiler.BuildGraph
open OpenTelemetry
open OpenTelemetry.Resources

[<AutoOpen>]
module EnvMisc =
Expand Down Expand Up @@ -1199,6 +1201,27 @@ type BackgroundCompiler

static member ActualCheckFileCount = actualCheckFileCount

module Foo =
open FSharp.Compiler.Diagnostics.Activity
open OpenTelemetry.Trace

let init () =
use tracerProvider =
Sdk.CreateTracerProviderBuilder()
.AddSource(activitySourceName)
.SetResourceBuilder(ResourceBuilder.CreateDefault().AddService(serviceName ="fsc", serviceVersion = "42.42.42.42"))
.AddOtlpExporter()
.AddZipkinExporter()
.Build();
use mainActivity = activitySource.StartActivity("main")

let forceCleanup() =
mainActivity.Dispose()
activitySource.Dispose()
tracerProvider.Dispose()

forceCleanup

[<Sealed; AutoSerializable(false)>]
// There is typically only one instance of this type in an IDE process.
type FSharpChecker
Expand Down Expand Up @@ -1226,6 +1249,8 @@ type FSharpChecker
enableBackgroundItemKeyStoreAndSemanticClassification,
enablePartialTypeChecking
)

do Foo.init() |> ignore

static let globalInstance = lazy FSharpChecker.Create()

Expand Down
4 changes: 0 additions & 4 deletions src/fsc/fscProject/fsc.fsproj
Expand Up @@ -2,10 +2,6 @@
<!-- Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. -->
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup >
<TargetFrameworks Condition="'$(ProtoTargetFramework)' != ''">$(ProtoTargetFramework)</TargetFrameworks>
<TargetFrameworks Condition="'$(ProtoTargetFramework)' == ''">net6.0;net472;</TargetFrameworks>
<TargetFrameworks Condition="'$(OS)' == 'Unix'">net6.0</TargetFrameworks>
<PropertyGroup Condition="'$(BUILD_PROTO)' != 'true'">
<TargetFrameworks Condition="'$(OS)' != 'Unix'">net472;net7.0</TargetFrameworks>
<TargetFrameworks Condition="'$(OS)' == 'Unix'">net7.0</TargetFrameworks>
Expand Down

0 comments on commit 01e165b

Please sign in to comment.