Skip to content

fix: show canonical env var names in adapter messages#379

Merged
HugoRCD merged 4 commits into
mainfrom
fix/adapter-env-messages-dx
Jun 11, 2026
Merged

fix: show canonical env var names in adapter messages#379
HugoRCD merged 4 commits into
mainfrom
fix/adapter-env-messages-dx

Conversation

@HugoRCD

@HugoRCD HugoRCD commented Jun 11, 2026

Copy link
Copy Markdown
Owner

Summary by CodeRabbit

  • Documentation

    • Simplified adapter docs and examples to use canonical environment variable names (e.g., AXIOM_API_KEY, SENTRY_DSN) across adapters.
  • Bug Fixes

    • Improved missing-key and deprecation messaging to reference canonical env vars for clearer guidance.
  • Refactor

    • Kept framework-prefixed env var support working silently while removing those aliases from user-facing docs and output.
  • Tests

    • Added/updated tests to validate env-var formatting, deprecation warnings, and alias resolution.

@vercel

vercel Bot commented Jun 11, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
evlog-docs Ready Ready Preview, Comment, Open in v0 Jun 11, 2026 8:40pm
just-use-evlog Ready Ready Preview, Comment Jun 11, 2026 8:40pm

@github-actions github-actions Bot added the bug Something isn't working label Jun 11, 2026
@github-actions

github-actions Bot commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Thank you for following the naming conventions! 🙏

@coderabbitai

coderabbitai Bot commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 029e016f-3560-457d-af2e-9ab619671d4a

📥 Commits

Reviewing files that changed from the base of the PR and between 198b89d and 250f2dc.

📒 Files selected for processing (14)
  • .changeset/adapter-env-messages-dx.md
  • apps/docs/content/3.integrate/adapters/01.overview.md
  • apps/docs/content/3.integrate/adapters/cloud/02.otlp.md
  • apps/docs/content/3.integrate/adapters/cloud/05.better-stack.md
  • apps/docs/skills/review-logging-patterns/SKILL.md
  • packages/evlog/README.md
  • packages/evlog/src/adapters/axiom.ts
  • packages/evlog/src/adapters/better-stack.ts
  • packages/evlog/src/adapters/otlp.ts
  • packages/evlog/src/shared/config.ts
  • packages/evlog/test/adapters/axiom.test.ts
  • packages/evlog/test/adapters/better-stack.test.ts
  • packages/evlog/test/adapters/otlp.test.ts
  • packages/evlog/test/shared/config.test.ts

📝 Walkthrough

Walkthrough

This PR standardizes environment-variable messaging: it adds formatPublicEnvKeys to shared config, updates adapters to use it for user-facing error messages (while still accepting NUXT_* aliases at runtime), adjusts adapter templates/skills, updates docs/README, and adds tests for formatting and deprecation warnings.

Changes

Adapter environment variable messaging standardization

Layer / File(s) Summary
Shared config utilities for formatted env-var display
packages/evlog/src/shared/config.ts, packages/evlog/test/shared/config.test.ts
Adds formatPublicEnvKeys(...) to produce canonical user-facing env-key strings (dropping NUXT_ aliases, deduping, and formatting alternatives). applyDeprecatedAlias opts type narrowed (removed envHint) and deprecation output simplified. Tests cover formatting, fallback, and warning deduplication.
Adapter runtime messages & tests
packages/evlog/src/adapters/*.ts, packages/evlog/test/adapters/*
Adapters import and use formatPublicEnvKeys for missing-config/deprecation messages; OTLP accepts OTLP_ENDPOINT/OTLP_HEADERS aliases; tests updated/added to assert new error text and deprecation warnings for legacy fields.
Adapter template & skill guidance
.agents/skills/create-adapter/*, .agents/skills/create-adapter/references/*, apps/docs/content/5.extend/8.custom-drains.md
Adapter template and skill guidance updated to instruct listing NUXT_* keys in ConfigField.env for silent Nuxt compatibility while showing canonical <NS>_<FIELD> via formatPublicEnvKeys in messages.
Public docs, changeset, and README
apps/docs/content/**, packages/evlog/README.md, .changeset/adapter-env-messages-dx.md
Docs and README now present canonical env var names (remove Nuxt-prefixed columns/examples); changeset documents message changes and OTLP short-alias acceptance.
Memory adapter docstring
packages/evlog/src/adapters/memory.ts
Doc comment adjusted to list EVLOG_MEMORY_* env vars without NUXT_ prefixes.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Possibly related PRs

  • HugoRCD/evlog#376: Introduces foundational applyDeprecatedAlias infrastructure that this PR extends and leverages throughout adapter config handling.
  • HugoRCD/evlog#354: Updates adapter credential/token conventions for missing-credential scenarios that directly align with the error-message improvements in this PR.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The pull request description is completely empty, missing all required sections from the template including linked issue, description of changes, and the pre-merge checklist. Add a comprehensive description explaining why this change was needed, what problem it solves, and complete the documentation checklist. Link any related issues if applicable.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title 'fix: show canonical env var names in adapter messages' clearly and specifically describes the main change—updating adapter error messages to display canonical environment variable names instead of Nuxt-prefixed aliases.
Docstring Coverage ✅ Passed Docstring coverage is 83.33% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/adapter-env-messages-dx

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint install timed out. The project may have too many dependencies for the sandbox.


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 and usage tips.

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
apps/docs/content/3.integrate/adapters/cloud/02.otlp.md (1)

134-152: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Update the remaining OTLP examples to the canonical OTEL_ vars.*

The env-var table now uses OTEL_EXPORTER_OTLP_*, but the quick-start and provider-specific snippets below still tell users to set OTLP_ENDPOINT/OTLP_HEADERS. That leaves the page with two incompatible setup paths.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/docs/content/3.integrate/adapters/cloud/02.otlp.md` around lines 134 -
152, Update all remaining OTLP examples that reference
OTLP_ENDPOINT/OTLP_HEADERS to use the canonical OTEL_* names used in the env-var
table: replace OTLP_ENDPOINT -> OTEL_EXPORTER_OTLP_ENDPOINT and OTLP_HEADERS ->
OTEL_EXPORTER_OTLP_HEADERS (and any OTLP_* variants) in the quick-start and
provider-specific snippets; keep the Nuxt runtimeConfig key (otlp.endpoint) but
ensure its comment and examples state it is set via OTEL_EXPORTER_OTLP_ENDPOINT
to keep both paths consistent.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@apps/docs/content/3.integrate/adapters/01.overview.md`:
- Around line 350-375: Unify the Better Stack environment variable name across
the docs by choosing a single public name (replace BETTER_STACK_API_KEY with
BETTER_STACK_SOURCE_TOKEN): update the env block example, any prose mentions,
and all Better Stack table rows so they consistently use
BETTER_STACK_SOURCE_TOKEN; ensure any explanatory text that refers to the
variable name is adjusted accordingly (search for BETTER_STACK_API_KEY and
BETTER_STACK_SOURCE_TOKEN and standardize them to the chosen symbol in the code
block and tables).

---

Outside diff comments:
In `@apps/docs/content/3.integrate/adapters/cloud/02.otlp.md`:
- Around line 134-152: Update all remaining OTLP examples that reference
OTLP_ENDPOINT/OTLP_HEADERS to use the canonical OTEL_* names used in the env-var
table: replace OTLP_ENDPOINT -> OTEL_EXPORTER_OTLP_ENDPOINT and OTLP_HEADERS ->
OTEL_EXPORTER_OTLP_HEADERS (and any OTLP_* variants) in the quick-start and
provider-specific snippets; keep the Nuxt runtimeConfig key (otlp.endpoint) but
ensure its comment and examples state it is set via OTEL_EXPORTER_OTLP_ENDPOINT
to keep both paths consistent.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 54127822-b3bb-440b-a979-0991a234468a

📥 Commits

Reviewing files that changed from the base of the PR and between 4c51970 and 198b89d.

⛔ Files ignored due to path filters (1)
  • packages/evlog/test/toolkit/__snapshots__/api-surface.test.ts.snap is excluded by !**/*.snap
📒 Files selected for processing (27)
  • .agents/skills/create-adapter/SKILL.md
  • .agents/skills/create-adapter/references/adapter-template.md
  • .changeset/adapter-env-messages-dx.md
  • apps/docs/content/3.integrate/adapters/01.overview.md
  • apps/docs/content/3.integrate/adapters/cloud/01.axiom.md
  • apps/docs/content/3.integrate/adapters/cloud/02.otlp.md
  • apps/docs/content/3.integrate/adapters/cloud/03.posthog.md
  • apps/docs/content/3.integrate/adapters/cloud/04.sentry.md
  • apps/docs/content/3.integrate/adapters/cloud/05.better-stack.md
  • apps/docs/content/3.integrate/adapters/cloud/06.datadog.md
  • apps/docs/content/3.integrate/adapters/cloud/07.hyperdx.md
  • apps/docs/content/3.integrate/adapters/self-hosted/03.memory.md
  • apps/docs/content/5.extend/8.custom-drains.md
  • apps/docs/skills/review-logging-patterns/SKILL.md
  • packages/evlog/README.md
  • packages/evlog/src/adapters/axiom.ts
  • packages/evlog/src/adapters/better-stack.ts
  • packages/evlog/src/adapters/datadog.ts
  • packages/evlog/src/adapters/hyperdx.ts
  • packages/evlog/src/adapters/memory.ts
  • packages/evlog/src/adapters/otlp.ts
  • packages/evlog/src/adapters/posthog.ts
  • packages/evlog/src/adapters/sentry.ts
  • packages/evlog/src/shared/config.ts
  • packages/evlog/test/adapters/axiom.test.ts
  • packages/evlog/test/adapters/better-stack.test.ts
  • packages/evlog/test/shared/config.test.ts

Comment on lines +350 to 375
Each adapter reads from standard environment variables — the same names work in every framework:

```bash [.env]
# Axiom (NUXT_AXIOM_* or AXIOM_*)
# Axiom
AXIOM_API_KEY=xaat-xxx
AXIOM_DATASET=my-logs

# OTLP (NUXT_OTLP_* or OTEL_*)
OTLP_ENDPOINT=https://otlp.example.com
# OTLP
OTEL_EXPORTER_OTLP_ENDPOINT=https://otlp.example.com

# HyperDX (NUXT_HYPERDX_* or HYPERDX_*)
# HyperDX
HYPERDX_API_KEY=<YOUR_HYPERDX_API_KEY_HERE>

# PostHog (NUXT_POSTHOG_* or POSTHOG_*)
# PostHog
POSTHOG_API_KEY=phc_xxx

# Sentry (NUXT_SENTRY_* or SENTRY_*)
# Sentry
SENTRY_DSN=https://key@o0.ingest.sentry.io/123

# Better Stack (NUXT_BETTER_STACK_* or BETTER_STACK_*)
# Better Stack
BETTER_STACK_API_KEY=your-source-token

# Datadog (NUXT_DATADOG_* or DATADOG_* or DD_*)
# Datadog
DD_API_KEY=your-api-key
DD_SITE=datadoghq.eu
```

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.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Better Stack env-var naming is still inconsistent across the docs.

Both files now mention BETTER_STACK_API_KEY, but the Better Stack tables still list BETTER_STACK_SOURCE_TOKEN. Update the prose/example and the table rows to one public name in both files.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/docs/content/3.integrate/adapters/01.overview.md` around lines 350 -
375, Unify the Better Stack environment variable name across the docs by
choosing a single public name (replace BETTER_STACK_API_KEY with
BETTER_STACK_SOURCE_TOKEN): update the env block example, any prose mentions,
and all Better Stack table rows so they consistently use
BETTER_STACK_SOURCE_TOKEN; ensure any explanatory text that refers to the
variable name is adjusted accordingly (search for BETTER_STACK_API_KEY and
BETTER_STACK_SOURCE_TOKEN and standardize them to the chosen symbol in the code
block and tables).

Comment thread packages/evlog/src/shared/config.ts Outdated
The NUXT_* env aliases were never part of the public contract, so the
deprecation warning no longer surfaces them. It now only points to the
canonical config field.

Co-authored-by: linear-code[bot] <222613912+linear-code[bot]@users.noreply.github.com>
@pkg-pr-new

pkg-pr-new Bot commented Jun 11, 2026

Copy link
Copy Markdown
npm i https://pkg.pr.new/evlog@379
npm i https://pkg.pr.new/@evlog/nuxthub@379

commit: 250f2dc

Drop the BETTER_STACK_SOURCE_TOKEN env alias from user-facing docs so
the public name is BETTER_STACK_API_KEY everywhere. The legacy
sourceToken config field stays documented; the env alias keeps working
silently.

Co-authored-by: linear-code[bot] <222613912+linear-code[bot]@users.noreply.github.com>
Comment on lines +357 to +358
# OTLP (NUXT_OTLP_* or OTEL_*)
OTLP_ENDPOINT=https://otlp.example.com
# OTLP
OTEL_EXPORTER_OTLP_ENDPOINT=https://otlp.example.com

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

@linear Why aren't there any OTLP endpoints anymore? Because I see that we're using an OTL exporter OTLP endpoint, which is a longer key, whereas an OTL endpoint is shorter and perhaps clearer. Is there a logical explanation for this? Is it a standardized format, etc.? And in that case, no problem, should we leave it as is? Or can we keep the OTLP endpoint? Or at least have both?

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.

There is a logical reason: OTEL_EXPORTER_OTLP_ENDPOINT is the standard OpenTelemetry env var, and the adapter already treats that as the canonical public name in packages/evlog/src/adapters/otlp.ts. OTLP_ENDPOINT is shorter, but it’s not currently a real supported alias in code — the remaining mentions in apps/docs/content/3.integrate/adapters/cloud/02.otlp.md look like stale docs, not an intended API.

So I’d leave the canonical docs on OTEL_EXPORTER_OTLP_ENDPOINT. If you want the shorter form too, that should be an explicit product decision: add OTLP_ENDPOINT as a real silent alias in code, then decide whether to document it or keep it purely as compatibility sugar.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

I think I'd like to have that added. It'll make things easier. Just as an alias for DX.

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.

Started working on this.

AgentSession

Add the shorter OTLP_ENDPOINT and OTLP_HEADERS env vars as real aliases
for the standard OTEL_EXPORTER_OTLP_* names. The OpenTelemetry standard
names remain supported; the shorthand is purely a DX convenience. Docs
and the missing-endpoint error now reference both.

Co-authored-by: linear-code[bot] <222613912+linear-code[bot]@users.noreply.github.com>
@HugoRCD HugoRCD merged commit 8ede2c2 into main Jun 11, 2026
16 checks passed
@HugoRCD HugoRCD deleted the fix/adapter-env-messages-dx branch June 11, 2026 20:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant