Skip to content

fix: bound telemetry request timeout - #2048

Merged
merill merged 1 commit into
maester365:mainfrom
SamErde:agent/bound-telemetry-timeout
Jul 29, 2026
Merged

fix: bound telemetry request timeout#2048
merill merged 1 commit into
maester365:mainfrom
SamErde:agent/bound-telemetry-timeout

Conversation

@SamErde

@SamErde SamErde commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Summary

  • bound the best-effort PostHog telemetry request to five seconds
  • make the request error terminating so the existing catch reliably handles request failures
  • add focused coverage for the timeout and non-fatal failure behavior

Why

Write-Telemetry runs synchronously during Invoke-Maester. When the PostHog endpoint is blocked or unreachable, the request previously relied on the operating system or HTTP stack's default timeout and could materially delay an assessment. Telemetry is optional and should not hold up assessment execution.

Closes #2047.

Validation

  • PowerShell 7 / Pester 5.7.1: 2 passed, 0 failed
  • Windows PowerShell / Pester 5.9.0: 2 passed, 0 failed
  • Build-MaesterModule.ps1: passed
  • Test-MaesterModuleOutput.ps1: passed
  • git diff --check: passed

Summary by CodeRabbit

  • Bug Fixes

    • Added a five-second timeout for telemetry requests.
    • Improved handling of telemetry network failures so they do not disrupt the application.
  • Tests

    • Added automated coverage for request timeouts, error handling, and network failure scenarios.

@coderabbitai

coderabbitai Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: fcc089e9-a427-4bc0-8829-5c52185295ae

📥 Commits

Reviewing files that changed from the base of the PR and between 2da9a7b and 06a940b.

📒 Files selected for processing (2)
  • powershell/internal/Write-Telemetry.ps1
  • powershell/tests/functions/Write-Telemetry.Tests.ps1

📝 Walkthrough

Walkthrough

Write-Telemetry now limits its REST request to five seconds and treats REST failures as terminating errors. New Pester tests verify both request parameters and non-throwing behavior when the HTTP call fails.

Changes

Telemetry request handling

Layer / File(s) Summary
Telemetry request handling and validation
powershell/internal/Write-Telemetry.ps1, powershell/tests/functions/Write-Telemetry.Tests.ps1
The telemetry POST adds -TimeoutSec 5 and -ErrorAction Stop; tests verify these parameters and confirm HTTP failures do not escape Write-Telemetry.

Estimated code review effort: 2 (Simple) | ~10 minutes

Suggested reviewers: cloud-architekt

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely summarizes the main change: bounding the telemetry request timeout.
Description check ✅ Passed The description covers the change, rationale, linked issue, and validation, though it does not follow the template headings exactly.
Linked Issues check ✅ Passed The changes match #2047 by adding the five-second timeout, terminating error handling, and focused tests for both behaviors.
Out of Scope Changes check ✅ Passed The PR stays scoped to telemetry timeout/error handling and related tests, with no unrelated code changes apparent.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@SamErde SamErde added the enhancement New feature or request label Jul 28, 2026
@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@SamErde
SamErde marked this pull request as ready for review July 28, 2026 20:51
Copilot AI review requested due to automatic review settings July 28, 2026 20:51
@SamErde
SamErde requested a review from a team as a code owner July 28, 2026 20:51

This comment was marked as outdated.

@merill merill left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks @SamErde this makes sense.

Long term I might look at using a proper OTel package for Maester.

Maybe https://opentelemetry.io/docs/zero-code/dotnet/getting-started/

This will allow users to configure where telemetry is sent to.

@merill
merill merged commit 3a30ea8 into maester365:main Jul 29, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add a timeout to the Write-Telemetry HTTP request

3 participants