Inferensys

Prompt

Circuit Breaker Logging Completeness Prompt

A practical prompt playbook for using the Circuit Breaker Logging Completeness Prompt in production AI workflows to audit state transition observability.
Elegant overhead shot of a polished wooden communal table in a sun-drenched WeWork lounge, laptops and tablets displaying AI workflow dashboards, plants and pendant lights in background.
PROMPT PLAYBOOK

When to Use This Prompt

Defines the exact scenarios, users, and failure conditions that justify running the Circuit Breaker Logging Completeness Prompt.

This prompt is for Site Reliability Engineers (SREs) and platform engineers who need to validate that circuit breaker implementations produce complete, traceable logs for every state transition. When a circuit breaker trips to OPEN, transitions to HALF_OPEN, or resets to CLOSED, the logs must capture the event, failure counts, cooldown timers, and the service context. Missing log data during these transitions turns a routine incident into a prolonged outage because on-call responders lack the evidence to determine what failed and whether recovery is safe. Use this prompt when you have raw log output from a failure injection test, a chaos engineering exercise, or a production incident review and you need a structured completeness report that flags gaps before they cause diagnostic dead ends.

The ideal input is a raw log segment spanning a known circuit breaker state transition, along with the expected state machine definition and the service identifier. The prompt works best when you can provide the exact time window of the transition, the circuit breaker configuration (thresholds, cooldown periods, half-open max requests), and the log aggregation query used to retrieve the output. Do not use this prompt for general log quality audits, performance profiling, or security log review—it is specifically designed to check whether state-transition telemetry is complete enough to support incident diagnosis. If you are evaluating alert rule accuracy, use the Alert Trigger Validation Prompt instead; if you are checking for PII leakage, use the PII Leakage Detection in Error Logs Prompt.

Before running this prompt, confirm that you have access to the raw log output and the circuit breaker's expected behavior specification. The prompt will produce a structured completeness report with a state-transition traceability matrix, gap flags for missing events or context, and a diagnostic sufficiency score. After receiving the output, review any flagged gaps against your observability pipeline configuration—many completeness failures originate in log sampling, retention filters, or misconfigured log levels rather than in the circuit breaker code itself. If the report identifies missing cooldown timer visibility or absent failure count context, prioritize adding those fields to your structured log schema before the next incident.

PRACTICAL GUARDRAILS

Use Case Fit

Where the Circuit Breaker Logging Completeness Prompt works and where it introduces operational risk.

01

Good Fit: Pre-Release Resilience Review

Use when: Validating logging completeness during chaos engineering or pre-release resilience reviews. Guardrail: Run against a controlled fault-injection environment, not production traffic, to avoid masking real incidents.

02

Bad Fit: Real-Time Incident Diagnosis

Avoid when: Using this prompt during an active incident to diagnose why a circuit breaker opened. Guardrail: This prompt audits logging completeness; it does not diagnose root cause. Use a diagnostic runbook prompt for live triage.

03

Required Inputs: State-Transition Logs

Risk: Incomplete or missing input logs produce a false-negative completeness report. Guardrail: Require structured log exports covering the full incident window, including timestamps, service names, and circuit breaker state fields before invoking the prompt.

04

Required Inputs: Expected Topology

Risk: Without an expected topology, the prompt cannot detect missing service hops or broken parent-child relationships. Guardrail: Provide a service dependency map or expected span topology as [CONTEXT] so the prompt can perform gap analysis.

05

Operational Risk: False Confidence

Risk: A passing completeness report may mask silent log drops or sampling gaps. Guardrail: Cross-reference the prompt's output with OpenTelemetry collector metrics and dead-letter queue inspection before signing off on logging readiness.

06

Operational Risk: Stale Runbook References

Risk: The prompt may flag runbook steps as accurate even when underlying commands have changed. Guardrail: Pair this prompt with the Runbook Accuracy Verification Prompt to audit remediation steps independently.

PROMPT PLAYBOOK

Copy-Ready Prompt Template

Paste this prompt into your AI harness to audit circuit breaker state transition logs for completeness, replacing placeholders with your actual log data and configuration.

The following prompt template is designed to be copied directly into your AI harness, LLM playground, or automated evaluation pipeline. It instructs the model to act as an SRE auditor, systematically checking circuit breaker logs for missing state transitions, absent context fields, and traceability gaps. Before running, replace every square-bracket placeholder with your actual data—this is not a fill-in-the-blanks exercise but a wiring step that connects the prompt to your real observability signals.

text
You are an SRE auditing circuit breaker logging completeness for a service. Your task is to analyze the provided log excerpts and configuration to determine whether all circuit breaker state transitions are fully logged with sufficient diagnostic context.

## INPUT
- Log Excerpts: [LOG_EXCERPTS]
- Circuit Breaker Configuration: [CIRCUIT_BREAKER_CONFIG]
- Expected State Transition Diagram: [STATE_TRANSITION_DIAGRAM]
- Service Topology Context: [SERVICE_TOPOLOGY]

## OUTPUT_SCHEMA
Return a single JSON object with the following structure:
{
  "audit_summary": {
    "total_transitions_expected": <number>,
    "total_transitions_logged": <number>,
    "completeness_score": <0.0 to 1.0>,
    "overall_verdict": "COMPLETE" | "PARTIAL" | "INCOMPLETE"
  },
  "state_transition_checks": [
    {
      "transition": "CLOSED_TO_OPEN" | "OPEN_TO_HALF_OPEN" | "HALF_OPEN_TO_CLOSED" | "HALF_OPEN_TO_OPEN" | "OPEN_TO_CLOSED",
      "logged": true | false,
      "timestamp_present": true | false,
      "failure_count_context_present": true | false,
      "cooldown_timer_visible": true | false,
      "upstream_service_identified": true | false,
      "correlation_id_present": true | false,
      "log_level_appropriate": true | false,
      "evidence": "<quote from logs or 'NOT FOUND'>",
      "gap_description": "<explain what is missing, or null if complete>"
    }
  ],
  "traceability_gaps": [
    {
      "gap_type": "MISSING_TRANSITION" | "MISSING_CONTEXT" | "BROKEN_CORRELATION" | "AMBIGUOUS_STATE",
      "severity": "HIGH" | "MEDIUM" | "LOW",
      "description": "<explain the gap>",
      "recommendation": "<specific fix>"
    }
  ],
  "diagnostic_readiness_score": <0.0 to 1.0>
}

## CONSTRAINTS
- Only report on transitions that should exist based on the provided state transition diagram.
- If a transition is not logged at all, mark all context fields as false and explain the gap.
- Do not infer transitions that are not evidenced in the logs.
- Flag any log line where the circuit breaker state is ambiguous or contradictory.
- If the cooldown timer is configured but not visible in half-open transition logs, treat this as a HIGH severity gap.
- If failure count context is missing from an OPEN transition, treat this as a HIGH severity gap.

## EVALUATION CRITERIA
- Completeness: Are all expected state transitions present in the logs?
- Context Richness: Does each transition log carry failure counts, cooldown status, and upstream identifiers?
- Traceability: Can each transition be correlated to a specific request or incident via correlation IDs?
- Diagnostic Readiness: Would an on-call responder understand the circuit state timeline from these logs alone?

## RISK_LEVEL: [RISK_LEVEL]

Analyze the logs and return the JSON output.

To adapt this template, replace [LOG_EXCERPTS] with the actual log lines you want to audit—ideally a time-bounded window covering at least one full circuit breaker lifecycle. [CIRCUIT_BREAKER_CONFIG] should include your threshold values (e.g., failure count, cooldown seconds, half-open max requests) so the model can validate whether logged context matches configured behavior. [STATE_TRANSITION_DIAGRAM] can be a textual description of allowed transitions (e.g., 'CLOSED → OPEN on threshold breach, OPEN → HALF_OPEN after cooldown, HALF_OPEN → CLOSED on success, HALF_OPEN → OPEN on failure'). [SERVICE_TOPOLOGY] provides the upstream/downstream service names the model should expect to see in log attributes. Set [RISK_LEVEL] to HIGH if this audit is part of an incident postmortem or compliance review—this signals the model to apply stricter gap severity and recommend human review of its findings.

Before integrating this prompt into a production pipeline, validate the output against a known set of complete and incomplete log samples. A common failure mode is the model reporting transitions as 'logged' when only a partial log line exists without the required context fields. To guard against this, run the prompt against a golden dataset where you have manually labeled each transition's completeness and compare the model's verdicts. If the audit is part of a CI/CD gate for observability standards, route HIGH severity traceability gaps to a human reviewer before blocking a release. Do not treat the model's completeness score as a single source of truth without spot-checking the evidence quotes it extracts.

IMPLEMENTATION TABLE

Prompt Variables

Each placeholder required by the Circuit Breaker Logging Completeness Prompt. Validate these inputs before execution to ensure the model receives the correct context for a state-transition traceability check.

PlaceholderPurposeExampleValidation Notes

[LOG_ENTRIES]

Raw log lines or structured JSON log entries spanning the circuit breaker's lifecycle during the test window.

{"timestamp": "2024-01-01T00:00:00Z", "level": "INFO", "message": "CircuitBreaker 'payment-service' state transition: CLOSED -> OPEN", "context": {"failure_count": 5, "cooldown_seconds": 30}}

Must be a valid JSON array or newline-delimited string. Reject if empty or if no entries contain circuit breaker keywords (open, close, half-open).

[CIRCUIT_BREAKER_NAME]

The specific identifier of the circuit breaker instance under audit.

payment-service-cb

Must be a non-empty string. Validate against a known list of deployed circuit breakers if available. Reject if null or whitespace.

[EXPECTED_STATE_TRANSITIONS]

An ordered list of expected state transitions (CLOSED->OPEN, OPEN->HALF_OPEN, HALF_OPEN->CLOSED, HALF_OPEN->OPEN) that should appear in the logs.

["CLOSED->OPEN", "OPEN->HALF_OPEN", "HALF_OPEN->CLOSED"]

Must be a valid JSON array of strings matching the pattern STATE_A->STATE_B. Reject if empty. Validate that states are from the allowed set: CLOSED, OPEN, HALF_OPEN.

[REQUIRED_CONTEXT_FIELDS]

A list of metadata fields that must be present in the log context for each state transition event.

["failure_count", "cooldown_seconds", "last_failure_reason"]

Must be a valid JSON array of strings. Reject if empty. Each field name should be a valid identifier (alphanumeric + underscore).

[TIME_WINDOW_START]

The start of the observation window for log analysis (ISO 8601).

2024-01-01T00:00:00Z

Must be a valid ISO 8601 datetime string. Must be before [TIME_WINDOW_END]. Reject if unparseable.

[TIME_WINDOW_END]

The end of the observation window for log analysis (ISO 8601).

2024-01-01T01:00:00Z

Must be a valid ISO 8601 datetime string. Must be after [TIME_WINDOW_START]. Reject if unparseable.

[OUTPUT_SCHEMA]

The expected JSON schema for the completeness report output.

{"type": "object", "properties": {"transitions_found": {"type": "array"}, "missing_transitions": {"type": "array"}, "context_completeness": {"type": "object"}}}

Must be a valid JSON Schema object. Reject if not parseable by a standard JSON Schema validator. Ensure it includes fields for transition traceability and context field presence.

[FAILURE_INJECTION_CONTEXT]

Optional description of the failure scenario used to trigger state transitions, providing the model with expected behavior.

Killed primary database connection for payment-service; expected circuit breaker to open after 5 consecutive timeouts.

If provided, must be a non-empty string. Null is allowed if no injection was performed. If present, use it to cross-check the model's reasoning about missing transitions.

PROMPT PLAYBOOK

Implementation Harness Notes

How to wire the Circuit Breaker Logging Completeness Prompt into an application or CI pipeline for repeatable, automated audits.

This prompt is designed to be integrated into a continuous validation pipeline, not run as a one-off manual check. The primary integration point is a post-deployment or pre-release audit step where structured log output from a circuit breaker library (e.g., resilience4j, Polly, or a custom implementation) is collected during a controlled failure injection test. The application harness should capture logs from the service under test, format them as a JSON array of log entries, and inject them into the [LOG_ENTRIES] placeholder. The [CIRCUIT_BREAKER_CONFIG] placeholder expects a structured object defining the expected breaker name, failure threshold, and cooldown period to ground the completeness check in the actual configuration.

The harness must enforce a strict validation loop. Before calling the model, validate that the input log array is not empty and contains at least one timestamped entry. After receiving the model's JSON output, validate it against the expected schema: a state_transition_trace array with from_state, to_state, timestamp, and log_evidence fields, plus a completeness_report object with boolean flags for open_event_logged, close_event_logged, half_open_event_logged, failure_count_context_present, and cooldown_timer_visible. If schema validation fails, retry once with a repair prompt that includes the validation error. For high-reliability pipelines, implement a human review gate when the completeness_report flags any missing events, routing the audit to an on-call channel before a release can proceed.

Model choice matters here. Use a model with strong JSON mode and structured output support (e.g., GPT-4o, Claude 3.5 Sonnet) because the state-transition traceability check requires precise temporal reasoning across log lines. Set temperature to 0 to minimize variance in audit results. For CI integration, wrap the prompt call in a script that exits with a non-zero code when critical events are missing, allowing the audit to block a deployment pipeline. Avoid running this prompt on production log streams without sampling; a single circuit breaker instance can generate thousands of state transitions under load, and the model context window should be reserved for a focused window around the injected failure test.

IMPLEMENTATION TABLE

Expected Output Contract

The exact JSON structure the prompt must return for a circuit breaker logging completeness report. Use this contract to validate the model's output before accepting it into your observability pipeline.

Field or ElementType or FormatRequiredValidation Rule

report_id

string (UUID v4)

Must match regex ^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$

circuit_breaker_name

string

Must be non-empty and match the [CIRCUIT_BREAKER_ID] provided in the input context

evaluation_timestamp

string (ISO 8601 UTC)

Must parse as valid ISO 8601 datetime in UTC; must not be in the future

state_transitions

array of objects

Each object must contain 'from_state', 'to_state', 'timestamp', and 'log_entry_found' fields; 'from_state' and 'to_state' must be one of CLOSED, OPEN, HALF_OPEN

completeness_checks

object

Must contain boolean fields: 'open_event_logged', 'close_event_logged', 'half_open_event_logged', 'failure_count_context_present', 'cooldown_timer_visible'; no null values allowed

missing_log_entries

array of strings

Each entry must describe a specific missing log event using the format 'Expected [EVENT_TYPE] at [TIMESTAMP] but not found'; array may be empty if all checks pass

traceability_score

number (0.0 - 1.0)

Must be a float between 0.0 and 1.0 inclusive; calculated as (number of found events / total expected events); must match the ratio implied by completeness_checks

remediation_suggestions

array of strings

If present, each string must be a non-empty, actionable recommendation; if traceability_score is 1.0, this field should be an empty array

PRACTICAL GUARDRAILS

Common Failure Modes

What breaks first when using the Circuit Breaker Logging Completeness Prompt in production and how to guard against each failure.

01

Incomplete State Transition Coverage

What to watch: The prompt may only check for open/close events but miss half-open, forced-open, or reset transitions. This creates a false sense of completeness when critical state changes are unlogged. Guardrail: Include an explicit state-transition matrix in the prompt that enumerates all valid transitions (closed→open, open→half-open, half-open→closed, half-open→open, forced-open, reset) and require the model to report on each transition type separately with a present/absent/malformed status.

02

Missing Failure Count Context

What to watch: The prompt may confirm that a circuit opened but fail to verify whether the failure count, threshold, and sliding window context were logged. Without this, on-call responders cannot determine if the breaker tripped due to a genuine downstream failure or a transient spike. Guardrail: Add a required field in the output schema for failureCountContext that checks for: total failures observed, configured threshold, evaluation window duration, and whether these values were logged at the time of state transition.

03

Cooldown Timer Visibility Gaps

What to watch: The prompt may overlook whether the cooldown timer duration, start time, and remaining time are logged during half-open and open states. Without timer visibility, teams cannot predict when the breaker will attempt recovery or diagnose premature retries. Guardrail: Require the model to extract and validate three timer fields per transition: cooldownDurationMs, cooldownStartTimestamp, and cooldownRemainingMs. Flag any transition where these are absent as a completeness gap.

04

Correlation ID Breakage Across Services

What to watch: The prompt may validate circuit breaker logs in isolation without checking whether the correlation ID is preserved across upstream and downstream services. A breaker event without a traceable request path is diagnostically useless. Guardrail: Include a cross-service traceability check that requires the model to verify the correlation ID appears in the breaker log, the upstream caller log, and the downstream dependency log for the same request context. Report any break as a critical gap.

05

False Confidence from Partial Logs

What to watch: The model may report a transition as fully logged when only a subset of required fields is present, especially if the log line exists but contains empty or default values for critical fields. Guardrail: Add a field-level completeness threshold in the prompt: each required field must be non-null, non-empty, and match its expected type. Require the model to produce a per-field pass/fail table rather than a single holistic judgment, and flag any transition with fewer than 100% of required fields present as incomplete.

06

Log Level Misclassification During Transitions

What to watch: The prompt may not check whether state transitions are logged at the appropriate severity level. An open-circuit event logged at DEBUG level will be invisible to alerting systems, while a routine closed→open transition logged at ERROR may trigger unnecessary alarms. Guardrail: Include a log-level appropriateness check that maps each transition type to an expected minimum level (e.g., open→half-open at INFO, closed→open at WARN) and flags mismatches. Reference the team's logging standards document in the prompt context.

IMPLEMENTATION TABLE

Evaluation Rubric

Criteria for testing the circuit breaker logging completeness prompt before integrating it into a CI pipeline or incident review workflow. Each row defines a pass standard, a failure signal, and a concrete test method.

CriterionPass StandardFailure SignalTest Method

State Transition Coverage

Report identifies all three circuit states (OPEN, CLOSED, HALF_OPEN) in the log sample

Report omits one or more state transitions present in the input

Inject a log sample containing all three state transitions and verify each appears in the output

Failure Count Context

Report includes the failure count threshold and the observed failure count that triggered the transition

Report mentions state change without the failure count that caused it

Provide a log where failure count exceeds threshold; check that both threshold and actual count appear in the report

Cooldown Timer Visibility

Report captures the cooldown duration and whether the timer expired before the HALF_OPEN probe

Report describes a HALF_OPEN transition without referencing the cooldown timer

Use a log with an explicit cooldown timestamp; confirm the report extracts and surfaces the timer value

State-Transition Traceability

Each state change is linked to a specific log line or timestamp with a traceability reference

Report describes state changes without pointing to the source log entry

Parse the output for each state change claim; assert every claim has a corresponding log line reference or timestamp

Missing Event Detection

Report flags any expected transition that is absent from the logs (e.g., no OPEN event before HALF_OPEN)

Report silently accepts an incomplete transition sequence as complete

Feed a log with a missing OPEN event; confirm the report explicitly calls out the gap

Schema Conformance

Output matches the expected JSON schema with all required fields present and correctly typed

Output is missing required fields, contains type mismatches, or is unparseable JSON

Validate the output against the defined JSON schema using a programmatic schema validator

False Confidence Avoidance

Report uses uncertainty language or confidence qualifiers when log evidence is ambiguous

Report asserts definitive conclusions when log data is incomplete or contradictory

Provide a log with conflicting timestamps; check that the report includes qualifiers such as 'unclear' or 'possible'

Remediation Hint Presence

Report includes actionable suggestions for missing log instrumentation when gaps are found

Report identifies a gap but provides no guidance on what to log or where to add instrumentation

Inject a log missing the failure count field; verify the report recommends adding a failure count log statement at the circuit breaker evaluation point

ADAPTATION OPTIONS

Adapt This Prompt

How to adapt

Add a strict JSON output schema with required fields: [STATE_TRANSITIONS_FOUND], [MISSING_EVENTS], [COOLDOWN_TIMER_VISIBILITY], [FAILURE_COUNT_CONTEXT], and [TRACEABILITY_MATRIX]. Include a [LOG_SOURCE_PATH] placeholder for file or stream input. Add retry logic for malformed outputs and log each validation failure. Wire the prompt into a CI step that blocks releases if completeness drops below a threshold.

Watch for

  • Silent format drift when the model changes the JSON structure
  • Missing correlation IDs breaking the traceability matrix
  • The model accepting incomplete logs as complete because it can't distinguish absent events from missing instrumentation
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.