thanos
Deploy and configure Thanos for long-term Prometheus metric storage, global querying across multiple Prometheus instances, and data compaction. Use when a user needs durable metric storage in object storage, a unified query view across clusters, downsampling for historical data, or high-availability Prometheus with deduplication.
What this skill does
# Thanos
## Overview
Deploy Thanos to extend Prometheus with unlimited metric retention via object storage, global query view across multiple Prometheus instances, and automated downsampling. Covers sidecar, store, query, compactor, and ruler components.
## Instructions
### Task A: Thanos Sidecar with Prometheus
```yaml
# docker-compose.yml — Prometheus with Thanos sidecar uploading to S3
services:
prometheus:
image: prom/prometheus:v2.49.0
command:
- '--config.file=/etc/prometheus/prometheus.yml'
- '--storage.tsdb.path=/prometheus'
- '--storage.tsdb.min-block-duration=2h'
- '--storage.tsdb.max-block-duration=2h'
- '--web.enable-lifecycle'
volumes:
- ./prometheus.yml:/etc/prometheus/prometheus.yml:ro
- prom_data:/prometheus
ports:
- "9090:9090"
thanos-sidecar:
image: thanosio/thanos:v0.34.0
command:
- 'sidecar'
- '--tsdb.path=/prometheus'
- '--prometheus.url=http://prometheus:9090'
- '--objstore.config-file=/etc/thanos/bucket.yml'
- '--grpc-address=0.0.0.0:10901'
- '--http-address=0.0.0.0:10902'
volumes:
- prom_data:/prometheus:ro
- ./bucket.yml:/etc/thanos/bucket.yml:ro
volumes:
prom_data:
```
```yaml
# bucket.yml — Object storage configuration (S3)
type: S3
config:
bucket: "thanos-metrics-production"
endpoint: "s3.us-east-1.amazonaws.com"
region: "us-east-1"
access_key: "${AWS_ACCESS_KEY_ID}"
secret_key: "${AWS_SECRET_ACCESS_KEY}"
insecure: false
```
```yaml
# bucket.yml — GCS configuration alternative
type: GCS
config:
bucket: "thanos-metrics-production"
service_account: "/etc/thanos/gcs-sa.json"
```
### Task B: Thanos Query (Global View)
```yaml
# docker-compose-query.yml — Thanos Query for global metric view
services:
thanos-query:
image: thanosio/thanos:v0.34.0
command:
- 'query'
- '--http-address=0.0.0.0:9090'
- '--grpc-address=0.0.0.0:10901'
- '--store=thanos-sidecar-cluster-a:10901'
- '--store=thanos-sidecar-cluster-b:10901'
- '--store=thanos-store-gateway:10901'
- '--store=thanos-ruler:10901'
- '--query.replica-label=replica'
- '--query.replica-label=prometheus_replica'
- '--query.auto-downsampling'
ports:
- "9090:9090"
```
```bash
# Query across all clusters via Thanos Query API
curl -s "http://thanos-query:9090/api/v1/query" \
--data-urlencode 'query=sum(rate(http_requests_total[5m])) by (cluster, service)' \
--data-urlencode 'dedup=true' | \
jq '.data.result[] | {cluster: .metric.cluster, service: .metric.service, rate: .value[1]}'
```
### Task C: Thanos Store Gateway
```yaml
# docker-compose-store.yml — Store gateway for querying object storage
services:
thanos-store:
image: thanosio/thanos:v0.34.0
command:
- 'store'
- '--objstore.config-file=/etc/thanos/bucket.yml'
- '--data-dir=/thanos/store'
- '--grpc-address=0.0.0.0:10901'
- '--http-address=0.0.0.0:10902'
- '--index-cache-size=1GB'
- '--chunk-pool-size=2GB'
- '--max-time=-2h'
volumes:
- ./bucket.yml:/etc/thanos/bucket.yml:ro
- store_cache:/thanos/store
volumes:
store_cache:
```
### Task D: Thanos Compactor
```yaml
# docker-compose-compactor.yml — Compactor for downsampling and retention
services:
thanos-compactor:
image: thanosio/thanos:v0.34.0
command:
- 'compact'
- '--objstore.config-file=/etc/thanos/bucket.yml'
- '--data-dir=/thanos/compact'
- '--http-address=0.0.0.0:10902'
- '--retention.resolution-raw=30d'
- '--retention.resolution-5m=90d'
- '--retention.resolution-1h=365d'
- '--compact.concurrency=2'
- '--downsample.concurrency=2'
- '--wait'
- '--wait-interval=5m'
volumes:
- ./bucket.yml:/etc/thanos/bucket.yml:ro
- compact_data:/thanos/compact
volumes:
compact_data:
```
### Task E: Thanos Ruler
```yaml
# docker-compose-ruler.yml — Ruler for recording and alerting rules
services:
thanos-ruler:
image: thanosio/thanos:v0.34.0
command:
- 'rule'
- '--objstore.config-file=/etc/thanos/bucket.yml'
- '--data-dir=/thanos/ruler'
- '--rule-file=/etc/thanos/rules/*.yml'
- '--query=thanos-query:9090'
- '--alertmanagers.url=http://alertmanager:9093'
- '--grpc-address=0.0.0.0:10901'
- '--http-address=0.0.0.0:10902'
- '--label=ruler_cluster="global"'
volumes:
- ./bucket.yml:/etc/thanos/bucket.yml:ro
- ./rules:/etc/thanos/rules:ro
```
```yaml
# rules/global-alerts.yml — Global alert rules evaluated by Thanos Ruler
groups:
- name: global-service-health
rules:
- alert: GlobalHighErrorRate
expr: |
sum(rate(http_requests_total{status=~"5.."}[5m])) by (service)
/ sum(rate(http_requests_total[5m])) by (service) > 0.05
for: 10m
labels:
severity: critical
scope: global
annotations:
summary: "Global error rate above 5% for {{ $labels.service }} across all clusters"
- record: global:request_rate:5m
expr: sum(rate(http_requests_total[5m])) by (service, cluster)
```
### Task F: Kubernetes Deployment
```yaml
# thanos-sidecar-container.yml — Add Thanos sidecar to Prometheus StatefulSet
containers:
- name: thanos-sidecar
image: thanosio/thanos:v0.34.0
args:
- sidecar
- --tsdb.path=/prometheus
- --prometheus.url=http://localhost:9090
- --objstore.config=$(OBJSTORE_CONFIG)
env:
- name: OBJSTORE_CONFIG
valueFrom:
secretKeyRef:
name: thanos-objstore-config
key: bucket.yml
ports:
- name: grpc
containerPort: 10901
- name: http
containerPort: 10902
volumeMounts:
- name: prometheus-data
mountPath: /prometheus
```
## Best Practices
- Set Prometheus `--storage.tsdb.min-block-duration=2h` and `max-block-duration=2h` for Thanos sidecar compatibility
- Use `--query.replica-label` to deduplicate metrics from HA Prometheus pairs
- Run exactly one compactor instance per object storage bucket to avoid data corruption
- Configure retention per resolution: keep raw data shorter, downsampled longer
- Use store gateway's `--max-time` flag to avoid overlap with sidecar's recent data
- Enable `--query.auto-downsampling` on Thanos Query for automatic resolution selection
Related in Cloud & DevOps
appbuilder-action-scaffolder
IncludedCreate, implement, deploy, and debug Adobe Runtime actions with consistent layout, validation, and error handling. Use this skill whenever the user needs to add actions to an App Builder project, understand action structure (params, response format, web/raw actions), configure actions in the manifest, use App Builder SDKs (State, Files, Events, database), deploy and invoke actions via CLI, debug action issues, or implement patterns such as webhook receivers, custom event providers, journaling consumers, large payload redirects, action sequence pipelines, and Asset Compute workers. Also trigger when users mention serverless functions in Adobe context, action logging, IMS authentication for actions, or cron-style scheduled actions.
orchestrating-datacloud
IncludedSalesforce Data Cloud product orchestrator for connect→prepare→harmonize→segment→act workflows. Use this skill when the user needs a multi-step Data Cloud pipeline, cross-phase troubleshooting, or data space and data kit management. TRIGGER when: user needs a multi-step Data Cloud pipeline, asks to set up or troubleshoot Data Cloud across phases, manages data spaces or data kits, or wants a cross-phase sf data360 workflow. DO NOT TRIGGER when: work is isolated to a single phase (use the matching phase-specific skill), the task is STDM/session tracing/parquet telemetry (use observing-agentforce), standard CRM SOQL (use querying-soql), or Apex implementation (use generating-apex).
github-project-automation
IncludedAutomate GitHub repository setup with CI/CD workflows, issue templates, Dependabot, and CodeQL security scanning. Includes 12 production-tested workflows and prevents 18 errors: YAML syntax, action pinning, and configuration. Use when: setting up GitHub Actions CI/CD, creating issue/PR templates, enabling Dependabot or CodeQL scanning, deploying to Cloudflare Workers, implementing matrix testing, or troubleshooting YAML indentation, action version pinning, secrets syntax, runner versions, or CodeQL configuration. Keywords: github actions, github workflow, ci/cd, issue templates, pull request templates, dependabot, codeql, security scanning, yaml syntax, github automation, repository setup, workflow templates, github actions matrix, secrets management, branch protection, codeowners, github projects, continuous integration, continuous deployment, workflow syntax error, action version pinning, runner version, github context, yaml indentation error
sf-datacloud
IncludedSalesforce Data Cloud product orchestrator for connect→prepare→harmonize→segment→act workflows. TRIGGER when: user needs a multi-step Data Cloud pipeline, asks to set up or troubleshoot Data Cloud across phases, manages data spaces or data kits, or wants a cross-phase `sf data360` workflow. DO NOT TRIGGER when: work is isolated to a single phase (use the matching sf-datacloud-* skill), the task is STDM/session tracing/parquet telemetry (use sf-ai-agentforce-observability), standard CRM SOQL (use sf-soql), or Apex implementation (use sf-apex).
fabric-cli
IncludedUse this skill for Fabric.so CLI workflows with the `fabric` terminal command: diagnose/install/login, search or browse a Fabric library, save notes/links/files, create folders, ask the Fabric AI assistant, manage tasks/workspaces, generate shell completion, check subscription usage, produce JSON output, and use Fabric as persistent agent memory. Do not use for Microsoft Fabric/Azure/Power BI `fab`, Daniel Miessler's Fabric framework, Python Fabric SSH, Fabric.js, or textile/fashion fabric.
lark
IncludedLark/Feishu CLI skills: lark-cli operations for docs, markdown, sheets, base, calendar, im, mail, task, okr, drive, wiki, slides, whiteboard, apps, approval, attendance, contact, vc, minutes, event. Use when the user needs to operate Lark/Feishu resources via lark-cli, send messages, manage documents, spreadsheets, calendars, tasks, OKRs, deploy web pages, or any Feishu/Lark workspace operations.