79 references to OpenTelemetryConsts
Microsoft.Extensions.AI (79)
ChatCompletion\OpenTelemetryChatClient.cs (49)
64string name = string.IsNullOrEmpty(sourceName) ? OpenTelemetryConsts.DefaultSourceName : sourceName!; 69OpenTelemetryConsts.GenAI.Client.TokenUsage.Name, 70OpenTelemetryConsts.TokensUnit, 71OpenTelemetryConsts.GenAI.Client.TokenUsage.Description, 72advice: new() { HistogramBucketBoundaries = OpenTelemetryConsts.GenAI.Client.TokenUsage.ExplicitBucketBoundaries }); 75OpenTelemetryConsts.GenAI.Client.OperationDuration.Name, 76OpenTelemetryConsts.SecondsUnit, 77OpenTelemetryConsts.GenAI.Client.OperationDuration.Description, 78advice: new() { HistogramBucketBoundaries = OpenTelemetryConsts.GenAI.Client.OperationDuration.ExplicitBucketBoundaries }); 219string.IsNullOrWhiteSpace(modelId) ? OpenTelemetryConsts.GenAI.Chat : $"{OpenTelemetryConsts.GenAI.Chat} {modelId}", 225.AddTag(OpenTelemetryConsts.GenAI.Operation.Name, OpenTelemetryConsts.GenAI.Chat) 226.AddTag(OpenTelemetryConsts.GenAI.Request.Model, modelId) 227.AddTag(OpenTelemetryConsts.GenAI.SystemName, _system); 232.AddTag(OpenTelemetryConsts.Server.Address, _serverAddress) 233.AddTag(OpenTelemetryConsts.Server.Port, _serverPort); 240_ = activity.AddTag(OpenTelemetryConsts.GenAI.Request.FrequencyPenalty, frequencyPenalty); 245_ = activity.AddTag(OpenTelemetryConsts.GenAI.Request.MaxTokens, maxTokens); 250_ = activity.AddTag(OpenTelemetryConsts.GenAI.Request.PresencePenalty, presencePenalty); 255_ = activity.AddTag(OpenTelemetryConsts.GenAI.Request.StopSequences, $"[{string.Join(", ", stopSequences.Select(s => $"\"{s}\""))}]"); 260_ = activity.AddTag(OpenTelemetryConsts.GenAI.Request.Temperature, temperature); 265_ = activity.AddTag(OpenTelemetryConsts.GenAI.Request.TopK, topK); 270_ = activity.AddTag(OpenTelemetryConsts.GenAI.Request.TopP, top_p); 284_ = activity.AddTag(OpenTelemetryConsts.GenAI.Request.PerProvider(_system, "response_format"), responseFormat); 289_ = activity.AddTag(OpenTelemetryConsts.GenAI.Request.PerProvider(_system, "seed"), seed); 314tags.Add(OpenTelemetryConsts.Error.Type, error.GetType().FullName); 325tags.Add(OpenTelemetryConsts.GenAI.Token.Type, "input"); 333tags.Add(OpenTelemetryConsts.GenAI.Token.Type, "output"); 342.AddTag(OpenTelemetryConsts.Error.Type, error.GetType().FullName) 355_ = activity.AddTag(OpenTelemetryConsts.GenAI.Response.FinishReasons, $"[\"{finishReason.Value.ToLowerInvariant()}\"]"); 361_ = activity.AddTag(OpenTelemetryConsts.GenAI.Response.Id, completion.CompletionId); 366_ = activity.AddTag(OpenTelemetryConsts.GenAI.Response.Model, completion.ModelId); 371_ = activity.AddTag(OpenTelemetryConsts.GenAI.Response.InputTokens, inputTokens); 376_ = activity.AddTag(OpenTelemetryConsts.GenAI.Response.OutputTokens, outputTokens); 383tags.Add(OpenTelemetryConsts.GenAI.Operation.Name, OpenTelemetryConsts.GenAI.Chat); 387tags.Add(OpenTelemetryConsts.GenAI.Request.Model, requestModelId); 390tags.Add(OpenTelemetryConsts.GenAI.SystemName, _system); 394tags.Add(OpenTelemetryConsts.Server.Address, endpointAddress); 395tags.Add(OpenTelemetryConsts.Server.Port, _serverPort); 400tags.Add(OpenTelemetryConsts.GenAI.Response.Model, responseModel); 416Log(new(1, OpenTelemetryConsts.GenAI.Assistant.Message), 423Log(new(1, OpenTelemetryConsts.GenAI.Tool.Message), 435Log(new(1, message.Role == ChatRole.System ? OpenTelemetryConsts.GenAI.System.Message : OpenTelemetryConsts.GenAI.User.Message), 452EventId id = new(1, OpenTelemetryConsts.GenAI.Choice); 473new(OpenTelemetryConsts.Event.Name, id.Name), 474new(OpenTelemetryConsts.GenAI.SystemName, _system),
Embeddings\OpenTelemetryEmbeddingGenerator.cs (30)
58string name = string.IsNullOrEmpty(sourceName) ? OpenTelemetryConsts.DefaultSourceName : sourceName!; 63OpenTelemetryConsts.GenAI.Client.TokenUsage.Name, 64OpenTelemetryConsts.TokensUnit, 65OpenTelemetryConsts.GenAI.Client.TokenUsage.Description, 66advice: new() { HistogramBucketBoundaries = OpenTelemetryConsts.GenAI.Client.TokenUsage.ExplicitBucketBoundaries }); 69OpenTelemetryConsts.GenAI.Client.OperationDuration.Name, 70OpenTelemetryConsts.SecondsUnit, 71OpenTelemetryConsts.GenAI.Client.OperationDuration.Description, 72advice: new() { HistogramBucketBoundaries = OpenTelemetryConsts.GenAI.Client.OperationDuration.ExplicitBucketBoundaries }); 129string.IsNullOrWhiteSpace(modelId) ? OpenTelemetryConsts.GenAI.Embed : $"{OpenTelemetryConsts.GenAI.Embed} {modelId}", 133new(OpenTelemetryConsts.GenAI.Operation.Name, OpenTelemetryConsts.GenAI.Embed), 134new(OpenTelemetryConsts.GenAI.Request.Model, modelId), 135new(OpenTelemetryConsts.GenAI.SystemName, _modelProvider), 143.AddTag(OpenTelemetryConsts.Server.Address, _endpointAddress) 144.AddTag(OpenTelemetryConsts.Server.Port, _endpointPort); 149_ = activity.AddTag(OpenTelemetryConsts.GenAI.Request.EmbeddingDimensions, dimensions); 182tags.Add(OpenTelemetryConsts.Error.Type, error.GetType().FullName); 191tags.Add(OpenTelemetryConsts.GenAI.Token.Type, "input"); 202.AddTag(OpenTelemetryConsts.Error.Type, error.GetType().FullName) 208_ = activity.AddTag(OpenTelemetryConsts.GenAI.Response.InputTokens, inputTokens); 213_ = activity.AddTag(OpenTelemetryConsts.GenAI.Response.Model, responseModelId); 220tags.Add(OpenTelemetryConsts.GenAI.Operation.Name, OpenTelemetryConsts.GenAI.Embed); 224tags.Add(OpenTelemetryConsts.GenAI.Request.Model, requestModelId); 227tags.Add(OpenTelemetryConsts.GenAI.SystemName, _modelProvider); 231tags.Add(OpenTelemetryConsts.Server.Address, endpointAddress); 232tags.Add(OpenTelemetryConsts.Server.Port, _endpointPort); 238tags.Add(OpenTelemetryConsts.GenAI.Response.Model, responseModelId);