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