Model\Assistant\AssistantChatDataContext.cs (7)
91await InvokeToolCallbackAsync(nameof(GetTraceAsync), _loc.GetString(nameof(AIAssistant.ToolNotificationTraceFailure), OtlpHelpers.ToShortenedId(traceId)), cancellationToken).ConfigureAwait(false);
95await InvokeToolCallbackAsync(nameof(GetTraceAsync), _loc.GetString(nameof(AIAssistant.ToolNotificationTrace), OtlpHelpers.ToShortenedId(traceId)), cancellationToken).ConfigureAwait(false);
102return SharedAIHelpers.GetTraceJson(spans, r => OtlpHelpers.GetResourceName(r, resources), AIHelpers.GetDashboardUrl(_dashboardOptions.CurrentValue));
136var (logsData, limitMessage) = AIHelpers.GetStructuredLogsJson(otlpData, _dashboardOptions.CurrentValue, r => OtlpHelpers.GetResourceName(r, resources));
180var (tracesData, limitMessage) = SharedAIHelpers.GetTracesJson(spans, r => OtlpHelpers.GetResourceName(r, resources), AIHelpers.GetDashboardUrl(_dashboardOptions.CurrentValue));
215await InvokeToolCallbackAsync(nameof(GetTraceStructuredLogsAsync), _loc.GetString(nameof(AIAssistant.ToolNotificationTraceStructuredLogs), OtlpHelpers.ToShortenedId(traceId)), cancellationToken).ConfigureAwait(false);
219var (logsData, limitMessage) = AIHelpers.GetStructuredLogsJson(otlpData, _dashboardOptions.CurrentValue, r => OtlpHelpers.GetResourceName(r, resources));
Model\Assistant\Prompts\PromptContextsBuilder.cs (5)
24KnownChatMessages.Traces.CreateErrorTracesMessage(errorTraces.Items, outgoingPeerResolvers, promptContext.DashboardOptions, r => OtlpHelpers.GetResourceName(r, resources)).Text);
41KnownChatMessages.StructuredLogs.CreateErrorStructuredLogsMessage(errorLogs.Items, promptContext.DashboardOptions, r => OtlpHelpers.GetResourceName(r, resources)).Text);
62KnownChatMessages.StructuredLogs.CreateAnalyzeLogEntryMessage(logEntry, promptContext.DashboardOptions, r => OtlpHelpers.GetResourceName(r, resources)).Text);
82KnownChatMessages.Traces.CreateAnalyzeTraceMessage(trace, traceLogs, outgoingPeerResolvers, context.DashboardOptions, r => OtlpHelpers.GetResourceName(r, resources)).Text);
102KnownChatMessages.Traces.CreateAnalyzeSpanMessage(span, traceLogs, outgoingPeerResolvers, context.DashboardOptions, r => OtlpHelpers.GetResourceName(r, resources)).Text);
Model\TelemetryExportService.cs (14)
169var resourceName = OtlpHelpers.GetResourceName(resource, resources);
186var resourceName = OtlpHelpers.GetResourceName(resource, resources);
227var resourceName = OtlpHelpers.GetResourceName(resource, resources);
264TimeUnixNano = OtlpHelpers.DateTimeToUnixNanoseconds(log.TimeStamp),
270new KeyValuePair<string, string>(OtlpHelpers.AspireLogIdAttribute, log.InternalId.ToString(CultureInfo.InvariantCulture))
403StartTimeUnixNano = OtlpHelpers.DateTimeToUnixNanoseconds(span.StartTime),
404EndTimeUnixNano = OtlpHelpers.DateTimeToUnixNanoseconds(span.EndTime),
406? () => [new KeyValuePair<string, string>(OtlpHelpers.AspireDestinationNameAttribute, destinationName)]
433TimeUnixNano = OtlpHelpers.DateTimeToUnixNanoseconds(evt.Time),
550StartTimeUnixNano = OtlpHelpers.DateTimeToUnixNanoseconds(value.Start),
551TimeUnixNano = OtlpHelpers.DateTimeToUnixNanoseconds(value.End),
588StartTimeUnixNano = OtlpHelpers.DateTimeToUnixNanoseconds(value.Start),
589TimeUnixNano = OtlpHelpers.DateTimeToUnixNanoseconds(value.End),
608TimeUnixNano = OtlpHelpers.DateTimeToUnixNanoseconds(e.Start),
Otlp\Model\OtlpSpan.cs (11)
187else if (!string.IsNullOrEmpty(OtlpHelpers.GetValue(span.Attributes, "db.system")))
189var dbSystem = OtlpHelpers.GetValue(span.Attributes, "db.system");
193else if (!string.IsNullOrEmpty(OtlpHelpers.GetValue(span.Attributes, "rpc.system")))
195var rpcSystem = OtlpHelpers.GetValue(span.Attributes, "rpc.system");
196var rpcService = OtlpHelpers.GetValue(span.Attributes, "rpc.service");
197var rpcMethod = OtlpHelpers.GetValue(span.Attributes, "rpc.method");
201var grpcStatusCode = OtlpHelpers.GetValue(span.Attributes, "rpc.grpc.status_code");
214else if (!string.IsNullOrEmpty(OtlpHelpers.GetValue(span.Attributes, "messaging.system")))
216var messagingSystem = OtlpHelpers.GetValue(span.Attributes, "messaging.system");
217var messagingOperation = OtlpHelpers.GetValue(span.Attributes, "messaging.operation");
218var destinationName = OtlpHelpers.GetValue(span.Attributes, "messaging.destination.name");
Otlp\Storage\TelemetryRepository.cs (10)
348if (!OtlpHelpers.TryGetOrAddScope(_logScopes, sl.Scope, _otlpContext, TelemetryType.Logs, out var scope))
449return OtlpHelpers.GetItems(results, context.StartIndex, context.Count, _logs.IsFull);
656var pagedResults = OtlpHelpers.GetItems(results, context.StartIndex, context.Count, _traces.IsFull, copyFunc);
1000if (OtlpHelpers.MatchTelemetryId(traceId, trace.TraceId))
1147if (!OtlpHelpers.TryGetOrAddScope(_traceScopes, scopeSpan.Scope, _otlpContext, TelemetryType.Traces, out var scope))
1329var hasPeerService = OtlpHelpers.GetPeerAddress(span.Attributes) != null;
1448StartTime = OtlpHelpers.UnixNanoSecondsToDateTime(span.StartTimeUnixNano),
1449EndTime = OtlpHelpers.UnixNanoSecondsToDateTime(span.EndTimeUnixNano),
1452Attributes = span.Attributes.ToKeyValuePairs(context, filter: attribute => attribute.Key != OtlpHelpers.AspireDestinationNameAttribute),
1465Time = OtlpHelpers.UnixNanoSecondsToDateTime(e.TimeUnixNano),
src\Shared\ConsoleLogs\SharedAIHelpers.cs (15)
221foreach (var attr in span.Attributes.Where(a => a.Key != OtlpHelpers.AspireDestinationNameAttribute))
224attributesObj[attr.Key!] = context.AddValue(attrValue, id => $@"Duplicate of attribute ""{id.Key}"" for span {OtlpHelpers.ToShortenedId(id.SpanId)}", (SpanId: spanId, attr.Key));
233["trace_id"] = OtlpHelpers.ToShortenedId(link.TraceId ?? string.Empty),
234["span_id"] = OtlpHelpers.ToShortenedId(link.SpanId ?? string.Empty)
240var destination = GetAttributeStringValue(span.Attributes, OtlpHelpers.AspireDestinationNameAttribute);
251["span_id"] = OtlpHelpers.ToShortenedId(spanId),
252["parent_span_id"] = span.ParentSpanId is { } id ? OtlpHelpers.ToShortenedId(id) : null,
254["name"] = context.AddValue(span.Name, sId => $@"Duplicate of ""name"" for span {OtlpHelpers.ToShortenedId(sId)}", spanId),
256["status_message"] = context.AddValue(span.Status?.Message, sId => $@"Duplicate of ""status_message"" for span {OtlpHelpers.ToShortenedId(sId)}", spanId),
267var traceId = OtlpHelpers.ToShortenedId(trace.TraceId);
271? OtlpHelpers.UnixNanoSecondsToDateTime(startNano)
536return attributes.Where(a => a.Key is not (ExceptionStackTraceField or ExceptionMessageField or ExceptionTypeField or OtlpHelpers.AspireLogIdAttribute));
580var logIdString = GetAttributeStringValue(logEntry.LogRecord.Attributes, OtlpHelpers.AspireLogIdAttribute);
595["span_id"] = OtlpHelpers.ToShortenedId(logEntry.LogRecord.SpanId ?? string.Empty),
596["trace_id"] = OtlpHelpers.ToShortenedId(logEntry.LogRecord.TraceId ?? string.Empty),