Skip to content

Add the MAL functions tests back. - #13967

Merged
wu-sheng merged 2 commits into
apache:masterfrom
wankai123:MAL-test
Aug 4, 2026
Merged

Add the MAL functions tests back.#13967
wu-sheng merged 2 commits into
apache:masterfrom
wankai123:MAL-test

Conversation

@wankai123

Copy link
Copy Markdown
Member

No description provided.

@wankai123 wankai123 added this to the 11.0.0 milestone Aug 4, 2026
@wankai123 wankai123 added test Test requirements about performance, feature or before release. chore Chores about the project, like code cleaning up, typos, upgrading dependencies, etc. labels Aug 4, 2026
@wankai123
wankai123 requested a lite review from Copilot August 4, 2026 06:11

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 jdbcUrl in 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.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 before build()). 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 of IncreaseTest.
                        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()

@wankai123
wankai123 requested a review from wu-sheng August 4, 2026 07:44
@wu-sheng
wu-sheng merged commit c693967 into apache:master Aug 4, 2026
451 of 454 checks passed
@wankai123
wankai123 deleted the MAL-test branch August 4, 2026 13:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

chore Chores about the project, like code cleaning up, typos, upgrading dependencies, etc. test Test requirements about performance, feature or before release.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants