{"id":40892239,"url":"https://github.com/staticaland/cue-otel","last_synced_at":"2026-01-22T02:10:08.209Z","repository":{"id":301916716,"uuid":"1008394802","full_name":"staticaland/cue-otel","owner":"staticaland","description":null,"archived":false,"fork":false,"pushed_at":"2025-06-25T14:18:26.000Z","size":15,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-01-19T11:38:38.072Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"CUE","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/staticaland.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-06-25T13:29:22.000Z","updated_at":"2025-06-25T13:29:40.000Z","dependencies_parsed_at":"2025-06-29T16:15:39.949Z","dependency_job_id":"e2d52017-d1bf-4af5-a0b6-afaad69653ec","html_url":"https://github.com/staticaland/cue-otel","commit_stats":null,"previous_names":["staticaland/cue-otel"],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/staticaland/cue-otel","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/staticaland%2Fcue-otel","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/staticaland%2Fcue-otel/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/staticaland%2Fcue-otel/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/staticaland%2Fcue-otel/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/staticaland","download_url":"https://codeload.github.com/staticaland/cue-otel/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/staticaland%2Fcue-otel/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28650884,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-22T01:17:37.254Z","status":"online","status_checked_at":"2026-01-22T02:00:07.137Z","response_time":144,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-01-22T02:10:07.595Z","updated_at":"2026-01-22T02:10:08.190Z","avatar_url":"https://github.com/staticaland.png","language":"CUE","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CUE OpenTelemetry Configuration\n\nA minimal-but-complete OpenTelemetry Collector configuration expressed in CUE, demonstrating the \"layer-cake\" model for reusable configuration management.\n\n## Overview\n\nThis project provides:\n- A base OpenTelemetry Collector configuration as a CUE definition\n- Environment-specific overlays (dev, prod) that extend the base\n- Build tooling to generate YAML configurations\n- Validation to ensure configurations are well-formed\n\n## Structure\n\n```\n├── base.cue              # Base collector definition (#Collector)\n├── examples/\n│   ├── dev.cue          # Development overlay\n│   ├── prod.cue         # Production overlay\n│   ├── custom-processor.cue    # Custom processors example\n│   └── pipeline-insertion.cue  # Pipeline manipulation example\n├── scripts/\n│   └── build.sh         # Build script\n└── justfile             # Build targets\n```\n\n## Usage\n\n### Building Configurations\n\nGenerate YAML configurations from CUE files:\n\n```bash\njust build\n```\n\nThis creates YAML configurations for all examples:\n- `output/collector-dev.yaml` - Development configuration\n- `output/collector-prod.yaml` - Production configuration\n- `output/collector-custom-processor.yaml` - Custom processors example\n- `output/collector-pipeline-insertion.yaml` - Pipeline manipulation example\n\n### Validating Configurations\n\nValidate all CUE files:\n\n```bash\njust validate\n```\n\n### Manual Commands\n\nExport specific configurations:\n\n```bash\n# Development configuration\ncue export ./examples/dev.cue -e collector -o yaml \u003e collector-dev.yaml\n\n# Production configuration\ncue export ./examples/prod.cue -e collector -o yaml \u003e collector-prod.yaml\n\n# With build-time parameters\ncue export ./examples/prod.cue -e collector -t build_id=$(git rev-parse --short HEAD) -o yaml\n```\n\n## Base Configuration\n\nThe base configuration (`#Collector`) includes:\n\n- **Receivers**: OTLP (HTTP and gRPC)\n- **Processors**: batch, memory_limiter\n- **Exporters**: OTLP\n- **Service Pipelines**: traces, metrics, logs\n\n## Configuration Examples\n\n### Development (`examples/dev.cue`)\n- Insecure TLS connections\n- Local endpoints\n- Reduced batch sizes and memory limits\n\n### Production (`examples/prod.cue`)\n- Secure TLS with certificates\n- Production endpoints\n- API key authentication\n- Optimized batch sizes and memory limits\n\n### Custom Processors (`examples/custom-processor.cue`)\n- Resource processor for adding custom attributes\n- Transform processor for span modification\n- Demonstrates processor insertion in traces pipeline\n\n### Pipeline Manipulation (`examples/pipeline-insertion.cue`)\n- Shows multiple approaches to modify base pipelines\n- Direct processor reference by index\n- List concatenation and slicing patterns\n\n## Using as a Module\n\nImport this base configuration in other CUE projects:\n\n```bash\ncue get pkg github.com/staticaland/cue-otel-config\n```\n\nThen use in your configurations:\n\n```cue\npackage myproject\n\nimport \"github.com/staticaland/cue-otel-config\"\n\ncollector: otel.#Collector \u0026 {\n    exporters: {\n        otlp: {\n            endpoint: \"my-custom-endpoint:4317\"\n        }\n    }\n}\n```\n\n## CUE Features Demonstrated\n\n- **Definitions** (`#Collector`) - Reusable, immutable base configurations\n- **Unification** (`\u0026`) - Deep merging of configurations\n- **Defaults** (`*value | type`) - Sensible defaults with override capability\n- **Optional fields** (`field?`) - Flexible configuration options\n- **Disjunctions** (`\"a\" | \"b\"`) - Constrained choices\n- **List operations** (`list.Concat`, indexing, slicing) - Dynamic list manipulation\n- **Field references** (`base.#Collector.service.pipelines.traces.processors[0]`) - Direct access to nested fields\n- **Validation** - Automatic schema validation and conflict detection\n\n## Advanced Patterns\n\n### Pipeline Processor Manipulation\n\nThe examples demonstrate several patterns for modifying the base pipeline processors:\n\n```cue\n// Reference base processors directly\nprocessors: [\n    base.#Collector.service.pipelines.traces.processors[0],  // \"memory_limiter\"\n    \"custom_processor\",\n    base.#Collector.service.pipelines.traces.processors[1]   // \"batch\"\n]\n\n// Prepend processors\nprocessors: list.Concat([[\"resource\"], base.#Collector.service.pipelines.traces.processors])\n\n// Append processors  \nprocessors: list.Concat([base.#Collector.service.pipelines.traces.processors, [\"sampler\"]])\n\n// Complex insertions using slicing\nprocessors: list.Concat([\n    [base.#Collector.service.pipelines.traces.processors[0]], \n    [\"transform\"], \n    base.#Collector.service.pipelines.traces.processors[1:]\n])\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstaticaland%2Fcue-otel","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstaticaland%2Fcue-otel","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstaticaland%2Fcue-otel/lists"}