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