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
Open
Conversation
…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
Author
|
@johannes-vogel @sjvans @mariayord @PDT42 @vkozyura could you take a look at this fix when you have a chance? Fixes #459. |
Author
|
cc @hyperspace-pr-bot for automated review. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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-jsexposes the composite delegate APIs (getCompositeSpanProcessor,getCompositeMetricReader,getCompositeLogRecordProcessor).Versions of
@sap/xotel-agent-ext-jsthat don't export these functions cause@cap-js/telemetryto 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()inlib/utils.js, which checks not only that@sap/xotel-agent-ext-jsis a dependency, but that it actually exports the three composite delegate functions required for the CALM integration.lib/index.jsnow uses this instead of the raw dependency check, falling back tosetup_standalone()when the required APIs aren't available.Testing
Fixes #459