private readonly TelemetryClient _telemetryClient; private Dictionary<string, IOperationHolder<RequestTelemetry>> _inFlightOperations = new Dictionary<string, IOperationHolder<RequestTelemetry>>(); [DiagnosticName("HotChocolate.Execution.Query.Start")] public void BeginQueryExecute(IQueryContext context) { var httpContext = GetHttpContextFrom(context); if (httpContext == null) return; // Create a new request var requestTelemetry = new RequestTelemetry() { Name = $"{httpContext.Request.Method} {httpContext.Request.GetUri().GetLeftPart(UriPartial.Path)}", Url = new Uri(httpContext.Request.GetUri().AbsoluteUri) }; requestTelemetry.Context.Operation.Id = GetOperationIdFrom(httpContext); requestTelemetry.Context.Operation.ParentId = GetOperationIdFrom(httpContext); requestTelemetry.Properties.Add("GraphQL Query", context.Request.Query.ToString()); // Start the operation, and store it in the dictionary var operation = _telemetryClient.StartOperation(requestTelemetry); _inFlightOperations.Add(GetOperationIdFrom(httpContext), operation); }