|
| 1 | +# Observability Tracing Module for Moesif |
| 2 | + |
| 3 | +This module collects traces using [OpenTelemetry Collector](https://opentelemetry.io) and exports them to [Moesif](https://www.moesif.com). |
| 4 | + |
| 5 | +## Prerequisites |
| 6 | + |
| 7 | +- [OpenChoreo](https://github.com/openchoreo/openchoreo) must be installed with the **observability plane** enabled for this module to work. |
| 8 | +- A Moesif account and a **Collector Application ID** for each environment from [Moesif](https://www.moesif.com/). |
| 9 | + |
| 10 | +## Installation |
| 11 | + |
| 12 | +### Create a Kubernetes Secret |
| 13 | + |
| 14 | +Create a Kubernetes secret containing your Moesif Collector Application IDs, with one key per environment. |
| 15 | + |
| 16 | +> **Note:** |
| 17 | +> - Use the environment name as the key (e.g., `development`, `production`). |
| 18 | +> - For environment names that contain hyphens (e.g., `my-env`), replace hyphens with underscores in the secret key (e.g., `my_env`). |
| 19 | +
|
| 20 | +```bash |
| 21 | +kubectl create secret generic moesif-tracing-secret \ |
| 22 | + --from-literal=development="YOUR_DEV_COLLECTOR_APP_ID" \ |
| 23 | + --from-literal=production="YOUR_PROD_COLLECTOR_APP_ID" \ |
| 24 | + --namespace openchoreo-observability-plane |
| 25 | +``` |
| 26 | + |
| 27 | +### Install the Helm Chart |
| 28 | + |
| 29 | +#### Installation modes |
| 30 | + |
| 31 | +This chart supports two `global.installationMode` values: |
| 32 | + |
| 33 | +- **`singleCluster`** *(default)*: Deploy the OpenTelemetry Collector into a single cluster where both the dataplane and the observability plane reside. |
| 34 | +- **`multiClusterReceiver`**: Deploy the OpenTelemetry Collector as a central receiver in the observability plane cluster. It accepts OTLP traces from remote dataplane clusters and forwards them to Moesif. |
| 35 | + |
| 36 | +#### Single-cluster topology |
| 37 | + |
| 38 | +```bash |
| 39 | +helm upgrade --install observability-tracing-moesif \ |
| 40 | + oci://ghcr.io/openchoreo/helm-charts/observability-tracing-moesif \ |
| 41 | + --create-namespace \ |
| 42 | + --namespace openchoreo-observability-plane \ |
| 43 | + --version 0.1.0 |
| 44 | +``` |
| 45 | + |
| 46 | +#### Multi-cluster topology (receiver) |
| 47 | + |
| 48 | +Install in the observability plane cluster. An HTTPRoute will be created so that dataplane clusters can push OTLP traces over HTTP/gRPC. |
| 49 | + |
| 50 | +```bash |
| 51 | +helm upgrade --install observability-tracing-moesif \ |
| 52 | + oci://ghcr.io/openchoreo/helm-charts/observability-tracing-moesif \ |
| 53 | + --create-namespace \ |
| 54 | + --namespace openchoreo-observability-plane \ |
| 55 | + --version 0.1.0 \ |
| 56 | + --set global.installationMode="multiClusterReceiver" |
| 57 | +``` |
| 58 | + |
| 59 | +### Configuration Options |
| 60 | + |
| 61 | +For easier configuration management, create a `moesif-tracing-values.yaml` file: |
| 62 | + |
| 63 | +```yaml |
| 64 | +# moesif-tracing-values.yaml |
| 65 | + |
| 66 | +global: |
| 67 | + # installationMode: "singleCluster" # default |
| 68 | + # installationMode: "multiClusterReceiver" |
| 69 | + |
| 70 | +moesif: |
| 71 | + # List of environment names to collect traces from. |
| 72 | + # These must match the openchoreo.dev/environment label on your resources. |
| 73 | + environments: |
| 74 | + - development |
| 75 | + - production |
| 76 | + |
| 77 | + # (Optional) Moesif API endpoint. Defaults to https://api.moesif.net |
| 78 | + # endpoint: "https://api.moesif.net" |
| 79 | + |
| 80 | +opentelemetryCollectorCustomizations: |
| 81 | + tailSampling: |
| 82 | + enabled: false # Enable tail-based sampling if needed |
| 83 | +``` |
| 84 | +
|
| 85 | +Then install with: |
| 86 | +
|
| 87 | +```bash |
| 88 | +helm upgrade --install observability-tracing-moesif \ |
| 89 | + oci://ghcr.io/openchoreo/helm-charts/observability-tracing-moesif \ |
| 90 | + --create-namespace \ |
| 91 | + --namespace openchoreo-observability-plane \ |
| 92 | + --version 0.1.0 \ |
| 93 | + -f moesif-tracing-values.yaml |
| 94 | +``` |
| 95 | + |
| 96 | +#### Configuration Parameters |
| 97 | + |
| 98 | +| Parameter | Description | Default | |
| 99 | +|-----------|-------------|---------| |
| 100 | +| `global.installationMode` | Installation mode: `singleCluster` or `multiClusterReceiver` | `singleCluster` | |
| 101 | +| `moesif.environments` | List of environment names to collect traces from | `[development, production]` | |
| 102 | +| `moesif.endpoint` | (Optional) Moesif API endpoint URL | `https://api.moesif.net` | |
| 103 | +| `opentelemetryCollectorCustomizations.tailSampling.enabled` | Enable tail-based sampling | `false` | |
| 104 | + |
| 105 | +## How It Works |
| 106 | + |
| 107 | +This module deploys an **OpenTelemetry Collector** that: |
| 108 | + |
| 109 | +1. Receives OTLP traces (gRPC on port `4317`, HTTP on port `4318`) from instrumented workloads. |
| 110 | +2. Enriches spans with Kubernetes metadata (pod name, deployment, namespace, etc.) using the `k8sattributes` processor (in `singleCluster` mode). |
| 111 | +3. Routes traces to the correct Moesif application based on the `openchoreo.dev/environment` resource attribute. |
| 112 | +4. Exports traces to Moesif using the Moesif Collector Application ID stored in the `moesif-tracing-secret` Kubernetes secret. |
| 113 | + |
| 114 | +## Troubleshooting |
| 115 | + |
| 116 | +### Check OpenTelemetry Collector logs |
| 117 | + |
| 118 | +```bash |
| 119 | +kubectl -n openchoreo-observability-plane logs -f deploy/moesif-tracing-collector |
| 120 | +``` |
| 121 | + |
| 122 | +### Verify the secret exists |
| 123 | + |
| 124 | +```bash |
| 125 | +kubectl -n openchoreo-observability-plane get secret moesif-tracing-secret |
| 126 | +``` |
| 127 | + |
| 128 | +### Check pod health |
| 129 | + |
| 130 | +```bash |
| 131 | +kubectl -n openchoreo-observability-plane get pods |
| 132 | +``` |
| 133 | + |
| 134 | +## Uninstalling |
| 135 | + |
| 136 | +```bash |
| 137 | +helm uninstall observability-tracing-moesif \ |
| 138 | + --namespace openchoreo-observability-plane |
| 139 | +``` |
| 140 | + |
| 141 | +To also remove the secret: |
| 142 | + |
| 143 | +```bash |
| 144 | +kubectl delete secret moesif-tracing-secret \ |
| 145 | + --namespace openchoreo-observability-plane |
| 146 | +``` |
0 commit comments