Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add global labels value regression tests #191

Merged
merged 12 commits into from
Aug 20, 2024
Merged

Add global labels value regression tests #191

merged 12 commits into from
Aug 20, 2024

Commits on Aug 14, 2024

  1. add converted failing test

    A basic test to verify the converted bug in handling tags.
    endorama committed Aug 14, 2024
    Configuration menu
    Copy the full SHA
    49d0906 View commit details
    Browse the repository at this point in the history
  2. refactor TestAggregateAndHarvest

    Refactor to allow running the same test logic with different inputs and
    expected results.
    endorama committed Aug 14, 2024
    Configuration menu
    Copy the full SHA
    6c0a6ab View commit details
    Browse the repository at this point in the history
  3. add global labels values test case

    Add an e2e test for global labels values with multiple events.
    
    A batch of 2 events in input with different labels Values but
    same key should produce in output events with all different
    Values added to the same key.
    endorama committed Aug 14, 2024
    Configuration menu
    Copy the full SHA
    57265b3 View commit details
    Browse the repository at this point in the history
  4. fix typos

    Fix unrelated typos found while exploring the code.
    endorama committed Aug 14, 2024
    Configuration menu
    Copy the full SHA
    3f629f5 View commit details
    Browse the repository at this point in the history
  5. fix expected output

    We only retain the latest tags in a batch of events.
    endorama committed Aug 14, 2024
    Configuration menu
    Copy the full SHA
    aa210a6 View commit details
    Browse the repository at this point in the history
  6. enhance sorting logic

    TestAggregateAndHarvest sort logic only used Metricset.Name.
    The latest test added to it s flappy with such a logic, as we are
    evaluating the same Metricset.Names in 2 different events with
    global labels with equal key and different values.
    
    Enhance the sorting logic to account for equal Metricset.Name and
    leverage labels (keys, Value and Values) in the lessFn.
    endorama committed Aug 14, 2024
    Configuration menu
    Copy the full SHA
    5e01ab2 View commit details
    Browse the repository at this point in the history
  7. fix TestAggregateAndHarvest expectations

    When 2 events in a batch have the same service name but
    different tags we output 2 different sets of metrics,
    one for each tag set. This was not considered in the
    previous expected values.
    endorama committed Aug 14, 2024
    Configuration menu
    Copy the full SHA
    93dbb9d View commit details
    Browse the repository at this point in the history
  8. Revert "add converted failing test"

    This reverts commit 49d0906.
    
    The same test is covered by TestMarshalEventGlobalLabelsRace,
    which also test for a possible race condition.
    endorama committed Aug 14, 2024
    Configuration menu
    Copy the full SHA
    e2fcbec View commit details
    Browse the repository at this point in the history

Commits on Aug 19, 2024

  1. fix bug

    There was a typo, this loop should have iterated over b.Labels
    but was iterating over a.Labels
    endorama committed Aug 19, 2024
    Configuration menu
    Copy the full SHA
    86f24d9 View commit details
    Browse the repository at this point in the history
  2. guard for b labels length

    The previous implementation could panic if len(b) > len(a). Add
    a guard clause that limit iterating over label based on len(b).
    
    If len(a.Labels) > len(b.Labels), everything else equal we
    conclude that a > b.
    endorama committed Aug 19, 2024
    Configuration menu
    Copy the full SHA
    3b3a56b View commit details
    Browse the repository at this point in the history

Commits on Aug 20, 2024

  1. simplify sort

    Leverage a string comparison as a sort function, as
    used in https://github.com/elastic/apm-data/blob/81d77648a3b17d4e52859110e233e40683fcdfe3/input/otlp/metrics_test.go#L1146-L1148
    
    Adds an additional tag to the test case to ensure
    expected results.
    endorama committed Aug 20, 2024
    Configuration menu
    Copy the full SHA
    396c6e5 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    9953142 View commit details
    Browse the repository at this point in the history