Skip to content

Fix active events metrics in OTel consumer#48720

Merged
faec merged 9 commits intoelastic:mainfrom
faec:otelconsumer-metrics
Feb 13, 2026
Merged

Fix active events metrics in OTel consumer#48720
faec merged 9 commits intoelastic:mainfrom
faec:otelconsumer-metrics

Conversation

@faec
Copy link
Contributor

@faec faec commented Feb 5, 2026

Fix the invalid (very large or negative) values for active events reported by elastic/elastic-agent#12515. The cause was a simple order-of-operations error where the events from a batch were not reported until after the events were consumed, and reporting was skipped entirely if there was a consume error, leading to underflow of the raw unsigned value. The fix was to move the batch event reporting to the top of the publish helper. The rest of the PR is a unit test to make sure the reporting is correct at each step.

Checklist

  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have made corresponding change to the default configuration files
  • I have added tests that prove my fix is effective or that my feature works. Where relevant, I have used the stresstest.sh script to run them under stress conditions and race detector to verify their stability.
  • I have added an entry in ./changelog/fragments using the changelog tool.

Related issues

@faec faec self-assigned this Feb 5, 2026
@faec faec requested a review from a team as a code owner February 5, 2026 21:53
@faec faec added bug backport-active-all Automated backport with mergify to all the active branches labels Feb 5, 2026
@faec faec requested review from AndersonQ and orestisfl February 5, 2026 21:53
@botelastic botelastic bot added the needs_team Indicates that the issue/PR needs a Team:* label label Feb 5, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Feb 5, 2026

🤖 GitHub comments

Just comment with:

  • run docs-build : Re-trigger the docs validation. (use unformatted text in the comment!)
@faec faec added the Team:Elastic-Agent-Data-Plane Label for the Agent Data Plane team label Feb 5, 2026
@botelastic botelastic bot removed the needs_team Indicates that the issue/PR needs a Team:* label label Feb 5, 2026
@elasticmachine
Copy link
Contributor

Pinging @elastic/elastic-agent-data-plane (Team:Elastic-Agent-Data-Plane)

@pierrehilbert pierrehilbert requested review from VihasMakwana, khushijain21 and leehinman and removed request for AndersonQ and orestisfl February 6, 2026 07:40
@khushijain21
Copy link
Contributor

khushijain21 commented Feb 6, 2026

LGTM otherwise

@faec faec merged commit 1cbe74e into elastic:main Feb 13, 2026
90 checks passed
@github-actions
Copy link
Contributor

@Mergifyio backport 8.19 9.2 9.3

@mergify
Copy link
Contributor

mergify bot commented Feb 13, 2026

backport 8.19 9.2 9.3

✅ Backports have been created

Details
mergify bot pushed a commit that referenced this pull request Feb 13, 2026
Fix the invalid (very large or negative) values for active events reported by elastic/elastic-agent#12515. The cause was a simple order-of-operations error where the events from a batch were not reported until after the events were consumed, and reporting was skipped entirely if there was a consume error, leading to underflow of the raw unsigned value. The fix was to move the batch event reporting to the top of the publish helper. The rest of the PR is a unit test to make sure the reporting is correct at each step.

(cherry picked from commit 1cbe74e)
mergify bot pushed a commit that referenced this pull request Feb 13, 2026
Fix the invalid (very large or negative) values for active events reported by elastic/elastic-agent#12515. The cause was a simple order-of-operations error where the events from a batch were not reported until after the events were consumed, and reporting was skipped entirely if there was a consume error, leading to underflow of the raw unsigned value. The fix was to move the batch event reporting to the top of the publish helper. The rest of the PR is a unit test to make sure the reporting is correct at each step.

(cherry picked from commit 1cbe74e)
mergify bot pushed a commit that referenced this pull request Feb 13, 2026
Fix the invalid (very large or negative) values for active events reported by elastic/elastic-agent#12515. The cause was a simple order-of-operations error where the events from a batch were not reported until after the events were consumed, and reporting was skipped entirely if there was a consume error, leading to underflow of the raw unsigned value. The fix was to move the batch event reporting to the top of the publish helper. The rest of the PR is a unit test to make sure the reporting is correct at each step.

(cherry picked from commit 1cbe74e)
pierrehilbert pushed a commit that referenced this pull request Feb 13, 2026
Fix the invalid (very large or negative) values for active events reported by elastic/elastic-agent#12515. The cause was a simple order-of-operations error where the events from a batch were not reported until after the events were consumed, and reporting was skipped entirely if there was a consume error, leading to underflow of the raw unsigned value. The fix was to move the batch event reporting to the top of the publish helper. The rest of the PR is a unit test to make sure the reporting is correct at each step.

(cherry picked from commit 1cbe74e)

Co-authored-by: Fae Charlton <fae.charlton@elastic.co>
pierrehilbert pushed a commit that referenced this pull request Feb 13, 2026
Fix the invalid (very large or negative) values for active events reported by elastic/elastic-agent#12515. The cause was a simple order-of-operations error where the events from a batch were not reported until after the events were consumed, and reporting was skipped entirely if there was a consume error, leading to underflow of the raw unsigned value. The fix was to move the batch event reporting to the top of the publish helper. The rest of the PR is a unit test to make sure the reporting is correct at each step.

(cherry picked from commit 1cbe74e)

Co-authored-by: Fae Charlton <fae.charlton@elastic.co>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport-active-all Automated backport with mergify to all the active branches bug Team:Elastic-Agent-Data-Plane Label for the Agent Data Plane team

5 participants