|
| 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 | +### Configuration Options |
| 28 | + |
| 29 | +For easier configuration management, create a `moesif-tracing-values.yaml` file: |
| 30 | + |
| 31 | +```yaml |
| 32 | +# moesif-tracing-values.yaml |
| 33 | + |
| 34 | +moesif: |
| 35 | + # List of environment names to collect traces from. |
| 36 | + # These must match the openchoreo.dev/environment label on your resources. |
| 37 | + environments: |
| 38 | + - development |
| 39 | + - production |
| 40 | + |
| 41 | + # (Optional) Moesif API endpoint. Defaults to https://api.moesif.net |
| 42 | + # endpoint: "https://api.moesif.net" |
| 43 | + |
| 44 | +opentelemetryCollectorCustomizations: |
| 45 | + tailSampling: |
| 46 | + enabled: false # Enable tail-based sampling if needed |
| 47 | +``` |
| 48 | +
|
| 49 | +Then install with: |
| 50 | +
|
| 51 | +```bash |
| 52 | +helm upgrade --install observability-tracing-moesif \ |
| 53 | + oci://ghcr.io/openchoreo/helm-charts/observability-tracing-moesif \ |
| 54 | + --create-namespace \ |
| 55 | + --namespace openchoreo-observability-plane \ |
| 56 | + --version 0.1.0 \ |
| 57 | + -f moesif-tracing-values.yaml |
| 58 | +``` |
| 59 | + |
| 60 | +#### Configuration Parameters |
| 61 | + |
| 62 | +| Parameter | Description | Default | |
| 63 | +|-----------|-------------|---------| |
| 64 | +| `moesif.environments` | List of environment names to collect traces from | `[development, production]` | |
| 65 | +| `moesif.endpoint` | (Optional) Moesif API endpoint URL | `https://api.moesif.net` | |
| 66 | +| `opentelemetryCollectorCustomizations.tailSampling.enabled` | Enable tail-based sampling | `false` | |
| 67 | + |
| 68 | +## How It Works |
| 69 | + |
| 70 | +This module deploys an **OpenTelemetry Collector** that: |
| 71 | + |
| 72 | +1. Receives OTLP traces (gRPC on port `4317`, HTTP on port `4318`) from instrumented workloads. |
| 73 | +2. Enriches spans with Kubernetes metadata (pod name, deployment, namespace, etc.) using the `k8sattributes` processor. |
| 74 | +3. Routes traces to the correct Moesif application based on the `openchoreo.dev/environment` resource attribute. |
| 75 | +4. Exports traces to Moesif using the Moesif Collector Application ID stored in the `moesif-tracing-secret` Kubernetes secret. |
| 76 | + |
| 77 | +## Troubleshooting |
| 78 | + |
| 79 | +### Check OpenTelemetry Collector logs |
| 80 | + |
| 81 | +```bash |
| 82 | +kubectl -n openchoreo-observability-plane logs -f deploy/moesif-tracing-collector |
| 83 | +``` |
| 84 | + |
| 85 | +### Verify the secret exists |
| 86 | + |
| 87 | +```bash |
| 88 | +kubectl -n openchoreo-observability-plane get secret moesif-tracing-secret |
| 89 | +``` |
| 90 | + |
| 91 | +### Check pod health |
| 92 | + |
| 93 | +```bash |
| 94 | +kubectl -n openchoreo-observability-plane get pods |
| 95 | +``` |
| 96 | + |
| 97 | +## Uninstalling |
| 98 | + |
| 99 | +```bash |
| 100 | +helm uninstall observability-tracing-moesif \ |
| 101 | + --namespace openchoreo-observability-plane |
| 102 | +``` |
| 103 | + |
| 104 | +To also remove the secret: |
| 105 | + |
| 106 | +```bash |
| 107 | +kubectl delete secret moesif-tracing-secret \ |
| 108 | + --namespace openchoreo-observability-plane |
| 109 | +``` |
0 commit comments