Skip to content

Conversation

@knudtty
Copy link
Contributor

@knudtty knudtty commented Oct 7, 2025

Gets us closer to a staging instance of json

image

@changeset-bot
Copy link

changeset-bot bot commented Oct 7, 2025

⚠️ No Changeset found

Latest commit: c74aea8

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

@vercel
Copy link

vercel bot commented Oct 7, 2025

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

Project Deployment Preview Comments Updated (UTC)
hyperdx-v2-oss-app Ready Ready Preview Comment Nov 4, 2025 9:17pm

@github-actions
Copy link
Contributor

github-actions bot commented Oct 7, 2025

E2E Test Results

All tests passed • 39 passed • 3 skipped • 296s

Status Count
✅ Passed 39
❌ Failed 0
⚠️ Flaky 0
⏭️ Skipped 3

View full report →

@claude
Copy link

claude bot commented Oct 9, 2025

Pull Request Review: Split JSON OTel Collector for Dev Environment

This PR introduces a second OTel collector instance (otel-collector-json) to run alongside the standard collector during development.

Strengths

  • Clear separation of concerns using feature flags
  • Backward compatible with existing workflow
  • Well-structured conditional logic

Critical Issues

1. Server Startup Logic Bug (HIGH PRIORITY)
Location: packages/api/src/server.ts:49
The condition !config.IS_DEV || !config.IS_OPAMP_ONLY will start the app server in production even when IS_OPAMP_ONLY=true. Should be !(config.IS_DEV && config.IS_OPAMP_ONLY).

2. Missing Tests (HIGH PRIORITY)
No unit tests for new config flags (IS_OPAMP_ONLY, IS_JSON_OPAMP), server startup logic combinations, or OpAMP controller conditional config.

3. Missing Documentation (MEDIUM PRIORITY)
New environment variables lack JSDoc comments explaining their purpose and usage.

Other Issues

OPAMP_PORT Validation (LOW)
Location: packages/api/src/config.ts:32
If OPAMP_PORT is not set, parseInt returns NaN. Add validation or default value.

Redundant Conditional (LOW)
Location: packages/api/src/opamp/controllers/opampController.ts:263
The spread ...(otlpExporter ? otlpExporter : {}) is redundant since otlpExporter is always defined.

Hardcoded Port (MEDIUM)
Location: docker-compose.dev.yml:65
JSON OpAMP URL uses port 4321 but default is 4320. Add comment explaining why.

API Key Handling (INFO)
Location: packages/api/src/opamp/controllers/opampController.ts:160
Consider logging warning when no API key available in dev mode.

Performance Note
Running two collectors doubles resource usage. Document when to use JSON vs standard collector.

Concurrency Colors (LOW)
package.json has 4 colors but 5 processes. Add 5th color.

Recommendations

Must Fix:

  1. Fix boolean logic in server.ts:49
  2. Add unit tests for new functionality
  3. Document new environment variables

Should Fix:
4. Add OPAMP_PORT validation
5. Document resource implications
6. Add integration tests

Nice to Have:
7. Clean up redundant conditionals
8. Improve naming consistency
9. Fix concurrency script colors

Overall

Well-structured PR that achieves its goal. Main blockers are the logic bug and missing tests. Once addressed, ready to merge!

Reviewed per CLAUDE.md conventions

@knudtty
Copy link
Contributor Author

knudtty commented Oct 15, 2025

@claude

@claude
Copy link

claude bot commented Oct 15, 2025

PR Review

Summary

This PR adds a second OTel collector instance (otel-collector-json) to enable testing the JSON schema feature in development alongside the standard collector.

Issues Found

  • ⚠️ Hardcoded API key in config file (docker/otel-collector/custom.config.yaml:23) → While this matches .env.development, hardcoded credentials in config files are a security risk. Consider using environment variable substitution (e.g., ${HYPERDX_API_KEY}) to avoid accidental credential leaks if this file is ever used outside dev.

  • ⚠️ Uncommented OTEL_SUPERVISOR_LOGS in main collector (docker-compose.dev.yml:36) → This enables verbose logging for the primary collector. Confirm this is intentional for dev, or should remain commented by default.

  • ℹ️ Missing sessionSourceId in JSON sources (packages/api/.env.development) → The new JSON Logs and JSON Traces sources do not reference a sessionSourceId like the standard sources do. Verify if this is intentional or if sessions should be excluded from JSON testing.

Minor Notes

  • Port conflict risk: Ensure port 14318 does not collide with other local services
  • The nop exporter addition in opampController.ts:70 correctly supports the new dev.json.config.yaml pipeline

Recommendation: Address the hardcoded credential issue before merge. Other items are minor and can be addressed if needed.

Copy link
Member

@wrn14897 wrn14897 left a comment

Choose a reason for hiding this comment

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

I think adding OTEL_AGENT_FEATURE_GATE_ARG should be sufficient. We can let developers decide whether to switch over and test the JSON columns to minimize code changes. If we are going to test JSON features more, imo we should just enable it by default

Copy link
Contributor

@dhable dhable left a comment

Choose a reason for hiding this comment

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

Two comments about the code and a nit pick.

ch-server:
condition: service_healthy
otel-collector-json:
# image: otel/opentelemetry-collector-contrib:0.120.0
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: remove the commented line

@wrn14897 wrn14897 force-pushed the aaron/json-dev-split branch from f6dedd2 to 7eea492 Compare November 4, 2025 02:31
@wrn14897 wrn14897 dismissed their stale review November 4, 2025 02:32

Pushed changes to use otel custom config instead

@wrn14897
Copy link
Member

wrn14897 commented Nov 4, 2025

reimplemented the data forking using otel config override (b2f7e48)

@wrn14897 wrn14897 force-pushed the aaron/json-dev-split branch from d2d2dfa to b2f7e48 Compare November 4, 2025 02:43
# Uncomment to enable JSON schema in ClickHouse
# Be sure to also set BETA_CH_OTEL_JSON_SCHEMA_ENABLED to 'true' in ch-server
# OTEL_AGENT_FEATURE_GATE_ARG: '--feature-gates=clickhouse.json'
OTEL_SUPERVISOR_LOGS: 'true'
Copy link
Member

Choose a reason for hiding this comment

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

IMO, we should enable supervisor logs (easier debugging)

environment:
CLICKHOUSE_ENDPOINT: 'tcp://ch-server:9000?dial_timeout=10s'
CLICKHOUSE_PROMETHEUS_METRICS_ENDPOINT: 'ch-server:9363'
HYPERDX_OTEL_EXPORTER_CLICKHOUSE_DATABASE: 'otel_json'
Copy link
Member

Choose a reason for hiding this comment

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

hardcode the target database

},
},
exporters: {
nop: null,
Copy link
Member

Choose a reason for hiding this comment

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

used for disabling rrweb export (json-otel-collector)

otlphttp/json:
endpoint: http://otel-collector-json:4318
headers:
authorization: "super-secure-ingestion-api-key"
Copy link
Member

Choose a reason for hiding this comment

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

INGESTION_API_KEY="super-secure-ingestion-api-key"

Copy link
Member

@wrn14897 wrn14897 left a comment

Choose a reason for hiding this comment

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

It works on my local environment, but I’d appreciate another pair of eyes!

@kodiakhq kodiakhq bot merged commit 19c5085 into main Nov 4, 2025
8 of 9 checks passed
@kodiakhq kodiakhq bot deleted the aaron/json-dev-split branch November 4, 2025 21:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants