Service metrics
Long-running exporter for Hummingbird AWS Cost Explorer spend and Kubernetes Metrics API CPU/memory gauges.
Features
- Explicit collectors - nothing runs unless listed in
METRICS_CONFIG - Kubernetes Metrics API - per-container CPU and memory gauges
- AWS Cost Explorer - yesterday’s
NetAmortizedCostby team and service - Prometheus - HTTP metrics on port 9090
Configuration
Collectors are off unless listed in METRICS_CONFIG:
enabled: [kubernetes]
or
enabled: [aws_cost]
Unknown names fail startup.
| Variable | Purpose |
|---|---|
METRICS_CONFIG |
YAML with enabled collector list (required) |
KUBERNETES_CONFIG |
YAML with namespaces for the kubernetes collector |
METRICS_PORT |
HTTP port (default 9090) |
SENTRY_DSN |
Optional Sentry DSN |
AWS_ACCESS_KEY_ID / AWS_SECRET_ACCESS_KEY |
Cost Explorer IAM user (hub) |
AWS_DEFAULT_REGION |
Must be us-east-1 for Cost Explorer |
Kubernetes Metrics API
hummingbird_k8s_resource_usage{namespace,pod,container,resource} with
resource=cpu|memory. Instant gauges from
/apis/metrics.k8s.io/v1beta1/namespaces/<ns>/pods. This is not cAdvisor:
managed OpenShift does not grant nodes/metrics or cluster-monitoring-view,
so kubelet /metrics/cadvisor and platform Prometheus federation are not
available.
If KUBERNETES_CONFIG.namespaces is unset, the collector uses the pod’s
ServiceAccount namespace.
AWS costs
hummingbird_aws_cost{group,type,key} is yesterday’s NetAmortizedCost.
Queries run at process start and every 24 hours.
group=all is the shared account by app-code and SERVICE.
group=hummingbird filters app-code=RPRM-001 and groups by SERVICE,
OPERATION, USAGE_TYPE, Name tag, and SERVICE+OPERATION.
Untagged Cost Explorer keys such as app-code$ become key=untagged.
Well-known SERVICE names are shortened (S3, EC2). Dual grouping uses
S3|PutObject.
The SAM template creates an IAM user with ce:GetCostAndUsage only. Access
keys are created after deploy and stored in Vault. Deployment lives in the
infrastructure repo.
License
This project is licensed under the GNU General Public License v3.0 or later - see the LICENSE file for details.