Skip to content

feat: provision a PromQL source in the dev default sources - #3311

Merged
karl-power merged 1 commit into
mainfrom
hdx-5595-auto-provision-promql-source-dev
Oct 7, 2026
Merged

karl-power merged 1 commit into
mainfrom
hdx-5595-auto-provision-promql-source-dev

Conversation

@karl-power

Copy link
Copy Markdown
Contributor

Summary

Auto-provisions a PromQL source for local dev.

  • Adds a PromQL source for default.metrics_ts to the dev DEFAULT_SOURCES. The dev collector always runs the PromQL migration, so the table exists.
  • setupTeamDefaults skips DEFAULT_SOURCES entries of kind promql unless ENABLE_PROMQL=true, so the source only appears with PromQL on.

Tests: unit tests for setupTeamDefaults with PromQL on and off.

How to test on Vercel preview

Set up a fresh dev env and check the PromQL source exists.

References

@changeset-bot

changeset-bot Bot commented Oct 7, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 439fdba

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
@hyperdx/api Patch
@hyperdx/app Patch
@hyperdx/otel-collector Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@karl-power
karl-power added this pull request to stack #3312 October 7, 2026 09:53
@vercel

vercel Bot commented Oct 7, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
hyperdx-oss Ready Ready Preview Oct 7, 2026 3:41pm UTC
hyperdx-storybook Ready Ready Preview Oct 7, 2026 3:41pm UTC

Request Review

@github-actions

github-actions Bot commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

PR Review

✅ No issues found.

@github-actions

github-actions Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Duplicate code analysis

No new duplicate code introduced by this PR.


jscpd compared this branch against origin/main
across app, api and common-utils. Only new clones are listed; the codebase
currently holds 127 in total (1.78%).
Run yarn dupes locally to reproduce, or yarn dupes:all for the full picture.

@github-actions

github-actions Bot commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

Deep Review

✅ No critical issues found.

This is a small, well-scoped change: a promql-kind skip gate in setupTeamDefaults plus a gated PromQL entry in the dev DEFAULT_SOURCES, backed by unit tests for both the enabled and disabled paths. The gate is correctly placed after required-field validation but before the source is registered for the second reference-resolution pass, so a skipped PromQL source leaves no dangling references. The test's getter-based @/config mock correctly mirrors TypeScript live-binding semantics, exercising both branches of the new gate.

🔵 P3 nitpicks (1)
  • packages/api/src/__tests__/setupDefaults.test.ts:1 — The test substitutes a simplified two-source DEFAULT_SOURCES, so a malformed promql entry in the shipped .env.development would be silently skipped by the pre-gate required-field validation (logger.warn, no throw) even with ENABLE_PROMQL=true, and no test would catch it.
    • Fix: Add a test that parses the shipped DEFAULT_SOURCES JSON and asserts the promql entry carries the required name/kind/connection fields.

Reviewers (5): correctness, testing, maintainability, project-standards, kieran-typescript.

Testing gaps:

  • The validation-skip branch (missing name/kind/connection) and the createSource catch/continue path share control flow with the new gate but remain uncovered; a single failing source silently logging without aborting provisioning is unasserted.
  • No test covers a non-PromQL source referencing a skipped PromQL source via metricSourceId/logSourceId; harmless today since no shipped source references the PromQL entry, but the graceful-degradation path is unverified.

No finding blocks merge automatically. A maintainer will expect P0/P1 findings in code this PR changes to be fixed; P2/P3 are your call -- fix or reply. Never fix findings about surrounding code here; reply instead. Do not widen the PR. How to respond

@greptile-apps

greptile-apps Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 4/5

[Medium risk] Adds conditional logic to skip PromQL sources in dev setup.

The skip must emit the required metric and span attribute before merging.

Fix All in Claude CodeFindings

  1. P2 Skipped sources lack metrics ▶

Summary

Adds a PromQL source for default.metrics_ts to the development defaults.

  • Skips default PromQL sources when ENABLE_PROMQL is off.
  • Adds tests for both flag settings and a patch changeset.
  • No new findings.

Reviews (3) · Last reviewed commit: "feat: provision a PromQL source in the d..." · Reviewed by Greptile

@github-actions

github-actions Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

E2E Test Results

✅ All tests passed • 400 passed • 1 skipped • 1638s

Status Count
✅ Passed 400
❌ Failed 0
⚠️ Flaky 0
⏭️ Skipped 1

Tests ran across 4 shards in parallel.

View full report →

pulpdrew
pulpdrew previously approved these changes Oct 7, 2026

@pulpdrew pulpdrew 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.

LGTM, this is very convenient

@karl-power
karl-power force-pushed the hdx-5595-auto-provision-promql-source-dev branch from 61e4f45 to 40c4f04 Compare October 7, 2026 15:21
@github-actions github-actions Bot added the review/tier-2 Low risk — AI review + quick human skim label Oct 7, 2026
@github-actions

github-actions Bot commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

🔵 Tier 2 — Low Risk

Small, isolated change with no API route or data model modifications.

Why this tier:

  • Standard feature/fix — introduces new logic or modifies core functionality

Review process: AI review + quick human skim (target: 5–15 min). Reviewer validates AI assessment and checks for domain-specific concerns.
SLA: Resolve within 4 business hours.

Stats
  • Production files changed: 2
  • Production lines changed: 18 (+ 87 in test files, excluded from tier calculation)
  • Branch: hdx-5595-auto-provision-promql-source-dev
  • Author: karl-power

To override this classification, remove the review/tier-2 label and apply a different review/tier-* label. Manual overrides are preserved on subsequent pushes.

Comment on lines +132 to +134
logger.info(
`Skipping default source ${sourceConfig.name}: PromQL is disabled`,
);

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.

P2 Skipped sources lack metrics

The new PromQL skip writes a countable log event but emits no metric or span attribute. The repository guide requires both for logged skips, so developers can count them and see the reason on the active span. Add these alongside the log before merging to satisfy that requirement.

Context Used: AGENTS.md (source)

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Fix in Claude Code Fix in Conductor Fix in Cursor Fix in Codex

Base automatically changed from hdx-5595-auto-detect-promql-source to main October 7, 2026 15:37
@karl-power
karl-power merged commit 6ea5f52 into main Oct 7, 2026
30 checks passed
@kodiakhq
kodiakhq Bot deleted the hdx-5595-auto-provision-promql-source-dev branch October 7, 2026 16:01

This branch was successfully deployed

2 active deployments
Preview – hyperdx-oss — 439fdbac Deployed Oct 7, 2026 by vercel[bot]
Preview – hyperdx-storybook — 439fdbac Deployed Oct 7, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

automerge review/tier-2 Low risk — AI review + quick human skim

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants