Skip to content

fix: fall back to standalone telemetry setup when xotel-agent-ext-js lacks CALM composite APIs#460

Open
harjyotsital15 wants to merge 1 commit into
cap-js:mainfrom
harjyotsital15:fix/calm-support-detection
Open

fix: fall back to standalone telemetry setup when xotel-agent-ext-js lacks CALM composite APIs#460
harjyotsital15 wants to merge 1 commit into
cap-js:mainfrom
harjyotsital15:fix/calm-support-detection

Conversation

@harjyotsital15

Copy link
Copy Markdown

Problem

hasDependency('@sap/xotel-agent-ext-js') alone is used to decide whether to use the CALM integration path (setup_with_calm()). This assumes any version of @sap/xotel-agent-ext-js exposes the composite delegate APIs (getCompositeSpanProcessor, getCompositeMetricReader, getCompositeLogRecordProcessor).

Versions of @sap/xotel-agent-ext-js that don't export these functions cause @cap-js/telemetry to throw at boot:

```
TypeError: getCompositeSpanProcessor is not a function
at module.exports (lib/tracing/index.js:179:7)
at setup_with_calm (lib/index.js:115:3)
at cds-plugin.js:15:19
```

The error is caught and re-thrown, so the process doesn't crash, but tracing/metrics/logging integration silently breaks and boot logs are flooded with errors.

Fix

Add hasCalmSupport() in lib/utils.js, which checks not only that @sap/xotel-agent-ext-js is a dependency, but that it actually exports the three composite delegate functions required for the CALM integration. lib/index.js now uses this instead of the raw dependency check, falling back to setup_standalone() when the required APIs aren't available.

Testing

  • `npx eslint lib/index.js lib/utils.js --max-warnings=0` passes
  • `npx jest --silent` — all 11 runnable test suites pass (39/39 non-skipped tests)

Fixes #459

…lacks CALM composite APIs

hasDependency('@sap/xotel-agent-ext-js') alone is not enough to know
whether the CALM delegate integration is usable: older/incompatible
versions of that package don't export getCompositeSpanProcessor,
getCompositeMetricReader or getCompositeLogRecordProcessor, causing
setup_with_calm() to throw at boot (TypeError: getCompositeSpanProcessor
is not a function).

Add hasCalmSupport() which additionally verifies these APIs exist
before opting into the CALM setup path, falling back to
setup_standalone() otherwise.

Fixes cap-js#459
@harjyotsital15

Copy link
Copy Markdown
Author

@johannes-vogel @sjvans @mariayord @PDT42 @vkozyura could you take a look at this fix when you have a chance? Fixes #459.

@harjyotsital15

Copy link
Copy Markdown
Author

cc @hyperspace-pr-bot for automated review.

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.

@cap-js/telemetry@2.0.0+ breaks with @sap/xotel-agent-ext-js — getCompositeSpanProcessor is not a function

1 participant