From 86c3b5ee083cce305c62fe1f530f65c58f9d0fb5 Mon Sep 17 00:00:00 2001 From: Jimmy Byrd Date: Fri, 24 Feb 2023 07:05:37 -0500 Subject: [PATCH] set tags early as possible --- src/FsAutoComplete.Core/Utils.fs | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/FsAutoComplete.Core/Utils.fs b/src/FsAutoComplete.Core/Utils.fs index 371b2ec67..c79483e0c 100644 --- a/src/FsAutoComplete.Core/Utils.fs +++ b/src/FsAutoComplete.Core/Utils.fs @@ -837,6 +837,7 @@ module Tracing = open System.Diagnostics open FsOpenTelemetry open StreamJsonRpc + open System.Collections.Generic module SemanticConventions = /// @@ -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")