Repository navigation
Restore Heartbeat monitor state in OTel mode - #16902
Conversation
Assisted-by: gpt-5.6-terra-xhigh
Assisted-by: gpt-5.6-terra-xhigh
Assisted-by: gpt-5.6-sol-high
…t-monitor-state-16284-testing
Assisted-by: gpt-5.6-sol-high
Assisted-by: gpt-5.6-sol-high
Assisted-by: gpt-5.6-sol-high
…t-monitor-state-16284
Assisted-by: gpt-5.6-sol-high
|
This pull request does not have a backport label. Could you fix it @belimawr? 🙏
|
Assisted-by: gpt-5.6-sol-high
|
This pull request is now in conflicts. Could you fix it? 🙏 |
Assisted-by: gpt-5.6-terra-high
|
This pull request is now in conflicts. Could you fix it? 🙏 |
…t-monitor-state-16284
There was a problem hiding this comment.
🟡 Changes recommended
Configuration and authentication mismatches can prevent state restoration and disrupt Elasticsearch publishing.
4 open issues
What changed in this PR
This PR aims to restore Heartbeat monitor-state continuity across restarts in Elastic Agent’s OTel runtime.
Changes:
- Connects Heartbeat receivers to output-scoped beatsauth configuration.
- Adds Elasticsearch endpoint, authentication, and Cloud ID translation.
- Extends unit and integration coverage for authentication and restored state.
| File | Description |
|---|---|
| testing/integration/ess/heartbeat_monitoring_test.go | Checks state continuity and counters after restarts. |
| internal/pkg/otel/translate/testdata/certs/client-unencrypted.key | Adds a TLS test fixture. |
| internal/pkg/otel/translate/output_elasticsearch.go | Translates endpoints and authentication into beatsauth settings. |
| internal/pkg/otel/translate/output_elasticsearch_test.go | Tests authentication, Cloud ID, and transport translation. |
| internal/pkg/otel/translate/otelconfig.go | Adds Heartbeat’s authentication-extension reference. |
| internal/pkg/otel/translate/otelconfig_test.go | Updates receiver and extension expectations. |
| changelog/fragments/1790701465-restore-heartbeat-monitor-state-in-otel-mode.yaml | Records the intended restoration fix. |
Review effort: Balanced
Assisted-by: gpt-5.6-sol-high
Assisted-by: gpt-5.6-sol-high
Assisted-by: gpt-5.6-sol-high
Assisted-by: gpt-5.6-sol-high
…t-monitor-state-16284
💛 Build succeeded, but was flaky
Failed CI StepsHistory
cc @belimawr |
|
This pull request does not currently match the merge queue conditions, so it cannot be queued from here. The box comes back if it matches again. |
…17568) Restore Heartbeat monitor state in OTel mode Configure output-scoped Elasticsearch authentication for Heartbeat receivers and delegate transport settings to beatsauth. Assisted-by: Cursor, Model: GPT-5.6 Terra & Sol (High) Assisted-by: Cursor, Model: Gemini 3.8 Flash (High) (cherry picked from commit fe0cdc3) # Conflicts: # internal/pkg/otel/translate/otelconfig_test.go Assisted-by: gpt-5.6-terra-high --------- Co-authored-by: Tiago Queiroz <tiago.queiroz@elastic.co>
…18106) Cloud ID resolution was added to the Elasticsearch output translation in #16902 only because Beats supports it. Elastic Agent never resolved cloud_id for the process runtime and does not document it, so a config that worked under the OTel runtime would break after falling back to the process runtime. It first shipped in 9.6 and is not known to be in use. Removing it also drops the copy of the output config that resolution required, along with the queue write-back that kept the copy in sync. Assisted-By: Cursor Co-authored-by: Cursor <cursoragent@cursor.com>
…18106) (#18126) Cloud ID resolution was added to the Elasticsearch output translation in #16902 only because Beats supports it. Elastic Agent never resolved cloud_id for the process runtime and does not document it, so a config that worked under the OTel runtime would break after falling back to the process runtime. It first shipped in 9.6 and is not known to be in use. Removing it also drops the copy of the output config that resolution required, along with the queue write-back that kept the copy in sync. Assisted-By: Cursor (cherry picked from commit 934da63) Co-authored-by: Khushi Jain <khushi.jain@elastic.co> Co-authored-by: Cursor <cursoragent@cursor.com>

What does this PR do?
Why is it important?
Fixes #16284
Checklist
I have made corresponding changes to the documentationI have made corresponding change to the default configuration files./changelog/fragmentsusing the changelog tool## Disruptive User ImpactHow to test this PR locally
Run the tests
Manual test
Runtime precondition
This Heartbeat defaults to the process runtime. Force OTel runtime via
Fleet policy override:
In Fleet UI go to: -> Settings -> Advanced internal YAML settings
and add the following snippet:
Kibana and Elastic Agent setup
Example URLs assume you're using Elastic-Package
python -m http.server.Reproduction
Run the following query in Dev Tools, replacing
<monitor-id>by the monitor ID you copied.Record the result:
state.checks: ever-increasing number of checks.state.id: the persisted Heartbeat state ID.state.started_at: the time of the first check.Restart Elastic Agent, for example on Linux:
sudo systemctl restart elastic-agent.Run the query again.
state.checksmust have increased;state.idandstate.started_atmust be unchanged.Related issues
Questions to ask yourself