Add the MAL functions tests back. - #13967
Conversation
There was a problem hiding this comment.
Pull request overview
This PR reintroduces a suite of MAL (Meter Analysis Language) / meter-analyzer v2 DSL unit tests to validate core parsing + execution semantics (aggregation, arithmetic, filters, scoping, k8s retagging, counters), and adds clarifying guidance in the default application.yml about JDBC credential handling and config masking.
Changes:
- Add back multiple JUnit 5 parameterized tests covering meter-analyzer v2 DSL/MAL functions and counter window behavior.
- Add targeted tests for Kubernetes metadata retagging and process ID generation scenarios.
- Document recommended JDBC URL credential placement and how to mask
jdbcUrlin config dump output.
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| oap-server/server-starter/src/main/resources/application.yml | Adds guidance to avoid embedding DB credentials in JDBC URLs and notes config-dump masking support. |
| oap-server/analyzer/meter-analyzer/src/test/java/org/apache/skywalking/oap/meter/analyzer/v2/dsl/ValueFilterTest.java | Adds parameterized tests for value-based filtering DSL functions. |
| oap-server/analyzer/meter-analyzer/src/test/java/org/apache/skywalking/oap/meter/analyzer/v2/dsl/TagFilterTest.java | Adds parameterized tests for tag-based filtering DSL functions. |
| oap-server/analyzer/meter-analyzer/src/test/java/org/apache/skywalking/oap/meter/analyzer/v2/dsl/ScopeTest.java | Adds scope/entity mapping tests for service/endpoint/instance/relation scoping. |
| oap-server/analyzer/meter-analyzer/src/test/java/org/apache/skywalking/oap/meter/analyzer/v2/dsl/K8sTagTest.java | Adds k8s meta retagging and IP→name virtual process tagging tests with mocked k8s registries. |
| oap-server/analyzer/meter-analyzer/src/test/java/org/apache/skywalking/oap/meter/analyzer/v2/dsl/IncreaseTest.java | Adds increase/rate/irate behavior tests using CounterWindow. |
| oap-server/analyzer/meter-analyzer/src/test/java/org/apache/skywalking/oap/meter/analyzer/v2/dsl/FunctionTest.java | Adds tests for tag mutation, histogram conversion, and forEach DSL functions (including negative parse cases). |
| oap-server/analyzer/meter-analyzer/src/test/java/org/apache/skywalking/oap/meter/analyzer/v2/dsl/FilterTest.java | Adds tests for FilterExpression (rule-level MAL filter closures). |
| oap-server/analyzer/meter-analyzer/src/test/java/org/apache/skywalking/oap/meter/analyzer/v2/dsl/DecorateTest.java | Adds a test for the decorate DSL function on MeterEntity. |
| oap-server/analyzer/meter-analyzer/src/test/java/org/apache/skywalking/oap/meter/analyzer/v2/dsl/counter/CounterWindowTest.java | Adds unit tests validating counter-window increase calculations across durations. |
| oap-server/analyzer/meter-analyzer/src/test/java/org/apache/skywalking/oap/meter/analyzer/v2/dsl/BasicTest.java | Adds baseline parse/run tests for empty and single-sample families. |
| oap-server/analyzer/meter-analyzer/src/test/java/org/apache/skywalking/oap/meter/analyzer/v2/dsl/ArithmeticTest.java | Adds parameterized tests for scalar/family arithmetic operations and empty-handling. |
| oap-server/analyzer/meter-analyzer/src/test/java/org/apache/skywalking/oap/meter/analyzer/v2/dsl/AggregationTest.java | Adds aggregation tests, including v2 grammar negative cases for total aggregation. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…tions - ScopeTest: compare the produced/expected MeterEntity key sets and iterate over the expected map so a missing or extra entity fails the test. - K8sTagTest: capture and restore the KubernetesServices/KubernetesPods enum singletons so the mocked instances do not leak into other tests. - DecorateTest: move MeterEntity naming-control setup into @BeforeAll/@afterall and reset it so the global state is not leaked.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 13 out of 13 changed files in this pull request and generated no new comments.
Suppressed comments (1)
oap-server/analyzer/meter-analyzer/src/test/java/org/apache/skywalking/oap/meter/analyzer/v2/dsl/IncreaseTest.java:47
- In this test data,
Sample.builder()sets the metric name twice (both at the start and again beforebuild()). This is redundant and makes the test data harder to read/maintain. Consider setting the name only once (the other tests in this package usually set it once near the end of the chain) and applying the same cleanup to the rest ofIncreaseTest.
Sample.builder().name("http_success_request").labels(of("svc", "product"))
.timestamp(parse("2020-09-11T11:11:01.00Z").toEpochMilli()).value(50).name("http_success_request").build(),
Sample.builder().name("http_success_request").labels(of("svc", "catalog"))
.timestamp(parse("2020-09-11T11:11:01.00Z").toEpochMilli()).value(150).name("http_success_request").build()
No description provided.