155 references to OtlpHelpers
Aspire.Dashboard (126)
Api\TelemetryApiService.cs (3)
68spans = spans.Where(s => OtlpHelpers.MatchTelemetryId(s.TraceId, traceId)).ToList(); 179var trace = result.PagedResult.Items.FirstOrDefault(t => OtlpHelpers.MatchTelemetryId(t.TraceId, traceId)); 309if (!string.IsNullOrEmpty(traceId) && !OtlpHelpers.MatchTelemetryId(span.TraceId, traceId))
Components\Controls\Chart\ChartContainer.razor.cs (1)
153var value = OtlpHelpers.GetValue(attributes, filter.Name);
Components\Controls\Chart\PlotlyChart.razor.cs (1)
167title = $"{Loc[nameof(ControlsStrings.PlotlyChartTrace)]}: {OtlpHelpers.ToShortenedId(exemplar.TraceId)}";
Components\Dialogs\ExemplarsDialog.razor.cs (1)
57: $"{Loc[nameof(Resources.Dialogs.ExemplarsDialogTrace)]}: {OtlpHelpers.ToShortenedId(exemplar.TraceId)}";
Components\Dialogs\ManageDataDialog.razor.cs (1)
344private string GetOtlpResourceName(OtlpResource resource) => OtlpHelpers.GetResourceName(resource, TelemetryRepository.GetResources());
Components\Pages\StructuredLogs.razor.cs (1)
417private string GetResourceName(OtlpResourceView app) => OtlpHelpers.GetResourceName(app.Resource, _resources);
Components\Pages\TraceDetail.razor.cs (1)
563AIPromptsLoc.GetString(nameof(AIPrompts.PromptAnalyzeTrace), OtlpHelpers.ToShortenedId(trace.TraceId)),
Components\Pages\Traces.razor.cs (2)
251private string GetResourceName(OtlpResource app) => OtlpHelpers.GetResourceName(app, _resources); 252private string GetResourceName(OtlpResourceView app) => OtlpHelpers.GetResourceName(app.Resource, _resources);
Components_Controls_SpanDetails_razor.g.cs (3)
1770__builder6.AddContent(178, OtlpHelpers.ToShortenedId(context.SpanId) 2150__builder6.AddContent(220, OtlpHelpers.ToShortenedId(context.SpanId) 2181: $"{Loc[nameof(ControlsStrings.SpanDetailsSpanPrefix)]}: {OtlpHelpers.ToShortenedId(context.SpanId)}";
Components_Dialogs_GenAIVisualizerDialog_razor.g.cs (1)
300__builder3.AddContent(20, OtlpHelpers.ToShortenedId(Content.Span.SpanId)
Components_Pages_StructuredLogs_razor.g.cs (1)
1745__builder6.AddContent(185, OtlpHelpers.ToShortenedId(context.TraceId)
Components_Pages_TraceDetail_razor.g.cs (2)
377__builder2.AddContent(25, OtlpHelpers.ToShortenedId(trace.TraceId) 1090subtitle = OtlpHelpers.ToShortenedId(spanVm.Span.SpanId);
Components_Pages_Traces_razor.g.cs (1)
1500__builder5.AddContent(146, OtlpHelpers.ToShortenedId(context.TraceId)
Mcp\AspireTelemetryMcpTools.cs (3)
80getResourceName: r => OtlpHelpers.GetResourceName(r, resources)); 129getResourceName: r => OtlpHelpers.GetResourceName(r, resources), 173getResourceName: r => OtlpHelpers.GetResourceName(r, resources));
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\Markdown\AspireEnrichmentParser.cs (3)
167linkInline.AppendChild(new CodeInline(OtlpHelpers.ToShortenedId(trace.TraceId))); 202var span = trace.Spans.FirstOrDefault(s => OtlpHelpers.MatchTelemetryId(text, s.SpanId)); 210linkInline.AppendChild(new CodeInline(OtlpHelpers.ToShortenedId(span.SpanId)));
Model\Assistant\Prompts\IceBreakersBuilder.cs (4)
295_loc.GetString(nameof(AIPrompts.PromptAnalyzeTrace), OtlpHelpers.ToShortenedId(trace.TraceId)), 300_loc.GetString(nameof(AIPrompts.PromptAnalyzeTrace), OtlpHelpers.ToShortenedId(trace.TraceId)), 310_loc.GetString(nameof(AIPrompts.PromptAnalyzeSpan), OtlpHelpers.ToShortenedId(span.SpanId)), 315_loc.GetString(nameof(AIPrompts.PromptAnalyzeSpan), OtlpHelpers.ToShortenedId(span.SpanId)),
Model\Assistant\Prompts\KnownChatMessages.cs (3)
297My application has written a distributed trace with trace_id `{OtlpHelpers.ToShortenedId(trace.TraceId)}`. 324My application has written a distributed trace with trace_id `{OtlpHelpers.ToShortenedId(span.TraceId)}`. 325Summarize the distributed span `{OtlpHelpers.ToShortenedId(span.SpanId)}`. Focus on errors.
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\BrowserLinkOutgoingPeerResolver.cs (2)
37var url = OtlpHelpers.GetValue(attributes, "url.full") ?? OtlpHelpers.GetValue(attributes, "http.url");
Model\ExportHelpers.cs (2)
28var fileName = $"span-{OtlpHelpers.ToShortenedId(span.SpanId)}.json"; 51var fileName = $"trace-{OtlpHelpers.ToShortenedId(trace.TraceId)}.json";
Model\GenAI\GenAIVisualizerDialogViewModel.cs (5)
66SourceName = OtlpHelpers.GetResourceName(spanDetailsViewModel.Span.Source.Resource, resources), 68? OtlpHelpers.GetResourceName(peerResource, resources) 69: OtlpHelpers.GetPeerAddress(spanDetailsViewModel.Span.Attributes) ?? UnknownPeerName 272if (!string.IsNullOrEmpty(item.Message) && OtlpHelpers.GetEventName(item) is { } name && TryMapEventName(name, out var type)) 591if (OtlpHelpers.GetEventName(logEntry) == GenAIHelpers.GenAIEvaluationResultEventName)
Model\Otlp\ResourcesSelectHelpers.cs (1)
114Name = OtlpHelpers.GetResourceName(replica, resources)
Model\Otlp\SpanWaterfallViewModel.cs (3)
161var hasPeerService = OtlpHelpers.GetPeerAddress(span.Attributes) != null; 223return OtlpHelpers.GetResourceName(span.UninstrumentedPeer, allResources); 237return OtlpHelpers.GetPeerAddress(span.Attributes);
Model\ResourceOutgoingPeerResolver.cs (1)
158var address = OtlpHelpers.GetPeerAddress(attributes);
Model\SpanDetailsViewModel.cs (1)
35Value = OtlpHelpers.GetResourceName(destination, resources)
Model\SpanMenuBuilder.cs (1)
138_aiPromptsLoc.GetString(nameof(AIPrompts.PromptAnalyzeSpan), OtlpHelpers.ToShortenedId(span.SpanId)),
Model\StructureLogsDetailsViewModel.cs (1)
15if (OtlpHelpers.GetEventName(logEntry) is { Length: > 0 } eventName)
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),
Model\TraceLinkHelpers.cs (1)
28string.Format(CultureInfo.InvariantCulture, loc[nameof(Dialogs.OpenSpanDialogMessage)], OtlpHelpers.ToShortenedId(spanId)),
Model\TraceMenuBuilder.cs (1)
128_aiPromptsLoc.GetString(nameof(AIPrompts.PromptAnalyzeTrace), OtlpHelpers.ToShortenedId(trace.TraceId)),
Otlp\Model\MetricValues\DimensionScope.cs (5)
34var start = OtlpHelpers.UnixNanoSecondsToDateTime(d.StartTimeUnixNano); 35var end = OtlpHelpers.UnixNanoSecondsToDateTime(d.TimeUnixNano); 82var start = OtlpHelpers.UnixNanoSecondsToDateTime(h.StartTimeUnixNano); 83var end = OtlpHelpers.UnixNanoSecondsToDateTime(h.TimeUnixNano); 131var start = OtlpHelpers.UnixNanoSecondsToDateTime(exemplar.TimeUnixNano);
Otlp\Model\OtlpInstrument.cs (2)
57OtlpHelpers.CopyKeyValuePairs(attributes, Summary.Parent.Attributes, Context, out var copyCount, ref tempAttributes); 94var currentDimensionValue = OtlpHelpers.GetValue(durableAttributes, key);
Otlp\Model\OtlpLogEntry.cs (3)
53case OtlpHelpers.AspireLogIdAttribute: 71? OtlpHelpers.TruncateString(body.GetString(), context.Options.MaxAttributeLength) 94return OtlpHelpers.UnixNanoSecondsToDateTime(resolvedTimeUnixNano);
Otlp\Model\OtlpResource.cs (2)
71if (!OtlpHelpers.TryGetOrAddScope(_meters, sm.Scope, Context, TelemetryType.Metrics, out var scope)) 285OtlpHelpers.GetResourceName(resource.Resource, allResources);
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\Model\OtlpTrace.cs (1)
145TraceId = OtlpHelpers.ToHexString(traceId);
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),
Aspire.Dashboard.Components.Tests (1)
tests\Shared\Telemetry\TelemetryTestHelpers.cs (1)
44return OtlpHelpers.ToHexString(id);
Aspire.Dashboard.Tests (28)
Model\ApplicationsSelectHelpersTests.cs (1)
277var key = OtlpHelpers.GetResourceKey(resource);
Model\TelemetryExportServiceTests.cs (6)
88Assert.Equal(OtlpHelpers.DateTimeToUnixNanoseconds(s_testTime), logRecord.TimeUnixNano); 129var logIdAttribute = Assert.Single(logRecord.Attributes, a => a.Key == OtlpHelpers.AspireLogIdAttribute); 321Assert.Equal(OtlpHelpers.DateTimeToUnixNanoseconds(s_testTime), span.StartTimeUnixNano); 322Assert.Equal(OtlpHelpers.DateTimeToUnixNanoseconds(s_testTime.AddSeconds(5)), span.EndTimeUnixNano); 419Assert.Contains(span.Attributes, a => a.Key == OtlpHelpers.AspireDestinationNameAttribute && a.Value?.StringValue == "target-service"); 462Assert.DoesNotContain(span.Attributes, a => a.Key == OtlpHelpers.AspireDestinationNameAttribute);
Model\TelemetryImportServiceTests.cs (6)
349Assert.Contains(exportedLogRecord.Attributes!, a => a.Key == OtlpHelpers.AspireLogIdAttribute && a.Value?.StringValue == originalInternalId.ToString(CultureInfo.InvariantCulture)); 369Assert.DoesNotContain(importedLogs.Items[0].Attributes, a => a.Key == OtlpHelpers.AspireLogIdAttribute); 428var timeUnixNano = OtlpHelpers.DateTimeToUnixNanoseconds(s_testTime); 469var timeUnixNano = OtlpHelpers.DateTimeToUnixNanoseconds(s_testTime); 470var endTimeUnixNano = OtlpHelpers.DateTimeToUnixNanoseconds(s_testTime.AddSeconds(1)); 517var timeUnixNano = OtlpHelpers.DateTimeToUnixNanoseconds(s_testTime);
TelemetryRepositoryTests\MetricsTests.cs (1)
318var end = OtlpHelpers.UnixNanoSecondsToDateTime(nanoSeconds);
TelemetryRepositoryTests\OtlpHelpersTests.cs (11)
25var s = OtlpHelpers.GetString(anyValue); 41var s = OtlpHelpers.GetString(anyValue); 54var s = OtlpHelpers.GetString(anyValue); 90var s = OtlpHelpers.GetString(anyValue); 153var s = OtlpHelpers.GetString(anyValue); 166OtlpHelpers.CopyKeyValuePairs( 193OtlpHelpers.CopyKeyValuePairs( 233OtlpHelpers.CopyKeyValuePairs( 277OtlpHelpers.CopyKeyValuePairs( 311OtlpHelpers.CopyKeyValuePairs( 352OtlpHelpers.CopyKeyValuePairs(
TelemetryRepositoryTests\ResourceTests.cs (2)
141var instance1Name = OtlpHelpers.GetResourceName(resources[0], resources); 142var instance2Name = OtlpHelpers.GetResourceName(resources[1], resources);
tests\Shared\Telemetry\TelemetryTestHelpers.cs (1)
44return OtlpHelpers.ToHexString(id);