Skip to content

Adding OpenChoreo trace module for Moesif#71

Open
ruks wants to merge 1 commit into
openchoreo:mainfrom
ruks:main1
Open

Adding OpenChoreo trace module for Moesif#71
ruks wants to merge 1 commit into
openchoreo:mainfrom
ruks:main1

Conversation

@ruks
Copy link
Copy Markdown
Contributor

@ruks ruks commented Apr 6, 2026

  • Adding OpenChoreo trace module for Moesif

Summary by CodeRabbit

  • New Features
    • Introduced observability tracing module for Moesif integration via Helm chart (v0.1.0).
    • OpenTelemetry Collector configuration for trace collection, routing, and export to Moesif.
    • Kubernetes metadata enrichment and optional tail sampling capabilities.
    • Complete setup documentation and operational guidance included.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 6, 2026

Warning

Rate limit exceeded

@ruks has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 53 minutes and 51 seconds before requesting another review.

To keep reviews running without waiting, you can enable usage-based add-on for your organization. This allows additional reviews beyond the hourly cap. Account admins can enable it under billing.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 083d4807-93f1-43e0-93b8-7a0385d08635

📥 Commits

Reviewing files that changed from the base of the PR and between ee38c31 and ebe6ad8.

⛔ Files ignored due to path filters (1)
  • observability-tracing-moesif/helm/Chart.lock is excluded by !**/*.lock
📒 Files selected for processing (6)
  • observability-tracing-moesif/README.md
  • observability-tracing-moesif/helm/.helmignore
  • observability-tracing-moesif/helm/Chart.yaml
  • observability-tracing-moesif/helm/templates/opentelemetry-collector/configMap.yaml
  • observability-tracing-moesif/helm/values.yaml
  • observability-tracing-moesif/module.yaml
📝 Walkthrough

Walkthrough

Introduces a new observability tracing module for Moesif that enables OpenTelemetry Collector deployment via Helm, with automatic trace enrichment using Kubernetes metadata, environment-based routing, and export to Moesif endpoints. Includes documentation, Helm chart manifests, collector configuration templates, and CI module declaration.

Changes

Cohort / File(s) Summary
Documentation
observability-tracing-moesif/README.md
Comprehensive setup guide for OpenChoreo observability plane integration, Helm chart installation, secret management, collector flow description, and troubleshooting commands.
Helm Chart Metadata & Infrastructure
observability-tracing-moesif/helm/.helmignore, observability-tracing-moesif/helm/Chart.yaml, observability-tracing-moesif/module.yaml
Helm chart housekeeping, chart manifest declaring v0.1.0 with OpenTelemetry Collector v0.140.0 dependency, and CI module structure initialization.
Helm Configuration Values
observability-tracing-moesif/helm/values.yaml
Default chart values for OpenTelemetry Collector deployment, RBAC setup, container image configuration, tail-sampling tuning parameters, and resource constraints.
OpenTelemetry Collector Configuration
observability-tracing-moesif/helm/templates/opentelemetry-collector/configMap.yaml
Dense OTel Collector ConfigMap with OTLP receivers, environment-based routing connector, per-environment Moesif exporters, Kubernetes attribute enrichment, optional tail-sampling, and debug export pipeline.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Poem

🐰 Hops of traces now take flight,
Through Kubernetes clusters, sparkling bright!
Moesif's eye sees all the way,
With sampling wisdom, enriched each day!

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Title check ⚠️ Warning The title does not follow the required Conventional Commits format specified in the repository template. Reformat the title to follow Conventional Commits format, e.g., 'feat: add observability-tracing-moesif module' or 'chore: add OpenChoreo trace module for Moesif'.
Description check ⚠️ Warning The description is incomplete and does not follow the required template structure with Purpose, Approach, Related Issues, Checklist, and Remarks sections. Expand the description to include all required template sections: Purpose, Approach, Related Issues, Checklist, and Remarks with relevant details.
✅ Passed checks (3 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🧹 Nitpick comments (3)
observability-tracing-moesif/helm/templates/opentelemetry-collector/configMap.yaml (2)

33-40: Consider adding a default route for unmatched traces.

If a trace's openchoreo.dev/environment attribute doesn't match any configured environment, it will be silently dropped. Consider adding a fallback pipeline or logging for unrouted traces to aid debugging.

♻️ Example: Add default route
     connectors:
       routing:
+        default_pipelines: [traces/default]
         table:
           {{- range .Values.moesif.environments }}
           - context: resource
             statement: route() where resource.attributes["openchoreo.dev/environment"] == {{ . | quote }}
             pipelines: [ traces/{{ . }} ]
           {{- end }}

Then add a default pipeline at the end of the pipelines section:

        traces/default:
          receivers: [ routing ]
          exporters: [ debug ]
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@observability-tracing-moesif/helm/templates/opentelemetry-collector/configMap.yaml`
around lines 33 - 40, The routing table under connectors -> routing in the
configMap currently only creates routes for each .Values.moesif.environments
entry and will drop traces missing openchoreo.dev/environment; add a fallback
entry to the routing.table that matches when no environment matched (e.g., a
default statement or an else-like route) that sends to a fallback pipeline
(e.g., traces/default) and also add a corresponding traces/default pipeline in
the pipelines section that attaches the routing receiver and a debug or logging
exporter so unrouted traces are captured for debugging; update the templates
that generate the route() statements and the pipelines block (referencing the
routing.table entries, the route() expression,
resource.attributes["openchoreo.dev/environment"], and pipelines: [ traces/{{ .
}} ]) to include this default route and pipeline.

47-47: Redundant or in conditional.

The or function requires multiple conditions, but only one is provided here. The same issue occurs on line 97.

♻️ Simplify the conditionals

Line 47:

-      {{- if or (eq .Values.global.installationMode "singleCluster") }}
+      {{- if eq .Values.global.installationMode "singleCluster" }}

Line 97:

-          {{- if or (eq .Values.global.installationMode "singleCluster") }}
+          {{- if eq .Values.global.installationMode "singleCluster" }}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@observability-tracing-moesif/helm/templates/opentelemetry-collector/configMap.yaml`
at line 47, The conditional uses the Helm `or` function with only one operand;
replace occurrences of `{{- if or (eq .Values.global.installationMode
"singleCluster") }}` (and the similar occurrence later) with a direct `if` using
`eq` so the check becomes `if eq .Values.global.installationMode
"singleCluster"`; update both spots where `or` wraps a single `eq` expression to
remove the redundant `or` call.
observability-tracing-moesif/helm/Chart.yaml (1)

17-21: Align the opentelemetry-collector chart version with other observability modules.

The observability-tracing-moesif module pins version 0.140.0, while observability-tracing-openobserve and observability-tracing-opensearch use 0.146.1 — a gap of 6 minor versions. Consistent versions across observability modules reduce maintenance overhead and ensure parity in features and bug fixes.

♻️ Suggested version alignment
 dependencies:
   - name: opentelemetry-collector
     repository: https://open-telemetry.github.io/opentelemetry-helm-charts
-    version: 0.140.0
+    version: 0.146.1
     condition: opentelemetry-collector.enabled
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@observability-tracing-moesif/helm/Chart.yaml` around lines 17 - 21, The
opentelemetry-collector dependency in Chart.yaml is pinned at version 0.140.0
while other observability charts use 0.146.1; update the dependency entry for
the opentelemetry-collector (look for the dependencies block and the - name:
opentelemetry-collector entry) to use the same version as the other modules
(0.146.1) so all observability modules are aligned.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In
`@observability-tracing-moesif/helm/templates/opentelemetry-collector/configMap.yaml`:
- Around line 81-89: The batch processor is conditionally defined (batch) when
$.Values.moesif.auth_mode == "api-key" but never added to the traces/in pipeline
processors list ($processors) so it is inactive; update the traces/in pipeline
(traces/in) to include the batch processor in its processors array when
auth_mode == "api-key" (i.e., conditionally append "batch" alongside the other
processor names so the defined batch processor is actually applied to incoming
traces).

In `@observability-tracing-moesif/helm/values.yaml`:
- Around line 48-57: The values.yaml currently sets
opentelemetryCollectorCustomizations.tailSampling.enabled to true while the
README and sample moesif-tracing-values.yaml state the default is false; update
the README (Configuration Parameters table and any sample snippets) to reflect
that tailSampling.enabled defaults to true (or if you prefer to change the code,
flip the values.yaml default to false) — locate references to
opentelemetryCollectorCustomizations, tailSampling, and enabled in the docs and
examples and make them consistent with the chosen default.
- Around line 59-62: The values.yaml is missing a default for
moesif.environments which the configMap.yaml template iterates over; add a
moesif section with a sensible default environments entry (e.g., an empty list
or a single default environment object) so templates that use
.Values.moesif.environments render correctly when users don't provide overrides;
update values.yaml to include the moesif key and an environments: [] (or a
minimal default env object) to prevent empty exporters/routing/pipelines in
configMap.yaml.

---

Nitpick comments:
In `@observability-tracing-moesif/helm/Chart.yaml`:
- Around line 17-21: The opentelemetry-collector dependency in Chart.yaml is
pinned at version 0.140.0 while other observability charts use 0.146.1; update
the dependency entry for the opentelemetry-collector (look for the dependencies
block and the - name: opentelemetry-collector entry) to use the same version as
the other modules (0.146.1) so all observability modules are aligned.

In
`@observability-tracing-moesif/helm/templates/opentelemetry-collector/configMap.yaml`:
- Around line 33-40: The routing table under connectors -> routing in the
configMap currently only creates routes for each .Values.moesif.environments
entry and will drop traces missing openchoreo.dev/environment; add a fallback
entry to the routing.table that matches when no environment matched (e.g., a
default statement or an else-like route) that sends to a fallback pipeline
(e.g., traces/default) and also add a corresponding traces/default pipeline in
the pipelines section that attaches the routing receiver and a debug or logging
exporter so unrouted traces are captured for debugging; update the templates
that generate the route() statements and the pipelines block (referencing the
routing.table entries, the route() expression,
resource.attributes["openchoreo.dev/environment"], and pipelines: [ traces/{{ .
}} ]) to include this default route and pipeline.
- Line 47: The conditional uses the Helm `or` function with only one operand;
replace occurrences of `{{- if or (eq .Values.global.installationMode
"singleCluster") }}` (and the similar occurrence later) with a direct `if` using
`eq` so the check becomes `if eq .Values.global.installationMode
"singleCluster"`; update both spots where `or` wraps a single `eq` expression to
remove the redundant `or` call.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: e2f54ac1-abd8-4cd4-adce-d5a28c032f0d

📥 Commits

Reviewing files that changed from the base of the PR and between bd7385c and 9b09575.

⛔ Files ignored due to path filters (1)
  • observability-tracing-moesif/helm/Chart.lock is excluded by !**/*.lock
📒 Files selected for processing (7)
  • observability-tracing-moesif/README.md
  • observability-tracing-moesif/helm/.helmignore
  • observability-tracing-moesif/helm/Chart.yaml
  • observability-tracing-moesif/helm/templates/opentelemetry-collector/configMap.yaml
  • observability-tracing-moesif/helm/templates/opentelemetry-collector/httproute.yaml
  • observability-tracing-moesif/helm/values.yaml
  • observability-tracing-moesif/module.yaml

Comment thread observability-tracing-moesif/helm/values.yaml
Comment thread observability-tracing-moesif/helm/values.yaml Outdated
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (1)
observability-tracing-moesif/helm/templates/opentelemetry-collector/configMap.yaml (1)

49-49: Simplify redundant single-operand or checks.

if or (eq ... ) is equivalent to if eq ... here. Simplifying improves readability.

♻️ Proposed cleanup
-      {{- if or (eq .Values.global.installationMode "singleCluster") }}
+      {{- if eq .Values.global.installationMode "singleCluster" }}
...
-          {{- if or (eq .Values.global.installationMode "singleCluster") }}
+          {{- if eq .Values.global.installationMode "singleCluster" }}

Also applies to: 99-99

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@observability-tracing-moesif/helm/templates/opentelemetry-collector/configMap.yaml`
at line 49, The Helm template contains redundant conditionals using an
unnecessary single-operand or, e.g. the conditional block "if or (eq
.Values.global.installationMode \"singleCluster\")" — replace these with the
simpler "if eq .Values.global.installationMode \"singleCluster\"" (and apply the
same simplification to the other occurrence around the same template noted at
lines 99-99) to improve readability; update the conditional expressions in the
opentelemetry-collector ConfigMap template accordingly.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In
`@observability-tracing-moesif/helm/templates/opentelemetry-collector/configMap.yaml`:
- Around line 54-58: The current extractor under extract -> labels uses
key_regex: (.*) and from: pod which copies all pod labels (high-cardinality/leak
risk); change it to only map explicit allowed label keys by replacing the broad
key_regex with either a whitelist regex (e.g., only specific keys) or explicit
label entries and ensure tag_name mappings reference only the approved pod
labels (update the extract.labels block and any tag_name entries to list only
required keys instead of using key_regex: (.*) and from: pod).

In
`@observability-tracing-moesif/helm/templates/opentelemetry-collector/httproute.yaml`:
- Around line 30-31: The HTTPRoute backendRefs.name is hardcoded to
"opentelemetry-collector" which can mismatch this chart’s fullnameOverride
(e.g., "moesif-tracing-collector"); update the template that renders
backendRefs.name (in httproute.yaml) to derive the service name from the chart
values (use the same helper or value used to produce fullnameOverride) so
backendRefs.name and the Service created by the subchart match; apply the same
change to all instances (including the multiClusterReceiver backend entries
around the other occurrence).

---

Nitpick comments:
In
`@observability-tracing-moesif/helm/templates/opentelemetry-collector/configMap.yaml`:
- Line 49: The Helm template contains redundant conditionals using an
unnecessary single-operand or, e.g. the conditional block "if or (eq
.Values.global.installationMode \"singleCluster\")" — replace these with the
simpler "if eq .Values.global.installationMode \"singleCluster\"" (and apply the
same simplification to the other occurrence around the same template noted at
lines 99-99) to improve readability; update the conditional expressions in the
opentelemetry-collector ConfigMap template accordingly.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: f27a3b78-4434-4e1a-a79c-0f01c4cb585e

📥 Commits

Reviewing files that changed from the base of the PR and between 9b09575 and b63a855.

⛔ Files ignored due to path filters (1)
  • observability-tracing-moesif/helm/Chart.lock is excluded by !**/*.lock
📒 Files selected for processing (7)
  • observability-tracing-moesif/README.md
  • observability-tracing-moesif/helm/.helmignore
  • observability-tracing-moesif/helm/Chart.yaml
  • observability-tracing-moesif/helm/templates/opentelemetry-collector/configMap.yaml
  • observability-tracing-moesif/helm/templates/opentelemetry-collector/httproute.yaml
  • observability-tracing-moesif/helm/values.yaml
  • observability-tracing-moesif/module.yaml
✅ Files skipped from review due to trivial changes (4)
  • observability-tracing-moesif/module.yaml
  • observability-tracing-moesif/helm/.helmignore
  • observability-tracing-moesif/helm/Chart.yaml
  • observability-tracing-moesif/README.md
🚧 Files skipped from review as they are similar to previous changes (1)
  • observability-tracing-moesif/helm/values.yaml

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

♻️ Duplicate comments (2)
observability-tracing-moesif/helm/values.yaml (1)

45-58: ⚠️ Potential issue | 🟠 Major

Add a default moesif block to keep templates render-safe by default.

configMap.yaml reads .Values.moesif.environments/.Values.moesif.endpoint (for example, Line 24 and Line 26 there), but this file has no moesif root key. With default values, this can break rendering or generate empty routing/export sections.

🐛 Proposed fix
 opentelemetryCollectorCustomizations:
   debug:
     enabled: false

   tailSampling:
     enabled: true
     decisionWait: 10s
     numTraces: 100
     expectedNewTracesPerSec: 10
     decisionCache:
       sampledCacheSize: 10000
       nonSampledCacheSize: 1000
     spansPerSecond: 10
+
+moesif:
+  environments: []
+  endpoint: "https://api.moesif.net"
+  # auth_mode: "application-id" # or "api-key"
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@observability-tracing-moesif/helm/values.yaml` around lines 45 - 58, Add a
default `moesif` root block to values.yaml so templates that read
`.Values.moesif.environments` and `.Values.moesif.endpoint` (e.g.,
configMap.yaml) don't fail during render; create a minimal safe default with
keys like `enabled: false`, `endpoint: ""`, and `environments: []` (and any
other keys your templates expect) so `configMap.yaml` and other templates
referencing `.Values.moesif.*` can safely render even when Moesif is not
configured.
observability-tracing-moesif/helm/templates/opentelemetry-collector/configMap.yaml (1)

49-53: ⚠️ Potential issue | 🟠 Major

Avoid extracting all pod labels into trace attributes.

Line 52 currently captures every pod label, which can create high-cardinality attributes and leak unintended metadata to exporters. Keep extraction to explicit allowed labels (at minimum the routing label).

🔒 Proposed fix
         extract:
           labels:
-            - tag_name: $$1
-              key_regex: (.*)
+            - tag_name: openchoreo.dev/environment
+              key: openchoreo.dev/environment
               from: pod
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@observability-tracing-moesif/helm/templates/opentelemetry-collector/configMap.yaml`
around lines 49 - 53, The current extractor under extract.labels is using a
wildcard key_regex "(.*)" which pulls every pod label into trace attributes;
replace this with an explicit allowlist of labels (e.g., use key_regex like
"^(routing_label|app|environment)$" or enumerate separate label entries) so only
known low-cardinality keys are extracted; update the block referencing
extract.labels / tag_name: $$1 / key_regex: (.*) / from: pod to either multiple
specific entries or a restrictive regex that includes only the routing label and
any other approved keys.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Duplicate comments:
In
`@observability-tracing-moesif/helm/templates/opentelemetry-collector/configMap.yaml`:
- Around line 49-53: The current extractor under extract.labels is using a
wildcard key_regex "(.*)" which pulls every pod label into trace attributes;
replace this with an explicit allowlist of labels (e.g., use key_regex like
"^(routing_label|app|environment)$" or enumerate separate label entries) so only
known low-cardinality keys are extracted; update the block referencing
extract.labels / tag_name: $$1 / key_regex: (.*) / from: pod to either multiple
specific entries or a restrictive regex that includes only the routing label and
any other approved keys.

In `@observability-tracing-moesif/helm/values.yaml`:
- Around line 45-58: Add a default `moesif` root block to values.yaml so
templates that read `.Values.moesif.environments` and `.Values.moesif.endpoint`
(e.g., configMap.yaml) don't fail during render; create a minimal safe default
with keys like `enabled: false`, `endpoint: ""`, and `environments: []` (and any
other keys your templates expect) so `configMap.yaml` and other templates
referencing `.Values.moesif.*` can safely render even when Moesif is not
configured.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 562ce831-c2b5-4f7a-819b-cde1f491b9e1

📥 Commits

Reviewing files that changed from the base of the PR and between b63a855 and ee38c31.

📒 Files selected for processing (3)
  • observability-tracing-moesif/README.md
  • observability-tracing-moesif/helm/templates/opentelemetry-collector/configMap.yaml
  • observability-tracing-moesif/helm/values.yaml
✅ Files skipped from review due to trivial changes (1)
  • observability-tracing-moesif/README.md

Signed-off-by: ruks <rukshan@wso2.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