Skip to content

fix: workaround for cds.cli.command bug#374

Merged
sjvans merged 8 commits into
2from
TELEMETRY_SKIP_BUILD
Jun 26, 2026
Merged

fix: workaround for cds.cli.command bug#374
sjvans merged 8 commits into
2from
TELEMETRY_SKIP_BUILD

Conversation

@sjvans

@sjvans sjvans commented Sep 15, 2025

Copy link
Copy Markdown
Contributor

Fix: Workaround for cds.cli.command Bug with build Command

Bug Fix

🐛 Added a workaround to prevent the telemetry plugin from loading when the cds build command is invoked. Due to a bug in cds.cli.command, the build command incorrectly resolves to an empty string (''), causing the plugin initialization check to pass unintentionally.

Changes

  • cds-plugin.js: Added an early return guard that checks if build is present in process.argv. This ensures the plugin exits before proceeding with initialization when the cds build command is used, mirroring the existing workaround for cds add.
  • 🔄 Regenerate and Update Summary
PR Bot Information

Version: 1.26.5

  • Correlation ID: 4743ca7e-193a-4675-a529-8872b09ede9e
  • Summary Prompt: Default Prompt
  • LLM: anthropic--claude-4.6-sonnet
  • Output Template: Default Template
  • Event Trigger: pull_request.ready_for_review
  • 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.

The change itself is a reasonable workaround, but the guard on line 6 is too broad — it will suppress the plugin for any process whose argv contains the bare string 'build' regardless of context, unlike the more precise positional check already used for 'add'.

PR Bot Information

Version: 1.26.5

  • File Content Strategy: Full file content
  • Event Trigger: pull_request.ready_for_review
  • LLM: anthropic--claude-4.6-sonnet
  • Correlation ID: 4743ca7e-193a-4675-a529-8872b09ede9e

Comment thread cds-plugin.js Outdated
@sjvans
sjvans changed the base branch from main to 2 June 26, 2026 14:30
sjvans and others added 2 commits June 26, 2026 16:30
Co-authored-by: hyperspace-insights[bot] <209611008+hyperspace-insights[bot]@users.noreply.github.com>
@sjvans
sjvans merged commit 89c985e into 2 Jun 26, 2026
3 checks passed
@sjvans
sjvans deleted the TELEMETRY_SKIP_BUILD branch June 26, 2026 14:32
@sjvans sjvans mentioned this pull request Jun 28, 2026
1 task
sjvans added a commit that referenced this pull request Jun 29, 2026
# Release: `v2.0.0` — OpenTelemetry SDK 2.0 Support

### New Features

🚀 This major release upgrades `@cap-js/telemetry` to support
**OpenTelemetry SDK 2.0**, introduces
`@opentelemetry/instrumentation-undici` as a default instrumentation,
adds CALM (`@sap/xotel-agent-ext-js`) integration, and drops support for
`@sap/cds^8`.

### Changes

* `package.json`: Bumped version to `2.0.0`. Updated all
`@opentelemetry/*` dependencies to SDK 2.x-compatible versions. Replaced
`@opentelemetry/host-metrics` with
`@opentelemetry/instrumentation-host-metrics`. Added
`@opentelemetry/instrumentation-undici` as a new default
instrumentation. Dropped `@sap/cds^8` peer dependency support. Updated
`vcap` binding config for Dynatrace and Cloud Logging to also match by
tag.
* `cds-plugin.js`: Removed the startup check that blocked usage with
OpenTelemetry SDK 2.0. Added a workaround for `cds build` command
detection.
* `lib/index.js`: Refactored to support two setup modes:
`setup_standalone` (default) and `setup_with_calm` (when
`@sap/xotel-agent-ext-js` is detected). Auto-detection of
`@opentelemetry/instrumentation-host-metrics` as an instrumentation,
with `metricGroups` limited to `['process.cpu', 'process.memory']` by
default.
* `lib/tracing/index.js`: Added CALM delegate support for span
processors. Replaced deprecated `Resource` with
`resourceFromAttributes`. Updated to use `spanProcessors` constructor
option instead of `addSpanProcessor`. Added SAP Passport cleanup for new
transactions.
* `lib/metrics/index.js`: Added CALM delegate support for metric
readers. Replaced deprecated `Resource`/`View`/`DropAggregation` APIs
with `resourceFromAttributes` and `readers` constructor option. Removed
`lib/metrics/host.js` (replaced by instrumentation-based approach).
* `lib/logging/index.js`: Added CALM delegate support for log
processors. Refactored provider initialization. Improved error message
for missing Cloud Logging credentials.
* `lib/utils.js`: Replaced `getEnv`/`getEnvWithoutDefaults` with
`getStringFromEnv`. Replaced `new Resource(...)` with
`resourceFromAttributes(...)` throughout.
* `lib/exporter/ConsoleSpanExporter.js`: Updated span parent references
from deprecated `parentSpanId` to `parentSpanContext?.spanId`.
* `lib/exporter/ConsoleMetricExporter.js`: Updated scope name check for
host metrics instrumentation.
* `lib/tracing/trace.js`: Updated `instrumentationLibrary` reference to
`instrumentationScope` (SDK 2.0 rename).
* `README.md`: Removed the "not yet supported" warning for OpenTelemetry
SDK 2.0. Updated host metrics docs to reflect the new `metricGroups`
configuration. Added `undici` to default instrumentations list.
Clarified Cloud Logging user-provided service tag requirement to `"Cloud
Logging"` only.
* `CHANGELOG.md`: Updated version header to `2.0.0` with added, changed,
fixed, and removed entries.
* `.github/workflows/ci.yml`: Updated CI matrix to test only with
`cds-version: [9]`; added branch `2` to push triggers.
* `test/bookshop/.cdsrc.json`: Extracted CDS profile-based test
configurations from `package.json` into a dedicated config file.
* Various test files: Migrated from `cds.test().in(...)` to
`cds.test(..., '--profile', ...)` pattern; reduced wait times from 300ms
to 150ms in metrics tests.

- [ ] 🔄 Regenerate and Update Summary



<details>
<summary>PR Bot Information</summary>

**Version:** `1.26.11`

- Event Trigger: `pull_request.edited`
- Output Template: [Default
Template](https://github.tools.sap/intelligent-insights/i2-pull-request/blob/main/src/services/llm/prompts/summary_default_output_template.md)
- Correlation ID: `99a59df9-b306-487f-9485-bc9d1b221f55`
- Summary Prompt: [Default
Prompt](https://github.tools.sap/intelligent-insights/i2-pull-request/blob/main/src/services/llm/prompts/summary_instructions_prompt.md)
- File Content Strategy: Full file content
- LLM: `anthropic--claude-4.6-sonnet`
</details>

---

compiled of:
- #364
  + #424
  + #442
- #407
- #374
- #425
- #443

---------

Co-authored-by: Vitaly Kozyura <58591662+vkozyura@users.noreply.github.com>
Co-authored-by: I548646 <paul.erlenwein@sap.com>
Co-authored-by: Paul <paul.erlenwein@gmail.com>
Co-authored-by: hyperspace-insights[bot] <209611008+hyperspace-insights[bot]@users.noreply.github.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