From 2cae628d4940fb6704a87462cb52a55439eb8a28 Mon Sep 17 00:00:00 2001 From: Sanket Mundra <97032782+sanket-mundra@users.noreply.github.com> Date: Wed, 14 Feb 2024 16:40:23 +0530 Subject: [PATCH] Expose URL_PATH in exclusion rules (#201) --- .../config/service/v1/span_filter.proto | 1 + .../SpanProcessingConfigServiceImplTest.java | 22 +++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/span-processing-config-service-api/src/main/proto/org/hypertrace/span/processing/config/service/v1/span_filter.proto b/span-processing-config-service-api/src/main/proto/org/hypertrace/span/processing/config/service/v1/span_filter.proto index d0380c1c..a7cb10df 100644 --- a/span-processing-config-service-api/src/main/proto/org/hypertrace/span/processing/config/service/v1/span_filter.proto +++ b/span-processing-config-service-api/src/main/proto/org/hypertrace/span/processing/config/service/v1/span_filter.proto @@ -47,6 +47,7 @@ enum Field { FIELD_URL = 1; FIELD_SERVICE_NAME = 2; FIELD_ENVIRONMENT_NAME = 3; + FIELD_URL_PATH = 4; } enum RelationalOperator { diff --git a/span-processing-config-service-impl/src/test/java/org/hypertrace/span/processing/config/service/SpanProcessingConfigServiceImplTest.java b/span-processing-config-service-impl/src/test/java/org/hypertrace/span/processing/config/service/SpanProcessingConfigServiceImplTest.java index 9b33216a..1798397a 100644 --- a/span-processing-config-service-impl/src/test/java/org/hypertrace/span/processing/config/service/SpanProcessingConfigServiceImplTest.java +++ b/span-processing-config-service-impl/src/test/java/org/hypertrace/span/processing/config/service/SpanProcessingConfigServiceImplTest.java @@ -1,6 +1,7 @@ package org.hypertrace.span.processing.config.service; import static org.hypertrace.span.processing.config.service.v1.Field.FIELD_URL; +import static org.hypertrace.span.processing.config.service.v1.Field.FIELD_URL_PATH; import static org.hypertrace.span.processing.config.service.v1.LogicalOperator.LOGICAL_OPERATOR_AND; import static org.hypertrace.span.processing.config.service.v1.RelationalOperator.RELATIONAL_OPERATOR_CONTAINS; import static org.hypertrace.span.processing.config.service.v1.RuleType.RULE_TYPE_SYSTEM; @@ -284,6 +285,18 @@ private ExcludeSpanRule buildMockSystemExcludeSpanRule(boolean disabled) { .build()) .build()) .build()) + .addOperands( + SpanFilter.newBuilder() + .setRelationalSpanFilter( + RelationalSpanFilterExpression.newBuilder() + .setOperator(RELATIONAL_OPERATOR_CONTAINS) + .setField(FIELD_URL_PATH) + .setRightOperand( + SpanFilterValue.newBuilder() + .setStringValue("health") + .build()) + .build()) + .build()) .build()) .build()) .build()) @@ -324,6 +337,15 @@ private Config buildMockConfig() { "operator", "RELATIONAL_OPERATOR_CONTAINS", "right_operand", + Map.of("string_value", "health"))), + Map.of( + "relational_span_filter", + Map.of( + "field", + "FIELD_URL_PATH", + "operator", + "RELATIONAL_OPERATOR_CONTAINS", + "right_operand", Map.of("string_value", "health")))))))))))); } }