How azure/prometheus-collector works
The repository combines Azure Monitor’s Prometheus collector with a separate Prometheus-rule-to-ARM conversion CLI. The collector’s principal workflow is to start its configured collector runtime, discover scrape targets, scrape and export metrics for managed Azure Monitor; the README confirms the managed-store purpose. The rule converter accepts YAML/JSON rules, validates and transforms them into an ARM template. Edges are limited to relationships visible in excerpts or documented in the README; some substantial but unsampled subsystems are included without speculative wiring.
Main entry points: index.ts Conversion Flow · metrics_receiver.go Metrics Receiver · server.go Target Allocator · cli.ts Converter CLI
Components 26
Collector Runtime
- Runtime Launcher
otelcollector/main/main.go - Collector Process
otelcollector/main/main.go - Fluent Bit Output
otelcollector/fluent-bit/src/out_appinsights.go
Prometheus Scraping
- Metrics Receiver
otelcollector/prometheusreceiver/metrics_receiver.go - Target Discovery
otelcollector/prometheusreceiver/metrics_receiver.go - Scrape Manager
otelcollector/prometheusreceiver/metrics_receiver.go - Prometheus API
otelcollector/prometheusreceiver/internal/apiserver/manager.go
Target Allocation
- Allocator Integration
otelcollector/prometheusreceiver/internal/targetallocator/manager.go - Target Allocator
otelcollector/otel-allocator/internal/server/server.go - Allocation Strategies
otelcollector/otel-allocator/internal/allocation/allocator.go - Allocator Discovery
otelcollector/otel-allocator/internal/target/discovery.go - Configuration Watcher
otelcollector/otel-allocator/internal/watcher/watcher.go
Configuration and Telemetry
- Configuration Reader
otelcollector/configuration-reader-builder/main.go - Config Map Parsers
otelcollector/shared/configmap/mp/configmapparser.go
Rule Conversion CLI
- Converter CLI
tools/az-prom-rules-converter/src/cli.ts - Conversion Flow
tools/az-prom-rules-converter/src/index.ts - YAML to JSON
tools/az-prom-rules-converter/src/steps/yaml2json.ts - Input Validation
tools/az-prom-rules-converter/src/steps/validate-input-not-empty.ts - Prometheus Validation
tools/az-prom-rules-converter/src/steps/validate-prom-schemas.ts - ARM Conversion
tools/az-prom-rules-converter/src/steps/to-arm-template.ts - Rule Group Mapping
tools/az-prom-rules-converter/src/steps/to-azure/to-azure-prom-rule-group.ts - Rule Properties Mapping
tools/az-prom-rules-converter/src/steps/to-azure/to-azure-prom-rule-group-properties.ts - ARM Validation
tools/az-prom-rules-converter/src/steps/validate-arm-template.ts
Other components
- Azure Monitor Store
- Operator
- Template Output
Connections 21
- Runtime Launcher → Collector Process: starts
otelcollector/main/main.go - Runtime Launcher → Fluent Bit Output: starts
otelcollector/main/main.go - Metrics Receiver → Target Discovery: starts
otelcollector/prometheusreceiver/metrics_receiver.go - Metrics Receiver → Scrape Manager: starts
otelcollector/prometheusreceiver/metrics_receiver.go - Metrics Receiver → Allocator Integration: starts
otelcollector/prometheusreceiver/metrics_receiver.go - Metrics Receiver → Prometheus API: starts
otelcollector/prometheusreceiver/metrics_receiver.go - Collector Process → Azure Monitor Store: sends metrics
- Allocator Integration → Target Allocator: coordinates
- Target Allocator → Allocator Discovery: discovers targets
- Target Allocator → Allocation Strategies: assigns targets
- Configuration Watcher → Target Allocator: updates config
- Operator → Converter CLI: provides rules
tools/az-prom-rules-converter/src/cli.ts - Converter CLI → Conversion Flow: runs flow
tools/az-prom-rules-converter/src/cli.ts - Conversion Flow → Input Validation: validates input
tools/az-prom-rules-converter/src/index.ts - Conversion Flow → YAML to JSON: parses YAML
tools/az-prom-rules-converter/src/index.ts - Conversion Flow → Prometheus Validation: validates rules
tools/az-prom-rules-converter/src/index.ts - Conversion Flow → ARM Conversion: converts rules
tools/az-prom-rules-converter/src/index.ts - Conversion Flow → ARM Validation: validates template
tools/az-prom-rules-converter/src/index.ts - ARM Conversion → Rule Group Mapping: maps groups
tools/az-prom-rules-converter/src/steps/to-arm-template.ts - Rule Group Mapping → Rule Properties Mapping: maps properties
- Converter CLI → Template Output: writes template
tools/az-prom-rules-converter/src/cli.ts