78 references to FilterCondition
Aspire.Dashboard (60)
Components\Dialogs\FilterDialog.razor.cs (9)
15
private List<SelectViewModel<
FilterCondition
>> _filterConditions = null!;
17
private SelectViewModel<
FilterCondition
> CreateFilterSelectViewModel(
FilterCondition
condition) =>
18
new SelectViewModel<
FilterCondition
> { Id = condition, Name = TelemetryFilter.ConditionToString(condition, FilterLoc) };
40
CreateFilterSelectViewModel(
FilterCondition
.Equals),
41
CreateFilterSelectViewModel(
FilterCondition
.Contains),
42
CreateFilterSelectViewModel(
FilterCondition
.NotEqual),
43
CreateFilterSelectViewModel(
FilterCondition
.NotContains)
80
_formModel.Condition = _filterConditions.Single(c => c.Id ==
FilterCondition
.Contains);
Components\Pages\StructuredLogs.razor.cs (2)
151
Field = KnownStructuredLogFields.TraceIdField, Condition =
FilterCondition
.Equals, Value = TraceId
158
Field = KnownStructuredLogFields.SpanIdField, Condition =
FilterCondition
.Equals, Value = SpanId
Extensions\TelemetryFilterFormatter.cs (17)
15
FilterCondition
.Equals => "equals",
16
FilterCondition
.Contains => "contains",
17
FilterCondition
.GreaterThan => "gt",
18
FilterCondition
.LessThan => "lt",
19
FilterCondition
.GreaterThanOrEqual => "gte",
20
FilterCondition
.LessThanOrEqual => "lte",
21
FilterCondition
.NotEqual => "!equals",
22
FilterCondition
.NotContains => "!contains",
44
FilterCondition
? condition = parts[1] switch
46
"equals" =>
FilterCondition
.Equals,
47
"contains" =>
FilterCondition
.Contains,
48
"gt" =>
FilterCondition
.GreaterThan,
49
"lt" =>
FilterCondition
.LessThan,
50
"gte" =>
FilterCondition
.GreaterThanOrEqual,
51
"lte" =>
FilterCondition
.LessThanOrEqual,
52
"!equals" =>
FilterCondition
.NotEqual,
53
"!contains" =>
FilterCondition
.NotContains,
Model\Otlp\FilterDialogFormModel.cs (1)
14
public SelectViewModel<
FilterCondition
>? Condition { get; set; }
Model\Otlp\TelemetryFilter.cs (29)
16
public
FilterCondition
Condition { get; set; }
43
public static string ConditionToString(
FilterCondition
c, IStringLocalizer<StructuredFiltering>? loc) =>
46
FilterCondition
.Equals => "==",
47
FilterCondition
.Contains => loc?[nameof(StructuredFiltering.ConditionContains)] ?? "contains",
48
FilterCondition
.GreaterThan => ">",
49
FilterCondition
.LessThan => "<",
50
FilterCondition
.GreaterThanOrEqual => ">=",
51
FilterCondition
.LessThanOrEqual => "<=",
52
FilterCondition
.NotEqual => "!=",
53
FilterCondition
.NotContains => loc?[nameof(StructuredFiltering.ConditionNotContains)] ?? "not contains",
57
private static Func<string?, string, bool> ConditionToFuncString(
FilterCondition
c) =>
60
FilterCondition
.Equals => (a, b) => string.Equals(a, b, StringComparisons.OtlpFieldValue),
61
FilterCondition
.Contains => (a, b) => a != null && a.Contains(b, StringComparisons.OtlpFieldValue),
66
FilterCondition
.NotEqual => (a, b) => !string.Equals(a, b, StringComparisons.OtlpFieldValue),
67
FilterCondition
.NotContains => (a, b) => a != null && !a.Contains(b, StringComparisons.OtlpFieldValue),
71
private static Func<DateTime, DateTime, bool> ConditionToFuncDate(
FilterCondition
c) =>
74
FilterCondition
.Equals => (a, b) => a == b,
76
FilterCondition
.GreaterThan => (a, b) => a > b,
77
FilterCondition
.LessThan => (a, b) => a < b,
78
FilterCondition
.GreaterThanOrEqual => (a, b) => a >= b,
79
FilterCondition
.LessThanOrEqual => (a, b) => a <= b,
80
FilterCondition
.NotEqual => (a, b) => a != b,
85
private static Func<double, double, bool> ConditionToFuncNumber(
FilterCondition
c) =>
88
FilterCondition
.Equals => (a, b) => a == b,
90
FilterCondition
.GreaterThan => (a, b) => a > b,
91
FilterCondition
.LessThan => (a, b) => a < b,
92
FilterCondition
.GreaterThanOrEqual => (a, b) => a >= b,
93
FilterCondition
.LessThanOrEqual => (a, b) => a <= b,
94
FilterCondition
.NotEqual => (a, b) => a != b,
Model\StructuredLogsViewModel.cs (2)
85
filters.Add(new TelemetryFilter { Field = nameof(OtlpLogEntry.Message), Condition =
FilterCondition
.Contains, Value = FilterText });
90
filters.Add(new TelemetryFilter { Field = nameof(OtlpLogEntry.Severity), Condition =
FilterCondition
.GreaterThanOrEqual, Value = _logLevel.Value.ToString() });
Aspire.Dashboard.Components.Tests (4)
Pages\StructuredLogsTests.cs (4)
71
var filter = new TelemetryFilter { Field = "TestField", Condition =
FilterCondition
.Contains, Value = "TestValue" };
107
var filter1 = new TelemetryFilter { Field = "Test:Field", Condition =
FilterCondition
.Contains, Value = "Test Value" };
108
var filter2 = new TelemetryFilter { Field = "Test!@#", Condition =
FilterCondition
.Contains, Value = "http://localhost#fragment?hi=true" };
109
var filter3 = new TelemetryFilter { Field = "\u2764\uFE0F", Condition =
FilterCondition
.Contains, Value = "\u4F60" };
Aspire.Dashboard.Tests (14)
DashboardUrlsTests.cs (4)
35
new TelemetryFilter { Condition =
FilterCondition
.Contains, Field = "test", Value = "value" }
46
new TelemetryFilter { Condition =
FilterCondition
.Contains, Field = "test", Value = "value" },
47
new TelemetryFilter { Condition =
FilterCondition
.GreaterThan, Field = "fieldWithSpacedValue", Value = "!! multiple words here !!" },
48
new TelemetryFilter { Condition =
FilterCondition
.NotEqual, Field = "name", Value = "nameValue" },
TelemetryFilterFormatterTests.cs (2)
19
Condition =
FilterCondition
.Equals,
39
Condition =
FilterCondition
.Equals,
TelemetryRepositoryTests\LogTests.cs (2)
814
Filters = [new TelemetryFilter { Condition =
FilterCondition
.Contains, Field = nameof(OtlpLogEntry.Message), Value = "does_not_contain" }]
822
Filters = [new TelemetryFilter { Condition =
FilterCondition
.Contains, Field = nameof(OtlpLogEntry.Message), Value = "message" }]
TelemetryRepositoryTests\TraceTests.cs (6)
1183
new TelemetryFilter { Field = "key1", Condition =
FilterCondition
.Equals, Value = "value1" }
1202
new TelemetryFilter { Field = "key2", Condition =
FilterCondition
.Equals, Value = "value2" }
1221
new TelemetryFilter { Field = "key1", Condition =
FilterCondition
.Equals, Value = "value1" },
1222
new TelemetryFilter { Field = "key2", Condition =
FilterCondition
.Equals, Value = "value2" }
1271
new TelemetryFilter { Field = name, Condition =
FilterCondition
.NotEqual, Value = value }
1287
new TelemetryFilter { Field = name, Condition =
FilterCondition
.Equals, Value = value }