Skip to content

Add telemetry-to-caas kind for CaaS (Collector as a Service) support#436

Draft
vkozyura wants to merge 9 commits into
mainfrom
feature/caas-support
Draft

Add telemetry-to-caas kind for CaaS (Collector as a Service) support#436
vkozyura wants to merge 9 commits into
mainfrom
feature/caas-support

Conversation

@vkozyura

Copy link
Copy Markdown
Contributor
  • Add telemetry-to-caas kind definition in package.json
  • Add getCredsForCaaS() to extract credentials from caas-service binding
  • Add augmentCaaSCreds() to configure OTLP endpoint URL
  • Handle CaaS in tracing and metrics exporters

Note: CaaS requires mTLS authentication with SAP-signed certificates. The certificate must be obtained separately via BTP Certificate Service.

- Add telemetry-to-caas kind definition in package.json
- Add getCredsForCaaS() to extract credentials from caas-service binding
- Add augmentCaaSCreds() to configure OTLP endpoint URL
- Handle CaaS in tracing and metrics exporters

Note: CaaS requires mTLS authentication with SAP-signed certificates.
The certificate must be obtained separately via BTP Certificate Service.
@hyperspace-insights

Copy link
Copy Markdown
Contributor

Summary

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


Add telemetry-to-caas Kind for CaaS (Collector as a Service) Support

New Feature

✨ Adds support for CaaS (Collector as a Service) as a telemetry destination, enabling both tracing and metrics export via OTLP over HTTP/protobuf to a caas-service binding.

⚠️ Note: CaaS requires mTLS authentication with SAP-signed certificates. The certificate must be obtained separately via BTP Certificate Service.

Changes

  • package.json: Added the telemetry-to-caas kind definition, configuring VCAP label caas-service and OTLP proto exporters for both tracing (OTLPTraceExporter) and metrics (OTLPMetricExporter).
  • lib/utils.js: Introduced getCredsForCaaS() to extract credentials from the caas-service VCAP binding, and augmentCaaSCreds() to validate OTLP endpoint availability, set the HTTP endpoint URL, and emit a warning about required mTLS configuration.
  • lib/tracing/index.js: Integrated CaaS handling in the tracing exporter setup — resolves credentials via getCredsForCaaS() and augments them with augmentCaaSCreds() when kind matches to-caas.
  • lib/metrics/index.js: Integrated CaaS handling in the metrics exporter setup — same credential resolution and augmentation pattern as tracing.

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

Version: 1.26.5

  • Correlation ID: be7942dc-b11a-457c-a83d-2aafac5eb2c3
  • Summary Prompt: Default Prompt
  • File Content Strategy: Full file content
  • LLM: anthropic--claude-4.6-sonnet
  • Event Trigger: pull_request.opened
  • Output Template: Default Template

@hyperspace-insights hyperspace-insights 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 PR is generally well-structured, but has one logic bug: when only a gRPC OTLP endpoint is present in the CaaS binding, credentials.url is set to undefined (the falsy http value), silently breaking the exporter. Please address the flagged issues before merging.

PR Bot Information

Version: 1.26.5

  • Event Trigger: pull_request.opened
  • LLM: anthropic--claude-4.6-sonnet
  • Correlation ID: be7942dc-b11a-457c-a83d-2aafac5eb2c3
  • File Content Strategy: Full file content

Comment thread lib/utils.js
}

// use http endpoint by default (proto exporter)
credentials.url = credentials.otlp.http

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.

Logic Error: When credentials.otlp.http is falsy but credentials.otlp.grpc exists, credentials.url is set to undefined (the falsy http value), silently misconfiguring the exporter. The URL should fall back to the gRPC endpoint when http is absent.

Suggested change
credentials.url = credentials.otlp.http
credentials.url = credentials.otlp.http ?? credentials.otlp.grpc

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

Comment thread lib/utils.js
// The certificate must be provided separately via BTP Certificate Service
// For now, we just set the URL and log a warning about mTLS
LOG._warn && LOG.warn('CaaS requires mTLS authentication. Make sure the SAP-signed certificate is configured.')
}

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: augmentCaaSCreds mutates the original credentials object from the VCAP binding (sets _augmented, url) as a side effect. If the credentials object is reused elsewhere, or getCredsForCaaS() is called again (e.g., both tracing and metrics paths), the first call marks _augmented = true and the second call skips re-augmentation - which is fine, but the mutation of a shared object can be surprising. Returning a new augmented object (like augmentCLCreds does) or at minimum being consistent with the other augment pattern is safer.


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

Comment thread lib/tracing/index.js
Comment thread lib/utils.js Fixed
Comment thread lib/utils.js Fixed
Comment thread lib/utils.js Fixed
This file should not be committed to the feature branch.
- Pass httpAgentOptions to OTLP exporter config as agentOptions
- Add debug logging to verify cert is being passed
- Remove monkey-patching of https.request (didn't work due to OTEL instrumentation)
The OTLP HTTP exporter expects 'httpAgentOptions' in the config,
not 'agentOptions'. This was causing the cert/key to be ignored.
When config.url is provided, OTLP exporter uses it as-is without
appending the signal resource path. CaaS binding provides base URL
without path, so we need to append /v1/traces and /v1/metrics.
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.

2 participants