Inferensys

Prompt

Metrics Collection Architecture Design Prompt

A practical prompt playbook for using the Metrics Collection Architecture Design Prompt in production AI workflows to generate architecture decision records for metrics pipelines.
Developer doing prompt engineering on laptop, prompt variations visible on screen, casual coding session.
PROMPT PLAYBOOK

When to Use This Prompt

Defines the job-to-be-done, the ideal user, and the constraints for the Metrics Collection Architecture Design Prompt.

This prompt is designed for platform engineers, SREs, and technical architects who need to produce a structured, defensible Architecture Decision Record (ADR) for a metrics collection pipeline. The job-to-be-done is not just generating a design, but forcing explicit reasoning about cardinality budgets, aggregation strategies, and storage trade-offs before any infrastructure is provisioned. Use this when you are selecting between push vs. pull models, deciding on a time-series database, or defining a standard for metric naming and labeling across services. The prompt assumes you have a clear understanding of the system's scale, the services involved, and the consumers of the metrics (e.g., dashboards, alerting systems, auto-scalers).

Do not use this prompt for general application performance monitoring (APM) setup, log aggregation design, or distributed tracing strategy—those are separate architectural concerns with different constraints. This prompt is also inappropriate for simple, single-service deployments where a managed cloud provider's default metrics agent is sufficient; it is intended for complex, multi-service architectures where uncontrolled metric cardinality can cause outages, storage costs can spiral, and aggregation rules must be defined to prevent data loss. The prompt requires you to provide a [SYSTEM_CONTEXT] that includes the service topology, expected request volumes, and existing observability stack components. Without this context, the model will produce a generic design that fails to address your specific cost and performance constraints.

The primary risk addressed by this prompt is the creation of an unmaintainable, expensive, and operationally dangerous metrics pipeline. The prompt forces the model to validate the design against USE (Utilization, Saturation, Errors) and RED (Rate, Errors, Duration) signal coverage, ensuring that the architecture supports both infrastructure and application-level monitoring. Before using the output, you must review the generated cardinality budget for feasibility against your metrics backend's documented limits. The ADR format ensures the decision is traceable and can be challenged by other engineers. Proceed by gathering your system context, defining your non-negotiable constraints (e.g., data residency, retention period), and then running the prompt to generate a draft ADR that you can refine with your team.

PRACTICAL GUARDRAILS

Use Case Fit

Where this prompt works, where it fails, and the operational preconditions required before you put it in front of a model.

01

Good Fit: Greenfield Metrics Design

Use when: You are designing a new metrics pipeline for a service or platform that does not yet have one. The prompt excels at generating a structured ADR that forces explicit decisions on cardinality budgets, aggregation rules, and storage selection. Guardrail: Provide the system context document and known constraints (e.g., cost ceiling, existing observability stack) as input; do not ask it to invent constraints from scratch.

02

Bad Fit: Real-Time Incident Diagnosis

Avoid when: You need to debug a live production incident by interpreting dashboards or raw metric streams. This prompt produces a design document, not a diagnostic analysis. It will hallucinate plausible-sounding metric interpretations without access to your actual telemetry. Guardrail: Route incident diagnosis to a runbook or log analysis prompt that is grounded in retrieved telemetry data, not architectural reasoning.

03

Required Inputs: System Context and Constraints

Risk: Without a detailed system description, the prompt generates a generic metrics architecture that ignores your actual service boundaries, traffic patterns, and existing tooling. Guardrail: Mandate at minimum a system architecture summary, known constraints (cost, cardinality limits, retention policies), and the target observability stack. Missing inputs should block generation or trigger a clarification request.

04

Operational Risk: Unvalidated Cardinality Budgets

Risk: The prompt may propose metric names and label combinations that explode cardinality in production, causing storage cost overruns or query degradation. It cannot test actual cardinality against your traffic patterns. Guardrail: Treat every cardinality recommendation as a hypothesis. Validate proposed label sets against a representative traffic sample before implementing. Add a manual review step for any label with unbounded values.

05

Operational Risk: USE/RED Coverage Gaps

Risk: The prompt claims coverage of USE (Utilization, Saturation, Errors) and RED (Rate, Errors, Duration) signals but may miss service-specific failure modes that are not captured by generic patterns. Guardrail: After generation, run a coverage checklist against known past incidents. If a past outage would not have been detected by the proposed metrics, the design is incomplete. Escalate gaps to a senior SRE for manual augmentation.

06

Process Fit: Architecture Review Gate

Risk: Teams may treat the generated ADR as an approved decision without peer review, embedding untested assumptions into production infrastructure. Guardrail: The output must pass through your standard architecture review process. Require explicit sign-off on cardinality budgets, storage selection, and aggregation rules before any implementation work begins. The prompt accelerates drafting; it does not replace engineering judgment.

PROMPT PLAYBOOK

Copy-Ready Prompt Template

A reusable prompt template for generating a metrics collection architecture decision record, ready to be copied and adapted with your system's specific constraints.

The following prompt template is designed to guide a model through the creation of a comprehensive Architecture Decision Record (ADR) for a metrics collection pipeline. It forces the model to consider cardinality budgets, aggregation strategies, storage selection, and alignment with USE and RED signals. The placeholders in square brackets are the only parts you need to customize before use.

text
You are a senior platform architect specializing in observability systems. Your task is to produce a detailed Architecture Decision Record (ADR) for a metrics collection architecture based on the provided context.

## CONTEXT
[SYSTEM_CONTEXT]

## CONSTRAINTS
- Cardinality Budget: [MAX_CARDINALITY]
- Retention Period: [RETENTION_PERIOD]
- Storage Backend: [STORAGE_BACKEND]
- Query Performance Target: [QUERY_SLA]
- Compliance Requirements: [COMPLIANCE_FRAMEWORKS]

## INSTRUCTIONS
1.  **Analyze the System Context:** Identify the key services, their interactions, and the critical user journeys.
2.  **Propose a Metrics Pipeline:** Design the flow from metric generation to storage and querying. Specify the collection agent (e.g., OpenTelemetry Collector, Prometheus), transport, and aggregation layers.
3.  **Define Aggregation Rules:** Specify how metrics should be pre-aggregated at the application, host, or cluster level to stay within the cardinality budget. Detail which labels must be preserved and which can be dropped.
4.  **Select Metric Types:** Choose between counters, gauges, histograms, and summaries for key signals, justifying your choices.
5.  **Map to USE and RED Signals:** Explicitly map your proposed metrics to the Utilization, Saturation, and Errors (USE) method for infrastructure and the Rate, Errors, and Duration (RED) method for services. Identify any gaps in coverage.
6.  **Storage and Retention Strategy:** Justify the choice of [STORAGE_BACKEND] and define a downsampling or expiration policy that aligns with the [RETENTION_PERIOD] and [QUERY_SLA].
7.  **Identify Risks and Trade-offs:** Document the risks of this architecture, such as cost overruns from label explosion or blind spots in the signal coverage.

## OUTPUT_SCHEMA
Produce your response as a valid JSON object with the following structure. Do not include any text outside the JSON block.
{
  "title": "ADR: Metrics Collection Architecture for [SYSTEM_NAME]",
  "status": "Proposed",
  "context": "A concise summary of the system and the problem this architecture solves.",
  "decision": {
    "pipeline_design": "A textual description of the metrics pipeline.",
    "aggregation_rules": [
      {
        "metric_name": "string",
        "type": "counter|gauge|histogram",
        "aggregation": "sum|average|percentile",
        "preserved_labels": ["label1", "label2"],
        "dropped_labels": ["label3"]
      }
    ],
    "storage_policy": {
      "backend": "[STORAGE_BACKEND]",
      "retention": "[RETENTION_PERIOD]",
      "downsampling_rules": "A description of how data resolution is reduced over time."
    }
  },
  "signal_coverage": {
    "use_method": {
      "utilization": ["metric1"],
      "saturation": ["metric2"],
      "errors": ["metric3"]
    },
    "red_method": {
      "rate": ["metric4"],
      "errors": ["metric5"],
      "duration": ["metric6"]
    },
    "gaps": ["A list of signals not captured by this design."]
  },
  "risks_and_tradeoffs": [
    "A list of identified risks, such as cost, complexity, or blind spots."
  ],
  "consequences": "What teams must do to implement this decision."
}

To adapt this template, replace the placeholders in the CONSTRAINTS section with your project's specific non-functional requirements. The [SYSTEM_CONTEXT] placeholder should be filled with a detailed description of your application's architecture, including a service map and key user flows. The output schema is strict JSON, which makes the result directly parseable by downstream automation, such as a CI/CD pipeline that publishes ADRs to a central repository. If your system has a high-risk profile, you should add a [RISK_LEVEL] constraint and a corresponding human-review step in your implementation harness before the ADR is accepted.

IMPLEMENTATION TABLE

Prompt Variables

Each placeholder must be replaced before the prompt is sent. Validation notes describe how to check the replacement value programmatically or manually before execution.

PlaceholderPurposeExampleValidation Notes

[SYSTEM_BOUNDARY]

Defines the scope of the system under review for metrics collection

payment-service or all services in checkout domain

Must be a non-empty string matching a known service name or domain boundary in the service catalog

[TRAFFIC_PATTERN]

Describes expected request volume, peaks, and user behavior

500 req/s steady, 2000 req/s peak weekdays 9am-12pm UTC

Must include at least one quantitative throughput estimate; null allowed if unknown but must be explicitly stated

[CRITICAL_USER_JOURNEYS]

Lists the user flows that metrics must cover for SLI definition

checkout-complete, search-to-purchase, login

Must be a non-empty list of journey identifiers; each identifier must match a documented journey in the product spec or runbook

[EXISTING_TELEMETRY_STACK]

Describes current observability tooling and storage already in use

Prometheus + Grafana for metrics, no existing trace store

Must enumerate metric store, log store, and trace store if any; use none for absent components

[CARDINALITY_BUDGET]

Maximum acceptable unique time series count for the metrics pipeline

10000 total series across all services

Must be a positive integer or a range; null allowed if budget is unconstrained but must be explicitly stated

[RETENTION_REQUIREMENT]

How long raw and aggregated metrics must be retained

raw: 30d, 5m-agg: 90d, 1h-agg: 1y

Must specify duration per resolution tier; parse check for valid duration strings like 30d, 1y

[COMPLIANCE_FRAMEWORK]

Regulatory or audit requirements affecting metric data handling

SOC2, GDPR - no PII in metric labels

Must be a list of framework identifiers or none; if frameworks include GDPR, HIPAA, or PCI, require PII redaction validation in output

[SERVICE_LEVEL_OBJECTIVES]

Existing SLO targets that metrics must support

checkout-latency-p99 < 200ms, availability > 99.95%

Each SLO must include a metric name, a comparator, and a threshold; null allowed if SLOs are not yet defined

PROMPT PLAYBOOK

Implementation Harness Notes

How to wire the Metrics Collection Architecture Design Prompt into an application or workflow with validation, retries, and human review gates.

This prompt is designed to be integrated into a platform engineering workflow, not used as a one-off chat. The primary integration point is an internal developer portal or an architecture review pipeline where a platform engineer submits a system context document and receives a structured Architecture Decision Record (ADR) as output. The harness should treat the LLM call as a draft generator, not an authoritative decision-maker. The output must pass through a validation layer that checks for the presence of required ADR sections (Context, Decision, Consequences), cardinality budget estimates, and explicit coverage mapping against USE (Utilization, Saturation, Errors) and RED (Rate, Errors, Duration) signals before it is surfaced to the user or stored in a decision log.

Validation and retry logic is critical because missing cardinality budgets or incomplete signal coverage can lead to production incidents. Implement a post-generation validator that parses the JSON output and checks: (1) the cardinality_budget field is a non-null integer, (2) the aggregation_rules array is non-empty, (3) the signal_coverage object contains keys for at least use and red with non-empty arrays, and (4) the storage_selection field includes a retention_policy. If validation fails, construct a retry prompt that includes the original input, the failed output, and a specific error message like VALIDATION_ERROR: cardinality_budget is missing or null. Limit retries to 2 attempts. If both attempts fail, route the request to a human review queue with the partial output and validation errors attached. Log every attempt, validation result, and final disposition for prompt observability and future regression testing.

Model choice and tool use should favor models with strong JSON mode and structured output support (e.g., GPT-4o with response_format set to json_schema or Claude 3.5 Sonnet with tool-use for schema enforcement). Do not rely on free-text completion for this prompt; the output must be machine-readable to feed downstream automation like Terraform module generation or OpenTelemetry Collector configuration. If your platform supports it, provide the model with a tool definition that matches the expected ADR schema. This reduces parsing errors and makes validation failures rarer. For RAG integration, you can optionally supply the model with your organization's existing SLO definitions, incident postmortems, or infrastructure cost data as additional context in the [CONTEXT] placeholder to ground the storage and cardinality recommendations in real constraints.

Human review is required before the generated ADR is committed to a decision log or used to provision infrastructure. The harness should present the validated output in a review UI that highlights: cardinality budget vs. current ingestion volume, any signal coverage gaps flagged by the validator, and the estimated monthly cost of the recommended storage tier. The reviewer must explicitly approve or request revision. Approved ADRs should be stored with a versioned prompt hash, model identifier, and reviewer identity for auditability. Avoid wiring this prompt directly into CI/CD pipelines without a human-in-the-loop gate, especially when the output drives resource provisioning or alerting rule creation.

IMPLEMENTATION TABLE

Expected Output Contract

Validate the model's output against this contract before accepting it into your metrics pipeline. Each field must pass the specified validation rule or trigger a retry or repair workflow.

Field or ElementType or FormatRequiredValidation Rule

architecture_decision_title

string

Must match pattern: 'ADR-[0-9]{3}: .+'

metrics_cardinality_budget

object

Must contain 'max_series' (integer > 0) and 'per_label_limit' (integer > 0)

aggregation_rules

array

Each item must have 'metric_name' (string), 'aggregation_type' (enum: sum, avg, max, min, histogram), and 'window_seconds' (integer > 0)

storage_backend_selection

object

Must contain 'backend' (enum: prometheus, victoriametrics, influxdb, m3db, thanos, cortex) and 'retention_policy' (string)

use_signal_coverage

object

Must contain 'utilization' (boolean), 'saturation' (boolean), 'errors' (boolean); each must be true or false

red_signal_coverage

object

Must contain 'rate' (boolean), 'errors' (boolean), 'duration' (boolean); each must be true or false

missing_signals

array

If present, each item must be a string explaining an uncovered USE or RED signal; null allowed

implementation_notes

string

Must not exceed 500 words; null allowed if no additional context is needed

PRACTICAL GUARDRAILS

Common Failure Modes

What breaks first when designing a metrics collection architecture with an LLM and how to guard against it.

01

Unbounded Cardinality Explosion

What to watch: The model proposes metric names or labels with high-cardinality dimensions (e.g., user ID, session ID, request ID) that will overwhelm your time-series database and blow up storage costs. Guardrail: Add a strict constraint in the prompt requiring a cardinality budget per metric and explicitly banning unbounded dimensions. Validate the output against a maximum label value count.

02

Missing USE/RED Signal Coverage

What to watch: The generated architecture focuses on infrastructure metrics (CPU, memory) but misses service-level signals like error rate, latency, and saturation for each service. This leaves blind spots for user-facing issues. Guardrail: Include a post-generation validation step that maps every service in the architecture to at least one Utilization, Saturation, Error, Rate, and Duration metric. Flag gaps for human review.

03

Aggregation Rule Ambiguity

What to watch: The model specifies aggregation (e.g., 'average latency') without defining the window, percentile, or handling of histograms, leading to misleading dashboards and SLOs. Guardrail: Require the prompt to output explicit aggregation functions, time windows, and quantile configurations for every metric. Use a schema validator to ensure these fields are populated and non-generic.

04

Storage Selection Mismatch

What to watch: The model recommends a storage backend (e.g., Prometheus, InfluxDB, ClickHouse) without analyzing the trade-offs for the specific workload's retention, query patterns, and write volume, leading to performance cliffs. Guardrail: Force the prompt to produce a trade-off matrix comparing at least two storage options against explicit constraints (retention period, query complexity, write throughput) before making a recommendation.

05

Instrumentation Gap in Async Workflows

What to watch: The design focuses on synchronous HTTP request paths and neglects asynchronous messaging, background jobs, or batch processing, leaving entire workflows unmonitored. Guardrail: Add a checklist item in the prompt requiring explicit metrics for message queue depth, job processing duration, and batch completion status. Review the output for coverage of all async boundaries.

06

Ignoring Metric Lifecycle Management

What to watch: The architecture defines metrics but provides no strategy for deprecation, renaming, or schema evolution, guaranteeing a future of broken dashboards and unmaintainable recording rules. Guardrail: Require the output to include a versioning policy for metric names and a deprecation process with a defined migration window. Treat this as a required section in the architecture decision record.

IMPLEMENTATION TABLE

Evaluation Rubric

Criteria for testing the quality of a generated Metrics Collection Architecture Design Record before it is approved for implementation.

CriterionPass StandardFailure SignalTest Method

Signal Coverage

Output explicitly maps each collected metric to a USE (Utilization, Saturation, Errors) or RED (Rate, Errors, Duration) signal category.

Metric list is present but lacks USE/RED mapping or contains metrics that don't fit any category.

Parse output JSON; assert every metric object has a non-null 'signal_category' field with a value from the controlled vocabulary.

Cardinality Budget

Design specifies a concrete cardinality budget (e.g., <100K active series) and a strategy for managing high-cardinality dimensions.

Cardinality is mentioned only in abstract terms without a numeric limit or specific dimension controls.

Regex search for a numeric threshold near 'cardinality' and a list of blocked or limited label keys.

Aggregation Rule Completeness

Aggregation rules are defined for all raw counter metrics, including a roll-up function and time window.

Only raw counter metrics are listed without specifying how they are aggregated for storage or alerting.

Validate that the count of 'aggregation_rules' objects in the output equals the count of 'counter_metrics' defined in the schema.

Storage Selection Rationale

The chosen storage backend (e.g., Prometheus, InfluxDB, M3DB) is justified with at least one trade-off related to the stated requirements.

A storage solution is named without any justification, or the justification is a generic marketing claim.

LLM-as-Judge check: Does the 'storage_rationale' field contain a sentence linking a specific product feature to a non-functional requirement from the input?

Pipeline Failure Mode

Design includes a specific strategy for handling metric loss during collector outages, such as a local write-ahead log or buffer configuration.

The design assumes 100% reliable delivery or only mentions 'retries' without a concrete buffering mechanism.

Keyword search for 'WAL', 'write-ahead log', 'persistent buffer', or 'backpressure' in the pipeline section.

Schema Validation

The output strictly conforms to the expected JSON schema for an Architecture Decision Record, including all required fields.

The output is valid JSON but is missing a required top-level field like 'decision_date' or 'stakeholders'.

Run a structural schema validator against the raw output; assert zero validation errors.

Query Pattern Support

The design lists at least two specific query types (e.g., P99 latency over 5m, error rate spike detection) that the schema supports.

The design only describes the schema structure without demonstrating how it answers operational questions.

LLM-as-Judge check: Does the 'query_examples' array contain at least two objects with a 'query_description' and 'use_case' field?

ADAPTATION OPTIONS

Adapt This Prompt

How to adapt

Use the base prompt with a single service and simplified constraints. Remove cardinality budget and storage selection sections. Focus on signal coverage validation only.

code
Design a metrics collection architecture for [SERVICE_NAME].
Cover USE and RED signals. Output a decision record with:
- Metrics inventory
- Collection method per metric
- Aggregation rules

Watch for

  • Overlooking push vs. pull collection trade-offs
  • Missing counter vs. gauge vs. histogram type decisions
  • No validation that all four golden signals are covered
Prasad Kumkar

About the author

Prasad Kumkar

CEO & MD, Inference Systems

Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.

His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.