Skip to content

Commit

Permalink
set tags early as possible
Browse files Browse the repository at this point in the history
  • Loading branch information
TheAngryByrd committed Feb 24, 2023
1 parent 2d8045c commit 86c3b5e
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/FsAutoComplete.Core/Utils.fs
Original file line number Diff line number Diff line change
Expand Up @@ -837,6 +837,7 @@ module Tracing =
open System.Diagnostics
open FsOpenTelemetry
open StreamJsonRpc
open System.Collections.Generic

module SemanticConventions =
/// <remarks>
Expand Down Expand Up @@ -882,8 +883,18 @@ module Tracing =
type StreamJsonRpcTracingStrategy(activitySource: ActivitySource) =
interface IActivityTracingStrategy with
member this.ApplyInboundActivity(request: Protocol.JsonRpcRequest) : IDisposable =

let activity = activitySource.StartActivity(request.Method)
let tags =
[
"rpc.system", box "jsonrpc"
"rpc.jsonrpc.is_notification", box request.IsNotification
"rpc.jsonrpc.is_response_expected", box request.IsResponseExpected
"rpc.jsonrpc.version", box request.Version
"rpc.jsonrpc.request_id", box request.RequestId
"rpc.method", box request.Method
]
|> Seq.map KeyValuePair

let activity = activitySource.StartActivity(ActivityKind.Server, name = request.Method, tags = tags)

activity
.SetTagSafe("rpc.system", "jsonrpc")
Expand Down

0 comments on commit 86c3b5e

Please sign in to comment.