2 instantiations of OtlpLogEntry
Aspire.Dashboard (2)
Otlp\Model\OtlpLogEntryData.cs (1)
71internal OtlpLogEntry CreateLogEntry(long internalId) => new(
Otlp\Storage\SqliteTelemetryRepository.Logs.cs (1)
698results.Add(new OtlpLogEntry(
109 references to OtlpLogEntry
Aspire.Dashboard (64)
Api\TelemetryApiService.cs (4)
198Field = nameof(OtlpLogEntry.Severity), 309Field = nameof(OtlpLogEntry.Severity), 327await foreach (var log in telemetryRepository.WatchLogsAsync(watchRequest, cancellationToken).ConfigureAwait(false)) 460/// <see cref="OtlpLogEntry.GetFieldValue"/>. Returns null for unrecognized keys.
Components\Controls\PropertyValues\LogLevelValue.razor.cs (1)
18public required OtlpLogEntry LogEntry { get; set; }
Components\Pages\StructuredLogs.razor.cs (4)
243var logEntryId = TelemetryRepository.GetLog(LogEntryId.Value); 293private async Task OnShowPropertiesAsync(OtlpLogEntry entry, string? focusElementId) 314var entry = TelemetryRepository.GetLog(summary.InternalId); 612var entry = SelectedLogEntry.LogEntry;
Model\ExportHelpers.cs (1)
37public static ExportResult GetLogEntryAsJson(OtlpLogEntry logEntry)
Model\GenAI\GenAIVisualizerDialogViewModel.cs (2)
597private static async Task<List<OtlpLogEntry>> GetSpanLogEntriesAsync(ITelemetryRepository telemetryRepository, OtlpSpan span, CancellationToken cancellationToken) 623foreach (var logEntry in logEntries)
Model\Otlp\TelemetryFilter.cs (1)
59/// milliseconds stored in the field value from <see cref="OtlpSpan.GetFieldValue"/> / <see cref="OtlpLogEntry.GetFieldValue"/>.
Model\StructuredLogMenuBuilder.cs (3)
54OtlpLogEntry logEntry, 80Func<OtlpLogEntry?> getLogEntry, 116var logEntry = getLogEntry();
Model\StructuredLogsViewModel.cs (2)
112filters.Add(new FieldTelemetryFilter { Field = nameof(OtlpLogEntry.Message), Condition = FilterCondition.Contains, Value = filterText }); 117filters.Add(new FieldTelemetryFilter { Field = nameof(OtlpLogEntry.Severity), Condition = FilterCondition.GreaterThanOrEqual, Value = logLevel.Value.ToString() });
Model\StructureLogsDetailsViewModel.cs (2)
11public required OtlpLogEntry LogEntry { get; init; } 13public static string GetEventName(OtlpLogEntry logEntry, IStringLocalizer<Dashboard.Resources.StructuredLogs> loc)
Model\TelemetryExportService.cs (8)
226internal static OtlpTelemetryDataJson ConvertLogsToOtlpJson(List<OtlpLogEntry> logs) 233var firstLog = resourceGroup.First(); 253private static OtlpLogRecordJson ConvertLogEntry(OtlpLogEntry log) 306internal static string ConvertSpanToJson(OtlpSpan span, List<OtlpLogEntry>? logs = null, bool indent = true) 331internal static string ConvertTraceToJson(OtlpTrace trace, List<OtlpLogEntry>? logs = null) 360internal static string ConvertLogEntryToJson(OtlpLogEntry logEntry) 441private static OtlpResourceLogsJson[]? ConvertLogsToResourceLogs(List<OtlpLogEntry>? logs) 453var firstLog = resourceGroup.First();
Otlp\Model\OtlpHelpers.cs (1)
548public static string? GetEventName(OtlpLogEntry logEntry)
Otlp\Model\OtlpLogEntry.cs (3)
62public static string? GetFieldValue(OtlpLogEntry log, string field) 83public static string? GetExceptionText(OtlpLogEntry logEntry) 104static string? GetProperty(OtlpLogEntry logEntry, string propertyName)
Otlp\Model\OtlpLogEntryData.cs (1)
71internal OtlpLogEntry CreateLogEntry(long internalId) => new(
Otlp\Storage\ITelemetryRepository.cs (5)
37Task<PagedResult<OtlpLogEntry>> GetLogsAsync(GetLogsContext context, CancellationToken cancellationToken); 39OtlpLogEntry? GetLog(long logId); 40Task<List<OtlpLogEntry>> GetLogsForSpanAsync(string traceId, string spanId, CancellationToken cancellationToken); 41Task<List<OtlpLogEntry>> GetLogsForTraceAsync(string traceId, CancellationToken cancellationToken); 68IAsyncEnumerable<OtlpLogEntry> WatchLogsAsync(WatchLogsRequest request, CancellationToken cancellationToken);
Otlp\Storage\SqliteTelemetryRepository.cs (4)
176public Task<PagedResult<OtlpLogEntry>> GetLogsAsync(GetLogsContext context, CancellationToken cancellationToken) => 180public OtlpLogEntry? GetLog(long logId) => GetLogFromDatabase(logId); 181public async Task<List<OtlpLogEntry>> GetLogsForSpanAsync(string traceId, string spanId, CancellationToken cancellationToken) 196public async Task<List<OtlpLogEntry>> GetLogsForTraceAsync(string traceId, CancellationToken cancellationToken)
Otlp\Storage\SqliteTelemetryRepository.Logs.cs (11)
24private async Task<List<OtlpLogEntry>> AddLogsToDatabaseAsync(AddContext context, RepeatedField<ResourceLogs> resourceLogs) 26var addedLogs = new List<OtlpLogEntry>(); 108List<OtlpLogEntry> addedLogs) 196private PagedResult<OtlpLogEntry> GetLogsFromDatabase(GetLogsContext context, CancellationToken cancellationToken) 268return new PagedResult<OtlpLogEntry> 405private OtlpLogEntry? GetLogFromDatabase(long logId) 577if (filter.Field == nameof(OtlpLogEntry.Severity)) 587if (filter.Field == nameof(OtlpLogEntry.TimeStamp)) 617nameof(OtlpLogEntry.Message) or KnownStructuredLogFields.MessageField => "l.message", 674private List<OtlpLogEntry> MaterializeLogs(SqliteConnection connection, List<LogRecord> records) 693var results = new List<OtlpLogEntry>(records.Count);
Otlp\Storage\SqliteTelemetryRepository.Runtime.cs (11)
176private void NotifyLogsAdded(List<OtlpLogEntry> logs) 180foreach (var log in logs) 275public async IAsyncEnumerable<OtlpLogEntry> WatchLogsAsync( 279var channel = Channel.CreateBounded<OtlpLogEntry>(new BoundedChannelOptions(1000) 302foreach (var log in existingLogs.Items) 307while (channel.Reader.TryRead(out var pendingLog)) 316await foreach (var log in channel.Reader.ReadAllAsync(cancellationToken).ConfigureAwait(false)) 372private void PushLogsToWatchers(List<OtlpLogEntry> logs) 397foreach (var log in logs) 430private sealed class LogWatcher(WatchLogsRequest request, Channel<OtlpLogEntry> channel) 433public Channel<OtlpLogEntry> Channel => channel;
Aspire.Dashboard.Components.Tests (6)
Shared\TestTelemetryRepository.cs (5)
33public Task<PagedResult<OtlpLogEntry>> GetLogsAsync(GetLogsContext context, CancellationToken cancellationToken) => inner.GetLogsAsync(context, cancellationToken); 36public OtlpLogEntry? GetLog(long logId) => inner.GetLog(logId); 37public Task<List<OtlpLogEntry>> GetLogsForSpanAsync(string traceId, string spanId, CancellationToken cancellationToken) => inner.GetLogsForSpanAsync(traceId, spanId, cancellationToken); 38public Task<List<OtlpLogEntry>> GetLogsForTraceAsync(string traceId, CancellationToken cancellationToken) => inner.GetLogsForTraceAsync(traceId, cancellationToken); 56public IAsyncEnumerable<OtlpLogEntry> WatchLogsAsync(WatchLogsRequest request, CancellationToken cancellationToken) => inner.WatchLogsAsync(request, cancellationToken);
tests\Shared\Telemetry\TelemetryTestHelpers.cs (1)
212public static OtlpLogEntry CreateOtlpLogEntry(LogRecord record, OtlpResourceView resourceView, OtlpScope scope, OtlpContext context)
Aspire.Dashboard.Tests (39)
Integration\OtlpHttpJsonTests.cs (2)
596var log = logs.Items.First(); 673var log = logs.Items.First();
Model\StructuredLogsPageViewModelTests.cs (4)
142Field = nameof(OtlpLogEntry.Message), 162Field = nameof(OtlpLogEntry.Message), 182Field = nameof(OtlpLogEntry.Message), 203Field = nameof(OtlpLogEntry.Message),
Model\TelemetryExportServiceTests.cs (1)
1247var logEntry = (await repositoryContext.Repository.GetLogsAsync(GetLogsContext.ForResourceKey(repositoryContext.Repository.GetResources()[0].ResourceKey), cancellationToken: CancellationToken.None)).Items[0];
Model\TraceDetailPageViewModelTests.cs (2)
109var logEntry = TelemetryTestHelpers.CreateOtlpLogEntry(TelemetryTestHelpers.CreateLogRecord(message: "test log"), resourceView, scope, context); 150var logEntry = TelemetryTestHelpers.CreateOtlpLogEntry(TelemetryTestHelpers.CreateLogRecord(message: "test log"), resourceView, scope, context);
TelemetryRepositoryTests\LogTests.cs (9)
193var log = logs.Items[0]; 331.Select(log => OtlpLogEntry.GetFieldValue(log, field)) 1067Filters = [new FieldTelemetryFilter { Condition = FilterCondition.Contains, Field = nameof(OtlpLogEntry.Message), Value = "does_not_contain" }] 1075Filters = [new FieldTelemetryFilter { Condition = FilterCondition.Contains, Field = nameof(OtlpLogEntry.Message), Value = "MESSAGE" }] 1112Filters = [new FieldTelemetryFilter { Condition = FilterCondition.Contains, Field = nameof(OtlpLogEntry.Message), Value = fragment }] 1115var log = Assert.Single(result.Items); 1554var log = Assert.Single(logs.Items); 1797Field = nameof(OtlpLogEntry.Message), 1804Field = nameof(OtlpLogEntry.Message),
TelemetryRepositoryTests\SqliteTelemetryPersistenceTests.cs (3)
110var log = Assert.Single((await repositoryContext.Repository.GetLogsAsync(CreateLogsContext(), cancellationToken: CancellationToken.None)).Items); 293var log = Assert.Single((await repositoryContext.Repository.GetLogsAsync(CreateLogsContext(), cancellationToken: CancellationToken.None)).Items); 299var log = Assert.Single((await historicalContext.Repository.GetLogsAsync(CreateLogsContext(), cancellationToken: CancellationToken.None)).Items);
TelemetryRepositoryTests\TelemetryRepositoryTests.cs (17)
506var receivedLogs = new List<OtlpLogEntry>(); 512await foreach (var log in repositoryContext.Repository.WatchLogsAsync(new WatchLogsRequest { ResourceKeys = [], Filters = [] }, cts.Token)) 573await foreach (var log in repositoryContext.Repository.WatchLogsAsync(new WatchLogsRequest { ResourceKeys = [], Filters = [] }, cts.Token)) 913var receivedLogs = new List<OtlpLogEntry>(); 918await foreach (var log in repositoryContext.Repository.WatchLogsAsync(new WatchLogsRequest { ResourceKeys = [new ResourceKey("service1", "inst1"), new ResourceKey("service2", "inst2")], Filters = [] }, cts.Token)) 945Field = nameof(OtlpLogEntry.Message), 972var receivedLogs = new List<OtlpLogEntry>(); 978await foreach (var log in repositoryContext.Repository.WatchLogsAsync(new WatchLogsRequest { ResourceKeys = [], Filters = filters }, cts.Token)) 1036Field = nameof(OtlpLogEntry.Severity), 1063var receivedLogs = new List<OtlpLogEntry>(); 1069await foreach (var log in repositoryContext.Repository.WatchLogsAsync(new WatchLogsRequest { ResourceKeys = [], Filters = filters }, cts.Token)) 1146var receivedLogs = new List<OtlpLogEntry>(); 1152await foreach (var log in repositoryContext.Repository.WatchLogsAsync(new WatchLogsRequest 1213Field = nameof(OtlpLogEntry.Message), 1220Field = nameof(OtlpLogEntry.Message), 1249var receivedLogs = new List<OtlpLogEntry>(); 1254await foreach (var log in repositoryContext.Repository.WatchLogsAsync(new WatchLogsRequest { ResourceKeys = [], Filters = filters }, cts.Token))
tests\Shared\Telemetry\TelemetryTestHelpers.cs (1)
212public static OtlpLogEntry CreateOtlpLogEntry(LogRecord record, OtlpResourceView resourceView, OtlpScope scope, OtlpContext context)