Skip to content

Validate expected Observation API call ordering on TestObservationRegistry #5239

Closed

Description

@bclozel

While working on a Spring Framework instrumentation problem, I have noticed that my instrumentation could in some cases call observation.stop() twice. This is not an intended usage and is considered as a bug in the instrumentation.

In production, calling stop() multiple times on an observation will result in calling observation handlers multiple times. In case of metrics, this will create duplicate records for the same observation (it will be counted twice). I have tried to replicate this case and test against it in my test suite, but failed to do that. Right now "micrometer-observation-test" allows to check whether an observation has been closed. In case of multiple stop() calls, I couldn't find a way to detect this case with the TestObservationRegistry.

I understand that introducing additional state checks in observations would likely create a performance degradation - testing this case would help instrumentations.

Activity

  1. changed the title [-]Prevent duplicate stops on observations[/-] [+]Test duplicate stops on observations[/+] on Jul 1, 2024
  2. modified the milestones: 1.14.0-M1, 1.14.0-M2 on Jul 2, 2024
  3. added a commit that references this issue on Jul 11, 2024
    d365754
  4. jonatan-ivanov commented on Jul 11, 2024

    @jonatan-ivanov
    Member

    @bclozel What do you think about something like this: #5300?

  5. added a commit that references this issue on Jul 12, 2024
    bc2a260
  6. added a commit that references this issue on Jul 12, 2024
    4f21e1e
  7. changed the title [-]Test duplicate stops on observations[/-] [+]Validate expected Observation API call ordering on TestObservationRegistry[/+] on Aug 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions