Skip to content

appsec: assert app-extended-heartbeat re-emits full telemetry state#3865

Open
cataphract wants to merge 1 commit intomasterfrom
glopes/fix-extended-hearbeat
Open

appsec: assert app-extended-heartbeat re-emits full telemetry state#3865
cataphract wants to merge 1 commit intomasterfrom
glopes/fix-extended-hearbeat

Conversation

@cataphract
Copy link
Copy Markdown
Contributor

@cataphract cataphract commented May 7, 2026

Updates libdatadog to a version that includes dependencies and integrations in app-extended-heartbeat. The previous behaviour omitted those fields and caused a duplicate app-integrations-change on the next regular flush.

Adds an integration test (TelemetryExtendedHeartbeatTests) that drives phpredis and exec via custom_integrations.php and asserts:

  1. They appear in a regular app-started/app-integrations-change.
  2. The next app-extended-heartbeat re-emits configuration, dependencies, and integrations (with phpredis present).
  3. Loading a fresh integration afterwards produces an app-integrations-change containing only the new integration — phpredis is not re-emitted, confirming the leak is fixed.

The new test runs in its own container so DD_TELEMETRY_EXTENDED_HEARTBEAT_INTERVAL=15 applies before the worker spawns. The existing TelemetryTests no longer sets that env var, so its 24h default no longer interferes with tests that are not about the extended heartbeat (this addresses the intermittent 'telemetry reflects the loading of a new integration' failure caused by the heartbeat re-queueing data into the next regular flush).

Folds two helpers into TelemetryHelpers:

  • filterMessages(...) gains a userAppOnly flag (default true) that skips the sidecar's own datadog-ipc-helper telemetry worker.
  • WithExtendedHeartbeat / waitForExtendedHeartbeat mirror the existing WithIntegrations / waitForIntegrations pattern.

custom_integrations.php gains an "fs" branch (fopen on /dev/null) so tests can trigger the filesystem deferred-loading hook.

Description

Reviewer checklist

  • Test coverage seems ok.
  • Appropriate labels assigned.

Updates libdatadog to a version that includes dependencies and integrations
in app-extended-heartbeat. The previous behaviour omitted those fields and
caused a duplicate app-integrations-change / app-dependencies-loaded on the
next regular flush.

Adds an integration test (TelemetryExtendedHeartbeatTests) that drives
phpredis and exec via custom_integrations.php and asserts:
  1. They appear in a regular app-started/app-integrations-change.
  2. The next app-extended-heartbeat re-emits configuration, dependencies,
     and integrations (with phpredis present).
  3. Loading a fresh integration afterwards produces an
     app-integrations-change containing only the new integration —
     phpredis is not re-emitted, confirming the leak is fixed.

The new test runs in its own container so DD_TELEMETRY_EXTENDED_HEARTBEAT_INTERVAL=15
applies before the worker spawns. The existing TelemetryTests no longer
sets that env var, so its 24h default no longer interferes with tests
that are not about the extended heartbeat (this addresses the intermittent
'telemetry reflects the loading of a new integration' failure caused by
the heartbeat re-queueing data into the next regular flush).

Folds two helpers into TelemetryHelpers:
  - filterMessages(...) gains a userAppOnly flag (default true) that
    skips the sidecar's own datadog-ipc-helper telemetry worker.
  - WithExtendedHeartbeat / waitForExtendedHeartbeat mirror the existing
    WithIntegrations / waitForIntegrations pattern.

custom_integrations.php gains an "fs" branch (fopen on /dev/null) so
tests can trigger the filesystem deferred-loading hook.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@cataphract cataphract requested review from a team as code owners May 7, 2026 16:29
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 987505e92c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@datadog-official
Copy link
Copy Markdown

datadog-official Bot commented May 7, 2026

Tests

Fix all issues with BitsAI or with Cursor

⚠️ Warnings

🧪 30 Tests failed

tests.appsec.test_automated_login_events.Test_V3_Login_Events_Blocking.test_login_event_blocking_auto_id[apache-mod-8.0] from system_tests_suite   View in Datadog   (Fix with Cursor)
AssertionError: assert 500 == 200
 +  where 500 = HttpResponse(status_code:500, headers:{'Date': 'Thu, 07 May 2026 17:00:54 GMT', 'Server': 'Apache/2.4.66 (Debian)', 'X...ed-By': 'PHP/8.0.18', 'Content-Length': '0', 'Connection': 'close', 'Content-Type': 'text/html; charset=UTF-8'}, text:).status_code
 +    where HttpResponse(status_code:500, headers:{'Date': 'Thu, 07 May 2026 17:00:54 GMT', 'Server': 'Apache/2.4.66 (Debian)', 'X...ed-By': 'PHP/8.0.18', 'Content-Length': '0', 'Connection': 'close', 'Content-Type': 'text/html; charset=UTF-8'}, text:) = <tests.appsec.test_automated_login_events.Test_V3_Login_Events_Blocking object at 0x7f4d4f775850>.r_login

self = <tests.appsec.test_automated_login_events.Test_V3_Login_Events_Blocking object at 0x7f4d4f775850>

    def test_login_event_blocking_auto_id(self):
>       assert self.r_login.status_code == 200
E       AssertionError: assert 500 == 200
E        +  where 500 = HttpResponse(status_code:500, headers:{'Date': 'Thu, 07 May 2026 17:00:54 GMT', 'Server': 'Apache/2.4.66 (Debian)', 'X...ed-By': 'PHP/8.0.18', 'Content-Length': '0', 'Connection': 'close', 'Content-Type': 'text/html; charset=UTF-8'}, text:).status_code
...
tests.appsec.test_automated_login_events.Test_V3_Login_Events_Blocking.test_login_event_blocking_auto_id[php-fpm-8.5] from system_tests_suite   View in Datadog   (Fix with Cursor)
AssertionError: assert 500 == 200
 +  where 500 = HttpResponse(status_code:500, headers:{'Date': 'Thu, 07 May 2026 16:59:53 GMT', 'Server': 'Apache/2.4.67 (Ubuntu)', 'X...red-By': 'PHP/8.5.5', 'Content-Length': '0', 'Connection': 'close', 'Content-Type': 'text/html; charset=UTF-8'}, text:).status_code
 +    where HttpResponse(status_code:500, headers:{'Date': 'Thu, 07 May 2026 16:59:53 GMT', 'Server': 'Apache/2.4.67 (Ubuntu)', 'X...red-By': 'PHP/8.5.5', 'Content-Length': '0', 'Connection': 'close', 'Content-Type': 'text/html; charset=UTF-8'}, text:) = <tests.appsec.test_automated_login_events.Test_V3_Login_Events_Blocking object at 0x7f842ce2ff80>.r_login

self = <tests.appsec.test_automated_login_events.Test_V3_Login_Events_Blocking object at 0x7f842ce2ff80>

    def test_login_event_blocking_auto_id(self):
>       assert self.r_login.status_code == 200
E       AssertionError: assert 500 == 200
E        +  where 500 = HttpResponse(status_code:500, headers:{'Date': 'Thu, 07 May 2026 16:59:53 GMT', 'Server': 'Apache/2.4.67 (Ubuntu)', 'X...red-By': 'PHP/8.5.5', 'Content-Length': '0', 'Connection': 'close', 'Content-Type': 'text/html; charset=UTF-8'}, text:).status_code
...
tests.appsec.test_automated_login_events.Test_V3_Login_Events_Blocking.test_login_event_blocking_auto_login[apache-mod-8.0] from system_tests_suite   View in Datadog   (Fix with Cursor)
AssertionError: assert 500 == 200
 +  where 500 = HttpResponse(status_code:500, headers:{'Date': 'Thu, 07 May 2026 17:01:22 GMT', 'Server': 'Apache/2.4.66 (Debian)', 'X...ed-By': 'PHP/8.0.18', 'Content-Length': '0', 'Connection': 'close', 'Content-Type': 'text/html; charset=UTF-8'}, text:).status_code
 +    where HttpResponse(status_code:500, headers:{'Date': 'Thu, 07 May 2026 17:01:22 GMT', 'Server': 'Apache/2.4.66 (Debian)', 'X...ed-By': 'PHP/8.0.18', 'Content-Length': '0', 'Connection': 'close', 'Content-Type': 'text/html; charset=UTF-8'}, text:) = <tests.appsec.test_automated_login_events.Test_V3_Login_Events_Blocking object at 0x7f4d4f776480>.r_login

self = <tests.appsec.test_automated_login_events.Test_V3_Login_Events_Blocking object at 0x7f4d4f776480>

    def test_login_event_blocking_auto_login(self):
>       assert self.r_login.status_code == 200
E       AssertionError: assert 500 == 200
E        +  where 500 = HttpResponse(status_code:500, headers:{'Date': 'Thu, 07 May 2026 17:01:22 GMT', 'Server': 'Apache/2.4.66 (Debian)', 'X...ed-By': 'PHP/8.0.18', 'Content-Length': '0', 'Connection': 'close', 'Content-Type': 'text/html; charset=UTF-8'}, text:).status_code
...
View all

ℹ️ Info

No other issues found (see more)

❄️ No new flaky tests detected

🎯 Code Coverage (details)
Patch Coverage: 100.00%
Overall Coverage: 60.68% (-0.03%)

Useful? React with 👍 / 👎

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 987505e | Docs | Datadog PR Page | Give us feedback!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant