Skip to content

final polishing - #517

Merged
sjvans merged 5 commits into
developfrom
polish
Sep 25, 2026
Merged

sjvans merged 5 commits into
developfrom
polish

Conversation

@sjvans

@sjvans sjvans commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

Polish CaaS Exporter Buffering and Tooling Cleanup

Bug Fix

🐛 Refines CaaS exporter buffering so telemetry batches are buffered only while certificates are unavailable, flushed once certificates arrive, and then exported directly for all future calls. Also includes small documentation and tooling cleanup.

Changes

  • lib/utils/caas.js: Simplified buffering logic by removing the separate readiness state and relying on certificate availability. Buffered batches are flushed once certificates are present, the original exporter is restored, and pre-certificate batches are acknowledged while buffered.
  • README.md: Corrected the documented number of predefined telemetry kinds from six to five.
  • package.json: Updated lint and format scripts to call local binaries directly instead of using npx.
  • .oxfmtrc.jsonc: Reduced formatter ignore patterns so CHANGELOG.md and jest.config.js are no longer excluded.
  • eslint.config.mjs: Removed the custom Vitest vi global override and now exports the recommended CDS ESLint config directly.
  • lib/tracing/locate.js: Clarified the comment explaining why locate failures stay quiet during tests.
  • test/tracing.test.js: Removed an outdated Jest-related revisit comment.
  • 🔄 Regenerate and Update Summary
PR Bot Information

Version: 1.31.51

  • Correlation ID: c1d5d860-b8d8-11f1-994e-9f11a17ac661
  • Output Template: Default Template
  • File Content Strategy: Full file content
  • LLM: gpt-5.5
  • Summary Prompt: Default Prompt
  • Event Trigger: pull_request.edited

@hyperspace-pr-bot hyperspace-pr-bot 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.

I found one documentation consistency issue in the README. The code change in lib/utils/caas.js looks reasonable from the available context.

PR Bot Information

Version: 1.31.51

  • LLM: gpt-5.5
  • File Content Strategy: Full file content
  • Correlation ID: 5951c4d0-b8d2-11f1-99fa-30eb8e08a95f
  • Event Trigger: pull_request.opened

Comment thread README.md
## Predefined Kinds

There are six predefined kinds as follows:
There are five predefined kinds as follows:

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.

Bug: Predefined kind count is inconsistent with configuration

package.json still defines six predefined kinds, including telemetry-to-caas, so this text now undercounts the available options and can mislead users scanning the README. Consider keeping the count aligned with the actual configured kinds, or also documenting/removing telemetry-to-caas if that kind is intentionally no longer supported.

Suggested change
There are five predefined kinds as follows:
There are six predefined kinds as follows:

Double-check suggestion before committing. Edit this comment for amendments.


Please provide feedback on the review comment by checking the appropriate box:

  • 🌟 Awesome comment, a human might have missed that.
  • ✅ Helpful comment
  • 🤷 Neutral
  • ❌ This comment is not helpful

@sjvans
sjvans marked this pull request as ready for review September 25, 2026 12:00
@sjvans
sjvans requested a review from a team as a code owner September 25, 2026 12:00
@hyperspace-pr-bot

Copy link
Copy Markdown
Contributor

Summary

The following content is AI-generated and provides a summary of the pull request:


Polish CaaS Exporter Buffering and Tooling Config

Bug Fix

🐛 Refines CaaS exporter buffering so telemetry batches are buffered only until certificates are available. Once certificates arrive, buffered batches are flushed, the original exporter is restored, and subsequent exports go directly through the exporter.

Changes

  • lib/utils/caas.js: Removed the separate readiness state and now relies directly on certificate availability. Buffered batches are flushed once certificates are present, the buffering wrapper is removed, and pre-certificate export calls are acknowledged after buffering.
  • README.md: Corrected the documented number of predefined telemetry kinds from six to five.
  • .oxfmtrc.jsonc: Simplified formatter ignore patterns by removing CHANGELOG.md and jest.config.js from the ignored files.
  • eslint.config.mjs: Simplified ESLint configuration to use only the CAP CDS recommended config.
  • package.json: Updated lint and format scripts to call local binaries directly instead of using npx.
  • lib/tracing/locate.js: Clarified the comment around suppressing locate warnings during tests to avoid polluting log assertion output.
  • test/tracing.test.js: Removed an outdated Jest-related comment.

  • 🔄 Regenerate and Update Summary
  • ✏️ Insert as PR Description (deletes this comment)
  • 🗑️ Delete comment
PR Bot Information

Version: 1.31.51

  • Summary Prompt: Default Prompt
  • LLM: gpt-5.5
  • Output Template: Default Template
  • Event Trigger: pull_request.ready_for_review
  • Correlation ID: c4f71590-b8d8-11f1-961c-09ed1a90e674
  • File Content Strategy: Full file content

@hyperspace-pr-bot hyperspace-pr-bot 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.

I posted one new review comment about the ESLint configuration dropping the Vitest vi global while tests still use it. Also remember to address the existing README kind-count comment, since telemetry-to-caas is still configured as a predefined kind.

PR Bot Information

Version: 1.31.51

  • Correlation ID: c4f71590-b8d8-11f1-961c-09ed1a90e674
  • Event Trigger: pull_request.ready_for_review
  • File Content Strategy: Full file content
  • LLM: gpt-5.5

Comment thread eslint.config.mjs
}
}
]
export default [...cds.recommended]

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.

Bug: Vitest globals are no longer declared for ESLint

The test suite still uses the global vi helper, but @sap/cds only declares Jest/Mocha globals, so npm run lint can report vi as undefined. Consider keeping the Vitest-specific globals override or adding an equivalent Vitest globals configuration.

Suggested change
export default [...cds.recommended]
export default [
...cds.recommended,
{
// The cds eslint config declares jest/mocha test globals but not vitest's `vi`.
files: ['**/+(test|tests)/**/*.+(js|cjs|mjs)', '**/*.test.+(js|cjs|mjs)', '**/*-test.+(js|cjs|mjs)'],
languageOptions: {
globals: {
vi: 'readonly'
}
}
}
]

Double-check suggestion before committing. Edit this comment for amendments.


Please provide feedback on the review comment by checking the appropriate box:

  • 🌟 Awesome comment, a human might have missed that.
  • ✅ Helpful comment
  • 🤷 Neutral
  • ❌ This comment is not helpful

@sjvans
sjvans merged commit be2c6ae into develop Sep 25, 2026
8 checks passed
@sjvans
sjvans deleted the polish branch September 25, 2026 12:31
@sjvans sjvans mentioned this pull request Sep 28, 2026
sjvans added a commit that referenced this pull request Sep 28, 2026
# Release: `v2.1.0`

Standing release PR — accumulates everything merged into `develop` for
the next minor. **Do not squash-merge**; review and merge with a team
member to satisfy the `main` review requirement. Description kept
current as PRs land on `develop`.

### Changes so far

* `package.json` / `CHANGELOG.md`: version → `2.1.0`; `## Version 2.1.0`
changelog section.
* **CI**: runs on push/PR to `develop` (#469); dependabot targets
`develop` (#470).
* **feat:** queue worker transactions traced as coherent `<service> -
tx` spans under the `cds.spawn - run task` root (#465), plus structured
in-memory span test infrastructure (`MyInMemorySpanExporter`) replacing
console-log-regex assertions.
* **fix:** Cloud SDK outbound requests traced again — getter-only
`@sap-cloud-sdk/http-client` exports patched via
`Object.defineProperty`; added to devDeps so the path runs in CI;
cloud-sdk + native-fetch tracing tests (#451).
* **chore:** test runner migrated jest → vitest — exits cleanly without
`--forceExit` via forked-pool teardown (#474).
* **chore:** adopted `oxfmt` code formatter + `format`/`format:check`
scripts + CI check (#476).
* **chore:** release workflow cleanup (#484).
* **test:** outbox + console metrics tests read from an in-memory
`MyInMemoryMetricReader` (DELTA temporality) instead of `console.dir`
spying; added a `ConsoleMetricExporter` unit test; state-based
`expectEventually` polling replaces fixed sleeps (#479).
* **chore(deps):** OTLP dev-deps bumped to `0.221`, with
`@opentelemetry/sdk-logs` pinned to `0.219` via `overrides` (0.221 leaks
memory via the log-format re-entrancy — see #482) (#483).
* **test/fix:** full test suite runs on HANA (removed the 2-file CI
subset + dead cds<9 guards); fixes two HANA-only lib bugs surfaced by it
— raw SQL leaking into HANA INSERT `prepare` span names, and
`*_storage_time_in_seconds` gauges skewed by the machine's UTC offset
(#481).
* **fix(logging):** logging no longer recurses through
`@opentelemetry/sdk-logs` 0.221's export path — log processors are
constructed with the arg shape the installed sdk-logs version expects
(version-adaptive), plus a re-entrancy guard; the temporary sdk-logs
0.219 pin (#483) is removed (#489, closes #482).
* **test:** removed the last `console.dir` span-scraping in tracing
tests — remote/span-name tests now read the in-memory span exporter;
dropped the unused `tracing-attributes` profile (#490, #478 group 1).
* **test:** re-enabled HTTP instrumentation in the test app; tests now
assert incoming SERVER spans, W3C traceparent propagation, and the
ignore-hook/sampler suppression (#491, #475).
* **test:** centralized the duplicated test helpers (`asExternalClient`,
`clearOutbox`, `flushSpans`, `eventually`, `makeExpectEventually`,
`isOutboxScanTrace`, `meaningful`) into `test/utils.js` (#492, #488).
* **test:** configure the suites via `.cdsrc.json` profiles instead of
`process.env.cds_*` string-JSON — removes the load-order fragility
behind #481's `delete cds.env` hack (#493, #486).
* **docs:** added `TESTING.md` (authoritative test doc: sqlite-vs-HANA
isolation model, config profiles + load-order gotcha, in-memory
exporters, `test/utils.js` helpers, HTTP instrumentation, sanctioned
skips) and trimmed the duplicated explanatory comments across the test
files to one-line pointers (#494, #487).
* **chore(deps-dev):** bumped the dev-dependencies group (10 updates,
rebased onto develop) — `@cap-js/cds-test`, the four OTLP exporters,
both OTel instrumentation packages, `@sap/cds-mtxs`, `axios`, `eslint`
(#485).
* **feat:** the span processor is now configurable via
`cds.requires.telemetry.tracing.processor = { kind, config? }`
(`BatchSpanProcessor` default, `SimpleSpanProcessor` in
`[development]`), replacing the hard-coded `NODE_ENV` switch; unknown
kinds throw, mirroring the sampler/propagator validation (#498, closes
#411).
* **test:** the sqlite queue-worker tracing skips are now gated on
`@sap/cds >= 10.1` (the `cds.spawn` fix) instead of unconditional — the
4 suites (`tracing-scheduled`, `tracing-outboxed-batch`,
`tracing-messaging-inboxed`, `tracing-messaging-persistent-outbox`) run
the full worker-span path on sqlite when cds ≥ 10.1, skip on older cds /
the cds-9 CI leg, and HANA always runs (#467, #477 §1).
* **feat:** new `telemetry-to-caas` kind for SAP CaaS
(Collector-as-a-Service) — OTLP-over-mTLS export with client certs
sourced either from a `zero-trust-identity` (ZTI) binding (SVID files,
hot-rotated via a filesystem watcher) or from static x509 credentials;
exports are buffered until certs become available so nothing is dropped
during startup (#436).
* **chore:** added `CODEOWNERS` to `develop` (#497).
* **chore(deps-dev):** bumped the dev-dependencies group across 1
directory (12 updates) (#505).
* **chore(deps):** bumped the prod-dependencies group across 1 directory
(8 updates) — OTel API/core/SDK/instrumentation packages (#499).
* **feat:** tenant id and correlation id added to exported logs (#506).
* **refactor:** `lib/utils` split into focused modules (`resource`,
`credentials`, `caas`, `common`, `mtls`, `time`) and mTLS cert sourcing
decoupled (#508).
* **fix(tracing):** no longer crashes on startup under Dynatrace
OneAgent (`DT_NODE_PRELOAD_OPTIONS` set, kind `*-to-dynatrace`, no
`@opentelemetry/exporter-trace-otlp-proto` dependency) — the factory no
longer builds a tracer provider around an undefined span processor
(which crashed on the first span in `MultiSpanProcessor.onStart`); on
that path it sets up no exporter and warns. Until further notice, traces
reach Dynatrace via the OTLP exporter, not in-process OneAgent capture
(#504, closes #502; re-enablement tracked in #509).
* **feat(tracing):** Dynatrace OneAgent **in-process trace capture** is
now the supported path when OneAgent is present and the OTLP exporter is
not installed — the factory registers a recording provider (empty
span-processor list) so the CDS spans exist for OneAgent to capture
in-process, without exporting (and duplicating) them. The branching was
refactored around two axes (`via_one_agent` × standalone/CALM) and the
unverified CALM+OneAgent combination is now rejected fail-fast.
Supersedes #504's interim "OTLP exporter required" framing. A remaining
**OneAgent-side** gap — it does not yet instrument the OpenTelemetry-JS
≥2.9 SDK layout — is documented as a temporary-pin workaround on #509
and pushed to Dynatrace via a support ticket (#512, closes #509).
* **docs:** new **Running with SAP Cloud ALM (beta)** section — when
`@sap/xotel-agent-ext-js` 2.0.4+ is present the plugin detects the CALM
agent and contributes its CDS spans to the agent's pipeline as a
delegate on the shared OTel SDK (no second SDK, no duplicate setup); the
`telemetry-to-caas` deployment recipe was carved out of the public
README into the internal golden-path docs (#516, closes #99).
* **docs:** added the missing CHANGELOG entry for the tenant-id log
attribute (#513).
* **fix(caas):** CaaS exporter buffering refined — telemetry is buffered
only while mTLS certificates are unavailable, flushed once they arrive,
and exported directly thereafter; plus small docs/tooling cleanup
(#517).
* **fix:** HANA CI green again — `db.client.response.returned_rows` is
recorded for INSERT/UPDATE/DELETE that reuse a cached prepared statement
on `@cap-js/hana` ≥ 3.1.0 (the execute span carries no SQL text in that
case); `logging-mt` excluded from the HANA job (unresolvable mtxs/sqlite
driver-name bleed, zero HANA coverage); `tracing-attributes` made
order-independent on the shared HDI container; `TESTING.md` documents
running the HANA suite locally (#519).

### Follow-ups tracked (not blocking this release)
- #477 eliminate remaining test skips/exclusions — **§1 (queue-worker
sqlite skips) DONE** via #467 (now gated on `@sap/cds >= 10.1` rather
than skipped outright); **§3** (7 unimplemented tracing stubs)
actionable but out of scope for this release.

---

compiled of:
- #468
- #469
- #451
- #465
- #470
- #474
- #476
- #484
- #479
- #483
- #481
- #489
- #490
- #491
- #492
- #493
- #494
- #485
- #498
- #467
- #497
- #436
- #505
- #499
- #506
- #508
- #504
- #512
- #513
- #516
- #517
- #519

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: sjvans <sjvans@users.noreply.github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Vitaly Kozyura <58591662+vkozyura@users.noreply.github.com>
Co-authored-by: Simon Engel <simon.engel01@sap.com>
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