forked from mtusi2026/mtusi2026lab6
Compare commits
15
Commits
main
..
0fc02496fe
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0fc02496fe | ||
|
|
cd9d91550a | ||
|
|
447a6507f9 | ||
|
|
44d81fd80e | ||
|
|
1a171d0d0f | ||
|
|
2903d9dc73 | ||
|
|
95511002b1 | ||
|
|
12db77133f | ||
|
|
dc9256baf9 | ||
|
|
a8836ce8b5 | ||
|
|
e2ec3fe9af | ||
|
|
e60b4eac98 | ||
|
|
a41d6d39e8 | ||
|
|
5ae3d77152 | ||
|
|
a0d3947710 |
@@ -0,0 +1,181 @@
|
||||
---
|
||||
name: "OPSX: Apply"
|
||||
description: "Implement tasks from an OpenSpec change (Experimental)"
|
||||
allowed-tools: Bash(openspec:*)
|
||||
category: "Workflow"
|
||||
tags: ["workflow", "artifacts", "experimental"]
|
||||
---
|
||||
|
||||
Implement tasks from an OpenSpec change.
|
||||
|
||||
**Store selection:** If the user names a store (a store is a standalone OpenSpec repo registered on this machine) or the work lives in one, run `openspec store list --json` to discover registered store ids, then pass `--store <id>` on the commands that read or write specs and changes (`new change`, `status`, `instructions`, `list`, `show`, `validate`, `archive`, `doctor`, `context`, `view`). Once selected, treat `--store <id>` as sticky for the rest of the workflow. Every unscoped example of those commands below is shorthand: before running it, append the flag. For example, run `openspec status --change "<name>" --json --store "<id>"`, not the unscoped form shown below. Other commands do not take the flag. Hints printed by commands already carry the flag; keep it on follow-ups. Without a store, commands act on the nearest local `openspec/` root.
|
||||
|
||||
**Input**: Optionally specify a change name (e.g., `/opsx:apply add-auth`). If omitted, check if it can be inferred from conversation context. If vague or ambiguous you MUST prompt for available changes.
|
||||
|
||||
**Steps**
|
||||
|
||||
1. **Select the change**
|
||||
|
||||
If a name is provided, use it. Otherwise:
|
||||
- Infer from conversation context if the user mentioned a change
|
||||
- Auto-select if only one active change exists
|
||||
- If ambiguous, run `openspec list --json` to get available changes and ask the user to select one
|
||||
|
||||
Always announce: "Using change: <name>" and how to override (e.g., `/opsx:apply <other>`).
|
||||
|
||||
2. **Check status to understand the schema**
|
||||
```bash
|
||||
openspec status --change "<name>" --json
|
||||
```
|
||||
Parse the JSON to understand:
|
||||
- `schemaName`: The workflow being used (e.g., "spec-driven")
|
||||
- `planningHome`, `changeRoot`, and `actionContext`: planning scope and edit constraints
|
||||
- Which artifact contains the tasks (typically "tasks" for spec-driven, check status for others)
|
||||
|
||||
3. **Get apply instructions**
|
||||
|
||||
```bash
|
||||
openspec instructions apply --change "<name>" --json
|
||||
```
|
||||
|
||||
This returns:
|
||||
- `contextFiles`: artifact ID -> array of concrete file paths (varies by schema - could be proposal/specs/design/tasks or spec/tests/implementation/docs)
|
||||
- Progress (total, complete, remaining)
|
||||
- Task list with status
|
||||
- Dynamic instruction based on current state
|
||||
- Optional `context`: current required project instruction input from the selected root
|
||||
- Optional `operationGuidance`: current advisory guidance for apply
|
||||
|
||||
**Handle states:**
|
||||
- If `state: "blocked"` (missing artifacts): show message, suggest using `/opsx:continue` (if it is not installed, run `openspec status --change "<name>" --json` to see the next artifact and `openspec instructions <artifact-id> --change "<name>" --json` for how to create it)
|
||||
- If `state: "all_done"`: congratulate, suggest archive
|
||||
- Otherwise: proceed to implementation
|
||||
|
||||
Treat `context` as a required prompt-level input. Read and consider it, and
|
||||
apply relevant project facts, conventions, and constraints while implementing.
|
||||
Treat `operationGuidance` as optional additive advice. Read and consider every
|
||||
entry, and follow entries that are applicable and compatible with the built-in
|
||||
workflow.
|
||||
|
||||
Keep both fields separate from CLI-returned state, missing artifacts, tasks,
|
||||
progress, `contextFiles`, and the built-in `instruction`. They are not
|
||||
evidence of task completion, do not replace the built-in instruction, and do
|
||||
not permit bypassing a blocked state. If context conflicts with the built-in
|
||||
instruction, an explicit user choice, or a CLI-controlled value, report the
|
||||
conflict and preserve the controlling value. If guidance is inapplicable or
|
||||
conflicts with those controlling inputs, do not follow it and explain why.
|
||||
These are prompt-level behavior contracts, not enforceable checks.
|
||||
|
||||
4. **Read context files**
|
||||
|
||||
Read every file path listed under `contextFiles` from the apply instructions output.
|
||||
The files depend on the schema being used:
|
||||
- **spec-driven**: proposal, specs, design, tasks
|
||||
- Other schemas: follow the contextFiles from CLI output
|
||||
|
||||
Do not copy `context` or `operationGuidance` verbatim into implementation
|
||||
files or planning artifacts unless the user separately asks for that content.
|
||||
|
||||
5. **Show current progress**
|
||||
|
||||
Display:
|
||||
- Schema being used
|
||||
- Progress: "N/M tasks complete"
|
||||
- Remaining tasks overview
|
||||
- Dynamic instruction from CLI
|
||||
|
||||
6. **Implement tasks (loop until done or blocked)**
|
||||
|
||||
For each pending task:
|
||||
- Show which task is being worked on
|
||||
- Make the code changes required
|
||||
- Keep changes minimal and focused
|
||||
- Mark task complete in the tasks file: `- [ ]` → `- [x]`
|
||||
- Continue to next task
|
||||
|
||||
**Pause if:**
|
||||
- Task is unclear → ask for clarification
|
||||
- Implementation reveals a design issue → suggest updating artifacts
|
||||
- Error or blocker encountered → report and wait for guidance
|
||||
- User interrupts
|
||||
|
||||
7. **On completion or pause, show status**
|
||||
|
||||
Display:
|
||||
- Tasks completed this session
|
||||
- Overall progress: "N/M tasks complete"
|
||||
- If all done: suggest archive
|
||||
- If paused: explain why and wait for guidance
|
||||
|
||||
**Output During Implementation**
|
||||
|
||||
```
|
||||
## Implementing: <change-name> (schema: <schema-name>)
|
||||
|
||||
Working on task 3/7: <task description>
|
||||
[...implementation happening...]
|
||||
✓ Task complete
|
||||
|
||||
Working on task 4/7: <task description>
|
||||
[...implementation happening...]
|
||||
✓ Task complete
|
||||
```
|
||||
|
||||
**Output On Completion**
|
||||
|
||||
```
|
||||
## Implementation Complete
|
||||
|
||||
**Change:** <change-name>
|
||||
**Schema:** <schema-name>
|
||||
**Progress:** 7/7 tasks complete ✓
|
||||
|
||||
### Completed This Session
|
||||
- [x] Task 1
|
||||
- [x] Task 2
|
||||
...
|
||||
|
||||
All tasks complete! You can archive this change with `/opsx:archive`.
|
||||
```
|
||||
|
||||
**Output On Pause (Issue Encountered)**
|
||||
|
||||
```
|
||||
## Implementation Paused
|
||||
|
||||
**Change:** <change-name>
|
||||
**Schema:** <schema-name>
|
||||
**Progress:** 4/7 tasks complete
|
||||
|
||||
### Issue Encountered
|
||||
<description of the issue>
|
||||
|
||||
**Options:**
|
||||
1. <option 1>
|
||||
2. <option 2>
|
||||
3. Other approach
|
||||
|
||||
What would you like to do?
|
||||
```
|
||||
|
||||
**Guardrails**
|
||||
- Keep going through tasks until done or blocked
|
||||
- Always read context files before starting (from the apply instructions output)
|
||||
- If task is ambiguous, pause and ask before implementing
|
||||
- If implementation reveals issues, pause and suggest artifact updates
|
||||
- Keep code changes minimal and scoped to each task
|
||||
- Update task checkbox immediately after completing each task
|
||||
- Pause on errors, blockers, or unclear requirements - don't guess
|
||||
- Use contextFiles from CLI output, don't assume specific file names
|
||||
- Do not use context or operation guidance as proof that a task is complete
|
||||
- Apply relevant project context; report conflicts with controlling workflow inputs
|
||||
- Consider every guidance entry; explain any inapplicable or conflicting advice
|
||||
- Do not copy runtime context or operation guidance into implementation files or planning artifacts
|
||||
- Preserve CLI-controlled blocked/ready/all-done behavior and completion criteria
|
||||
|
||||
**Fluid Workflow Integration**
|
||||
|
||||
This skill supports the "actions on a change" model:
|
||||
|
||||
- **Can be invoked anytime**: Before all artifacts are done (if tasks exist), after partial implementation, interleaved with other actions
|
||||
- **Allows artifact updates**: If implementation reveals design issues, suggest updating artifacts - not phase-locked, work fluidly
|
||||
@@ -0,0 +1,225 @@
|
||||
---
|
||||
name: "OPSX: Archive"
|
||||
description: "Archive a completed change in the experimental workflow"
|
||||
allowed-tools: Bash(openspec:*)
|
||||
category: "Workflow"
|
||||
tags: ["workflow", "archive", "experimental"]
|
||||
---
|
||||
|
||||
Archive a completed change in the experimental workflow.
|
||||
|
||||
**Store selection:** If the user names a store (a store is a standalone OpenSpec repo registered on this machine) or the work lives in one, run `openspec store list --json` to discover registered store ids, then pass `--store <id>` on the commands that read or write specs and changes (`new change`, `status`, `instructions`, `list`, `show`, `validate`, `archive`, `doctor`, `context`, `view`). Once selected, treat `--store <id>` as sticky for the rest of the workflow. Every unscoped example of those commands below is shorthand: before running it, append the flag. For example, run `openspec status --change "<name>" --json --store "<id>"`, not the unscoped form shown below. Other commands do not take the flag. Hints printed by commands already carry the flag; keep it on follow-ups. Without a store, commands act on the nearest local `openspec/` root.
|
||||
|
||||
`<capability-path>` is the spec directory relative to `specs/` (for example, `user-auth` or `identity/user-auth`). Preserve the full path from each delta spec when resolving its main spec.
|
||||
|
||||
**Input**: Optionally specify a change name after `/opsx:archive` (e.g., `/opsx:archive add-auth`). If omitted, check if it can be inferred from conversation context. If vague or ambiguous you MUST prompt for available changes.
|
||||
|
||||
**Steps**
|
||||
|
||||
1. **Select the change**
|
||||
|
||||
If a name is provided, use it. Otherwise:
|
||||
- Infer from conversation context if the user mentioned a change
|
||||
- Auto-select if only one active change exists
|
||||
- If ambiguous, run `openspec list --json` to get available changes and ask the user to select one
|
||||
|
||||
When prompting, show only active changes (not already archived).
|
||||
Include the schema used for each change if available.
|
||||
|
||||
Always announce: "Using change: <name>" and how to override (e.g., `/opsx:archive <other>`).
|
||||
|
||||
**Load current archive inputs before the existing archive checks:**
|
||||
|
||||
After resolving the selected change and planning root, run:
|
||||
```bash
|
||||
openspec instructions archive --change "<name>" --json
|
||||
```
|
||||
Keep the same selected-root flags on this command. This lookup is advisory and
|
||||
optional: it only supplies extra prompt inputs, so it must never block archiving.
|
||||
If it exits non-zero or returns invalid JSON — for example on an older CLI that
|
||||
does not support this command yet — continue the archive workflow with no
|
||||
context and no operation guidance. Do not report an error and do not stop.
|
||||
|
||||
A successful response may omit both optional fields. Treat `context` as a
|
||||
required prompt-level input: read and consider it, and apply relevant project
|
||||
facts, conventions, and constraints. Treat `operationGuidance` as optional
|
||||
additive advice: read and consider every entry, and follow entries that are
|
||||
applicable and compatible with the built-in archive workflow.
|
||||
|
||||
Keep both fields separate from built-in steps, explicit user choices, resolved
|
||||
paths, CLI checks, and command contracts. If context conflicts with one of those
|
||||
controlling inputs, report the conflict and preserve the controlling value. If
|
||||
guidance is inapplicable or conflicts with a controlling input, do not follow it
|
||||
and explain why. Do not infer replacement paths, skipped prompts, or flags from
|
||||
either field, and do not copy their text verbatim into specs, change artifacts,
|
||||
or archive summaries unless the user separately asks for it. These are
|
||||
prompt-level behavior contracts, not enforceable checks.
|
||||
|
||||
2. **Check artifact completion status**
|
||||
|
||||
Run `openspec status --change "<name>" --json` to check artifact completion.
|
||||
|
||||
Parse the JSON to understand:
|
||||
- `schemaName`: The workflow being used
|
||||
- `planningHome`, `changeRoot`, `artifactPaths`, and `actionContext`: path and scope context
|
||||
- `artifacts`: List of artifacts with their status (`done`, `skipped`, or other)
|
||||
|
||||
**If any artifacts are neither `done` nor `skipped`** (skipped artifacts satisfy the requirement - the change declares skip_specs):
|
||||
- Display warning listing incomplete artifacts
|
||||
- Prompt user for confirmation to continue
|
||||
- Proceed if user confirms
|
||||
|
||||
3. **Check task completion status**
|
||||
|
||||
Read the tasks file (typically `tasks.md`) to check for incomplete tasks.
|
||||
|
||||
Count tasks marked with `- [ ]` (incomplete) vs `- [x]` (complete).
|
||||
|
||||
**If incomplete tasks found:**
|
||||
- Display warning showing count of incomplete tasks
|
||||
- Prompt user for confirmation to continue
|
||||
- Proceed if user confirms
|
||||
|
||||
**If no tasks file exists:** Proceed without task-related warning.
|
||||
|
||||
4. **Assess delta spec sync state**
|
||||
|
||||
Use `artifactPaths.specs.existingOutputPaths` from status JSON as the only
|
||||
delta-spec source. If the `specs` entry is missing or
|
||||
`existingOutputPaths` is empty, proceed without a sync prompt and do not infer
|
||||
delta specs from other artifacts.
|
||||
|
||||
**If delta specs exist:**
|
||||
- Compare each delta spec with its corresponding main spec at `<planningHome.root>/openspec/specs/<capability-path>/spec.md` (use the store-aware `planningHome.root` from step 2, not a hardcoded repo path)
|
||||
- Determine what changes would be applied (adds, modifications, removals, renames)
|
||||
- Show a combined summary before prompting
|
||||
|
||||
**Prompt options:**
|
||||
- If changes needed: "Sync now (recommended)", "Archive without syncing"
|
||||
- If already synced: "Archive now", "Sync anyway", "Cancel"
|
||||
|
||||
Route on the answer:
|
||||
- "Cancel" — stop, do not archive
|
||||
- "Archive without syncing" or "Archive now" — proceed to archive
|
||||
- "Sync now" or "Sync anyway" — sync, then verify (below)
|
||||
- Anything else — ask again rather than archiving
|
||||
|
||||
Before a selected sync writes any main spec, run
|
||||
`openspec instructions specs --change "<name>" --json` once with the same
|
||||
selected-root flags. Require a zero exit status and valid artifact-instruction
|
||||
JSON. If the lookup fails or returns invalid JSON, report the error and stop
|
||||
before writing any main spec or moving the change. A valid response with omitted
|
||||
`rules` is the no-rules case. Apply returned `rules` only to the content and
|
||||
form of main specs produced by this merge; do not use them as archive guidance,
|
||||
change CLI behavior, or copy the rule text into any output file.
|
||||
|
||||
Then run the `/opsx:sync` workflow inline (agent-driven intelligent merge) for change '<name>', passing the delta spec analysis and the fetched specs-rule snapshot from above, and wait for it to finish. The inline sync must reuse that snapshot without fetching `specs` instructions again. Do not delegate it to a background task — step 5 would move `changeRoot` out from under a sync that is still reading it, leaving the change archived and the main specs never updated. If your agent can only run it by delegation, delegate synchronously and wait for the result.
|
||||
|
||||
Then re-run the comparison from the top of this step against every capability that has a delta spec in `artifactPaths.specs.existingOutputPaths` — not only the ones the sync reports it touched. A successful sync leaves nothing left to apply, so each capability must now read as already synced:
|
||||
- ADDED requirements present
|
||||
- MODIFIED requirements carrying the scenario and description changes named in the delta, with their other scenarios intact
|
||||
- REMOVED requirements gone — and where this sync retired a capability (removed its last requirement, leaving `## Requirements` empty), its main spec deleted rather than left empty; a spec the sync deliberately kept and reported is also a match
|
||||
- RENAMED requirements present under the new name and absent under the old one
|
||||
|
||||
If the sync failed, or any capability does not match, report what differs and stop — do not archive. Nothing has moved and `changeRoot` is intact, so the user can fix the mismatch or re-run the sync and start the archive again.
|
||||
|
||||
5. **Perform the archive**
|
||||
|
||||
Create an `archive` directory under `planningHome.changesDir` if it doesn't exist:
|
||||
```bash
|
||||
mkdir -p "<planningHome.changesDir>/archive"
|
||||
```
|
||||
|
||||
Generate the target name: use the change name as-is when it already starts with a `YYYY-MM-DD-` prefix; otherwise prepend the current date as `YYYY-MM-DD-<change-name>`. Never stack a second date (same rule as `openspec archive`).
|
||||
|
||||
**Check if target already exists:**
|
||||
- If yes: Fail with error, suggest renaming existing archive or using different date
|
||||
- If no: Move `changeRoot` to the archive directory
|
||||
|
||||
```bash
|
||||
mv "<changeRoot>" "<planningHome.changesDir>/archive/<target-name>"
|
||||
```
|
||||
|
||||
6. **Display summary**
|
||||
|
||||
Show archive completion summary including:
|
||||
- Change name
|
||||
- Schema that was used
|
||||
- Archive location
|
||||
- Spec sync status (synced / sync skipped / no delta specs)
|
||||
- Note about any warnings (incomplete artifacts/tasks)
|
||||
|
||||
**Output On Success**
|
||||
|
||||
```markdown
|
||||
## Archive Complete
|
||||
|
||||
**Change:** <change-name>
|
||||
**Schema:** <schema-name>
|
||||
**Archived to:** the archive path derived from `planningHome.changesDir`/<target-name>/
|
||||
**Specs:** ✓ Synced to main specs
|
||||
|
||||
All artifacts complete. All tasks complete.
|
||||
```
|
||||
|
||||
**Output On Success (No Delta Specs)**
|
||||
|
||||
```markdown
|
||||
## Archive Complete
|
||||
|
||||
**Change:** <change-name>
|
||||
**Schema:** <schema-name>
|
||||
**Archived to:** the archive path derived from `planningHome.changesDir`/<target-name>/
|
||||
**Specs:** No delta specs
|
||||
|
||||
All artifacts complete. All tasks complete.
|
||||
```
|
||||
|
||||
**Output On Success With Warnings**
|
||||
|
||||
```markdown
|
||||
## Archive Complete (with warnings)
|
||||
|
||||
**Change:** <change-name>
|
||||
**Schema:** <schema-name>
|
||||
**Archived to:** the archive path derived from `planningHome.changesDir`/<target-name>/
|
||||
**Specs:** Sync skipped (user chose to skip)
|
||||
|
||||
**Warnings:**
|
||||
- Archived with 2 incomplete artifacts
|
||||
- Archived with 3 incomplete tasks
|
||||
- Delta spec sync was skipped (user chose to skip)
|
||||
|
||||
Review the archive if this was not intentional.
|
||||
```
|
||||
|
||||
**Output On Error (Archive Exists)**
|
||||
|
||||
```markdown
|
||||
## Archive Failed
|
||||
|
||||
**Change:** <change-name>
|
||||
**Target:** the archive path derived from `planningHome.changesDir`/<target-name>/
|
||||
|
||||
Target archive directory already exists.
|
||||
|
||||
**Options:**
|
||||
1. Rename the existing archive
|
||||
2. Delete the existing archive if it's a duplicate
|
||||
3. Wait until a different date to archive
|
||||
```
|
||||
|
||||
**Guardrails**
|
||||
- Announce the selected change; prompt for selection when it is ambiguous
|
||||
- Use artifact graph (openspec status --json) for completion checking
|
||||
- Don't block archive on warnings - just inform and confirm
|
||||
- Preserve .openspec.yaml when moving to archive (it moves with the directory)
|
||||
- Show clear summary of what happened
|
||||
- If sync is requested, run the `/opsx:sync` workflow inline (agent-driven)
|
||||
- Never archive while a spec sync is still in flight — run the sync inline and verify the main specs before moving `changeRoot`
|
||||
- If delta specs exist, always run the sync assessment and show the combined summary before prompting
|
||||
- Apply relevant runtime context and report conflicts; operation guidance remains advisory
|
||||
- Consider every guidance entry and explain any inapplicable or conflicting advice
|
||||
- Existing CLI checks, resolved paths, prompts, and command contracts are unchanged
|
||||
- Artifact rules constrain only the specs being written and are never operation guidance
|
||||
- Never copy runtime context, operation guidance, or artifact-rule text verbatim into output files
|
||||
@@ -0,0 +1,193 @@
|
||||
---
|
||||
name: "OPSX: Explore"
|
||||
description: "Enter explore mode - think through ideas, investigate problems, clarify requirements"
|
||||
allowed-tools: Bash(openspec:*)
|
||||
category: "Workflow"
|
||||
tags: ["workflow", "explore", "experimental", "thinking"]
|
||||
---
|
||||
|
||||
Enter explore mode. Think deeply. Visualize freely. Follow the conversation wherever it goes.
|
||||
|
||||
**IMPORTANT: Explore mode is for thinking, not implementing.** You may read files, search code, and investigate the codebase, but you must NEVER write code or implement features. If the user asks you to implement something, remind them to exit explore mode first and create a change proposal. You MAY create OpenSpec artifacts (proposals, designs, specs) if the user asks—that's capturing thinking, not implementing. For a new change, scaffold it first as described below.
|
||||
|
||||
**This is a stance, not a workflow.** There are no fixed steps, no required sequence, no mandatory outputs. You're a thinking partner helping the user explore.
|
||||
|
||||
**Store selection:** If the user names a store (a store is a standalone OpenSpec repo registered on this machine) or the work lives in one, run `openspec store list --json` to discover registered store ids, then pass `--store <id>` on the commands that read or write specs and changes (`new change`, `status`, `instructions`, `list`, `show`, `validate`, `archive`, `doctor`, `context`, `view`). Once selected, treat `--store <id>` as sticky for the rest of the workflow. Every unscoped example of those commands below is shorthand: before running it, append the flag. For example, run `openspec status --change "<name>" --json --store "<id>"`, not the unscoped form shown below. Other commands do not take the flag. Hints printed by commands already carry the flag; keep it on follow-ups. Without a store, commands act on the nearest local `openspec/` root.
|
||||
|
||||
**Input**: The argument after `/opsx:explore` is whatever the user wants to think about. Could be:
|
||||
- A vague idea: "real-time collaboration"
|
||||
- A specific problem: "the auth system is getting unwieldy"
|
||||
- A change name: "add-dark-mode" (to explore in context of that change)
|
||||
- A comparison: "postgres vs sqlite for this"
|
||||
- Nothing (just enter explore mode)
|
||||
|
||||
---
|
||||
|
||||
## The Stance
|
||||
|
||||
- **Curious, not prescriptive** - Ask questions that emerge naturally, don't follow a script
|
||||
- **Open threads, not interrogations** - Surface multiple interesting directions and let the user follow what resonates. Don't funnel them through a single path of questions.
|
||||
- **Visual** - Use ASCII diagrams liberally when they'd help clarify thinking
|
||||
- **Adaptive** - Follow interesting threads, pivot when new information emerges
|
||||
- **Patient** - Don't rush to conclusions, let the shape of the problem emerge
|
||||
- **Grounded** - Explore the actual codebase when relevant, don't just theorize
|
||||
|
||||
---
|
||||
|
||||
## What You Might Do
|
||||
|
||||
Depending on what the user brings, you might:
|
||||
|
||||
**Explore the problem space**
|
||||
- Ask clarifying questions that emerge from what they said
|
||||
- Challenge assumptions
|
||||
- Reframe the problem
|
||||
- Find analogies
|
||||
|
||||
**Investigate the codebase**
|
||||
- Map existing architecture relevant to the discussion
|
||||
- Find integration points
|
||||
- Identify patterns already in use
|
||||
- Surface hidden complexity
|
||||
|
||||
**Compare options**
|
||||
- Brainstorm multiple approaches
|
||||
- Build comparison tables
|
||||
- Sketch tradeoffs
|
||||
- Recommend a path (if asked)
|
||||
|
||||
**Visualize**
|
||||
```
|
||||
┌─────────────────────────────────────────┐
|
||||
│ Use ASCII diagrams liberally │
|
||||
├─────────────────────────────────────────┤
|
||||
│ │
|
||||
│ ┌────────┐ ┌────────┐ │
|
||||
│ │ State │────────▶│ State │ │
|
||||
│ │ A │ │ B │ │
|
||||
│ └────────┘ └────────┘ │
|
||||
│ │
|
||||
│ System diagrams, state machines, │
|
||||
│ data flows, architecture sketches, │
|
||||
│ dependency graphs, comparison tables │
|
||||
│ │
|
||||
└─────────────────────────────────────────┘
|
||||
```
|
||||
|
||||
**Surface risks and unknowns**
|
||||
- Identify what could go wrong
|
||||
- Find gaps in understanding
|
||||
- Suggest spikes or investigations
|
||||
|
||||
---
|
||||
|
||||
## OpenSpec Awareness
|
||||
|
||||
You have full context of the OpenSpec system. Use it naturally, don't force it.
|
||||
|
||||
### Check for context
|
||||
|
||||
At the start, quickly check what exists:
|
||||
```bash
|
||||
openspec list --json
|
||||
```
|
||||
|
||||
This tells you:
|
||||
- If there are active changes
|
||||
- Their names, schemas, and status
|
||||
- What the user might be working on
|
||||
|
||||
Then read the project's own context from the resolved root - `<root.path>/openspec/config.yaml` (or `config.yml`). Use the `root.path` returned above, and skip this if neither file exists:
|
||||
- `context`: project background - tech stack, conventions, constraints
|
||||
- `rules`: keyed by artifact id - the entries for an artifact apply only when you write that artifact
|
||||
|
||||
Ground your thinking in these. They are constraints for you to follow, not content to reproduce: do NOT copy them into the conversation or into any artifact you create.
|
||||
|
||||
If the user mentioned a specific change name, read its artifacts for context.
|
||||
|
||||
### When no change exists
|
||||
|
||||
Think freely. When insights crystallize, you might offer:
|
||||
|
||||
- "This feels solid enough to start a change. Want me to create a proposal?"
|
||||
- Or keep exploring - no pressure to formalize
|
||||
|
||||
If the user asks you to capture the exploration as a new change, transition seamlessly into the requested capture:
|
||||
|
||||
1. Run `openspec new change "<name>"` (with `--store <id>` when applicable) before creating any artifacts. Never create a new change directory under `openspec/changes/` by hand; the CLI scaffold creates required metadata such as `.openspec.yaml`. Keep the selected `--store <id>` on every applicable follow-up `status` and `instructions` command.
|
||||
2. Run `openspec status --change "<name>" --json` (append the confirmed `--store "<id>"` only for a registered standalone store), then process the requested artifacts in dependency order. For each requested artifact that is `ready`, run `openspec instructions "<artifact-id>" --change "<name>" --json` (append the confirmed `--store "<id>"` only for a registered standalone store). Before creating a requested artifact, evaluate any condition in its own `instruction` against the explored change; record a deliberate skip instead when the condition does not apply. If a requested artifact is blocked by a direct prerequisite the user did not request, run `openspec instructions "<prerequisite-id>" --change "<name>" --json` (append the confirmed `--store "<id>"` only for a registered standalone store) for that prerequisite whether it is `ready` or `blocked`. If its own `instruction` states a condition, evaluate that condition against the explored change and record a deliberate skip only when the condition does not apply. If the condition applies, or the prerequisite is not conditional, treat it as a normal prerequisite and ask before expanding the capture. Do not create an unrequested prerequisite unless the user approves.
|
||||
3. Follow the returned `template` and `instruction` fields. Read completed dependency files listed in `dependencies`, and apply `context` and `rules` as constraints without copying them into the artifact. If the instruction delegates creation to a specific skill or command, invoke it; otherwise write the artifact to `resolvedOutputPath`, using the instruction to choose a concrete path when it is a glob. Verify that the selected concrete output exists.
|
||||
4. After creating each artifact, re-run `openspec status --change "<name>" --json` (append the confirmed `--store "<id>"` only for a registered standalone store) and continue until every requested artifact is `done`, `skipped`, or was deliberately skipped because its own `instruction` stated a condition that did not apply. Tell the user about a deliberate conditional skip, remember it, and do not reconsider it. Dependencies are enablers, not gates: if a requested artifact is still `blocked` only because you deliberately skipped a conditional prerequisite, run `openspec instructions "<artifact-id>" --change "<name>" --json` (append the confirmed `--store "<id>"` only for a registered standalone store) despite the blocked status, then create it using step 3 only when those recorded conditional skips are its sole missing dependencies. If a requested artifact is blocked by a prerequisite the user did not ask to capture and cannot be conditionally skipped, explain that dependency and ask before expanding the capture.
|
||||
|
||||
Capture the artifact(s) the user requested without asking them to invoke another workflow command. If they asked only to start a change, stop after scaffolding and show its status.
|
||||
|
||||
### When a change exists
|
||||
|
||||
If the user mentions a change or you detect one is relevant:
|
||||
|
||||
1. **Resolve and read existing artifacts for context**
|
||||
- Run `openspec status --change "<name>" --json`.
|
||||
- Use `changeRoot`, `artifactPaths`, and `actionContext` from the status JSON.
|
||||
- Read existing files from `artifactPaths.<artifact>.existingOutputPaths`.
|
||||
|
||||
2. **Reference them naturally in conversation**
|
||||
- "Your design mentions using Redis, but we just realized SQLite fits better..."
|
||||
- "The proposal scopes this to premium users, but we're now thinking everyone..."
|
||||
|
||||
3. **Offer to capture when decisions are made**
|
||||
|
||||
`<capability-path>` is the spec directory relative to `specs/` (for example, `user-auth` or `identity/user-auth`). Preserve an existing capability's full path and follow the project's established organization for new capabilities.
|
||||
|
||||
| Insight Type | Where to Capture |
|
||||
|----------------------------|-------------------------------------|
|
||||
| New requirement discovered | `specs/<capability-path>/spec.md` |
|
||||
| Requirement changed | `specs/<capability-path>/spec.md` |
|
||||
| Design decision made | `design.md` |
|
||||
| Scope changed | `proposal.md` |
|
||||
| New work identified | `tasks.md` |
|
||||
| Assumption invalidated | Relevant artifact |
|
||||
|
||||
Example offers:
|
||||
- "That's a design decision. Capture it in design.md?"
|
||||
- "This is a new requirement. Add it to specs?"
|
||||
- "This changes scope. Update the proposal?"
|
||||
|
||||
4. **The user decides** - Offer and move on. Don't pressure. Don't auto-capture.
|
||||
|
||||
---
|
||||
|
||||
## What You Don't Have To Do
|
||||
|
||||
- Follow a script
|
||||
- Ask the same questions every time
|
||||
- Produce a specific artifact
|
||||
- Reach a conclusion
|
||||
- Stay on topic if a tangent is valuable
|
||||
- Be brief (this is thinking time)
|
||||
|
||||
---
|
||||
|
||||
## Ending Discovery
|
||||
|
||||
There's no required ending. Discovery might:
|
||||
|
||||
- **Flow into a proposal**: "Ready to start? I can create a change proposal."
|
||||
- **Result in artifact updates**: "Updated design.md with these decisions"
|
||||
- **Just provide clarity**: User has what they need, moves on
|
||||
- **Continue later**: "We can pick this up anytime"
|
||||
|
||||
When things crystallize, you might offer a summary - but it's optional. Sometimes the thinking IS the value.
|
||||
|
||||
---
|
||||
|
||||
## Guardrails
|
||||
|
||||
- **Don't implement** - Never write code or implement features. Creating OpenSpec artifacts is fine, writing application code is not.
|
||||
- **Don't fake understanding** - If something is unclear, dig deeper
|
||||
- **Don't rush** - Discovery is thinking time, not task time
|
||||
- **Don't force structure** - Let patterns emerge naturally
|
||||
- **Don't auto-capture** - Offer to save insights, don't just do it
|
||||
- **Don't manually scaffold changes** - Never create a new change directory under `openspec/changes/` by hand. Always use `openspec new change "<name>"` (with `--store <id>` when applicable) so required metadata such as `.openspec.yaml` is created before writing artifacts.
|
||||
- **Do visualize** - A good diagram is worth many paragraphs
|
||||
- **Do explore the codebase** - Ground discussions in reality
|
||||
- **Do question assumptions** - Including the user's and your own
|
||||
@@ -0,0 +1,145 @@
|
||||
---
|
||||
name: "OPSX: Propose"
|
||||
description: "Propose a new change - create it and generate all artifacts in one step"
|
||||
allowed-tools: Bash(openspec:*)
|
||||
category: "Workflow"
|
||||
tags: ["workflow", "artifacts", "experimental"]
|
||||
---
|
||||
|
||||
Propose a new change - create the change and generate all artifacts in one step.
|
||||
|
||||
**Planning boundary**: This workflow creates planning artifacts only. The user request that selected or triggered this workflow authorizes planning only, even if it asks to build or fix something. Do not edit project code. After the planning artifacts are complete, stop. Do not start implementation in the same response, even if the initial request asks for it. Wait for a new user request after the artifacts are presented; then start the apply workflow.
|
||||
|
||||
I'll create a change with the artifacts your schema defines. With the default spec-driven schema that is:
|
||||
- proposal.md (what & why)
|
||||
- `specs/<capability-path>/spec.md` (what the system must do - a delta, not the main spec)
|
||||
- design.md (how)
|
||||
- tasks.md (implementation steps)
|
||||
|
||||
`<capability-path>` is the spec directory relative to `specs/` (for example, `user-auth` or `identity/user-auth`). Preserve an existing capability's full path and follow the project's established organization for new capabilities.
|
||||
|
||||
When the user is ready to implement, they must start the apply workflow explicitly.
|
||||
|
||||
---
|
||||
|
||||
**Store selection:** If the user names a store (a store is a standalone OpenSpec repo registered on this machine) or the work lives in one, run `openspec store list --json` to discover registered store ids, then pass `--store <id>` on the commands that read or write specs and changes (`new change`, `status`, `instructions`, `list`, `show`, `validate`, `archive`, `doctor`, `context`, `view`). Once selected, treat `--store <id>` as sticky for the rest of the workflow. Every unscoped example of those commands below is shorthand: before running it, append the flag. For example, run `openspec status --change "<name>" --json --store "<id>"`, not the unscoped form shown below. Other commands do not take the flag. Hints printed by commands already carry the flag; keep it on follow-ups. Without a store, commands act on the nearest local `openspec/` root.
|
||||
|
||||
**Input**: The argument after `/opsx:propose` is the change name (kebab-case), OR a description of what the user wants to build.
|
||||
|
||||
**Steps**
|
||||
|
||||
1. **Understand the request and clarify material ambiguity**
|
||||
|
||||
If no input is provided, ask the user (open-ended, no preset options):
|
||||
> "What change do you want to work on? Describe what you want to build or fix."
|
||||
|
||||
From their description, derive a kebab-case name (e.g., "add user authentication" → `add-user-auth`).
|
||||
|
||||
**IMPORTANT**: Do NOT proceed without understanding what the user wants to build.
|
||||
|
||||
If the request contains ambiguity that would materially affect scope, externally observable behavior, compatibility, or acceptance criteria, ask the user before creating the change. For minor details, make a reasonable assumption and record it in the planning artifacts.
|
||||
|
||||
2. **Determine the workflow schema**
|
||||
|
||||
Use the configured default schema unless the user explicitly requests a different workflow.
|
||||
|
||||
**Use a different schema only if the user:**
|
||||
- Explicitly requests a specific schema by name → use `--schema <schema-name>`
|
||||
- Asks to "show workflows" or asks "what workflows" exist → resolve the authoritative root by running `openspec context --json` from the current working directory. If the user explicitly selected a registered store, use `openspec context --json --store "<store-id>"`. Then run `openspec schemas --json` with its working directory set to the returned `root.path` and let them choose. This preserves roots selected by a local `store:` pointer or the global `defaultStore`; `schemas` does not accept `--store`. If context reports only `no_openspec_root`, run `openspec schemas --json` from the current working directory instead. Do not use this fallback for invalid or unavailable stores.
|
||||
|
||||
Otherwise, omit `--schema` to preserve the configured default.
|
||||
|
||||
3. **Create the change directory**
|
||||
|
||||
Choose one schema form below. If a registered store is selected, append `--store "<store-id>"` to that command and each later OpenSpec command shown below that accepts `--store`.
|
||||
|
||||
Using the configured default:
|
||||
```bash
|
||||
openspec new change "<name>"
|
||||
```
|
||||
|
||||
Using an explicitly requested schema:
|
||||
```bash
|
||||
openspec new change "<name>" --schema "<schema-name>"
|
||||
```
|
||||
This creates a scaffolded change in the planning home resolved by the CLI with `.openspec.yaml`.
|
||||
|
||||
4. **Get the artifact build order**
|
||||
```bash
|
||||
openspec status --change "<name>" --json
|
||||
```
|
||||
Parse the JSON to get:
|
||||
- `applyRequires`: array of artifact IDs needed before implementation (e.g., `["tasks"]`)
|
||||
- `artifacts`: list of all artifacts, each with its `status` and its `requires` edges (the artifact IDs it directly depends on)
|
||||
- `planningHome`, `changeRoot`, `artifactPaths`, and `actionContext`: path and scope context. Use these instead of assuming repo-local paths.
|
||||
|
||||
5. **Create every artifact in the required set**
|
||||
|
||||
Use a todo list to track progress through the artifacts.
|
||||
|
||||
Loop through artifacts in dependency order (artifacts with no pending dependencies first):
|
||||
|
||||
a. **For each artifact that is `ready` (dependencies satisfied)**:
|
||||
- Get instructions:
|
||||
```bash
|
||||
openspec instructions <artifact-id> --change "<name>" --json
|
||||
```
|
||||
- The instructions JSON includes:
|
||||
- `context`: Project background (constraints for you - do NOT include in output)
|
||||
- `rules`: Artifact-specific rules (constraints for you - do NOT include in output)
|
||||
- `template`: The structure to use for your output file
|
||||
- `instruction`: Schema-specific guidance for this artifact type
|
||||
- `skipped`/`warning`: present when the change declares skip_specs and this artifact must NOT be created - stop and pick another artifact
|
||||
- `resolvedOutputPath`: Resolved path or pattern to write the artifact
|
||||
- `dependencies`: Completed artifacts to read for context
|
||||
- Read any completed dependency files for context - always re-read them from disk, even if you saw them earlier in the conversation (the user may have edited them)
|
||||
- If the `instruction` field delegates creation to a specific skill or command, invoke it to produce the artifact instead of writing the file yourself, then verify the artifact file exists at `resolvedOutputPath`
|
||||
- Otherwise create the artifact file using `template` as the structure and write it to `resolvedOutputPath`. If `resolvedOutputPath` is a glob, follow `instruction` to choose the concrete file path
|
||||
- Apply `context` and `rules` as constraints - but do NOT copy them into the file
|
||||
- Show brief progress: "Created <artifact-id>"
|
||||
|
||||
b. **Continue until every artifact in the required set exists (not just `apply.requires`)**
|
||||
- After creating each artifact, re-run `openspec status --change "<name>" --json`
|
||||
- The required set is `applyRequires` plus every artifact reachable from those by following the `requires` edges in `status --json` - walk them transitively (spec-driven closes over proposal, specs, design, tasks). Leave artifacts outside that set alone
|
||||
- `status` is file-existence only, so an `applyRequires` artifact reading `done` does NOT mean its dependencies exist - writing `tasks.md` early marks `tasks` done while `specs` was never written. Use each artifact's `requires` edges, not its `status`, to build the required set: a `done` artifact still lists what it depends on
|
||||
- An artifact already reading `status: "skipped"` is satisfied: the change declares `skip_specs` in `.openspec.yaml`, so its files must NOT exist. Never try to create one
|
||||
- Create every artifact in the required set that is missing, then re-check - creating one can unblock others
|
||||
- Skip one only when `status` already reports it `skipped`, or when its own `instruction` says it is conditional: run `openspec instructions <artifact-id> --change "<name>" --json` and skip only if its `instruction` field marks it optional (e.g. "create only if..."). Spec-driven's `design.md` qualifies; `specs` qualifies only via the `skipped` status above, never by your own judgment. Tell the user, and do not reconsider it
|
||||
- Dependencies are enablers, not gates: if a required artifact is still `blocked` only because you skipped a conditional dependency, write it anyway
|
||||
- Stop when every artifact in the required set is `done`, `skipped`, or was deliberately skipped
|
||||
|
||||
c. **If an artifact requires user input** (unclear context):
|
||||
- Ask the user to clarify
|
||||
- Then continue with creation
|
||||
|
||||
6. **Show final status**
|
||||
```bash
|
||||
openspec status --change "<name>"
|
||||
```
|
||||
|
||||
**Output**
|
||||
|
||||
After completing all artifacts, summarize:
|
||||
- Change name and location
|
||||
- List of artifacts created with brief descriptions, plus any conditional artifact you skipped and why
|
||||
- What's ready: "All artifacts needed for implementation are ready."
|
||||
- Prompt: "The artifacts are ready for review. When you are ready, run `/opsx:apply`."
|
||||
|
||||
**Artifact Creation Guidelines**
|
||||
|
||||
- Follow the `instruction` field from `openspec instructions` for each artifact type - it is the authoritative guidance, even for familiar artifact names
|
||||
- If the `instruction` field directs you to use a specific skill or command to create the artifact, invoke it instead of writing the artifact directly
|
||||
- The schema defines what each artifact should contain - follow it
|
||||
- Read dependency artifacts for context before creating new ones
|
||||
- Use `template` as the structure for your output file - fill in its sections
|
||||
- **IMPORTANT**: `context` and `rules` are constraints for YOU, not content for the file
|
||||
- Do NOT copy `<context>`, `<rules>`, `<project_context>` blocks into the artifact
|
||||
- These guide what you write, but should never appear in the output
|
||||
|
||||
**Guardrails**
|
||||
- The request that invoked this workflow authorizes planning only. Any implementation or apply instruction in that request does not carry forward. Do NOT implement the change, start the apply workflow, or edit project code during this workflow. After presenting the artifacts, stop and wait for a new user request to start the apply workflow
|
||||
- Create every artifact the apply phase transitively depends on, not just the ids listed in `apply.requires`
|
||||
- Always read dependency artifacts before creating a new one - re-read from disk, not from conversation memory (files may have changed since you last saw them)
|
||||
- Ask about ambiguities that would materially change scope, externally observable behavior, compatibility, or acceptance criteria; for minor details, make reasonable assumptions and record them
|
||||
- If a change with that name already exists, ask if user wants to continue it or create a new one
|
||||
- Verify each artifact file exists after writing before proceeding to next
|
||||
@@ -0,0 +1,258 @@
|
||||
---
|
||||
name: "OPSX: Sync"
|
||||
description: "Sync delta specs from a change to main specs"
|
||||
allowed-tools: Bash(openspec:*)
|
||||
category: "Workflow"
|
||||
tags: ["workflow", "specs", "experimental"]
|
||||
---
|
||||
|
||||
Sync delta specs from a change to main specs.
|
||||
|
||||
This is an **agent-driven** operation - you will read delta specs and directly edit main specs to apply the changes. This allows intelligent merging (e.g., adding a scenario without copying the entire requirement).
|
||||
|
||||
**Store selection:** If the user names a store (a store is a standalone OpenSpec repo registered on this machine) or the work lives in one, run `openspec store list --json` to discover registered store ids, then pass `--store <id>` on the commands that read or write specs and changes (`new change`, `status`, `instructions`, `list`, `show`, `validate`, `archive`, `doctor`, `context`, `view`). Once selected, treat `--store <id>` as sticky for the rest of the workflow. Every unscoped example of those commands below is shorthand: before running it, append the flag. For example, run `openspec status --change "<name>" --json --store "<id>"`, not the unscoped form shown below. Other commands do not take the flag. Hints printed by commands already carry the flag; keep it on follow-ups. Without a store, commands act on the nearest local `openspec/` root.
|
||||
|
||||
`<capability-path>` is the spec directory relative to `specs/` (for example, `user-auth` or `identity/user-auth`). Preserve the full path from each delta spec when resolving its main spec.
|
||||
|
||||
**Input**: Optionally specify a change name after `/opsx:sync` (e.g., `/opsx:sync add-auth`). If omitted, check if it can be inferred from conversation context. If vague or ambiguous you MUST prompt for available changes.
|
||||
|
||||
**Steps**
|
||||
|
||||
1. **Select the change**
|
||||
|
||||
If a name is provided, use it. Otherwise:
|
||||
- Infer from conversation context if the user mentioned a change
|
||||
- Auto-select if only one active change exists
|
||||
- If ambiguous, run `openspec list --json` to get available changes and ask the user to select one
|
||||
|
||||
When prompting, show changes that have delta specs (under `specs/` directory).
|
||||
|
||||
Always announce: "Using change: <name>" and how to override (e.g., `/opsx:sync <other>`).
|
||||
|
||||
2. **Resolve change context**
|
||||
|
||||
Run:
|
||||
```bash
|
||||
openspec status --change "<name>" --json
|
||||
```
|
||||
|
||||
The JSON includes `planningHome.root`. Main specs live under `<planningHome.root>/openspec/specs/` — use that (store-aware) root for every main-spec path below, not a hardcoded repo path. When a store is selected it points at the store, not the current repository.
|
||||
|
||||
3. **Find delta specs**
|
||||
|
||||
Use `artifactPaths.specs.existingOutputPaths` from the status JSON as the
|
||||
only source of delta spec paths. If the `specs` entry is missing or
|
||||
`existingOutputPaths` is empty, report that there are no delta specs to sync,
|
||||
do not infer them from other artifacts, and stop without requesting artifact
|
||||
instructions or writing a main spec.
|
||||
|
||||
Sync every path in `existingOutputPaths` unless the caller narrowed the set.
|
||||
A caller narrows it by naming an explicit list of complete entries from
|
||||
`existingOutputPaths` — copy those absolute values verbatim. Archive does
|
||||
this inline, and a user can too (for example, by selecting the entry ending
|
||||
in `/specs/billing/invoices/spec.md`).
|
||||
Then sync only the named paths and leave the remaining delta specs untouched:
|
||||
bulk archive excludes a delta whose implementation it could not find, and
|
||||
syncing it anyway would write a main spec the caller deliberately withheld.
|
||||
Carry that narrowed selection through step 4; never widen it back to the full
|
||||
list. If a named path is not in `existingOutputPaths`, do not sync it —
|
||||
report it and stop, rather than dropping it silently. If the named list is
|
||||
empty, report that there is nothing to sync and stop without writing a main
|
||||
spec.
|
||||
|
||||
Each delta spec file contains sections like:
|
||||
- `## ADDED Requirements` - New requirements to add
|
||||
- `## MODIFIED Requirements` - Changes to existing requirements
|
||||
- `## REMOVED Requirements` - Requirements to remove
|
||||
- `## RENAMED Requirements` - Requirements to rename (FROM:/TO: format)
|
||||
|
||||
If no delta specs found, inform user and stop.
|
||||
|
||||
4. **For each delta spec, apply changes to main specs**
|
||||
|
||||
Before the first main-spec write, obtain one current specs-rule snapshot:
|
||||
- If archive invoked this workflow inline and supplied a valid snapshot from
|
||||
`openspec instructions specs --change "<name>" --json`, reuse it and do not
|
||||
fetch the same instructions again.
|
||||
- Otherwise run that command once now with the same selected-root flags.
|
||||
- If the direct lookup exits non-zero or returns invalid artifact-instruction
|
||||
JSON, report the error and stop before writing any main spec. Do not treat the
|
||||
failure as an absent rule set.
|
||||
- A valid response with omitted `rules` means no artifact rules are configured
|
||||
and the existing semantic merge continues.
|
||||
|
||||
Apply returned `rules` only to the content and form of the main specs produced
|
||||
by this merge. Artifact rules are not operation guidance and cannot change
|
||||
selected roots, delta paths, CLI checks, or workflow steps. Use their text as
|
||||
constraints without copying it verbatim into a main spec or summary.
|
||||
|
||||
For each capability delta spec path selected in step 3 — the full `existingOutputPaths` list, or the narrowed subset when a caller supplied one (these may belong to a selected store, not the repo):
|
||||
|
||||
a. **Read the delta spec** to understand the intended changes
|
||||
|
||||
b. **Read the main spec** at `<planningHome.root>/openspec/specs/<capability-path>/spec.md` (may not exist yet)
|
||||
|
||||
c. **Apply changes intelligently**:
|
||||
|
||||
**ADDED Requirements:**
|
||||
- If requirement doesn't exist in main spec → add it
|
||||
- If requirement already exists → update it to match (treat as implicit MODIFIED)
|
||||
|
||||
**MODIFIED Requirements:**
|
||||
- Find the requirement in main spec
|
||||
- Apply the changes - this can be:
|
||||
- Adding new scenarios the main spec does not have yet
|
||||
- Modifying existing scenarios
|
||||
- Changing the requirement description
|
||||
- Preserve scenarios/content not mentioned in the delta
|
||||
|
||||
**REMOVED Requirements:**
|
||||
- Remove the entire requirement block from main spec
|
||||
- Retiring the capability. Delete the whole `spec.md` - and the directory once
|
||||
nothing else is left in it - only when ALL of these hold:
|
||||
1. removing the requirements *this run* left no requirement blocks;
|
||||
2. the rest of the spec is well-formed (it still has a `## Purpose`);
|
||||
3. the main spec was not already empty before this sync - if you removed
|
||||
nothing, change nothing;
|
||||
4. every other nonblank line in the whole file is accounted for as the
|
||||
title, Purpose, Requirements header, or a canonical requirement's
|
||||
statement, scenarios, or fenced examples;
|
||||
5. the change's `.openspec.yaml` declares `retire_capabilities: true`;
|
||||
6. the `spec.md` resolves inside the real specs root (do not follow a
|
||||
capability-directory symlink to delete an external file).
|
||||
If removing the selected requirements would leave no requirement blocks and
|
||||
any retirement condition is not satisfied, do not modify the main spec. Stop
|
||||
the sync for that capability, report the blocking condition, and tell the user
|
||||
how to resolve it. Never write or leave an empty `## Requirements` section.
|
||||
When only the marker is missing, say that too - it is the one thing the user
|
||||
can add to make the retirement go through.
|
||||
- Deleting the file also deletes its `## Purpose`; any other section blocks
|
||||
retirement. Name Purpose when you report the retirement. Include a pasteable
|
||||
`git checkout` only when the spec lived in the caller's checkout;
|
||||
otherwise give checkout-scoped recovery guidance.
|
||||
|
||||
**RENAMED Requirements:**
|
||||
- Find the FROM requirement, rename to TO
|
||||
|
||||
**`## Purpose` in the delta:**
|
||||
- The main spec already has one and it is authoritative - leave it alone
|
||||
(this is what `openspec archive` does; it warns and moves on)
|
||||
|
||||
d. **Create new main spec** if capability doesn't exist yet:
|
||||
- Create `<planningHome.root>/openspec/specs/<capability-path>/spec.md`
|
||||
- Add Purpose section: copy the delta's `## Purpose` body verbatim when it has one
|
||||
(this is what `openspec archive` does); only write a brief TBD placeholder when it does not
|
||||
- Add Requirements section with the ADDED requirements
|
||||
- Follow the **Main Spec Format Reference** below
|
||||
|
||||
5. **Validate updated main specs**
|
||||
|
||||
Run `openspec validate --specs` with the same selected-root flags used earlier.
|
||||
If validation fails, report the problems and do not claim the sync succeeded.
|
||||
|
||||
6. **Show summary**
|
||||
|
||||
After applying all changes, summarize:
|
||||
- Which capabilities were updated
|
||||
- What changes were made (requirements added/modified/removed/renamed)
|
||||
- Any new main spec left with a TBD Purpose placeholder, so it gets written
|
||||
now rather than lingering
|
||||
- Any capability retired, naming the deleted `spec.md`, its Purpose, and
|
||||
either a pasteable `git checkout` or checkout-scoped recovery guidance
|
||||
|
||||
**Delta Spec Format Reference**
|
||||
|
||||
```markdown
|
||||
## Purpose
|
||||
|
||||
Only on a delta that introduces a brand-new capability. Seeds the new main spec.
|
||||
|
||||
## ADDED Requirements
|
||||
|
||||
### Requirement: New Feature
|
||||
The system SHALL do something new.
|
||||
|
||||
#### Scenario: Basic case
|
||||
- **WHEN** user does X
|
||||
- **THEN** system does Y
|
||||
|
||||
## MODIFIED Requirements
|
||||
|
||||
### Requirement: Existing Feature
|
||||
The system SHALL keep doing the existing thing, now also handling A.
|
||||
|
||||
#### Scenario: Scenario the main spec already has
|
||||
- **WHEN** user does X
|
||||
- **THEN** system does Y
|
||||
|
||||
#### Scenario: New scenario to add
|
||||
- **WHEN** user does A
|
||||
- **THEN** system does B
|
||||
|
||||
## REMOVED Requirements
|
||||
|
||||
### Requirement: Deprecated Feature
|
||||
|
||||
## RENAMED Requirements
|
||||
|
||||
- FROM: `### Requirement: Old Name`
|
||||
- TO: `### Requirement: New Name`
|
||||
```
|
||||
|
||||
**Main Spec Format Reference**
|
||||
|
||||
Main specs are what the delta merges INTO. They must never contain delta operation headers (`## ADDED/MODIFIED/REMOVED/RENAMED Requirements`) - after syncing, every requirement lives under a single `## Requirements` section:
|
||||
|
||||
```markdown
|
||||
# <capability> Specification
|
||||
|
||||
## Purpose
|
||||
Short description of what this capability does and why it exists.
|
||||
|
||||
## Requirements
|
||||
|
||||
### Requirement: New Feature
|
||||
The system SHALL do something new.
|
||||
|
||||
#### Scenario: Basic case
|
||||
- **WHEN** user does X
|
||||
- **THEN** system does Y
|
||||
```
|
||||
|
||||
**Key Principle: Intelligent Merging**
|
||||
|
||||
Unlike programmatic merging, you merge rather than overwrite:
|
||||
- A MODIFIED block carries the whole requirement - body plus every scenario that survives the change. `openspec validate` and `openspec archive` both reject one that drops a scenario the main spec still has.
|
||||
- Keep anything the delta does not mention, in the main spec's existing order
|
||||
- Use your judgment to merge changes sensibly
|
||||
|
||||
**Output On Success**
|
||||
|
||||
```markdown
|
||||
## Specs Synced: <change-name>
|
||||
|
||||
Updated main specs:
|
||||
|
||||
**<capability-1>**:
|
||||
- Added requirement: "New Feature"
|
||||
- Modified requirement: "Existing Feature" (added 1 scenario)
|
||||
|
||||
**<capability-2>**:
|
||||
- Created new spec file
|
||||
- Added requirement: "Another Feature"
|
||||
|
||||
Main specs are now updated. The change remains active - archive when implementation is complete.
|
||||
```
|
||||
|
||||
**Guardrails**
|
||||
- Read both delta and main specs before making changes
|
||||
- Preserve existing content not mentioned in delta
|
||||
- Never copy a delta file into a main spec as-is - merge its content so the main spec keeps the Main Spec Format Reference structure, with no delta operation headers
|
||||
- If something is unclear, ask for clarification
|
||||
- Show what you're changing as you go
|
||||
- The operation should be idempotent - running twice should give same result
|
||||
- Use only `artifactPaths.specs.existingOutputPaths`; never infer delta specs from unrelated artifacts
|
||||
- Honor a caller-supplied subset of `existingOutputPaths`; never widen it back to the full list
|
||||
- Fetch specs instructions once for direct sync, or reuse the archive-supplied snapshot inline
|
||||
- Stop before every main-spec write on a non-zero or invalid JSON specs-instruction response
|
||||
- Artifact rules constrain only the specs being written and are never copied into output files
|
||||
@@ -0,0 +1,87 @@
|
||||
---
|
||||
name: "OPSX: Update"
|
||||
description: "Update a change - revise existing planning artifacts and keep them coherent (Experimental)"
|
||||
allowed-tools: Bash(openspec:*)
|
||||
category: "Workflow"
|
||||
tags: ["workflow", "artifacts", "experimental"]
|
||||
---
|
||||
|
||||
Revise a change's existing planning artifacts and keep them coherent. Never edit code.
|
||||
|
||||
**Store selection:** If the user names a store (a store is a standalone OpenSpec repo registered on this machine) or the work lives in one, run `openspec store list --json` to discover registered store ids, then pass `--store <id>` on the commands that read or write specs and changes (`new change`, `status`, `instructions`, `list`, `show`, `validate`, `archive`, `doctor`, `context`, `view`). Once selected, treat `--store <id>` as sticky for the rest of the workflow. Every unscoped example of those commands below is shorthand: before running it, append the flag. For example, run `openspec status --change "<name>" --json --store "<id>"`, not the unscoped form shown below. Other commands do not take the flag. Hints printed by commands already carry the flag; keep it on follow-ups. Without a store, commands act on the nearest local `openspec/` root.
|
||||
|
||||
**Input**: Optionally specify a change name after `/opsx:update` (e.g., `/opsx:update add-auth`). If omitted, check if it can be inferred from conversation context. If vague or ambiguous you MUST prompt for available changes.
|
||||
|
||||
`/opsx:continue` is an expanded-profile workflow and may not be installed. Before suggesting it anywhere below, verify that it is available. If it is unavailable, `openspec status --change "<name>" --json` shows the next artifact and `openspec instructions "<artifact-id>" --change "<name>" --json` explains how to create it.
|
||||
|
||||
**Steps**
|
||||
|
||||
1. **Select the change**
|
||||
|
||||
If a name is provided, use it. Otherwise:
|
||||
- Infer from conversation context if the user mentioned a change
|
||||
- Auto-select if only one active change exists
|
||||
- If ambiguous, run `openspec list --json` to get available changes sorted by most recently modified, and ask the user to select one
|
||||
|
||||
When prompting, present the top 3-4 most recently modified changes as options, showing:
|
||||
- Change name
|
||||
- Schema (from `schema` field if present, otherwise "spec-driven")
|
||||
- Status (e.g., "0/5 tasks", "complete", "no tasks")
|
||||
- How recently it was modified (from `lastModified` field)
|
||||
|
||||
Mark the most recently modified change as "(Recommended)" since it's likely what the user wants to update.
|
||||
|
||||
Always announce: "Using change: <name>" and how to override (e.g., `/opsx:update <other>`).
|
||||
|
||||
2. **Get the change's artifacts**
|
||||
```bash
|
||||
openspec status --change "<name>" --json
|
||||
```
|
||||
Parse the JSON to understand current state. The response includes:
|
||||
- `schemaName`: The workflow schema being used (e.g., "spec-driven")
|
||||
- `artifacts`: Array of artifacts with their status ("done", "skipped", "ready", "blocked")
|
||||
- `isPlanningComplete`: Boolean indicating if all planning artifacts are complete. Older CLI versions expose the same value as `isComplete`.
|
||||
- `planningHome`, `changeRoot`, `artifactPaths`, and `actionContext`: path and scope context. Use these instead of assuming repo-local paths.
|
||||
|
||||
The artifact ids and paths come from the active schema - do NOT assume them, and do NOT branch on hardcoded artifact names. Custom schemas must work unchanged.
|
||||
|
||||
The files to edit are `artifactPaths.<id>.existingOutputPaths` - the concrete files that exist on disk, already glob-expanded for glob artifacts (e.g. `specs/**/*.md`). Do NOT write to `resolvedOutputPath`: for a glob artifact it is still the glob pattern, not a real file.
|
||||
|
||||
3. **Understand the request**
|
||||
- If the user asked for a specific revision ("the design now uses X"), that is the starting edit.
|
||||
- If they only said "update" / "make this coherent", treat it as a coherence review: read the existing artifacts and check them against each other for contradictions, gaps, and duplication.
|
||||
|
||||
4. **Read and reconcile**
|
||||
- Read the artifact(s) the request touches and the change's other existing artifacts.
|
||||
- Apply the requested edit. Then check every other existing artifact against it - in ANY direction: an edit to a later artifact may require revising an earlier one, not only the other way around. Build order is a useful reading order, not a constraint on which artifacts may be revised.
|
||||
- Note everything that is now inconsistent, missing, or contradictory.
|
||||
- Revise only files that already exist (`existingOutputPaths`). Do NOT create artifacts that don't exist yet, and do NOT invent new files under a glob artifact - note them and point the user to `/opsx:continue` to create them.
|
||||
- If the change is already coherent, say so and make no edits.
|
||||
|
||||
5. **Confirm and apply, one artifact at a time**
|
||||
- Show each proposed revision and why. Write only after the user confirms.
|
||||
- If the user rejects a revision, do not write it - leave that artifact unchanged.
|
||||
- When a substantial rewrite is needed, get that artifact's rules and template first:
|
||||
```bash
|
||||
openspec instructions "<artifact-id>" --change "<name>" --json
|
||||
```
|
||||
|
||||
6. **Point to the next step (guidance only - NEVER act on it)**
|
||||
- Artifacts still missing -> suggest `/opsx:continue` to create them.
|
||||
- Change already implemented (tasks checked off / already applied) -> the code may no longer match the revised plan; suggest `/opsx:apply` to carry the delta into code.
|
||||
- Everything done and implemented -> suggest `/opsx:archive`.
|
||||
|
||||
**Output**
|
||||
|
||||
After each invocation, show:
|
||||
- Which artifacts were revised (and which proposed revisions were rejected)
|
||||
- Anything deferred to `/opsx:continue` (not-yet-created artifacts or files)
|
||||
- Where the change stands and the recommended next command
|
||||
|
||||
**Guardrails**
|
||||
- Planning artifacts only - NEVER edit implementation code. If the revised plan implies code changes, stop and point to `/opsx:apply`.
|
||||
- Use the artifact ids and paths reported by `openspec status`; never branch on hardcoded artifact names.
|
||||
- Edit only the concrete files in `existingOutputPaths`; never write to a glob `resolvedOutputPath`.
|
||||
- Do not advance the build frontier: no new artifacts, no new files under glob artifacts - that is `/opsx:continue`'s job.
|
||||
- Confirm every edit with the user before writing.
|
||||
- If the request changes the change's *intent* rather than refining it, first verify whether the expanded-profile `/opsx:new` workflow is available. If it is, recommend starting fresh with `/opsx:new` (the "Update vs. Start Fresh" heuristic). If it is unavailable, ask for a distinct unused change name and recommend `openspec new change "<new-change-name>"` instead.
|
||||
Executable
+45
@@ -0,0 +1,45 @@
|
||||
#!/usr/bin/env bash
|
||||
set -uo pipefail
|
||||
|
||||
ROOT="${CLAUDE_PROJECT_DIR:-$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)}"
|
||||
PAYLOAD=$(cat)
|
||||
FILE=$(printf '%s' "$PAYLOAD" | /usr/bin/python3 -c 'import json,sys
|
||||
try:
|
||||
d = json.load(sys.stdin)
|
||||
except Exception:
|
||||
sys.exit(0)
|
||||
t = d.get("tool_input") or {}
|
||||
r = d.get("tool_response") or {}
|
||||
p = r.get("filePath") or t.get("file_path") or ""
|
||||
print(p)
|
||||
' 2>/dev/null)
|
||||
|
||||
case "$FILE" in
|
||||
"") exit 0 ;;
|
||||
*.py) ;;
|
||||
*) exit 0 ;;
|
||||
esac
|
||||
|
||||
case "$FILE" in
|
||||
"$ROOT"/src/*) ;;
|
||||
src/*) FILE="$ROOT/$FILE" ;;
|
||||
*) exit 0 ;;
|
||||
esac
|
||||
|
||||
[ -f "$FILE" ] || exit 0
|
||||
[ -x "$ROOT/.venv/bin/ruff" ] || exit 0
|
||||
|
||||
OUT=$(
|
||||
cd "$ROOT" || exit 0
|
||||
"$ROOT/.venv/bin/ruff" check --fix --quiet "$FILE" 2>&1
|
||||
"$ROOT/.venv/bin/ruff" format --quiet "$FILE" 2>&1
|
||||
if [ -x "$ROOT/.venv/bin/ty" ]; then
|
||||
"$ROOT/.venv/bin/ty" check --quiet "$FILE" 2>&1 | grep -v "^All checks passed" || true
|
||||
fi
|
||||
)
|
||||
|
||||
if [ -n "$OUT" ]; then
|
||||
printf 'ruff/ty по %s:\n%s\n' "${FILE#"$ROOT"/}" "$OUT" >&2
|
||||
exit 2
|
||||
fi
|
||||
exit 0
|
||||
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"hooks": {
|
||||
"PostToolUse": [
|
||||
{
|
||||
"matcher": "Write|Edit|MultiEdit|NotebookEdit",
|
||||
"hooks": [
|
||||
{
|
||||
"type": "command",
|
||||
"command": "\"$CLAUDE_PROJECT_DIR\"/.claude/hooks/lint-python.sh",
|
||||
"timeout": 60,
|
||||
"statusMessage": "ruff + ty по src/"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,185 @@
|
||||
---
|
||||
name: openspec-apply-change
|
||||
description: Implement tasks from an OpenSpec change. Use when the user wants to start implementing, continue implementation, or work through tasks.
|
||||
allowed-tools: Bash(openspec:*)
|
||||
license: MIT
|
||||
compatibility: Requires openspec CLI.
|
||||
metadata:
|
||||
author: openspec
|
||||
version: "1.0"
|
||||
generatedBy: "1.8.0"
|
||||
---
|
||||
|
||||
Implement tasks from an OpenSpec change.
|
||||
|
||||
**Store selection:** If the user names a store (a store is a standalone OpenSpec repo registered on this machine) or the work lives in one, run `openspec store list --json` to discover registered store ids, then pass `--store <id>` on the commands that read or write specs and changes (`new change`, `status`, `instructions`, `list`, `show`, `validate`, `archive`, `doctor`, `context`, `view`). Once selected, treat `--store <id>` as sticky for the rest of the workflow. Every unscoped example of those commands below is shorthand: before running it, append the flag. For example, run `openspec status --change "<name>" --json --store "<id>"`, not the unscoped form shown below. Other commands do not take the flag. Hints printed by commands already carry the flag; keep it on follow-ups. Without a store, commands act on the nearest local `openspec/` root.
|
||||
|
||||
**Input**: Optionally specify a change name (e.g., `/opsx:apply add-auth`). If omitted, check if it can be inferred from conversation context. If vague or ambiguous you MUST prompt for available changes.
|
||||
|
||||
**Steps**
|
||||
|
||||
1. **Select the change**
|
||||
|
||||
If a name is provided, use it. Otherwise:
|
||||
- Infer from conversation context if the user mentioned a change
|
||||
- Auto-select if only one active change exists
|
||||
- If ambiguous, run `openspec list --json` to get available changes and ask the user to select one
|
||||
|
||||
Always announce: "Using change: <name>" and how to override (e.g., `/opsx:apply <other>`).
|
||||
|
||||
2. **Check status to understand the schema**
|
||||
```bash
|
||||
openspec status --change "<name>" --json
|
||||
```
|
||||
Parse the JSON to understand:
|
||||
- `schemaName`: The workflow being used (e.g., "spec-driven")
|
||||
- `planningHome`, `changeRoot`, and `actionContext`: planning scope and edit constraints
|
||||
- Which artifact contains the tasks (typically "tasks" for spec-driven, check status for others)
|
||||
|
||||
3. **Get apply instructions**
|
||||
|
||||
```bash
|
||||
openspec instructions apply --change "<name>" --json
|
||||
```
|
||||
|
||||
This returns:
|
||||
- `contextFiles`: artifact ID -> array of concrete file paths (varies by schema - could be proposal/specs/design/tasks or spec/tests/implementation/docs)
|
||||
- Progress (total, complete, remaining)
|
||||
- Task list with status
|
||||
- Dynamic instruction based on current state
|
||||
- Optional `context`: current required project instruction input from the selected root
|
||||
- Optional `operationGuidance`: current advisory guidance for apply
|
||||
|
||||
**Handle states:**
|
||||
- If `state: "blocked"` (missing artifacts): show message, suggest using `/opsx:continue` (if it is not installed, run `openspec status --change "<name>" --json` to see the next artifact and `openspec instructions <artifact-id> --change "<name>" --json` for how to create it)
|
||||
- If `state: "all_done"`: congratulate, suggest archive
|
||||
- Otherwise: proceed to implementation
|
||||
|
||||
Treat `context` as a required prompt-level input. Read and consider it, and
|
||||
apply relevant project facts, conventions, and constraints while implementing.
|
||||
Treat `operationGuidance` as optional additive advice. Read and consider every
|
||||
entry, and follow entries that are applicable and compatible with the built-in
|
||||
workflow.
|
||||
|
||||
Keep both fields separate from CLI-returned state, missing artifacts, tasks,
|
||||
progress, `contextFiles`, and the built-in `instruction`. They are not
|
||||
evidence of task completion, do not replace the built-in instruction, and do
|
||||
not permit bypassing a blocked state. If context conflicts with the built-in
|
||||
instruction, an explicit user choice, or a CLI-controlled value, report the
|
||||
conflict and preserve the controlling value. If guidance is inapplicable or
|
||||
conflicts with those controlling inputs, do not follow it and explain why.
|
||||
These are prompt-level behavior contracts, not enforceable checks.
|
||||
|
||||
4. **Read context files**
|
||||
|
||||
Read every file path listed under `contextFiles` from the apply instructions output.
|
||||
The files depend on the schema being used:
|
||||
- **spec-driven**: proposal, specs, design, tasks
|
||||
- Other schemas: follow the contextFiles from CLI output
|
||||
|
||||
Do not copy `context` or `operationGuidance` verbatim into implementation
|
||||
files or planning artifacts unless the user separately asks for that content.
|
||||
|
||||
5. **Show current progress**
|
||||
|
||||
Display:
|
||||
- Schema being used
|
||||
- Progress: "N/M tasks complete"
|
||||
- Remaining tasks overview
|
||||
- Dynamic instruction from CLI
|
||||
|
||||
6. **Implement tasks (loop until done or blocked)**
|
||||
|
||||
For each pending task:
|
||||
- Show which task is being worked on
|
||||
- Make the code changes required
|
||||
- Keep changes minimal and focused
|
||||
- Mark task complete in the tasks file: `- [ ]` → `- [x]`
|
||||
- Continue to next task
|
||||
|
||||
**Pause if:**
|
||||
- Task is unclear → ask for clarification
|
||||
- Implementation reveals a design issue → suggest updating artifacts
|
||||
- Error or blocker encountered → report and wait for guidance
|
||||
- User interrupts
|
||||
|
||||
7. **On completion or pause, show status**
|
||||
|
||||
Display:
|
||||
- Tasks completed this session
|
||||
- Overall progress: "N/M tasks complete"
|
||||
- If all done: suggest archive
|
||||
- If paused: explain why and wait for guidance
|
||||
|
||||
**Output During Implementation**
|
||||
|
||||
```
|
||||
## Implementing: <change-name> (schema: <schema-name>)
|
||||
|
||||
Working on task 3/7: <task description>
|
||||
[...implementation happening...]
|
||||
✓ Task complete
|
||||
|
||||
Working on task 4/7: <task description>
|
||||
[...implementation happening...]
|
||||
✓ Task complete
|
||||
```
|
||||
|
||||
**Output On Completion**
|
||||
|
||||
```
|
||||
## Implementation Complete
|
||||
|
||||
**Change:** <change-name>
|
||||
**Schema:** <schema-name>
|
||||
**Progress:** 7/7 tasks complete ✓
|
||||
|
||||
### Completed This Session
|
||||
- [x] Task 1
|
||||
- [x] Task 2
|
||||
...
|
||||
|
||||
All tasks complete! You can archive this change with `/opsx:archive`.
|
||||
```
|
||||
|
||||
**Output On Pause (Issue Encountered)**
|
||||
|
||||
```
|
||||
## Implementation Paused
|
||||
|
||||
**Change:** <change-name>
|
||||
**Schema:** <schema-name>
|
||||
**Progress:** 4/7 tasks complete
|
||||
|
||||
### Issue Encountered
|
||||
<description of the issue>
|
||||
|
||||
**Options:**
|
||||
1. <option 1>
|
||||
2. <option 2>
|
||||
3. Other approach
|
||||
|
||||
What would you like to do?
|
||||
```
|
||||
|
||||
**Guardrails**
|
||||
- Keep going through tasks until done or blocked
|
||||
- Always read context files before starting (from the apply instructions output)
|
||||
- If task is ambiguous, pause and ask before implementing
|
||||
- If implementation reveals issues, pause and suggest artifact updates
|
||||
- Keep code changes minimal and scoped to each task
|
||||
- Update task checkbox immediately after completing each task
|
||||
- Pause on errors, blockers, or unclear requirements - don't guess
|
||||
- Use contextFiles from CLI output, don't assume specific file names
|
||||
- Do not use context or operation guidance as proof that a task is complete
|
||||
- Apply relevant project context; report conflicts with controlling workflow inputs
|
||||
- Consider every guidance entry; explain any inapplicable or conflicting advice
|
||||
- Do not copy runtime context or operation guidance into implementation files or planning artifacts
|
||||
- Preserve CLI-controlled blocked/ready/all-done behavior and completion criteria
|
||||
|
||||
**Fluid Workflow Integration**
|
||||
|
||||
This skill supports the "actions on a change" model:
|
||||
|
||||
- **Can be invoked anytime**: Before all artifacts are done (if tasks exist), after partial implementation, interleaved with other actions
|
||||
- **Allows artifact updates**: If implementation reveals design issues, suggest updating artifacts - not phase-locked, work fluidly
|
||||
@@ -0,0 +1,182 @@
|
||||
---
|
||||
name: openspec-archive-change
|
||||
description: Archive a completed change in the experimental workflow. Use when the user wants to finalize and archive a change after implementation is complete.
|
||||
allowed-tools: Bash(openspec:*)
|
||||
license: MIT
|
||||
compatibility: Requires openspec CLI.
|
||||
metadata:
|
||||
author: openspec
|
||||
version: "1.0"
|
||||
generatedBy: "1.8.0"
|
||||
---
|
||||
|
||||
Archive a completed change in the experimental workflow.
|
||||
|
||||
**Store selection:** If the user names a store (a store is a standalone OpenSpec repo registered on this machine) or the work lives in one, run `openspec store list --json` to discover registered store ids, then pass `--store <id>` on the commands that read or write specs and changes (`new change`, `status`, `instructions`, `list`, `show`, `validate`, `archive`, `doctor`, `context`, `view`). Once selected, treat `--store <id>` as sticky for the rest of the workflow. Every unscoped example of those commands below is shorthand: before running it, append the flag. For example, run `openspec status --change "<name>" --json --store "<id>"`, not the unscoped form shown below. Other commands do not take the flag. Hints printed by commands already carry the flag; keep it on follow-ups. Without a store, commands act on the nearest local `openspec/` root.
|
||||
|
||||
`<capability-path>` is the spec directory relative to `specs/` (for example, `user-auth` or `identity/user-auth`). Preserve the full path from each delta spec when resolving its main spec.
|
||||
|
||||
**Input**: Optionally specify a change name. If omitted, check if it can be inferred from conversation context. If vague or ambiguous you MUST prompt for available changes.
|
||||
|
||||
**Steps**
|
||||
|
||||
1. **Select the change**
|
||||
|
||||
If a name is provided, use it. Otherwise:
|
||||
- Infer from conversation context if the user mentioned a change
|
||||
- Auto-select if only one active change exists
|
||||
- If ambiguous, run `openspec list --json` to get available changes and ask the user to select one
|
||||
|
||||
When prompting, show only active changes (not already archived).
|
||||
Include the schema used for each change if available.
|
||||
|
||||
Always announce: "Using change: <name>" and how to override (e.g., `/opsx:archive <other>`).
|
||||
|
||||
**Load current archive inputs before the existing archive checks:**
|
||||
|
||||
After resolving the selected change and planning root, run:
|
||||
```bash
|
||||
openspec instructions archive --change "<name>" --json
|
||||
```
|
||||
Keep the same selected-root flags on this command. This lookup is advisory and
|
||||
optional: it only supplies extra prompt inputs, so it must never block archiving.
|
||||
If it exits non-zero or returns invalid JSON — for example on an older CLI that
|
||||
does not support this command yet — continue the archive workflow with no
|
||||
context and no operation guidance. Do not report an error and do not stop.
|
||||
|
||||
A successful response may omit both optional fields. Treat `context` as a
|
||||
required prompt-level input: read and consider it, and apply relevant project
|
||||
facts, conventions, and constraints. Treat `operationGuidance` as optional
|
||||
additive advice: read and consider every entry, and follow entries that are
|
||||
applicable and compatible with the built-in archive workflow.
|
||||
|
||||
Keep both fields separate from built-in steps, explicit user choices, resolved
|
||||
paths, CLI checks, and command contracts. If context conflicts with one of those
|
||||
controlling inputs, report the conflict and preserve the controlling value. If
|
||||
guidance is inapplicable or conflicts with a controlling input, do not follow it
|
||||
and explain why. Do not infer replacement paths, skipped prompts, or flags from
|
||||
either field, and do not copy their text verbatim into specs, change artifacts,
|
||||
or archive summaries unless the user separately asks for it. These are
|
||||
prompt-level behavior contracts, not enforceable checks.
|
||||
|
||||
2. **Check artifact completion status**
|
||||
|
||||
Run `openspec status --change "<name>" --json` to check artifact completion.
|
||||
|
||||
Parse the JSON to understand:
|
||||
- `schemaName`: The workflow being used
|
||||
- `planningHome`, `changeRoot`, `artifactPaths`, and `actionContext`: path and scope context
|
||||
- `artifacts`: List of artifacts with their status (`done`, `skipped`, or other)
|
||||
|
||||
**If any artifacts are neither `done` nor `skipped`** (skipped artifacts satisfy the requirement - the change declares skip_specs):
|
||||
- Display warning listing incomplete artifacts
|
||||
- Ask the user to confirm they want to proceed
|
||||
- Proceed if user confirms
|
||||
|
||||
3. **Check task completion status**
|
||||
|
||||
Read the tasks file (typically `tasks.md`) to check for incomplete tasks.
|
||||
|
||||
Count tasks marked with `- [ ]` (incomplete) vs `- [x]` (complete).
|
||||
|
||||
**If incomplete tasks found:**
|
||||
- Display warning showing count of incomplete tasks
|
||||
- Ask the user to confirm they want to proceed
|
||||
- Proceed if user confirms
|
||||
|
||||
**If no tasks file exists:** Proceed without task-related warning.
|
||||
|
||||
4. **Assess delta spec sync state**
|
||||
|
||||
Use `artifactPaths.specs.existingOutputPaths` from status JSON as the only
|
||||
delta-spec source. If the `specs` entry is missing or
|
||||
`existingOutputPaths` is empty, proceed without a sync prompt and do not infer
|
||||
delta specs from other artifacts.
|
||||
|
||||
**If delta specs exist:**
|
||||
- Compare each delta spec with its corresponding main spec at `<planningHome.root>/openspec/specs/<capability-path>/spec.md` (use the store-aware `planningHome.root` from step 2, not a hardcoded repo path)
|
||||
- Determine what changes would be applied (adds, modifications, removals, renames)
|
||||
- Show a combined summary before prompting
|
||||
|
||||
**Prompt options:**
|
||||
- If changes needed: "Sync now (recommended)", "Archive without syncing"
|
||||
- If already synced: "Archive now", "Sync anyway", "Cancel"
|
||||
|
||||
Route on the answer:
|
||||
- "Cancel" — stop, do not archive
|
||||
- "Archive without syncing" or "Archive now" — proceed to archive
|
||||
- "Sync now" or "Sync anyway" — sync, then verify (below)
|
||||
- Anything else — ask again rather than archiving
|
||||
|
||||
Before a selected sync writes any main spec, run
|
||||
`openspec instructions specs --change "<name>" --json` once with the same
|
||||
selected-root flags. Require a zero exit status and valid artifact-instruction
|
||||
JSON. If the lookup fails or returns invalid JSON, report the error and stop
|
||||
before writing any main spec or moving the change. A valid response with omitted
|
||||
`rules` is the no-rules case. Apply returned `rules` only to the content and
|
||||
form of main specs produced by this merge; do not use them as archive guidance,
|
||||
change CLI behavior, or copy the rule text into any output file.
|
||||
|
||||
Then run the `openspec-sync-specs` workflow inline (agent-driven intelligent merge) for change '<name>', passing the delta spec analysis and the fetched specs-rule snapshot from above, and wait for it to finish. The inline sync must reuse that snapshot without fetching `specs` instructions again. Do not delegate it to a background task — step 5 would move `changeRoot` out from under a sync that is still reading it, leaving the change archived and the main specs never updated. If your agent can only run it by delegation, delegate synchronously and wait for the result.
|
||||
|
||||
Then re-run the comparison from the top of this step against every capability that has a delta spec in `artifactPaths.specs.existingOutputPaths` — not only the ones the sync reports it touched. A successful sync leaves nothing left to apply, so each capability must now read as already synced:
|
||||
- ADDED requirements present
|
||||
- MODIFIED requirements carrying the scenario and description changes named in the delta, with their other scenarios intact
|
||||
- REMOVED requirements gone — and where this sync retired a capability (removed its last requirement, leaving `## Requirements` empty), its main spec deleted rather than left empty; a spec the sync deliberately kept and reported is also a match
|
||||
- RENAMED requirements present under the new name and absent under the old one
|
||||
|
||||
If the sync failed, or any capability does not match, report what differs and stop — do not archive. Nothing has moved and `changeRoot` is intact, so the user can fix the mismatch or re-run the sync and start the archive again.
|
||||
|
||||
5. **Perform the archive**
|
||||
|
||||
Create an `archive` directory under `planningHome.changesDir` if it doesn't exist:
|
||||
```bash
|
||||
mkdir -p "<planningHome.changesDir>/archive"
|
||||
```
|
||||
|
||||
Generate the target name: use the change name as-is when it already starts with a `YYYY-MM-DD-` prefix; otherwise prepend the current date as `YYYY-MM-DD-<change-name>`. Never stack a second date (same rule as `openspec archive`).
|
||||
|
||||
**Check if target already exists:**
|
||||
- If yes: Fail with error, suggest renaming existing archive or using different date
|
||||
- If no: Move `changeRoot` to the archive directory
|
||||
|
||||
```bash
|
||||
mv "<changeRoot>" "<planningHome.changesDir>/archive/<target-name>"
|
||||
```
|
||||
|
||||
6. **Display summary**
|
||||
|
||||
Show archive completion summary including:
|
||||
- Change name
|
||||
- Schema that was used
|
||||
- Archive location
|
||||
- Whether specs were synced (if applicable)
|
||||
- Note about any warnings (incomplete artifacts/tasks)
|
||||
|
||||
**Output On Success**
|
||||
|
||||
```markdown
|
||||
## Archive Complete
|
||||
|
||||
**Change:** <change-name>
|
||||
**Schema:** <schema-name>
|
||||
**Archived to:** the archive path derived from `planningHome.changesDir`/<target-name>/
|
||||
**Specs:** <"✓ Synced to main specs" only if the step 4 verification passed; otherwise "No delta specs" or "Sync skipped">
|
||||
|
||||
<"All artifacts complete. All tasks complete." — or, if archived with warnings, list them instead (e.g. "Archived with 2 incomplete tasks")>
|
||||
```
|
||||
|
||||
**Guardrails**
|
||||
- Announce the selected change; prompt for selection when it is ambiguous
|
||||
- Use artifact graph (openspec status --json) for completion checking
|
||||
- Don't block archive on warnings - just inform and confirm
|
||||
- Preserve .openspec.yaml when moving to archive (it moves with the directory)
|
||||
- Show clear summary of what happened
|
||||
- If sync is requested, run the `openspec-sync-specs` workflow inline (agent-driven)
|
||||
- Never archive while a spec sync is still in flight — run the sync inline and verify the main specs before moving `changeRoot`
|
||||
- If delta specs exist, always run the sync assessment and show the combined summary before prompting
|
||||
- Apply relevant runtime context and report conflicts; operation guidance remains advisory
|
||||
- Consider every guidance entry and explain any inapplicable or conflicting advice
|
||||
- Existing CLI checks, resolved paths, prompts, and command contracts are unchanged
|
||||
- Artifact rules constrain only the specs being written and are never operation guidance
|
||||
- Never copy runtime context, operation guidance, or artifact-rule text verbatim into output files
|
||||
@@ -0,0 +1,308 @@
|
||||
---
|
||||
name: openspec-explore
|
||||
description: Enter explore mode - a thinking partner for exploring ideas, investigating problems, and clarifying requirements. Use when the user wants to think through something before or during a change.
|
||||
allowed-tools: Bash(openspec:*)
|
||||
license: MIT
|
||||
compatibility: Requires openspec CLI.
|
||||
metadata:
|
||||
author: openspec
|
||||
version: "1.0"
|
||||
generatedBy: "1.8.0"
|
||||
---
|
||||
|
||||
Enter explore mode. Think deeply. Visualize freely. Follow the conversation wherever it goes.
|
||||
|
||||
**IMPORTANT: Explore mode is for thinking, not implementing.** You may read files, search code, and investigate the codebase, but you must NEVER write code or implement features. If the user asks you to implement something, remind them to exit explore mode first and create a change proposal. You MAY create OpenSpec artifacts (proposals, designs, specs) if the user asks—that's capturing thinking, not implementing. For a new change, scaffold it first as described below.
|
||||
|
||||
**This is a stance, not a workflow.** There are no fixed steps, no required sequence, no mandatory outputs. You're a thinking partner helping the user explore.
|
||||
|
||||
**Store selection:** If the user names a store (a store is a standalone OpenSpec repo registered on this machine) or the work lives in one, run `openspec store list --json` to discover registered store ids, then pass `--store <id>` on the commands that read or write specs and changes (`new change`, `status`, `instructions`, `list`, `show`, `validate`, `archive`, `doctor`, `context`, `view`). Once selected, treat `--store <id>` as sticky for the rest of the workflow. Every unscoped example of those commands below is shorthand: before running it, append the flag. For example, run `openspec status --change "<name>" --json --store "<id>"`, not the unscoped form shown below. Other commands do not take the flag. Hints printed by commands already carry the flag; keep it on follow-ups. Without a store, commands act on the nearest local `openspec/` root.
|
||||
|
||||
---
|
||||
|
||||
## The Stance
|
||||
|
||||
- **Curious, not prescriptive** - Ask questions that emerge naturally, don't follow a script
|
||||
- **Open threads, not interrogations** - Surface multiple interesting directions and let the user follow what resonates. Don't funnel them through a single path of questions.
|
||||
- **Visual** - Use ASCII diagrams liberally when they'd help clarify thinking
|
||||
- **Adaptive** - Follow interesting threads, pivot when new information emerges
|
||||
- **Patient** - Don't rush to conclusions, let the shape of the problem emerge
|
||||
- **Grounded** - Explore the actual codebase when relevant, don't just theorize
|
||||
|
||||
---
|
||||
|
||||
## What You Might Do
|
||||
|
||||
Depending on what the user brings, you might:
|
||||
|
||||
**Explore the problem space**
|
||||
- Ask clarifying questions that emerge from what they said
|
||||
- Challenge assumptions
|
||||
- Reframe the problem
|
||||
- Find analogies
|
||||
|
||||
**Investigate the codebase**
|
||||
- Map existing architecture relevant to the discussion
|
||||
- Find integration points
|
||||
- Identify patterns already in use
|
||||
- Surface hidden complexity
|
||||
|
||||
**Compare options**
|
||||
- Brainstorm multiple approaches
|
||||
- Build comparison tables
|
||||
- Sketch tradeoffs
|
||||
- Recommend a path (if asked)
|
||||
|
||||
**Visualize**
|
||||
```
|
||||
┌─────────────────────────────────────────┐
|
||||
│ Use ASCII diagrams liberally │
|
||||
├─────────────────────────────────────────┤
|
||||
│ │
|
||||
│ ┌────────┐ ┌────────┐ │
|
||||
│ │ State │────────▶│ State │ │
|
||||
│ │ A │ │ B │ │
|
||||
│ └────────┘ └────────┘ │
|
||||
│ │
|
||||
│ System diagrams, state machines, │
|
||||
│ data flows, architecture sketches, │
|
||||
│ dependency graphs, comparison tables │
|
||||
│ │
|
||||
└─────────────────────────────────────────┘
|
||||
```
|
||||
|
||||
**Surface risks and unknowns**
|
||||
- Identify what could go wrong
|
||||
- Find gaps in understanding
|
||||
- Suggest spikes or investigations
|
||||
|
||||
---
|
||||
|
||||
## OpenSpec Awareness
|
||||
|
||||
You have full context of the OpenSpec system. Use it naturally, don't force it.
|
||||
|
||||
### Check for context
|
||||
|
||||
At the start, quickly check what exists:
|
||||
```bash
|
||||
openspec list --json
|
||||
```
|
||||
|
||||
This tells you:
|
||||
- If there are active changes
|
||||
- Their names, schemas, and status
|
||||
- What the user might be working on
|
||||
|
||||
Then read the project's own context from the resolved root - `<root.path>/openspec/config.yaml` (or `config.yml`). Use the `root.path` returned above, and skip this if neither file exists:
|
||||
- `context`: project background - tech stack, conventions, constraints
|
||||
- `rules`: keyed by artifact id - the entries for an artifact apply only when you write that artifact
|
||||
|
||||
Ground your thinking in these. They are constraints for you to follow, not content to reproduce: do NOT copy them into the conversation or into any artifact you create.
|
||||
|
||||
### When no change exists
|
||||
|
||||
Think freely. When insights crystallize, you might offer:
|
||||
|
||||
- "This feels solid enough to start a change. Want me to create a proposal?"
|
||||
- Or keep exploring - no pressure to formalize
|
||||
|
||||
If the user asks you to capture the exploration as a new change, transition seamlessly into the requested capture:
|
||||
|
||||
1. Run `openspec new change "<name>"` (with `--store <id>` when applicable) before creating any artifacts. Never create a new change directory under `openspec/changes/` by hand; the CLI scaffold creates required metadata such as `.openspec.yaml`. Keep the selected `--store <id>` on every applicable follow-up `status` and `instructions` command.
|
||||
2. Run `openspec status --change "<name>" --json` (append the confirmed `--store "<id>"` only for a registered standalone store), then process the requested artifacts in dependency order. For each requested artifact that is `ready`, run `openspec instructions "<artifact-id>" --change "<name>" --json` (append the confirmed `--store "<id>"` only for a registered standalone store). Before creating a requested artifact, evaluate any condition in its own `instruction` against the explored change; record a deliberate skip instead when the condition does not apply. If a requested artifact is blocked by a direct prerequisite the user did not request, run `openspec instructions "<prerequisite-id>" --change "<name>" --json` (append the confirmed `--store "<id>"` only for a registered standalone store) for that prerequisite whether it is `ready` or `blocked`. If its own `instruction` states a condition, evaluate that condition against the explored change and record a deliberate skip only when the condition does not apply. If the condition applies, or the prerequisite is not conditional, treat it as a normal prerequisite and ask before expanding the capture. Do not create an unrequested prerequisite unless the user approves.
|
||||
3. Follow the returned `template` and `instruction` fields. Read completed dependency files listed in `dependencies`, and apply `context` and `rules` as constraints without copying them into the artifact. If the instruction delegates creation to a specific skill or command, invoke it; otherwise write the artifact to `resolvedOutputPath`, using the instruction to choose a concrete path when it is a glob. Verify that the selected concrete output exists.
|
||||
4. After creating each artifact, re-run `openspec status --change "<name>" --json` (append the confirmed `--store "<id>"` only for a registered standalone store) and continue until every requested artifact is `done`, `skipped`, or was deliberately skipped because its own `instruction` stated a condition that did not apply. Tell the user about a deliberate conditional skip, remember it, and do not reconsider it. Dependencies are enablers, not gates: if a requested artifact is still `blocked` only because you deliberately skipped a conditional prerequisite, run `openspec instructions "<artifact-id>" --change "<name>" --json` (append the confirmed `--store "<id>"` only for a registered standalone store) despite the blocked status, then create it using step 3 only when those recorded conditional skips are its sole missing dependencies. If a requested artifact is blocked by a prerequisite the user did not ask to capture and cannot be conditionally skipped, explain that dependency and ask before expanding the capture.
|
||||
|
||||
Capture the artifact(s) the user requested without asking them to invoke another workflow command. If they asked only to start a change, stop after scaffolding and show its status.
|
||||
|
||||
### When a change exists
|
||||
|
||||
If the user mentions a change or you detect one is relevant:
|
||||
|
||||
1. **Resolve and read existing artifacts for context**
|
||||
- Run `openspec status --change "<name>" --json`.
|
||||
- Use `changeRoot`, `artifactPaths`, and `actionContext` from the status JSON.
|
||||
- Read existing files from `artifactPaths.<artifact>.existingOutputPaths`.
|
||||
|
||||
2. **Reference them naturally in conversation**
|
||||
- "Your design mentions using Redis, but we just realized SQLite fits better..."
|
||||
- "The proposal scopes this to premium users, but we're now thinking everyone..."
|
||||
|
||||
3. **Offer to capture when decisions are made**
|
||||
|
||||
`<capability-path>` is the spec directory relative to `specs/` (for example, `user-auth` or `identity/user-auth`). Preserve an existing capability's full path and follow the project's established organization for new capabilities.
|
||||
|
||||
| Insight Type | Where to Capture |
|
||||
|----------------------------|-------------------------------------|
|
||||
| New requirement discovered | `specs/<capability-path>/spec.md` |
|
||||
| Requirement changed | `specs/<capability-path>/spec.md` |
|
||||
| Design decision made | `design.md` |
|
||||
| Scope changed | `proposal.md` |
|
||||
| New work identified | `tasks.md` |
|
||||
| Assumption invalidated | Relevant artifact |
|
||||
|
||||
Example offers:
|
||||
- "That's a design decision. Capture it in design.md?"
|
||||
- "This is a new requirement. Add it to specs?"
|
||||
- "This changes scope. Update the proposal?"
|
||||
|
||||
4. **The user decides** - Offer and move on. Don't pressure. Don't auto-capture.
|
||||
|
||||
---
|
||||
|
||||
## What You Don't Have To Do
|
||||
|
||||
- Follow a script
|
||||
- Ask the same questions every time
|
||||
- Produce a specific artifact
|
||||
- Reach a conclusion
|
||||
- Stay on topic if a tangent is valuable
|
||||
- Be brief (this is thinking time)
|
||||
|
||||
---
|
||||
|
||||
## Handling Different Entry Points
|
||||
|
||||
**User brings a vague idea:**
|
||||
```
|
||||
User: I'm thinking about adding real-time collaboration
|
||||
|
||||
You: Real-time collab is a big space. Let me think about this...
|
||||
|
||||
COLLABORATION SPECTRUM
|
||||
════════════════════════════════════════════
|
||||
|
||||
Awareness Coordination Sync
|
||||
│ │ │
|
||||
▼ ▼ ▼
|
||||
┌────────┐ ┌────────┐ ┌────────┐
|
||||
│Presence│ │Cursors │ │ CRDT │
|
||||
│ "3 │ │ Multi │ │Conflict│
|
||||
│online" │ │ select │ │ free │
|
||||
└────────┘ └────────┘ └────────┘
|
||||
│ │ │
|
||||
trivial moderate complex
|
||||
|
||||
Where's your head at?
|
||||
```
|
||||
|
||||
**User brings a specific problem:**
|
||||
```
|
||||
User: The auth system is a mess
|
||||
|
||||
You: [reads codebase]
|
||||
|
||||
┌─────────────────────────────────────────────┐
|
||||
│ CURRENT AUTH FLOW │
|
||||
└─────────────────────────────────────────────┘
|
||||
│
|
||||
┌─────────────┼─────────────┐
|
||||
▼ ▼ ▼
|
||||
┌─────────┐ ┌─────────┐ ┌─────────┐
|
||||
│ Google │ │ GitHub │ │ Email │
|
||||
│ OAuth │ │ OAuth │ │ Magic │
|
||||
└────┬────┘ └────┬────┘ └────┬────┘
|
||||
│ │ │
|
||||
└─────────────┼─────────────┘
|
||||
▼
|
||||
┌───────────┐
|
||||
│ Session │
|
||||
└─────┬─────┘
|
||||
│
|
||||
▼
|
||||
┌───────────┐
|
||||
│ Perms │
|
||||
└───────────┘
|
||||
|
||||
I see three tangles. Which one's burning?
|
||||
```
|
||||
|
||||
**User is stuck mid-implementation:**
|
||||
```
|
||||
User: /opsx:explore add-auth-system
|
||||
The OAuth integration is more complex than expected
|
||||
|
||||
You: [reads change artifacts]
|
||||
|
||||
You're on task 4: "Implement OAuth flow"
|
||||
|
||||
Let me trace what's involved...
|
||||
|
||||
[draws diagram, explores options, suggests paths]
|
||||
|
||||
Want to update the design to reflect this?
|
||||
Or add a spike task to investigate?
|
||||
```
|
||||
|
||||
**User wants to compare options:**
|
||||
```
|
||||
User: Should we use Postgres or SQLite?
|
||||
|
||||
You: Generic answer is boring. What's the context?
|
||||
|
||||
User: A CLI tool that tracks local dev environments
|
||||
|
||||
You: That changes everything.
|
||||
|
||||
┌─────────────────────────────────────────────────┐
|
||||
│ CLI TOOL DATA STORAGE │
|
||||
└─────────────────────────────────────────────────┘
|
||||
|
||||
Key constraints:
|
||||
• No daemon running
|
||||
• Must work offline
|
||||
• Single user
|
||||
|
||||
SQLite Postgres
|
||||
Deployment embedded ✓ needs server ✗
|
||||
Offline yes ✓ no ✗
|
||||
Single file yes ✓ no ✗
|
||||
|
||||
SQLite. Not even close.
|
||||
|
||||
Unless... is there a sync component?
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Ending Discovery
|
||||
|
||||
There's no required ending. Discovery might:
|
||||
|
||||
- **Flow into a proposal**: "Ready to start? I can create a change proposal."
|
||||
- **Result in artifact updates**: "Updated design.md with these decisions"
|
||||
- **Just provide clarity**: User has what they need, moves on
|
||||
- **Continue later**: "We can pick this up anytime"
|
||||
|
||||
When it feels like things are crystallizing, you might summarize:
|
||||
|
||||
```
|
||||
## What We Figured Out
|
||||
|
||||
**The problem**: [crystallized understanding]
|
||||
|
||||
**The approach**: [if one emerged]
|
||||
|
||||
**Open questions**: [if any remain]
|
||||
|
||||
**Next steps** (if ready):
|
||||
- Create a change proposal
|
||||
- Keep exploring: just keep talking
|
||||
```
|
||||
|
||||
But this summary is optional. Sometimes the thinking IS the value.
|
||||
|
||||
---
|
||||
|
||||
## Guardrails
|
||||
|
||||
- **Don't implement** - Never write code or implement features. Creating OpenSpec artifacts is fine, writing application code is not.
|
||||
- **Don't fake understanding** - If something is unclear, dig deeper
|
||||
- **Don't rush** - Discovery is thinking time, not task time
|
||||
- **Don't force structure** - Let patterns emerge naturally
|
||||
- **Don't auto-capture** - Offer to save insights, don't just do it
|
||||
- **Don't manually scaffold changes** - Never create a new change directory under `openspec/changes/` by hand. Always use `openspec new change "<name>"` (with `--store <id>` when applicable) so required metadata such as `.openspec.yaml` is created before writing artifacts.
|
||||
- **Do visualize** - A good diagram is worth many paragraphs
|
||||
- **Do explore the codebase** - Ground discussions in reality
|
||||
- **Do question assumptions** - Including the user's and your own
|
||||
@@ -0,0 +1,149 @@
|
||||
---
|
||||
name: openspec-propose
|
||||
description: Propose a new change with all artifacts generated in one step. Use when the user wants to quickly describe what they want to build and get a complete proposal with design, specs, and tasks ready for implementation.
|
||||
allowed-tools: Bash(openspec:*)
|
||||
license: MIT
|
||||
compatibility: Requires openspec CLI.
|
||||
metadata:
|
||||
author: openspec
|
||||
version: "1.0"
|
||||
generatedBy: "1.8.0"
|
||||
---
|
||||
|
||||
Propose a new change - create the change and generate all artifacts in one step.
|
||||
|
||||
**Planning boundary**: This workflow creates planning artifacts only. The user request that selected or triggered this workflow authorizes planning only, even if it asks to build or fix something. Do not edit project code. After the planning artifacts are complete, stop. Do not start implementation in the same response, even if the initial request asks for it. Wait for a new user request after the artifacts are presented; then start the apply workflow.
|
||||
|
||||
I'll create a change with the artifacts your schema defines. With the default spec-driven schema that is:
|
||||
- proposal.md (what & why)
|
||||
- `specs/<capability-path>/spec.md` (what the system must do - a delta, not the main spec)
|
||||
- design.md (how)
|
||||
- tasks.md (implementation steps)
|
||||
|
||||
`<capability-path>` is the spec directory relative to `specs/` (for example, `user-auth` or `identity/user-auth`). Preserve an existing capability's full path and follow the project's established organization for new capabilities.
|
||||
|
||||
When the user is ready to implement, they must start the apply workflow explicitly.
|
||||
|
||||
---
|
||||
|
||||
**Store selection:** If the user names a store (a store is a standalone OpenSpec repo registered on this machine) or the work lives in one, run `openspec store list --json` to discover registered store ids, then pass `--store <id>` on the commands that read or write specs and changes (`new change`, `status`, `instructions`, `list`, `show`, `validate`, `archive`, `doctor`, `context`, `view`). Once selected, treat `--store <id>` as sticky for the rest of the workflow. Every unscoped example of those commands below is shorthand: before running it, append the flag. For example, run `openspec status --change "<name>" --json --store "<id>"`, not the unscoped form shown below. Other commands do not take the flag. Hints printed by commands already carry the flag; keep it on follow-ups. Without a store, commands act on the nearest local `openspec/` root.
|
||||
|
||||
**Input**: The user's request should include a change name (kebab-case) OR a description of what they want to build.
|
||||
|
||||
**Steps**
|
||||
|
||||
1. **Understand the request and clarify material ambiguity**
|
||||
|
||||
If no clear input is provided, ask the user (open-ended, no preset options):
|
||||
> "What change do you want to work on? Describe what you want to build or fix."
|
||||
|
||||
From their description, derive a kebab-case name (e.g., "add user authentication" → `add-user-auth`).
|
||||
|
||||
**IMPORTANT**: Do NOT proceed without understanding what the user wants to build.
|
||||
|
||||
If the request contains ambiguity that would materially affect scope, externally observable behavior, compatibility, or acceptance criteria, ask the user before creating the change. For minor details, make a reasonable assumption and record it in the planning artifacts.
|
||||
|
||||
2. **Determine the workflow schema**
|
||||
|
||||
Use the configured default schema unless the user explicitly requests a different workflow.
|
||||
|
||||
**Use a different schema only if the user:**
|
||||
- Explicitly requests a specific schema by name → use `--schema <schema-name>`
|
||||
- Asks to "show workflows" or asks "what workflows" exist → resolve the authoritative root by running `openspec context --json` from the current working directory. If the user explicitly selected a registered store, use `openspec context --json --store "<store-id>"`. Then run `openspec schemas --json` with its working directory set to the returned `root.path` and let them choose. This preserves roots selected by a local `store:` pointer or the global `defaultStore`; `schemas` does not accept `--store`. If context reports only `no_openspec_root`, run `openspec schemas --json` from the current working directory instead. Do not use this fallback for invalid or unavailable stores.
|
||||
|
||||
Otherwise, omit `--schema` to preserve the configured default.
|
||||
|
||||
3. **Create the change directory**
|
||||
|
||||
Choose one schema form below. If a registered store is selected, append `--store "<store-id>"` to that command and each later OpenSpec command shown below that accepts `--store`.
|
||||
|
||||
Using the configured default:
|
||||
```bash
|
||||
openspec new change "<name>"
|
||||
```
|
||||
|
||||
Using an explicitly requested schema:
|
||||
```bash
|
||||
openspec new change "<name>" --schema "<schema-name>"
|
||||
```
|
||||
This creates a scaffolded change in the planning home resolved by the CLI with `.openspec.yaml`.
|
||||
|
||||
4. **Get the artifact build order**
|
||||
```bash
|
||||
openspec status --change "<name>" --json
|
||||
```
|
||||
Parse the JSON to get:
|
||||
- `applyRequires`: array of artifact IDs needed before implementation (e.g., `["tasks"]`)
|
||||
- `artifacts`: list of all artifacts, each with its `status` and its `requires` edges (the artifact IDs it directly depends on)
|
||||
- `planningHome`, `changeRoot`, `artifactPaths`, and `actionContext`: path and scope context. Use these instead of assuming repo-local paths.
|
||||
|
||||
5. **Create every artifact in the required set**
|
||||
|
||||
Use a todo list to track progress through the artifacts.
|
||||
|
||||
Loop through artifacts in dependency order (artifacts with no pending dependencies first):
|
||||
|
||||
a. **For each artifact that is `ready` (dependencies satisfied)**:
|
||||
- Get instructions:
|
||||
```bash
|
||||
openspec instructions <artifact-id> --change "<name>" --json
|
||||
```
|
||||
- The instructions JSON includes:
|
||||
- `context`: Project background (constraints for you - do NOT include in output)
|
||||
- `rules`: Artifact-specific rules (constraints for you - do NOT include in output)
|
||||
- `template`: The structure to use for your output file
|
||||
- `instruction`: Schema-specific guidance for this artifact type
|
||||
- `skipped`/`warning`: present when the change declares skip_specs and this artifact must NOT be created - stop and pick another artifact
|
||||
- `resolvedOutputPath`: Resolved path or pattern to write the artifact
|
||||
- `dependencies`: Completed artifacts to read for context
|
||||
- Read any completed dependency files for context - always re-read them from disk, even if you saw them earlier in the conversation (the user may have edited them)
|
||||
- If the `instruction` field delegates creation to a specific skill or command, invoke it to produce the artifact instead of writing the file yourself, then verify the artifact file exists at `resolvedOutputPath`
|
||||
- Otherwise create the artifact file using `template` as the structure and write it to `resolvedOutputPath`. If `resolvedOutputPath` is a glob, follow `instruction` to choose the concrete file path
|
||||
- Apply `context` and `rules` as constraints - but do NOT copy them into the file
|
||||
- Show brief progress: "Created <artifact-id>"
|
||||
|
||||
b. **Continue until every artifact in the required set exists (not just `apply.requires`)**
|
||||
- After creating each artifact, re-run `openspec status --change "<name>" --json`
|
||||
- The required set is `applyRequires` plus every artifact reachable from those by following the `requires` edges in `status --json` - walk them transitively (spec-driven closes over proposal, specs, design, tasks). Leave artifacts outside that set alone
|
||||
- `status` is file-existence only, so an `applyRequires` artifact reading `done` does NOT mean its dependencies exist - writing `tasks.md` early marks `tasks` done while `specs` was never written. Use each artifact's `requires` edges, not its `status`, to build the required set: a `done` artifact still lists what it depends on
|
||||
- An artifact already reading `status: "skipped"` is satisfied: the change declares `skip_specs` in `.openspec.yaml`, so its files must NOT exist. Never try to create one
|
||||
- Create every artifact in the required set that is missing, then re-check - creating one can unblock others
|
||||
- Skip one only when `status` already reports it `skipped`, or when its own `instruction` says it is conditional: run `openspec instructions <artifact-id> --change "<name>" --json` and skip only if its `instruction` field marks it optional (e.g. "create only if..."). Spec-driven's `design.md` qualifies; `specs` qualifies only via the `skipped` status above, never by your own judgment. Tell the user, and do not reconsider it
|
||||
- Dependencies are enablers, not gates: if a required artifact is still `blocked` only because you skipped a conditional dependency, write it anyway
|
||||
- Stop when every artifact in the required set is `done`, `skipped`, or was deliberately skipped
|
||||
|
||||
c. **If an artifact requires user input** (unclear context):
|
||||
- Ask the user to clarify
|
||||
- Then continue with creation
|
||||
|
||||
6. **Show final status**
|
||||
```bash
|
||||
openspec status --change "<name>"
|
||||
```
|
||||
|
||||
**Output**
|
||||
|
||||
After completing all artifacts, summarize:
|
||||
- Change name and location
|
||||
- List of artifacts created with brief descriptions, plus any conditional artifact you skipped and why
|
||||
- What's ready: "All artifacts needed for implementation are ready."
|
||||
- Prompt: "The artifacts are ready for review. When you are ready, run `/opsx:apply` or ask me to apply this change."
|
||||
|
||||
**Artifact Creation Guidelines**
|
||||
|
||||
- Follow the `instruction` field from `openspec instructions` for each artifact type - it is the authoritative guidance, even for familiar artifact names
|
||||
- If the `instruction` field directs you to use a specific skill or command to create the artifact, invoke it instead of writing the artifact directly
|
||||
- The schema defines what each artifact should contain - follow it
|
||||
- Read dependency artifacts for context before creating new ones
|
||||
- Use `template` as the structure for your output file - fill in its sections
|
||||
- **IMPORTANT**: `context` and `rules` are constraints for YOU, not content for the file
|
||||
- Do NOT copy `<context>`, `<rules>`, `<project_context>` blocks into the artifact
|
||||
- These guide what you write, but should never appear in the output
|
||||
|
||||
**Guardrails**
|
||||
- The request that invoked this workflow authorizes planning only. Any implementation or apply instruction in that request does not carry forward. Do NOT implement the change, start the apply workflow, or edit project code during this workflow. After presenting the artifacts, stop and wait for a new user request to start the apply workflow
|
||||
- Create every artifact the apply phase transitively depends on, not just the ids listed in `apply.requires`
|
||||
- Always read dependency artifacts before creating a new one - re-read from disk, not from conversation memory (files may have changed since you last saw them)
|
||||
- Ask about ambiguities that would materially change scope, externally observable behavior, compatibility, or acceptance criteria; for minor details, make reasonable assumptions and record them
|
||||
- If a change with that name already exists, ask if user wants to continue it or create a new one
|
||||
- Verify each artifact file exists after writing before proceeding to next
|
||||
@@ -0,0 +1,262 @@
|
||||
---
|
||||
name: openspec-sync-specs
|
||||
description: Sync delta specs from a change to main specs. Use when the user wants to update main specs with changes from a delta spec, without archiving the change.
|
||||
allowed-tools: Bash(openspec:*)
|
||||
license: MIT
|
||||
compatibility: Requires openspec CLI.
|
||||
metadata:
|
||||
author: openspec
|
||||
version: "1.0"
|
||||
generatedBy: "1.8.0"
|
||||
---
|
||||
|
||||
Sync delta specs from a change to main specs.
|
||||
|
||||
This is an **agent-driven** operation - you will read delta specs and directly edit main specs to apply the changes. This allows intelligent merging (e.g., adding a scenario without copying the entire requirement).
|
||||
|
||||
**Store selection:** If the user names a store (a store is a standalone OpenSpec repo registered on this machine) or the work lives in one, run `openspec store list --json` to discover registered store ids, then pass `--store <id>` on the commands that read or write specs and changes (`new change`, `status`, `instructions`, `list`, `show`, `validate`, `archive`, `doctor`, `context`, `view`). Once selected, treat `--store <id>` as sticky for the rest of the workflow. Every unscoped example of those commands below is shorthand: before running it, append the flag. For example, run `openspec status --change "<name>" --json --store "<id>"`, not the unscoped form shown below. Other commands do not take the flag. Hints printed by commands already carry the flag; keep it on follow-ups. Without a store, commands act on the nearest local `openspec/` root.
|
||||
|
||||
`<capability-path>` is the spec directory relative to `specs/` (for example, `user-auth` or `identity/user-auth`). Preserve the full path from each delta spec when resolving its main spec.
|
||||
|
||||
**Input**: Optionally specify a change name. If omitted, check if it can be inferred from conversation context. If vague or ambiguous you MUST prompt for available changes.
|
||||
|
||||
**Steps**
|
||||
|
||||
1. **Select the change**
|
||||
|
||||
If a name is provided, use it. Otherwise:
|
||||
- Infer from conversation context if the user mentioned a change
|
||||
- Auto-select if only one active change exists
|
||||
- If ambiguous, run `openspec list --json` to get available changes and ask the user to select one
|
||||
|
||||
When prompting, show changes that have delta specs (under `specs/` directory).
|
||||
|
||||
Always announce: "Using change: <name>" and how to override (e.g., `/opsx:sync <other>`).
|
||||
|
||||
2. **Resolve change context**
|
||||
|
||||
Run:
|
||||
```bash
|
||||
openspec status --change "<name>" --json
|
||||
```
|
||||
|
||||
The JSON includes `planningHome.root`. Main specs live under `<planningHome.root>/openspec/specs/` — use that (store-aware) root for every main-spec path below, not a hardcoded repo path. When a store is selected it points at the store, not the current repository.
|
||||
|
||||
3. **Find delta specs**
|
||||
|
||||
Use `artifactPaths.specs.existingOutputPaths` from the status JSON as the
|
||||
only source of delta spec paths. If the `specs` entry is missing or
|
||||
`existingOutputPaths` is empty, report that there are no delta specs to sync,
|
||||
do not infer them from other artifacts, and stop without requesting artifact
|
||||
instructions or writing a main spec.
|
||||
|
||||
Sync every path in `existingOutputPaths` unless the caller narrowed the set.
|
||||
A caller narrows it by naming an explicit list of complete entries from
|
||||
`existingOutputPaths` — copy those absolute values verbatim. Archive does
|
||||
this inline, and a user can too (for example, by selecting the entry ending
|
||||
in `/specs/billing/invoices/spec.md`).
|
||||
Then sync only the named paths and leave the remaining delta specs untouched:
|
||||
bulk archive excludes a delta whose implementation it could not find, and
|
||||
syncing it anyway would write a main spec the caller deliberately withheld.
|
||||
Carry that narrowed selection through step 4; never widen it back to the full
|
||||
list. If a named path is not in `existingOutputPaths`, do not sync it —
|
||||
report it and stop, rather than dropping it silently. If the named list is
|
||||
empty, report that there is nothing to sync and stop without writing a main
|
||||
spec.
|
||||
|
||||
Each delta spec file contains sections like:
|
||||
- `## ADDED Requirements` - New requirements to add
|
||||
- `## MODIFIED Requirements` - Changes to existing requirements
|
||||
- `## REMOVED Requirements` - Requirements to remove
|
||||
- `## RENAMED Requirements` - Requirements to rename (FROM:/TO: format)
|
||||
|
||||
If no delta specs found, inform user and stop.
|
||||
|
||||
4. **For each delta spec, apply changes to main specs**
|
||||
|
||||
Before the first main-spec write, obtain one current specs-rule snapshot:
|
||||
- If archive invoked this workflow inline and supplied a valid snapshot from
|
||||
`openspec instructions specs --change "<name>" --json`, reuse it and do not
|
||||
fetch the same instructions again.
|
||||
- Otherwise run that command once now with the same selected-root flags.
|
||||
- If the direct lookup exits non-zero or returns invalid artifact-instruction
|
||||
JSON, report the error and stop before writing any main spec. Do not treat the
|
||||
failure as an absent rule set.
|
||||
- A valid response with omitted `rules` means no artifact rules are configured
|
||||
and the existing semantic merge continues.
|
||||
|
||||
Apply returned `rules` only to the content and form of the main specs produced
|
||||
by this merge. Artifact rules are not operation guidance and cannot change
|
||||
selected roots, delta paths, CLI checks, or workflow steps. Use their text as
|
||||
constraints without copying it verbatim into a main spec or summary.
|
||||
|
||||
For each capability delta spec path selected in step 3 — the full `existingOutputPaths` list, or the narrowed subset when a caller supplied one (these may belong to a selected store, not the repo):
|
||||
|
||||
a. **Read the delta spec** to understand the intended changes
|
||||
|
||||
b. **Read the main spec** at `<planningHome.root>/openspec/specs/<capability-path>/spec.md` (may not exist yet)
|
||||
|
||||
c. **Apply changes intelligently**:
|
||||
|
||||
**ADDED Requirements:**
|
||||
- If requirement doesn't exist in main spec → add it
|
||||
- If requirement already exists → update it to match (treat as implicit MODIFIED)
|
||||
|
||||
**MODIFIED Requirements:**
|
||||
- Find the requirement in main spec
|
||||
- Apply the changes - this can be:
|
||||
- Adding new scenarios the main spec does not have yet
|
||||
- Modifying existing scenarios
|
||||
- Changing the requirement description
|
||||
- Preserve scenarios/content not mentioned in the delta
|
||||
|
||||
**REMOVED Requirements:**
|
||||
- Remove the entire requirement block from main spec
|
||||
- Retiring the capability. Delete the whole `spec.md` - and the directory once
|
||||
nothing else is left in it - only when ALL of these hold:
|
||||
1. removing the requirements *this run* left no requirement blocks;
|
||||
2. the rest of the spec is well-formed (it still has a `## Purpose`);
|
||||
3. the main spec was not already empty before this sync - if you removed
|
||||
nothing, change nothing;
|
||||
4. every other nonblank line in the whole file is accounted for as the
|
||||
title, Purpose, Requirements header, or a canonical requirement's
|
||||
statement, scenarios, or fenced examples;
|
||||
5. the change's `.openspec.yaml` declares `retire_capabilities: true`;
|
||||
6. the `spec.md` resolves inside the real specs root (do not follow a
|
||||
capability-directory symlink to delete an external file).
|
||||
If removing the selected requirements would leave no requirement blocks and
|
||||
any retirement condition is not satisfied, do not modify the main spec. Stop
|
||||
the sync for that capability, report the blocking condition, and tell the user
|
||||
how to resolve it. Never write or leave an empty `## Requirements` section.
|
||||
When only the marker is missing, say that too - it is the one thing the user
|
||||
can add to make the retirement go through.
|
||||
- Deleting the file also deletes its `## Purpose`; any other section blocks
|
||||
retirement. Name Purpose when you report the retirement. Include a pasteable
|
||||
`git checkout` only when the spec lived in the caller's checkout;
|
||||
otherwise give checkout-scoped recovery guidance.
|
||||
|
||||
**RENAMED Requirements:**
|
||||
- Find the FROM requirement, rename to TO
|
||||
|
||||
**`## Purpose` in the delta:**
|
||||
- The main spec already has one and it is authoritative - leave it alone
|
||||
(this is what `openspec archive` does; it warns and moves on)
|
||||
|
||||
d. **Create new main spec** if capability doesn't exist yet:
|
||||
- Create `<planningHome.root>/openspec/specs/<capability-path>/spec.md`
|
||||
- Add Purpose section: copy the delta's `## Purpose` body verbatim when it has one
|
||||
(this is what `openspec archive` does); only write a brief TBD placeholder when it does not
|
||||
- Add Requirements section with the ADDED requirements
|
||||
- Follow the **Main Spec Format Reference** below
|
||||
|
||||
5. **Validate updated main specs**
|
||||
|
||||
Run `openspec validate --specs` with the same selected-root flags used earlier.
|
||||
If validation fails, report the problems and do not claim the sync succeeded.
|
||||
|
||||
6. **Show summary**
|
||||
|
||||
After applying all changes, summarize:
|
||||
- Which capabilities were updated
|
||||
- What changes were made (requirements added/modified/removed/renamed)
|
||||
- Any new main spec left with a TBD Purpose placeholder, so it gets written
|
||||
now rather than lingering
|
||||
- Any capability retired, naming the deleted `spec.md`, its Purpose, and
|
||||
either a pasteable `git checkout` or checkout-scoped recovery guidance
|
||||
|
||||
**Delta Spec Format Reference**
|
||||
|
||||
```markdown
|
||||
## Purpose
|
||||
|
||||
Only on a delta that introduces a brand-new capability. Seeds the new main spec.
|
||||
|
||||
## ADDED Requirements
|
||||
|
||||
### Requirement: New Feature
|
||||
The system SHALL do something new.
|
||||
|
||||
#### Scenario: Basic case
|
||||
- **WHEN** user does X
|
||||
- **THEN** system does Y
|
||||
|
||||
## MODIFIED Requirements
|
||||
|
||||
### Requirement: Existing Feature
|
||||
The system SHALL keep doing the existing thing, now also handling A.
|
||||
|
||||
#### Scenario: Scenario the main spec already has
|
||||
- **WHEN** user does X
|
||||
- **THEN** system does Y
|
||||
|
||||
#### Scenario: New scenario to add
|
||||
- **WHEN** user does A
|
||||
- **THEN** system does B
|
||||
|
||||
## REMOVED Requirements
|
||||
|
||||
### Requirement: Deprecated Feature
|
||||
|
||||
## RENAMED Requirements
|
||||
|
||||
- FROM: `### Requirement: Old Name`
|
||||
- TO: `### Requirement: New Name`
|
||||
```
|
||||
|
||||
**Main Spec Format Reference**
|
||||
|
||||
Main specs are what the delta merges INTO. They must never contain delta operation headers (`## ADDED/MODIFIED/REMOVED/RENAMED Requirements`) - after syncing, every requirement lives under a single `## Requirements` section:
|
||||
|
||||
```markdown
|
||||
# <capability> Specification
|
||||
|
||||
## Purpose
|
||||
Short description of what this capability does and why it exists.
|
||||
|
||||
## Requirements
|
||||
|
||||
### Requirement: New Feature
|
||||
The system SHALL do something new.
|
||||
|
||||
#### Scenario: Basic case
|
||||
- **WHEN** user does X
|
||||
- **THEN** system does Y
|
||||
```
|
||||
|
||||
**Key Principle: Intelligent Merging**
|
||||
|
||||
Unlike programmatic merging, you merge rather than overwrite:
|
||||
- A MODIFIED block carries the whole requirement - body plus every scenario that survives the change. `openspec validate` and `openspec archive` both reject one that drops a scenario the main spec still has.
|
||||
- Keep anything the delta does not mention, in the main spec's existing order
|
||||
- Use your judgment to merge changes sensibly
|
||||
|
||||
**Output On Success**
|
||||
|
||||
```markdown
|
||||
## Specs Synced: <change-name>
|
||||
|
||||
Updated main specs:
|
||||
|
||||
**<capability-1>**:
|
||||
- Added requirement: "New Feature"
|
||||
- Modified requirement: "Existing Feature" (added 1 scenario)
|
||||
|
||||
**<capability-2>**:
|
||||
- Created new spec file
|
||||
- Added requirement: "Another Feature"
|
||||
|
||||
Main specs are now updated. The change remains active - archive when implementation is complete.
|
||||
```
|
||||
|
||||
**Guardrails**
|
||||
- Read both delta and main specs before making changes
|
||||
- Preserve existing content not mentioned in delta
|
||||
- Never copy a delta file into a main spec as-is - merge its content so the main spec keeps the Main Spec Format Reference structure, with no delta operation headers
|
||||
- If something is unclear, ask for clarification
|
||||
- Show what you're changing as you go
|
||||
- The operation should be idempotent - running twice should give same result
|
||||
- Use only `artifactPaths.specs.existingOutputPaths`; never infer delta specs from unrelated artifacts
|
||||
- Honor a caller-supplied subset of `existingOutputPaths`; never widen it back to the full list
|
||||
- Fetch specs instructions once for direct sync, or reuse the archive-supplied snapshot inline
|
||||
- Stop before every main-spec write on a non-zero or invalid JSON specs-instruction response
|
||||
- Artifact rules constrain only the specs being written and are never copied into output files
|
||||
@@ -0,0 +1,91 @@
|
||||
---
|
||||
name: openspec-update-change
|
||||
description: Update an OpenSpec change by revising its existing planning artifacts and keeping them coherent with one another. Use when the user wants to revise a change's plan, fold new decisions into it, or reconcile its artifacts after an edit. Never edits code.
|
||||
allowed-tools: Bash(openspec:*)
|
||||
license: MIT
|
||||
compatibility: Requires openspec CLI.
|
||||
metadata:
|
||||
author: openspec
|
||||
version: "1.0"
|
||||
generatedBy: "1.8.0"
|
||||
---
|
||||
|
||||
Revise a change's existing planning artifacts and keep them coherent. Never edit code.
|
||||
|
||||
**Store selection:** If the user names a store (a store is a standalone OpenSpec repo registered on this machine) or the work lives in one, run `openspec store list --json` to discover registered store ids, then pass `--store <id>` on the commands that read or write specs and changes (`new change`, `status`, `instructions`, `list`, `show`, `validate`, `archive`, `doctor`, `context`, `view`). Once selected, treat `--store <id>` as sticky for the rest of the workflow. Every unscoped example of those commands below is shorthand: before running it, append the flag. For example, run `openspec status --change "<name>" --json --store "<id>"`, not the unscoped form shown below. Other commands do not take the flag. Hints printed by commands already carry the flag; keep it on follow-ups. Without a store, commands act on the nearest local `openspec/` root.
|
||||
|
||||
**Input**: Optionally specify a change name. If omitted, check if it can be inferred from conversation context. If vague or ambiguous you MUST prompt for available changes.
|
||||
|
||||
`/opsx:continue` is an expanded-profile workflow and may not be installed. Before suggesting it anywhere below, verify that it is available. If it is unavailable, `openspec status --change "<name>" --json` shows the next artifact and `openspec instructions "<artifact-id>" --change "<name>" --json` explains how to create it.
|
||||
|
||||
**Steps**
|
||||
|
||||
1. **Select the change**
|
||||
|
||||
If a name is provided, use it. Otherwise:
|
||||
- Infer from conversation context if the user mentioned a change
|
||||
- Auto-select if only one active change exists
|
||||
- If ambiguous, run `openspec list --json` to get available changes sorted by most recently modified, and ask the user to select one
|
||||
|
||||
When prompting, present the top 3-4 most recently modified changes as options, showing:
|
||||
- Change name
|
||||
- Schema (from `schema` field if present, otherwise "spec-driven")
|
||||
- Status (e.g., "0/5 tasks", "complete", "no tasks")
|
||||
- How recently it was modified (from `lastModified` field)
|
||||
|
||||
Mark the most recently modified change as "(Recommended)" since it's likely what the user wants to update.
|
||||
|
||||
Always announce: "Using change: <name>" and how to override (e.g., `/opsx:update <other>`).
|
||||
|
||||
2. **Get the change's artifacts**
|
||||
```bash
|
||||
openspec status --change "<name>" --json
|
||||
```
|
||||
Parse the JSON to understand current state. The response includes:
|
||||
- `schemaName`: The workflow schema being used (e.g., "spec-driven")
|
||||
- `artifacts`: Array of artifacts with their status ("done", "skipped", "ready", "blocked")
|
||||
- `isPlanningComplete`: Boolean indicating if all planning artifacts are complete. Older CLI versions expose the same value as `isComplete`.
|
||||
- `planningHome`, `changeRoot`, `artifactPaths`, and `actionContext`: path and scope context. Use these instead of assuming repo-local paths.
|
||||
|
||||
The artifact ids and paths come from the active schema - do NOT assume them, and do NOT branch on hardcoded artifact names. Custom schemas must work unchanged.
|
||||
|
||||
The files to edit are `artifactPaths.<id>.existingOutputPaths` - the concrete files that exist on disk, already glob-expanded for glob artifacts (e.g. `specs/**/*.md`). Do NOT write to `resolvedOutputPath`: for a glob artifact it is still the glob pattern, not a real file.
|
||||
|
||||
3. **Understand the request**
|
||||
- If the user asked for a specific revision ("the design now uses X"), that is the starting edit.
|
||||
- If they only said "update" / "make this coherent", treat it as a coherence review: read the existing artifacts and check them against each other for contradictions, gaps, and duplication.
|
||||
|
||||
4. **Read and reconcile**
|
||||
- Read the artifact(s) the request touches and the change's other existing artifacts.
|
||||
- Apply the requested edit. Then check every other existing artifact against it - in ANY direction: an edit to a later artifact may require revising an earlier one, not only the other way around. Build order is a useful reading order, not a constraint on which artifacts may be revised.
|
||||
- Note everything that is now inconsistent, missing, or contradictory.
|
||||
- Revise only files that already exist (`existingOutputPaths`). Do NOT create artifacts that don't exist yet, and do NOT invent new files under a glob artifact - note them and point the user to `/opsx:continue` to create them.
|
||||
- If the change is already coherent, say so and make no edits.
|
||||
|
||||
5. **Confirm and apply, one artifact at a time**
|
||||
- Show each proposed revision and why. Write only after the user confirms.
|
||||
- If the user rejects a revision, do not write it - leave that artifact unchanged.
|
||||
- When a substantial rewrite is needed, get that artifact's rules and template first:
|
||||
```bash
|
||||
openspec instructions "<artifact-id>" --change "<name>" --json
|
||||
```
|
||||
|
||||
6. **Point to the next step (guidance only - NEVER act on it)**
|
||||
- Artifacts still missing -> suggest `/opsx:continue` to create them.
|
||||
- Change already implemented (tasks checked off / already applied) -> the code may no longer match the revised plan; suggest `/opsx:apply` to carry the delta into code.
|
||||
- Everything done and implemented -> suggest `/opsx:archive`.
|
||||
|
||||
**Output**
|
||||
|
||||
After each invocation, show:
|
||||
- Which artifacts were revised (and which proposed revisions were rejected)
|
||||
- Anything deferred to `/opsx:continue` (not-yet-created artifacts or files)
|
||||
- Where the change stands and the recommended next command
|
||||
|
||||
**Guardrails**
|
||||
- Planning artifacts only - NEVER edit implementation code. If the revised plan implies code changes, stop and point to `/opsx:apply`.
|
||||
- Use the artifact ids and paths reported by `openspec status`; never branch on hardcoded artifact names.
|
||||
- Edit only the concrete files in `existingOutputPaths`; never write to a glob `resolvedOutputPath`.
|
||||
- Do not advance the build frontier: no new artifacts, no new files under glob artifacts - that is `/opsx:continue`'s job.
|
||||
- Confirm every edit with the user before writing.
|
||||
- If the request changes the change's *intent* rather than refining it, first verify whether the expanded-profile `/opsx:new` workflow is available. If it is, recommend starting fresh with `/opsx:new` (the "Update vs. Start Fresh" heuristic). If it is unavailable, ask for a distinct unused change name and recommend `openspec new change "<new-change-name>"` instead.
|
||||
@@ -14,7 +14,33 @@ backups
|
||||
*.pfx
|
||||
*.jks
|
||||
.venv
|
||||
venv
|
||||
__pycache__
|
||||
*.pyc
|
||||
*.pyo
|
||||
.pytest_cache
|
||||
.ruff_cache
|
||||
.mypy_cache
|
||||
.ty_cache
|
||||
node_modules
|
||||
evidence
|
||||
openspec
|
||||
student-tests
|
||||
tests
|
||||
scripts
|
||||
examples
|
||||
contracts
|
||||
infra
|
||||
*.md
|
||||
!README.md
|
||||
Makefile
|
||||
Dockerfile*
|
||||
compose*.yaml
|
||||
.dockerignore
|
||||
.gitignore
|
||||
.DS_Store
|
||||
lab.json
|
||||
requirements-dev.txt
|
||||
.claude
|
||||
|
||||
.verification/
|
||||
|
||||
@@ -28,3 +28,79 @@ OTEL_SERVICE_NAME=messenger-api
|
||||
OTEL_EXPORTER_OTLP_ENDPOINT=http://otel-collector:4318
|
||||
OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf
|
||||
OTEL_RESOURCE_ATTRIBUTES=deployment.environment.name=lab
|
||||
# Solution-specific: published LB ports, replica limits, workers and pool per replica,
|
||||
# LB queue per replica, drain window before closing the listener on SIGTERM, PostgreSQL
|
||||
# limits, load generator limits (profile bench), cursor key file. API_PORT/SHORTTTL_PORT of lab2 are gone:
|
||||
# only the load balancer is published.
|
||||
LB_HTTP_PORT=18086
|
||||
LB_STATS_PORT=26085
|
||||
API_CPUS=1
|
||||
API_MEMORY=512m
|
||||
WEB_CONCURRENCY=2
|
||||
DB_POOL_MAX_SIZE=8
|
||||
API_SERVER_MAXCONN=64
|
||||
DRAIN_SECONDS=2
|
||||
PG_MAX_CONNECTIONS=200
|
||||
PG_CPUS=2
|
||||
PG_MEMORY=1g
|
||||
K6_CPUS=2
|
||||
K6_MEMORY=512m
|
||||
CURSOR_SECRET_FILE=/run/secrets/cursor_secret
|
||||
# Solution-specific for lab4: S3 client timeouts (connect + read, two attempts stay below
|
||||
# REQUEST_TIMEOUT_SECONDS=8), parallel image checks per worker, RustFS memory limit.
|
||||
S3_CONNECT_TIMEOUT_SECONDS=1
|
||||
S3_READ_TIMEOUT_SECONDS=2
|
||||
IMAGE_CHECK_CONCURRENCY=2
|
||||
S3_MEMORY=512m
|
||||
# Solution-specific for lab4 grade 4: upload bodies buffered at once per worker, grace period
|
||||
# before an abandoned pending upload is swept, sweep interval and rows per sweep pass.
|
||||
UPLOAD_CONCURRENCY=3
|
||||
UPLOAD_GRACE_SECONDS=900
|
||||
UPLOAD_SWEEP_INTERVAL_SECONDS=30
|
||||
UPLOAD_SWEEP_BATCH=100
|
||||
# Fixed glibc mmap threshold for the API: buffers above 128 KiB are returned to the system on free.
|
||||
MALLOC_MMAP_THRESHOLD_=131072
|
||||
# Solution-specific for lab5: RabbitMQ management UI on 127.0.0.1, backoff base of a transient
|
||||
# retry (doubles per attempt up to 60 s), relay poll and sweep intervals, worker limits and the
|
||||
# PostgreSQL pool of relay and worker. FAULT_POINT is set only by infra/compose.faults.yaml.
|
||||
BROKER_MANAGEMENT_PORT=26086
|
||||
JOB_BACKOFF_BASE_SECONDS=2
|
||||
OUTBOX_POLL_SECONDS=1
|
||||
SWEEP_INTERVAL_SECONDS=5
|
||||
WORKER_CPUS=2
|
||||
WORKER_MEMORY=1g
|
||||
PIPELINE_DB_POOL_MAX_SIZE=4
|
||||
# Solution-specific for lab5 grade 4: render time per job (the render process is killed after it),
|
||||
# address space of one render process (WORKER_MEMORY >= WORKER_CONCURRENCY * RENDER_MEMORY_MB plus
|
||||
# ~120 MiB of the worker itself), jobs per render process before it is replaced.
|
||||
RENDER_TIMEOUT_SECONDS=30
|
||||
RENDER_MEMORY_MB=448
|
||||
RENDER_TASKS_PER_CHILD=100
|
||||
# Solution-specific for lab6: host ports of Prometheus, Loki, Tempo and Grafana (127.0.0.1 only),
|
||||
# Prometheus retention, OTLP export timeout in seconds, metric export interval in ms, SDK queue
|
||||
# sizes, the bounded flush on shutdown; OTEL_SDK_DISABLED=true turns the SDK and instrumentations off.
|
||||
# relay and worker get OTEL_SERVICE_NAME messenger-relay and messenger-worker in compose.yaml.
|
||||
PROMETHEUS_PORT=26090
|
||||
LOKI_PORT=26310
|
||||
TEMPO_PORT=26320
|
||||
GRAFANA_PORT=26300
|
||||
PROMETHEUS_RETENTION=7d
|
||||
OTEL_SDK_DISABLED=false
|
||||
OTEL_EXPORTER_OTLP_TIMEOUT=2
|
||||
OTEL_METRIC_EXPORT_INTERVAL=10000
|
||||
OTEL_BSP_MAX_QUEUE_SIZE=2048
|
||||
OTEL_BLRP_MAX_QUEUE_SIZE=2048
|
||||
TELEMETRY_SHUTDOWN_SECONDS=2
|
||||
# Minimal client transfer rate, bytes/s: every body byte moved in either direction extends the
|
||||
# request deadline by 1/rate, so slow but steady uploads and downloads outlive REQUEST_TIMEOUT_SECONDS.
|
||||
MIN_TRANSFER_RATE_BYTES=131072
|
||||
# Solution-specific for lab4 track 2: limits of the one-off reconciler (profile reconcile), its S3
|
||||
# read timeout for listing pages, optional CPU pinning of the measured services (empty = no pinning)
|
||||
# and the CPU limit of RustFS (make reconcile-cost raises it with its memory for the 100k point).
|
||||
RECONCILE_CPUS=1
|
||||
RECONCILE_MEMORY=256m
|
||||
RECONCILE_S3_READ_TIMEOUT_SECONDS=10
|
||||
RECONCILE_CPUSET=
|
||||
S3_CPUSET=
|
||||
PG_CPUSET=
|
||||
S3_CPUS=1
|
||||
|
||||
@@ -0,0 +1,122 @@
|
||||
name: Application
|
||||
|
||||
on: [push, pull_request]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
quality:
|
||||
name: Линт, типы и собственные тесты
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: astral-sh/setup-uv@v5
|
||||
with:
|
||||
enable-cache: true
|
||||
- run: uv sync --locked --group dev
|
||||
- run: make lint VENV=.venv
|
||||
- run: make student-test VENV=.venv
|
||||
|
||||
acceptance:
|
||||
name: Стенд Compose с RabbitMQ, relay и worker за HAProxy, smoke, pipeline, отказ реплики, рестарт и отказы зависимостей
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: astral-sh/setup-uv@v5
|
||||
with:
|
||||
enable-cache: true
|
||||
- run: uv sync --locked --group dev
|
||||
|
||||
- name: Поднять стенд из чистого clone
|
||||
run: make up
|
||||
|
||||
- name: Публичный smoke через балансировщик
|
||||
run: make test
|
||||
|
||||
- name: Топология брокера, consumer с prefetch и права клиентов
|
||||
run: make topology
|
||||
|
||||
- name: Уровни «3» и «4» pipeline — worker остановлен, рестарт брокера, дубль, S3, попытки, варианты и пределы, падения в окнах 2–5, аренда, replay, DLQ, jitter, retention
|
||||
run: |
|
||||
make suite-preflight
|
||||
make level4
|
||||
|
||||
- name: Сообщение задания в очереди, 409 до ready и SIGTERM relay и worker
|
||||
run: make pipeline-evidence
|
||||
|
||||
- name: Вложение после остановки принявшей его реплики и при недоступном S3
|
||||
run: |
|
||||
make scenario SCENARIO=failover-upload
|
||||
make scenario SCENARIO=s3-outage
|
||||
|
||||
- name: Приватный bucket, ограниченный ключ API и повторный bootstrap
|
||||
run: make s3-check
|
||||
|
||||
- name: Негативный suite вложений, компенсация, уборка после grace, обрыв и зависание загрузки
|
||||
run: make upload-faults
|
||||
|
||||
- name: Несколько реплик на одном токене и гонка одного ключа
|
||||
run: make lb-check
|
||||
|
||||
- name: Повтор неподтверждённой записи после потерянного ответа и убитой реплики
|
||||
run: make retry-check
|
||||
|
||||
- name: Остановка реплики под запросами, затем возврат
|
||||
run: |
|
||||
make test-failover ACTION_SCRIPT=scripts/stop-one.sh
|
||||
docker compose ps -a api
|
||||
make restore
|
||||
|
||||
- name: Рестарт LB, API и хранилищ с сохранением volumes
|
||||
run: make test-persistence ACTION_SCRIPT=scripts/restart.sh
|
||||
|
||||
- name: Отказы Valkey и PostgreSQL, гонка и rollback
|
||||
run: make test-faults
|
||||
|
||||
- name: Лимиты, порты, секреты, volumes и сети по политике
|
||||
run: make limits
|
||||
|
||||
- name: Время обнаружения отказа балансировщиком (SIGTERM, kill, pause, PostgreSQL)
|
||||
run: make detection
|
||||
|
||||
- name: Наружу опубликован только балансировщик
|
||||
run: |
|
||||
docker compose ps --format '{{.Service}} {{.Ports}}' | awk '$2 != "" && $1 != "lb" && $1 != "broker" {print; bad=1} END {exit bad}'
|
||||
docker compose ps --format '{{.Service}} {{.Ports}}' | awk '$1 == "broker" && $2 !~ /^127\.0\.0\.1:/ {print; bad=1} END {exit bad}'
|
||||
|
||||
- name: Процессы работают не от root
|
||||
run: |
|
||||
for id in $(docker compose ps -q); do
|
||||
docker top "$id" -eo pid,uid,comm | awk 'NR>1 && $2==0 {print; bad=1} END {exit bad}' || exit 1
|
||||
done
|
||||
|
||||
- name: Одноразовые сервисы не от root
|
||||
run: |
|
||||
for service in migrate s3-init; do
|
||||
user=$(docker inspect -f '{{.Config.User}}' "$(docker compose ps -aq "$service")")
|
||||
echo "$service: $user"
|
||||
case "${user%%:*}" in ""|0|root) exit 1 ;; esac
|
||||
done
|
||||
|
||||
- name: Корректная остановка relay и worker по SIGTERM
|
||||
run: |
|
||||
start=$(date +%s)
|
||||
docker compose stop -t 10 relay worker
|
||||
elapsed=$(( $(date +%s) - start ))
|
||||
codes=$(docker inspect -f '{{.State.ExitCode}}' $(docker compose ps -aq relay worker) | sort -u)
|
||||
echo "остановка за ${elapsed} с, коды завершения ${codes}"
|
||||
test "$elapsed" -le 10 && test "$codes" = "0"
|
||||
|
||||
- name: Корректная остановка реплик API по SIGTERM
|
||||
run: |
|
||||
start=$(date +%s)
|
||||
docker compose kill --signal SIGTERM api
|
||||
codes=$(docker wait $(docker compose ps -aq api) | sort -u)
|
||||
elapsed=$(( $(date +%s) - start ))
|
||||
echo "остановка за ${elapsed} с, коды завершения ${codes}"
|
||||
test "$elapsed" -le 10 && test "$codes" = "0"
|
||||
|
||||
- name: Журналы стенда
|
||||
if: always()
|
||||
run: docker compose logs --tail 80
|
||||
+10
@@ -30,3 +30,13 @@ coverage/
|
||||
.vscode/
|
||||
# Keep small, sanitized evidence summaries in evidence/ under version control.
|
||||
# Inspect git diff --cached: ignore rules are not a secret scanner.
|
||||
|
||||
# Тулчейн студенческой реализации
|
||||
.pytest_cache/
|
||||
.ruff_cache/
|
||||
.ty_cache/
|
||||
|
||||
# Локальные настройки агента
|
||||
.claude/settings.local.json
|
||||
|
||||
.verification/
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
## Что это за репозиторий
|
||||
|
||||
Skeleton лабораторной 6 курса «Мессенджер под нагрузкой» (МТУСИ, 7 независимых лаб) и решение в ветке `solution/bpi2303-kostylev`. Skeleton даёт задание (`README.md`), нормативный контракт (`contracts/`, включая `contracts/observability.md`) и публичные black-box проверки (`tests/`). Реализация API, relay, worker, Dockerfile, compose-стенд, конфигурация балансировщика, S3, брокера и стека наблюдаемости, миграции, хуки отказов и собственные тесты — студенческие; решение лабы 6 построено переносом решения лабы 5.
|
||||
|
||||
Лаба 6: наблюдаемость всей системы, включая фоновую обработку. Бизнес-API не меняется (контракт 1.6.0). API, relay и worker инициализируют **OpenTelemetry SDK** в каждом процессе после fork (gunicorn-воркер, процесс relay, процесс worker) и отдают OTLP/HTTP в **OTel Collector** (`otelcol-contrib`); Collector раскладывает метрики в **Prometheus 3** (OTLP-приём), логи в **Loki 3** (OTLP `/otlp`), трассы в **Tempo 2**; **Grafana 12** только показывает и связывает их, datasources и dashboards приходят из provisioning в Git. HTTP-метрики и server spans даёт инструментация FastAPI, client spans БД — инструментация asyncpg, consumer spans — `RabbitTelemetryMiddleware` FastStream. Логи идут через порт `Logger` (structlog → stdout JSON и OTLP) с `trace_id`/`span_id`, без тел сообщений и секретов. Остаётся всё из лаб 1–5: HAProxy перед ≥2 репликами, PostgreSQL, Valkey, RustFS, RabbitMQ, outbox, relay, worker с арендой и вариантами, хуки остановки реплики и рестарта стенда.
|
||||
|
||||
## Команды
|
||||
|
||||
```sh
|
||||
make check # offline: структура skeleton, JSON, локальные $ref, синтаксис Python, версия 1.6.0
|
||||
make validate PYTHON=.venv/bin/python # полная валидация OpenAPI 3.1 и jobs.schema.json (venv с requirements-dev.txt)
|
||||
make install # uv sync --group dev
|
||||
make lint # ruff check + ruff format --check + ty check; обязательно перед commit
|
||||
make student-test # собственные тесты (одноразовые PostgreSQL, Valkey, RustFS и RabbitMQ в Docker)
|
||||
|
||||
make secrets # локальные secrets/* (lab5 + Grafana и DSN Collector) и .env
|
||||
make up # docker compose build, затем up -d --wait: хранилища, broker, стек наблюдаемости → migrate, s3-init → api ×2, relay, worker → lb
|
||||
make obs-validate # otelcol validate, promtool check config, loki/tempo verify, JSON dashboards
|
||||
make telemetry-check # Grafana provisioning, запрос → лог → трасса, job → трасса и лог worker, утечки
|
||||
make test # публичный smoke через LB (BASE_URL, по умолчанию http://localhost:8080)
|
||||
make test-persistence ACTION_SCRIPT=scripts/restart.sh # рестарт lb, api, relay, worker и postgres, valkey, s3, broker с volumes
|
||||
make test-failover ACTION_SCRIPT=scripts/stop-one.sh # остановка реплики TARGET_INSTANCE_ID под запросами
|
||||
make restore # вернуть остановленные реплики и дождаться их в ротации LB
|
||||
make level3 # сценарии уровня «3» лабы 5 (scripts/pipeline_suite.py) → evidence/level3.json
|
||||
make down # остановка без удаления данных; make reset-data — намеренное удаление volumes
|
||||
```
|
||||
|
||||
`tests/*.py` и `scripts/*.py` — только stdlib, синтаксис Python 3.9 (`make check` разбирает их системным `python3`). Проверки сами не поднимают стенд. Хуки `scripts/stop-one.sh` и `scripts/restart.sh` запускаются тестом без shell, поэтому исполняемые и с shebang. Адреса Prometheus, Loki, Tempo и Grafana для `scripts/obs_check.py` — переменные `PROMETHEUS_URL`, `LOKI_URL`, `TEMPO_URL`, `GRAFANA_URL` (по умолчанию стандартные порты на `127.0.0.1`).
|
||||
|
||||
## Архитектура skeleton
|
||||
|
||||
- `lab.json` — единственный источник номера лабы (6). От него зависят `scripts/check_contract.py` (`info.version == 1.6.0`) и `tests/client.py` (ветки `LAB>=5`: upload `202 queued`, ожидание `ready` до 60 с, ровно один `thumbnail` 256×160). Публичных проверок телеметрии нет: наблюдаемость доказывается своими скриптами и `evidence/`.
|
||||
- `tests/` байт в байт как в лабе 5. `contracts/openapi.json` отличается только `info.title` и `info.version`.
|
||||
- `contracts/observability.md` — нормативный набор сигналов (уровни «3» и «4»), resource attributes, запрещённые labels метрик и запрещённое содержимое telemetry, alerts и инциденты. `infra/otel/README.md` — что лежит в Git (Collector, storage, provisioning, dashboards, rules).
|
||||
- `contracts/infrastructure.json` — роли лабы 5 плюс `otel_collector`, `telemetry_storage` (метрики, логи, трассы, persistent volume) и `grafana` (provisioning в Git). `compose.example.yaml` — только worksheet ролей.
|
||||
|
||||
## Ключевые правила контракта (lab6)
|
||||
|
||||
- Resource attributes: `service.name` (`messenger-api`, `messenger-worker`, `messenger-relay`), `service.version`, `service.instance.id` (уникален на процесс: `<hostname>-<pid>`), `deployment.environment.name=lab`.
|
||||
- Метрики не получают labels `user_id`, `chat_id`, `message_id`, `attachment_id`, `request_id`, сырой URL, filename, текст; маршрут — шаблон (`/api/v1/chats/{chat_id}/messages`). HTTP duration — histogram в секундах (`http.server.request.duration`, `OTEL_SEMCONV_STABILITY_OPT_IN=http`).
|
||||
- Логи: timestamp, severity, `service.name`, `event`, `trace_id`/`span_id` при активном span. В telemetry никогда не попадают пароли, `Authorization`, токен сессии, тело сообщения, байты изображения, filename, ключи и подписанные URL; захват HTTP-заголовков выключен, Collector дополнительно редактирует подозрительные ключи.
|
||||
- Экспорт телеметрии никогда не блокирует запрос: только `Batch*Processor` и `PeriodicExportingMetricReader`, короткий таймаут OTLP. `/health/ready` не зависит от Collector, хранилищ телеметрии и Grafana. `OTEL_SDK_DISABLED=true` выключает SDK целиком.
|
||||
- Тело ошибки остаётся `{"error":{"code","message","request_id"}}` с `additionalProperties: false`: `trace_id` в тело и схемы не добавляется.
|
||||
- Сохраняются правила lab5 (outbox, `202 queued`, `ack` после `COMMIT`, ключ эффекта, `409` на `/content` до `ready`), lab4, lab3 (`X-Instance-Id`, `Idempotency-Key`), lab2 и lab1.
|
||||
|
||||
## Правила работы с репозиторием
|
||||
|
||||
- Не менять и не ослаблять `contracts/`, `tests/`, `README.md`, `COURSE.md`, `infra/README.md`, `infra/otel/README.md`, рубрику. Расхождение оформляется вопросом преподавателю.
|
||||
- Код — `src/messenger/`, миграции — `src/messenger/migrations/NNNN_*.sql`, конфигурация LB, нагрузки, S3, брокера и наблюдаемости — `infra/` (`infra/otel`, `infra/prometheus`, `infra/loki`, `infra/tempo`, `infra/grafana`), хуки и обвязка стенда — `scripts/`, собственные тесты — `student-tests/`, обезличенные доказательства — `evidence/`.
|
||||
- Без комментариев в коде; отступы — пробелы (`[tool.ruff.format]`); Python 3.14 без `from __future__ import annotations` и `TYPE_CHECKING`.
|
||||
- Наружу публикуются только LB, UI брокера, Prometheus, Loki, Tempo и Grafana на `127.0.0.1`; порты реплик API, OTLP и self-metrics Collector не публикуются. Порты задаются переменными `.env`, дефолты compose — стандартные.
|
||||
- `REPORT.md`: команды из чистого clone, архитектура, таблица «критерий → команда → наблюдение → файл», таблица отказов, сопоставление сигналов `observability.md` реальным именам метрик. PASS без команды не доказательство.
|
||||
- Ветка `solution/bpi2303-kostylev`, коммиты на английском, перед каждым — `make lint`. Никогда не коммитить `.env`, `secrets/`, токены, пароли Grafana, ключи S3, пароли брокера, volumes, дампы.
|
||||
|
||||
## Уровни оценки
|
||||
|
||||
Решение заявлено на **«5»** с треком 1 «Цена наблюдаемости»; таблица доказательств — в `REPORT.md`.
|
||||
|
||||
- **3** — минимум lab5 работает при включённой телеметрии; Collector, Prometheus, Loki, Tempo и Grafana в общем стенде с volumes и provisioning из Git; API, relay и worker отдают OTLP; RPS/errors/duration API, jobs по исходу и duration worker; структурные логи с `trace_id`/`span_id`; реальные server и consumer spans; импортируемые dashboards; нет секретов и тел в telemetry; запрос → трасса и лог, job → трасса и лог worker.
|
||||
- **4** — W3C trace context API → outbox → broker → worker (producer/consumer), цепочка до S3/DB с retry; p50/p95/p99 из histogram, доля ошибок, queue depth и возраст старейшей job, DB pool, saturation worker, CPU/RAM; SLI/SLO, alert rules error rate и queue lag (firing → resolved); memory_limiter, batch, ограниченные очереди, отказ хранилищ телеметрии; два разобранных инцидента.
|
||||
- **5** — трек 1: telemetry off / on / head sampling / tail sampling / сбалансированная конфигурация при одинаковой open-loop нагрузке — latency с клиента, CPU/RAM вне телеметрии, объём ingest, потери spans и захват вброшенных ошибок и медленных запросов.
|
||||
+51
@@ -0,0 +1,51 @@
|
||||
FROM python:3.14-slim-trixie@sha256:51dafde81dbdb6ebde285137a295cf18a47ca95234fe388a343719cb97305b3d AS builder
|
||||
|
||||
COPY --from=ghcr.io/astral-sh/uv:0.9.7@sha256:ba4857bf2a068e9bc0e64eed8563b065908a4cd6bfb66b531a9c424c8e25e142 /uv /usr/local/bin/uv
|
||||
|
||||
ENV UV_COMPILE_BYTECODE=1 \
|
||||
UV_LINK_MODE=copy \
|
||||
UV_PYTHON_DOWNLOADS=never \
|
||||
UV_PROJECT_ENVIRONMENT=/opt/venv
|
||||
|
||||
WORKDIR /build
|
||||
|
||||
COPY pyproject.toml uv.lock README.md ./
|
||||
RUN uv sync --locked --no-dev --no-install-project --no-editable
|
||||
|
||||
COPY src ./src
|
||||
RUN uv sync --locked --no-dev --no-editable
|
||||
|
||||
|
||||
FROM python:3.14-slim-trixie@sha256:51dafde81dbdb6ebde285137a295cf18a47ca95234fe388a343719cb97305b3d AS runtime
|
||||
|
||||
ENV PYTHONUNBUFFERED=1 \
|
||||
PYTHONDONTWRITEBYTECODE=1 \
|
||||
PATH="/opt/venv/bin:$PATH" \
|
||||
HOST=0.0.0.0 \
|
||||
PORT=8080 \
|
||||
LOG_LEVEL=INFO \
|
||||
WEB_CONCURRENCY=2 \
|
||||
REQUEST_TIMEOUT_SECONDS=8 \
|
||||
DRAIN_SECONDS=2 \
|
||||
SHUTDOWN_TIMEOUT_SECONDS=6
|
||||
|
||||
RUN groupadd --system --gid 10001 messenger \
|
||||
&& useradd --system --uid 10001 --gid messenger --no-create-home --shell /usr/sbin/nologin messenger
|
||||
|
||||
COPY --from=builder --chown=root:root /opt/venv /opt/venv
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY --chown=root:root alembic.ini ./
|
||||
COPY --chown=root:root alembic ./alembic
|
||||
|
||||
USER 10001:10001
|
||||
|
||||
EXPOSE 8080
|
||||
|
||||
HEALTHCHECK --interval=10s --timeout=3s --start-period=5s --retries=3 \
|
||||
CMD ["python", "-c", "import urllib.request,sys;sys.exit(0 if urllib.request.urlopen('http://127.0.0.1:8080/health/live',timeout=2).status==200 else 1)"]
|
||||
|
||||
CMD ["python", "-m", "gunicorn", \
|
||||
"--config", "python:messenger.gunicorn_conf", \
|
||||
"messenger.main:create_app()"]
|
||||
@@ -1,17 +1,72 @@
|
||||
PYTHON ?= python3
|
||||
BASE_URL ?= http://localhost:8080
|
||||
BASE_URL ?= http://$(shell docker compose port lb 8080 2>/dev/null || echo localhost:8080)
|
||||
CA_FILE ?=
|
||||
ACTION_SCRIPT ?=
|
||||
TLS_ARGS = $(if $(CA_FILE),--ca-file "$(CA_FILE)",)
|
||||
|
||||
.PHONY: help check validate test load test-persistence test-failover
|
||||
VENV ?= .venv
|
||||
UV ?= uv
|
||||
COMPOSE ?= docker compose
|
||||
RATE ?= 100
|
||||
FROM_REV ?=
|
||||
SHIFT ?= 0
|
||||
SCRIPTS_PY = scripts/obs_incidents.py scripts/obs_recovery.py scripts/capture_evidence.py alembic scripts/scaling.py tools scripts/probe.py scripts/limits.py scripts/lab4_scenarios.py scripts/lab4_seed.py \
|
||||
scripts/upload_memory.py scripts/reconcile_check.py scripts/reconcile_track.py \
|
||||
scripts/make_images.py scripts/pipeline_suite.py scripts/pipeline_evidence.py
|
||||
SCENARIO ?= failover-upload
|
||||
PSQL = $(COMPOSE) exec -T postgres psql -U messenger -d messenger -X -q
|
||||
OBS_CHECK = $(PYTHON) scripts/obs_check.py
|
||||
APP_METRICS = {job=~"messenger-.*"}
|
||||
|
||||
TRACK2_OUTPUT ?= evidence/track2.json
|
||||
TRACK2_SCENARIOS = smoke_pipeline,duplicate_after_ready,crash_commit_publish,crash_publish_confirm,crash_after_s3_before_commit,crash_after_commit_before_ack,lease_expiry_fencing,crash_before_side_effect,worker_kill_mid_task,duplicate_in_flight,reorder_attempts,reorder_versions,stale_after_new_version
|
||||
PIPELINE_VERSION ?= 2
|
||||
PYTEST_ARGS ?=
|
||||
|
||||
.PHONY: help check validate test load test-persistence test-failover \
|
||||
install lint format typecheck student-test \
|
||||
secrets up down reset-data migrate ps logs restore lb-check failover-evidence stack-evidence \
|
||||
persistence-evidence storage-evidence cache-evidence test-faults seed explain \
|
||||
limits detection failover-each rolling-update lab4-level4 \
|
||||
scenario s3-check attachments-evidence upload-faults upload-memory \
|
||||
images queues topology worker-stop worker-start broker-restart suite-preflight level3 \
|
||||
pipeline-evidence level4 replay failed dlq \
|
||||
obs-validate telemetry-check \
|
||||
faults-evidence retry-check reconcile reconcile-demo reconcile-cost load-evidence \
|
||||
clean-clone-evidence overload-leftovers
|
||||
|
||||
.NOTPARALLEL:
|
||||
|
||||
help:
|
||||
@echo "check: offline structure; validate: full OpenAPI (requirements-dev.txt); test: running API; load: synthetic writes"
|
||||
@echo "install/lint/typecheck/student-test: студенческий тулчейн"
|
||||
@echo "secrets/up/down/migrate/ps/logs: стенд Docker Compose; reset-data: намеренное удаление volumes"
|
||||
@echo "restore: вернуть остановленные реплики; lb-check: реплики на одном токене и 20 гонок одного ключа"
|
||||
@echo "lab4-level4 = limits, lb-check, detection, failover-each, rolling-update [FROM_REV=<коммит>]; RATE=$(RATE) rps"
|
||||
@echo "scenario SCENARIO=failover-upload|s3-outage → evidence/<сценарий>.json; s3-check; attachments-evidence"
|
||||
@echo "upload-faults: негативный suite, компенсация, уборка, обрыв и зависание загрузки против стенда"
|
||||
@echo "upload-memory: пик памяти реплик при 10/20/40 одновременных загрузках 1 и 10 MiB → evidence/upload-memory/"
|
||||
@echo "lab5: queues, topology, worker-stop/worker-start, broker-restart, images, suite-preflight, level3, level4"
|
||||
@echo "lab5 оператор: failed (реестр), replay ID=<attachment_id>, dlq (просмотр DLQ без извлечения)"
|
||||
@echo "lab6: obs-validate (конфиги Collector, Prometheus, Loki, Tempo, dashboards); telemetry-check → evidence/*.json"
|
||||
|
||||
@echo "retry-check: потерянный ответ на живой и на убитой реплике, повтор тем же ключом"
|
||||
@echo "lab4-level4 = limits, lb-check, detection, failover-each, rolling-update [FROM_REV=<коммит>]; RATE=$(RATE) rps"
|
||||
@echo "scenario SCENARIO=failover-upload|s3-outage → evidence/<сценарий>.json; s3-check; attachments-evidence"
|
||||
@echo "upload-faults: негативный suite, компенсация, уборка, обрыв и зависание загрузки против стенда"
|
||||
@echo "upload-memory ARGS='--out evidence/upload-memory/runN': пик памяти реплик при 10/20/40 загрузках 1 и 10 MiB"
|
||||
@echo "load-evidence: tests/load.py ×3 клиентом-контейнером в сети edge стенда → evidence/load.txt, evidence/load/"
|
||||
@echo "overload-leftovers: после upload-memory — намерения от 503, сверка и уборка после grace → evidence/overload-leftovers.txt"
|
||||
@echo "clean-clone-evidence: блок «Запуск из чистого clone» в свежем клоне рядом → evidence/clean-clone.txt"
|
||||
@echo "reconcile ARGS='--apply --deep': сверка PostgreSQL ↔ S3 (без ARGS — dry-run); трек 2:"
|
||||
@echo "reconcile-demo: внедрение ошибок, dry-run/apply/повтор, безопасность, нагрузка → evidence/reconcile/"
|
||||
@echo "reconcile-cost: стоимость обхода 1k/10k/30k/100k объектов × 3 прогона на чистом стенде → evidence/reconcile/cost/"
|
||||
@echo "BASE_URL=$(BASE_URL) (порт lb из docker compose); failover-evidence SHIFT=1 — сдвиг round robin на вторую реплику"
|
||||
|
||||
check:
|
||||
$(PYTHON) scripts/check_contract.py
|
||||
|
||||
validate: PYTHON := $(if $(wildcard $(VENV)/bin/python),$(VENV)/bin/python,$(PYTHON))
|
||||
validate:
|
||||
$(PYTHON) scripts/validate_openapi.py
|
||||
|
||||
@@ -28,3 +83,226 @@ test-persistence:
|
||||
test-failover:
|
||||
@test -n "$(ACTION_SCRIPT)" || (echo "Set ACTION_SCRIPT to your implemented executable stop-one hook"; exit 2)
|
||||
$(PYTHON) tests/resilience.py --mode failover --action-script "$(ACTION_SCRIPT)" --base-url "$(BASE_URL)" $(TLS_ARGS)
|
||||
|
||||
install:
|
||||
$(UV) sync --group dev
|
||||
|
||||
lint:
|
||||
$(VENV)/bin/ruff check src student-tests $(SCRIPTS_PY)
|
||||
$(VENV)/bin/ruff format --check src student-tests $(SCRIPTS_PY)
|
||||
$(VENV)/bin/ty check src student-tests alembic
|
||||
|
||||
format:
|
||||
$(VENV)/bin/ruff check --fix src student-tests $(SCRIPTS_PY)
|
||||
$(VENV)/bin/ruff format src student-tests $(SCRIPTS_PY)
|
||||
|
||||
typecheck:
|
||||
$(VENV)/bin/ty check src student-tests alembic
|
||||
|
||||
student-test:
|
||||
$(VENV)/bin/pytest $(PYTEST_ARGS)
|
||||
|
||||
secrets:
|
||||
sh scripts/secrets.sh
|
||||
sh scripts/broker-secrets.sh
|
||||
sh scripts/secrets-lab6.sh
|
||||
|
||||
up: secrets
|
||||
$(COMPOSE) build
|
||||
$(COMPOSE) up -d --wait
|
||||
scripts/lb-wait.sh
|
||||
|
||||
down:
|
||||
$(COMPOSE) --profile bench --profile tools --profile reconcile down
|
||||
|
||||
reset-data:
|
||||
@echo "Удаляются volumes с учебными данными стенда"
|
||||
$(COMPOSE) --profile bench --profile tools --profile reconcile down -v --remove-orphans
|
||||
|
||||
migrate:
|
||||
$(COMPOSE) run --rm migrate
|
||||
|
||||
ps:
|
||||
$(COMPOSE) ps
|
||||
|
||||
logs:
|
||||
$(COMPOSE) logs --tail 200
|
||||
|
||||
restore:
|
||||
scripts/restore.sh
|
||||
|
||||
lb-check:
|
||||
$(PYTHON) scripts/probe.py check --rounds 20 --out evidence/lb-check.json
|
||||
|
||||
retry-check:
|
||||
$(PYTHON) scripts/probe.py retry --out evidence/retry.json
|
||||
|
||||
limits:
|
||||
$(PYTHON) scripts/limits.py --out evidence/limits.txt
|
||||
|
||||
detection:
|
||||
rm -rf evidence/detection
|
||||
for run in 1 2 3; do sh scripts/detection.sh evidence/detection/run$$run || exit 1; done
|
||||
|
||||
failover-each:
|
||||
RATE=$(RATE) sh scripts/failover-each.sh evidence/failover-each
|
||||
|
||||
rolling-update:
|
||||
ifneq ($(FROM_REV),)
|
||||
git archive "$(FROM_REV)" | docker build -q -t "mtusi-messenger:$(FROM_REV)" -
|
||||
API_IMAGE="mtusi-messenger:$(FROM_REV)" $(COMPOSE) up -d --no-deps --force-recreate --wait api
|
||||
scripts/lb-wait.sh
|
||||
endif
|
||||
$(COMPOSE) build -q api
|
||||
RATE=$(RATE) $(PYTHON) scripts/probe.py load --expect replace --duration 90 \
|
||||
--out evidence/rolling$(if $(FROM_REV),-from-$(FROM_REV)) \
|
||||
-- scripts/rolling-update.sh
|
||||
|
||||
lab4-level4: limits lb-check detection failover-each rolling-update
|
||||
|
||||
scenario:
|
||||
$(PYTHON) scripts/lab4_scenarios.py $(SCENARIO) --base-url "$(BASE_URL)" --restore --output evidence/$(SCENARIO).json
|
||||
scripts/lb-wait.sh
|
||||
|
||||
s3-check:
|
||||
sh scripts/s3-check.sh > evidence/s3-security.txt; status=$$?; cat evidence/s3-security.txt; exit $$status
|
||||
|
||||
attachments-evidence:
|
||||
sh scripts/evidence-attachments.sh
|
||||
|
||||
upload-faults:
|
||||
{ echo "date: $$(date -u +%FT%TZ) commit: $$(git rev-parse --short HEAD) BASE_URL=$(BASE_URL)"; \
|
||||
BASE_URL="$(BASE_URL)" $(VENV)/bin/pytest -m stack -v -s --no-header --tb=short \
|
||||
-p no:cacheprovider student-tests/stack/test_attachment_faults.py; } > evidence/upload-faults.txt; \
|
||||
status=$$?; cat evidence/upload-faults.txt; exit $$status
|
||||
|
||||
upload-memory:
|
||||
$(PYTHON) scripts/upload_memory.py --base-url "$(BASE_URL)" $(ARGS)
|
||||
|
||||
load-evidence:
|
||||
sh scripts/load-evidence.sh
|
||||
|
||||
overload-leftovers:
|
||||
sh scripts/overload-leftovers.sh
|
||||
|
||||
clean-clone-evidence:
|
||||
sh scripts/clean-clone.sh
|
||||
|
||||
reconcile:
|
||||
$(COMPOSE) run --rm --no-deps reconciler $(ARGS)
|
||||
|
||||
reconcile-demo:
|
||||
$(PYTHON) scripts/reconcile_track.py demo --base-url "$(BASE_URL)" $(ARGS)
|
||||
|
||||
reconcile-cost:
|
||||
$(PYTHON) scripts/reconcile_track.py cost $(ARGS)
|
||||
|
||||
failover-evidence:
|
||||
sh scripts/failover-evidence.sh "$(BASE_URL)" "$(SHIFT)"
|
||||
|
||||
stack-evidence:
|
||||
sh scripts/evidence-stack.sh
|
||||
|
||||
persistence-evidence:
|
||||
sh scripts/persistence-evidence.sh "$(BASE_URL)" > evidence/persistence.txt
|
||||
cat evidence/persistence.txt
|
||||
|
||||
storage-evidence:
|
||||
sh scripts/evidence-storage.sh
|
||||
|
||||
cache-evidence:
|
||||
sh scripts/evidence-cache.sh > evidence/cache.txt
|
||||
cat evidence/cache.txt
|
||||
|
||||
test-faults:
|
||||
BASE_URL="$(BASE_URL)" $(VENV)/bin/pytest -m stack -v -s student-tests/stack
|
||||
|
||||
faults-evidence:
|
||||
{ echo "date: $$(date -u +%FT%TZ) commit: $$(git rev-parse --short HEAD)"; echo "\$$ make test-faults"; \
|
||||
$(MAKE) --no-print-directory test-faults 2>&1; } | sed 's#$(CURDIR)#<repo>#g' > evidence/faults.txt
|
||||
cat evidence/faults.txt
|
||||
grep -qE '^=+ [0-9]+ passed in' evidence/faults.txt
|
||||
|
||||
seed:
|
||||
$(PSQL) -f - < scripts/sql/seed-history.sql
|
||||
|
||||
explain: seed
|
||||
{ echo "date: $$(date -u +%FT%TZ) commit: $$(git rev-parse --short HEAD)"; \
|
||||
echo "\$$ make explain # scripts/sql/explain-history.sql"; \
|
||||
$(PSQL) -f - < scripts/sql/explain-history.sql; } > evidence/explain-history.txt
|
||||
cat evidence/explain-history.txt
|
||||
|
||||
images:
|
||||
$(PYTHON) scripts/make_images.py
|
||||
|
||||
queues:
|
||||
sh scripts/broker.sh queues
|
||||
|
||||
topology:
|
||||
{ echo "date: $$(date -u +%FT%TZ) commit: $$(git rev-parse --short HEAD)"; \
|
||||
echo "$$ rabbitmqctl list_queues -p messenger name type durable policy messages"; \
|
||||
$(COMPOSE) exec -T broker rabbitmqctl -q list_queues -p messenger name type durable policy messages; \
|
||||
echo "$$ rabbitmqctl list_consumers -p messenger"; \
|
||||
$(COMPOSE) exec -T broker rabbitmqctl -q list_consumers -p messenger queue_name ack_required prefetch_count; \
|
||||
echo "$$ rabbitmqctl list_permissions -p messenger"; \
|
||||
$(COMPOSE) exec -T broker rabbitmqctl -q list_permissions -p messenger; \
|
||||
echo "$$ rabbitmqctl list_users"; \
|
||||
$(COMPOSE) exec -T broker rabbitmqctl -q list_users; \
|
||||
echo "$$ docker compose ps"; \
|
||||
$(COMPOSE) ps --format '{{.Service}}\t{{.Status}}\t{{.Ports}}'; } > evidence/topology.txt
|
||||
cat evidence/topology.txt
|
||||
|
||||
worker-stop:
|
||||
sh scripts/worker.sh stop
|
||||
|
||||
worker-start:
|
||||
sh scripts/worker.sh start
|
||||
|
||||
broker-restart:
|
||||
sh scripts/broker.sh restart
|
||||
|
||||
suite-preflight:
|
||||
BASE_URL="$(BASE_URL)" $(PYTHON) scripts/pipeline_suite.py --preflight
|
||||
|
||||
level3:
|
||||
BASE_URL="$(BASE_URL)" $(PYTHON) scripts/pipeline_suite.py --level 3 --output evidence/level3.json
|
||||
|
||||
level4:
|
||||
BASE_URL="$(BASE_URL)" $(PYTHON) scripts/pipeline_suite.py --level 4 --output evidence/level4.json
|
||||
|
||||
failed:
|
||||
$(COMPOSE) run --rm --no-deps -T worker python -m messenger.admin failed
|
||||
|
||||
replay:
|
||||
@test -n "$(ID)" || (echo "Set ID=<attachment_id>"; exit 2)
|
||||
$(COMPOSE) run --rm --no-deps -T worker python -m messenger.admin replay --attachment-id "$(ID)"
|
||||
|
||||
dlq:
|
||||
sh scripts/broker.sh dlq
|
||||
|
||||
pipeline-evidence:
|
||||
$(PYTHON) scripts/pipeline_evidence.py --base-url "$(BASE_URL)" > evidence/pipeline-stand.txt; \
|
||||
status=$$?; cat evidence/pipeline-stand.txt; exit $$status
|
||||
|
||||
obs-validate:
|
||||
sh scripts/obs-validate.sh
|
||||
|
||||
telemetry-check:
|
||||
$(OBS_CHECK) grafana > evidence/grafana.json
|
||||
$(OBS_CHECK) dashboards --strict > evidence/dashboards.json
|
||||
$(OBS_CHECK) request --base-url "$(BASE_URL)" > evidence/trace-request.json
|
||||
$(OBS_CHECK) job --base-url "$(BASE_URL)" > evidence/trace-job.json
|
||||
$(OBS_CHECK) leaks --base-url "$(BASE_URL)" > evidence/leaks.json
|
||||
$(OBS_CHECK) query 'count by (__name__, job) ($(APP_METRICS))' \
|
||||
'count by (http_route, http_request_method) (http_server_request_duration_seconds_count)' \
|
||||
'count by (job_type, outcome) (messenger_jobs_processed_total)' > evidence/cardinality.json
|
||||
@echo "telemetry-check: evidence/grafana.json dashboards.json trace-request.json trace-job.json leaks.json cardinality.json"
|
||||
|
||||
.PHONY: track2 reprocess
|
||||
|
||||
track2:
|
||||
BASE_URL="$(BASE_URL)" $(PYTHON) scripts/pipeline_suite.py --level 5 --only "$(TRACK2_SCENARIOS)" --output "$(TRACK2_OUTPUT)"
|
||||
|
||||
reprocess:
|
||||
@test -n "$(ID)" || (echo "Set ID=<attachment_id>"; exit 2)
|
||||
$(COMPOSE) run --rm --no-deps -T worker python -m messenger.admin reprocess --attachment-id "$(ID)" --pipeline-version "$(PIPELINE_VERSION)"
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
[alembic]
|
||||
script_location = %(here)s/alembic
|
||||
prepend_sys_path = %(here)s/src %(here)s/alembic
|
||||
path_separator = space
|
||||
+102
@@ -0,0 +1,102 @@
|
||||
import asyncio
|
||||
|
||||
from alembic import context
|
||||
from alembic.script import ScriptDirectory
|
||||
from legacy import adopt_legacy
|
||||
from sqlalchemy import Connection, func, make_url, pool, select
|
||||
from sqlalchemy.ext.asyncio import create_async_engine
|
||||
|
||||
from messenger.attachments.infrastructure.postgres import (
|
||||
AttachmentRow,
|
||||
JobEventRow,
|
||||
JobRow,
|
||||
OutboxRow,
|
||||
VariantRow,
|
||||
)
|
||||
from messenger.identity.infrastructure.postgres import SessionRow, UserRow
|
||||
from messenger.messaging.infrastructure.postgres import (
|
||||
ChatMemberRow,
|
||||
ChatRow,
|
||||
IdempotencyKeyRow,
|
||||
MessageAttachmentRow,
|
||||
MessageRow,
|
||||
)
|
||||
from messenger.shared.config import PlatformSettings
|
||||
|
||||
LOCK_KEY = 20_260_002
|
||||
MODELS = (
|
||||
UserRow,
|
||||
SessionRow,
|
||||
ChatRow,
|
||||
ChatMemberRow,
|
||||
MessageRow,
|
||||
IdempotencyKeyRow,
|
||||
AttachmentRow,
|
||||
JobRow,
|
||||
OutboxRow,
|
||||
JobEventRow,
|
||||
VariantRow,
|
||||
MessageAttachmentRow,
|
||||
)
|
||||
target_metadata = UserRow.metadata
|
||||
config = context.config
|
||||
|
||||
|
||||
def include_object(_obj, name, _type, _reflected, _compare_to):
|
||||
return name != "schema_migrations"
|
||||
|
||||
|
||||
def run_migrations(connection: Connection) -> None:
|
||||
with connection.engine.connect() as lock:
|
||||
lock.execute(select(func.pg_advisory_lock(LOCK_KEY)))
|
||||
lock.commit()
|
||||
try:
|
||||
with connection.begin():
|
||||
adopt_legacy(connection, ScriptDirectory.from_config(config))
|
||||
context.configure(
|
||||
connection=connection,
|
||||
target_metadata=target_metadata,
|
||||
transaction_per_migration=True,
|
||||
compare_type=True,
|
||||
include_object=include_object,
|
||||
)
|
||||
with context.begin_transaction():
|
||||
context.run_migrations()
|
||||
finally:
|
||||
lock.execute(select(func.pg_advisory_unlock(LOCK_KEY)))
|
||||
lock.commit()
|
||||
|
||||
|
||||
async def run_async_migrations() -> None:
|
||||
dsn = config.attributes.get("database_url")
|
||||
if dsn is None:
|
||||
dsn = PlatformSettings().database_url.get_secret_value()
|
||||
engine = create_async_engine(
|
||||
make_url(dsn).set(drivername="postgresql+asyncpg"),
|
||||
poolclass=pool.NullPool,
|
||||
hide_parameters=True,
|
||||
connect_args={
|
||||
"timeout": 10,
|
||||
"server_settings": {"lock_timeout": "10000", "statement_timeout": "60000"},
|
||||
},
|
||||
)
|
||||
try:
|
||||
async with engine.connect() as connection:
|
||||
await connection.run_sync(run_migrations)
|
||||
finally:
|
||||
await engine.dispose()
|
||||
|
||||
|
||||
if context.is_offline_mode():
|
||||
context.configure(
|
||||
dialect_name="postgresql",
|
||||
target_metadata=target_metadata,
|
||||
literal_binds=True,
|
||||
transaction_per_migration=True,
|
||||
)
|
||||
with context.begin_transaction():
|
||||
context.run_migrations()
|
||||
elif config.attributes.get("connection") is not None:
|
||||
run_migrations(config.attributes["connection"])
|
||||
else:
|
||||
asyncio.run(run_async_migrations())
|
||||
@@ -0,0 +1,94 @@
|
||||
from uuid import uuid4
|
||||
|
||||
from alembic.migration import MigrationContext
|
||||
from alembic.operations import Operations
|
||||
from alembic.script import ScriptDirectory
|
||||
from sqlalchemy import Connection, MetaData, Table, func, inspect, select, text
|
||||
from sqlalchemy.schema import CreateSchema
|
||||
|
||||
LEGACY = {
|
||||
"0001_init": "9a13618f078ae9056431391e2e5197a31b981ae1fff047a9b3421ac750d3fd0d",
|
||||
"0002_idempotency_keys": "d9159a35553249a1e51af5f2e4e7c39b014e97593c49748e13f3799839063dd0",
|
||||
"0003_attachments": "c4417f560538a083efba1c67f660147dc94532fcbb2fa91f3f3e8258a0f01f2e",
|
||||
"0004_jobs": "c3887fa7a886ae8153a216aa43fd4c3c6190a2074e8ce20c3e77f29bfb01550e",
|
||||
"0005_failed_registry": "02b80061a08a6929feb092148c453ad970e3d001901c651b5a73b90b1e40f145",
|
||||
"0006_attachment_quarantine": (
|
||||
"541f5399d87fac3584c4102b4e0bf92c23cd372cc20a7d56dad03e771773202c"
|
||||
),
|
||||
}
|
||||
SNAPSHOT = text("""
|
||||
WITH relations AS (
|
||||
SELECT c.* FROM pg_class c JOIN pg_namespace n ON n.oid = c.relnamespace
|
||||
WHERE n.nspname = :schema AND c.relkind IN ('r', 'p')
|
||||
AND c.relname NOT IN ('schema_migrations', 'alembic_version')
|
||||
)
|
||||
SELECT 'table' AS kind, c.relname AS name,
|
||||
concat_ws('|', c.relkind, c.relpersistence,
|
||||
c.relrowsecurity, c.relforcerowsecurity) AS definition
|
||||
FROM relations c
|
||||
UNION ALL
|
||||
SELECT 'column', c.relname || '.' || a.attname,
|
||||
concat_ws('|', a.attnum, format_type(a.atttypid, a.atttypmod), a.attnotnull,
|
||||
a.attidentity, a.attgenerated, a.attcollation::regcollation,
|
||||
pg_get_expr(d.adbin, d.adrelid))
|
||||
FROM relations c JOIN pg_attribute a ON a.attrelid = c.oid
|
||||
LEFT JOIN pg_attrdef d ON d.adrelid = c.oid AND d.adnum = a.attnum
|
||||
WHERE a.attnum > 0 AND NOT a.attisdropped
|
||||
UNION ALL
|
||||
SELECT 'constraint', c.relname || '.' || k.conname,
|
||||
concat_ws('|', pg_get_constraintdef(k.oid), k.convalidated)
|
||||
FROM relations c JOIN pg_constraint k ON k.conrelid = c.oid
|
||||
UNION ALL
|
||||
SELECT 'index', c.relname || '.' || x.relname,
|
||||
concat_ws('|', pg_get_indexdef(i.indexrelid), i.indisvalid, i.indisready)
|
||||
FROM relations c JOIN pg_index i ON i.indrelid = c.oid
|
||||
JOIN pg_class x ON x.oid = i.indexrelid
|
||||
UNION ALL
|
||||
SELECT 'trigger', c.relname || '.' || t.tgname,
|
||||
concat_ws('|', pg_get_triggerdef(t.oid), t.tgenabled)
|
||||
FROM relations c JOIN pg_trigger t ON t.tgrelid = c.oid WHERE NOT t.tgisinternal
|
||||
ORDER BY kind, name
|
||||
""")
|
||||
|
||||
|
||||
def snapshot(connection: Connection, schema: str) -> list[tuple[str, str, str]]:
|
||||
return [
|
||||
(kind, name, definition.replace(f"{schema}.", ""))
|
||||
for kind, name, definition in connection.execute(SNAPSHOT, {"schema": schema})
|
||||
]
|
||||
|
||||
|
||||
def adopt_legacy(connection: Connection, scripts: ScriptDirectory) -> None:
|
||||
migration = MigrationContext.configure(connection)
|
||||
if migration.get_current_heads():
|
||||
return
|
||||
tables = set(inspect(connection).get_table_names(schema="public"))
|
||||
if tables <= {"alembic_version"}:
|
||||
return
|
||||
if "schema_migrations" not in tables:
|
||||
raise RuntimeError("Existing schema has no legacy migration journal")
|
||||
journal = Table("schema_migrations", MetaData(), schema="public", autoload_with=connection)
|
||||
applied = dict(connection.execute(select(journal.c.version, journal.c.checksum)).tuples().all())
|
||||
expected = dict(list(LEGACY.items())[: len(applied)])
|
||||
if applied != expected:
|
||||
raise RuntimeError("Unknown or changed legacy migrations")
|
||||
if not applied:
|
||||
if tables - {"schema_migrations", "alembic_version"}:
|
||||
raise RuntimeError("Existing schema has an empty migration journal")
|
||||
return
|
||||
revision = list(expected)[-1]
|
||||
actual = snapshot(connection, "public")
|
||||
reference = f"alembic_verify_{uuid4().hex}"
|
||||
savepoint = connection.begin_nested()
|
||||
try:
|
||||
connection.execute(CreateSchema(reference))
|
||||
connection.execute(select(func.set_config("search_path", reference, True)))
|
||||
with Operations.context(MigrationContext.configure(connection)):
|
||||
for script in reversed(list(scripts.walk_revisions(base="base", head=revision))):
|
||||
script.module.upgrade()
|
||||
wanted = snapshot(connection, reference)
|
||||
finally:
|
||||
savepoint.rollback()
|
||||
if actual != wanted:
|
||||
raise RuntimeError("Legacy schema differs from the recorded migrations")
|
||||
migration.stamp(scripts, revision)
|
||||
@@ -0,0 +1,16 @@
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
${imports if imports else ""}
|
||||
|
||||
revision = ${repr(up_revision)}
|
||||
down_revision = ${repr(down_revision)}
|
||||
branch_labels = ${repr(branch_labels)}
|
||||
depends_on = ${repr(depends_on)}
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
${upgrades if upgrades else "pass"}
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
${downgrades if downgrades else "pass"}
|
||||
@@ -0,0 +1,87 @@
|
||||
import sqlalchemy as sa
|
||||
from alembic import op
|
||||
|
||||
revision = "0001_init"
|
||||
down_revision = None
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
op.create_table(
|
||||
"users",
|
||||
sa.Column("id", sa.Uuid(), nullable=False),
|
||||
sa.Column("username", sa.Text(), nullable=False),
|
||||
sa.Column("display_name", sa.Text(), nullable=False),
|
||||
sa.Column("password_hash", sa.Text(), nullable=False),
|
||||
sa.Column("created_at", sa.DateTime(timezone=True), nullable=False),
|
||||
sa.CheckConstraint("password_hash LIKE '$argon2id$%'", name="users_password_hash_check"),
|
||||
sa.CheckConstraint("username ~ '^[a-z0-9_]{3,32}$'", name="users_username_format"),
|
||||
sa.CheckConstraint(
|
||||
"char_length(display_name) BETWEEN 1 AND 100", name="users_display_name_check"
|
||||
),
|
||||
sa.PrimaryKeyConstraint("id"),
|
||||
sa.UniqueConstraint("username", name="users_username_key"),
|
||||
)
|
||||
op.create_table(
|
||||
"sessions",
|
||||
sa.Column("token_hash", sa.LargeBinary(), nullable=False),
|
||||
sa.Column("user_id", sa.Uuid(), nullable=False),
|
||||
sa.Column("created_at", sa.DateTime(timezone=True), nullable=False),
|
||||
sa.Column("expires_at", sa.DateTime(timezone=True), nullable=False),
|
||||
sa.CheckConstraint("expires_at > created_at", name="sessions_check"),
|
||||
sa.CheckConstraint("octet_length(token_hash) = 32", name="sessions_token_hash_check"),
|
||||
sa.ForeignKeyConstraint(["user_id"], ["users.id"], ondelete="CASCADE"),
|
||||
sa.PrimaryKeyConstraint("token_hash"),
|
||||
)
|
||||
op.create_index("sessions_user_idx", "sessions", ["user_id"], unique=False)
|
||||
op.create_table(
|
||||
"chats",
|
||||
sa.Column("id", sa.Uuid(), nullable=False),
|
||||
sa.Column("title", sa.Text(), nullable=False),
|
||||
sa.Column("created_at", sa.DateTime(timezone=True), nullable=False),
|
||||
sa.Column("last_message_at", sa.DateTime(timezone=True), nullable=True),
|
||||
sa.CheckConstraint("char_length(title) BETWEEN 1 AND 100", name="chats_title_check"),
|
||||
sa.PrimaryKeyConstraint("id"),
|
||||
)
|
||||
op.create_table(
|
||||
"chat_members",
|
||||
sa.Column("chat_id", sa.Uuid(), nullable=False),
|
||||
sa.Column("user_id", sa.Uuid(), nullable=False),
|
||||
sa.Column("position", sa.SmallInteger(), nullable=False),
|
||||
sa.Column("chat_created_at", sa.DateTime(timezone=True), nullable=False),
|
||||
sa.CheckConstraint("position BETWEEN 1 AND 100", name="chat_members_position_check"),
|
||||
sa.ForeignKeyConstraint(["chat_id"], ["chats.id"], ondelete="CASCADE"),
|
||||
sa.ForeignKeyConstraint(
|
||||
["user_id"],
|
||||
["users.id"],
|
||||
),
|
||||
sa.PrimaryKeyConstraint("chat_id", "user_id"),
|
||||
)
|
||||
op.create_index(
|
||||
"chat_members_user_idx",
|
||||
"chat_members",
|
||||
["user_id", "chat_created_at", "chat_id"],
|
||||
unique=False,
|
||||
)
|
||||
op.create_table(
|
||||
"messages",
|
||||
sa.Column("id", sa.Uuid(), nullable=False),
|
||||
sa.Column("chat_id", sa.Uuid(), nullable=False),
|
||||
sa.Column("sender_id", sa.Uuid(), nullable=False),
|
||||
sa.Column("text", sa.Text(), nullable=False),
|
||||
sa.Column("created_at", sa.DateTime(timezone=True), nullable=False),
|
||||
sa.CheckConstraint("char_length(text) BETWEEN 1 AND 4000", name="messages_text_check"),
|
||||
sa.ForeignKeyConstraint(
|
||||
["chat_id", "sender_id"],
|
||||
["chat_members.chat_id", "chat_members.user_id"],
|
||||
),
|
||||
sa.PrimaryKeyConstraint("id"),
|
||||
)
|
||||
op.create_index(
|
||||
"messages_history_idx", "messages", ["chat_id", "created_at", "id"], unique=False
|
||||
)
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
raise RuntimeError("Downgrade would delete application data")
|
||||
@@ -0,0 +1,33 @@
|
||||
import sqlalchemy as sa
|
||||
from alembic import op
|
||||
|
||||
revision = "0002_idempotency_keys"
|
||||
down_revision = "0001_init"
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
op.create_table(
|
||||
"idempotency_keys",
|
||||
sa.Column("chat_id", sa.Uuid(), nullable=False),
|
||||
sa.Column("user_id", sa.Uuid(), nullable=False),
|
||||
sa.Column("key", sa.Text(), nullable=False),
|
||||
sa.Column("fingerprint", sa.LargeBinary(), nullable=False),
|
||||
sa.Column("message_id", sa.Uuid(), nullable=False),
|
||||
sa.Column("created_at", sa.DateTime(timezone=True), nullable=False),
|
||||
sa.CheckConstraint("key ~ '^[A-Za-z0-9._:-]{1,128}$'", name="idempotency_keys_key_check"),
|
||||
sa.CheckConstraint(
|
||||
"octet_length(fingerprint) = 32", name="idempotency_keys_fingerprint_check"
|
||||
),
|
||||
sa.ForeignKeyConstraint(
|
||||
["chat_id", "user_id"],
|
||||
["chat_members.chat_id", "chat_members.user_id"],
|
||||
),
|
||||
sa.ForeignKeyConstraint(["message_id"], ["messages.id"], ondelete="CASCADE"),
|
||||
sa.PrimaryKeyConstraint("chat_id", "user_id", "key"),
|
||||
)
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
raise RuntimeError("Downgrade would delete application data")
|
||||
@@ -0,0 +1,77 @@
|
||||
import sqlalchemy as sa
|
||||
from alembic import op
|
||||
|
||||
revision = "0003_attachments"
|
||||
down_revision = "0002_idempotency_keys"
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
op.drop_constraint("messages_text_check", "messages", type_="check")
|
||||
op.create_check_constraint("messages_text_check", "messages", "char_length(text) <= 4000")
|
||||
op.create_table(
|
||||
"attachments",
|
||||
sa.Column("id", sa.Uuid(), nullable=False),
|
||||
sa.Column("chat_id", sa.Uuid(), nullable=False),
|
||||
sa.Column("owner_id", sa.Uuid(), nullable=False),
|
||||
sa.Column("filename", sa.Text(), nullable=False),
|
||||
sa.Column("content_type", sa.Text(), nullable=False),
|
||||
sa.Column("size_bytes", sa.BigInteger(), nullable=False),
|
||||
sa.Column("sha256", sa.Text(), nullable=False),
|
||||
sa.Column("width", sa.Integer(), nullable=False),
|
||||
sa.Column("height", sa.Integer(), nullable=False),
|
||||
sa.Column("object_key", sa.Text(collation="C"), nullable=False),
|
||||
sa.Column("status", sa.Text(), nullable=False),
|
||||
sa.Column("created_at", sa.DateTime(timezone=True), nullable=False),
|
||||
sa.Column("updated_at", sa.DateTime(timezone=True), nullable=False),
|
||||
sa.PrimaryKeyConstraint("id"),
|
||||
sa.UniqueConstraint("object_key", name="attachments_object_key_key"),
|
||||
sa.UniqueConstraint("id", "chat_id", name="attachments_chat_key"),
|
||||
sa.ForeignKeyConstraint(
|
||||
["chat_id", "owner_id"],
|
||||
["chat_members.chat_id", "chat_members.user_id"],
|
||||
name="attachments_owner_fkey",
|
||||
),
|
||||
sa.CheckConstraint(
|
||||
"char_length(filename) BETWEEN 1 AND 255", name="attachments_filename_check"
|
||||
),
|
||||
sa.CheckConstraint(
|
||||
"content_type IN ('image/png', 'image/jpeg')", name="attachments_content_type_check"
|
||||
),
|
||||
sa.CheckConstraint(
|
||||
"size_bytes BETWEEN 1 AND 10485760", name="attachments_size_bytes_check"
|
||||
),
|
||||
sa.CheckConstraint("sha256 ~ '^[0-9a-f]{64}$'", name="attachments_sha256_check"),
|
||||
sa.CheckConstraint("width > 0", name="attachments_width_check"),
|
||||
sa.CheckConstraint("height > 0", name="attachments_height_check"),
|
||||
sa.CheckConstraint("status IN ('pending', 'ready')", name="attachments_status_check"),
|
||||
)
|
||||
op.create_index(
|
||||
"attachments_pending_idx",
|
||||
"attachments",
|
||||
["created_at"],
|
||||
postgresql_where=sa.text("status = 'pending'"),
|
||||
)
|
||||
op.create_table(
|
||||
"message_attachments",
|
||||
sa.Column("message_id", sa.Uuid(), nullable=False),
|
||||
sa.Column("position", sa.SmallInteger(), nullable=False),
|
||||
sa.Column("chat_id", sa.Uuid(), nullable=False),
|
||||
sa.Column("attachment_id", sa.Uuid(), nullable=False),
|
||||
sa.PrimaryKeyConstraint("message_id", "position"),
|
||||
sa.UniqueConstraint("message_id", "attachment_id"),
|
||||
sa.CheckConstraint("position BETWEEN 0 AND 9", name="message_attachments_position_check"),
|
||||
sa.ForeignKeyConstraint(["message_id"], ["messages.id"], ondelete="CASCADE"),
|
||||
sa.ForeignKeyConstraint(
|
||||
["attachment_id", "chat_id"],
|
||||
["attachments.id", "attachments.chat_id"],
|
||||
name="message_attachments_attachment_fkey",
|
||||
ondelete="RESTRICT",
|
||||
),
|
||||
)
|
||||
op.create_index("message_attachments_attachment_idx", "message_attachments", ["attachment_id"])
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
raise RuntimeError("Downgrade would delete application data")
|
||||
@@ -0,0 +1,146 @@
|
||||
import sqlalchemy as sa
|
||||
from alembic import op
|
||||
from sqlalchemy.dialects import postgresql
|
||||
|
||||
revision = "0004_jobs"
|
||||
down_revision = "0003_attachments"
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
op.drop_constraint("attachments_status_check", "attachments", type_="check")
|
||||
op.create_check_constraint(
|
||||
"attachments_status_check",
|
||||
"attachments",
|
||||
"status IN ('pending', 'queued', 'processing', 'ready', 'failed')",
|
||||
)
|
||||
for name in ("staging_key", "original_key"):
|
||||
op.add_column("attachments", sa.Column(name, sa.Text(collation="C"), nullable=True))
|
||||
op.create_unique_constraint(f"attachments_{name}_key", "attachments", [name])
|
||||
op.add_column(
|
||||
"attachments",
|
||||
sa.Column("published_version", sa.Integer(), nullable=False, server_default="0"),
|
||||
)
|
||||
op.create_check_constraint(
|
||||
"attachments_published_version_check", "attachments", "published_version >= 0"
|
||||
)
|
||||
op.add_column("attachments", sa.Column("error_code", sa.Text(), nullable=True))
|
||||
op.create_check_constraint(
|
||||
"attachments_error_code_check",
|
||||
"attachments",
|
||||
"error_code IN ('invalid_image', 'processing_failed', 'retry_exhausted')",
|
||||
)
|
||||
op.alter_column("attachments", "object_key", nullable=True)
|
||||
attachments = sa.table(
|
||||
"attachments",
|
||||
sa.column("status"),
|
||||
sa.column("object_key"),
|
||||
sa.column("original_key"),
|
||||
sa.column("staging_key"),
|
||||
sa.column("published_version"),
|
||||
)
|
||||
op.execute(
|
||||
attachments.update()
|
||||
.where(attachments.c.status == "ready")
|
||||
.values(original_key=attachments.c.object_key, published_version=1)
|
||||
)
|
||||
op.execute(
|
||||
attachments.update()
|
||||
.where(attachments.c.status == "pending")
|
||||
.values(staging_key=attachments.c.object_key)
|
||||
)
|
||||
op.create_index(
|
||||
"attachments_staged_idx",
|
||||
"attachments",
|
||||
["updated_at"],
|
||||
postgresql_where=sa.column("staging_key").is_not(None),
|
||||
)
|
||||
op.create_table(
|
||||
"attachment_variants",
|
||||
sa.Column("attachment_id", sa.Uuid(), sa.ForeignKey("attachments.id"), nullable=False),
|
||||
sa.Column("pipeline_version", sa.Integer(), nullable=False),
|
||||
sa.Column("name", sa.Text(), nullable=False),
|
||||
sa.Column("object_key", sa.Text(collation="C"), nullable=False),
|
||||
sa.Column("content_type", sa.Text(), nullable=False),
|
||||
sa.Column("size_bytes", sa.BigInteger(), nullable=False),
|
||||
sa.Column("width", sa.Integer(), nullable=False),
|
||||
sa.Column("height", sa.Integer(), nullable=False),
|
||||
sa.Column("sha256", sa.Text(), nullable=False),
|
||||
sa.Column("created_at", sa.DateTime(timezone=True), nullable=False),
|
||||
sa.PrimaryKeyConstraint("attachment_id", "pipeline_version", "name"),
|
||||
sa.UniqueConstraint("object_key", name="attachment_variants_object_key_key"),
|
||||
sa.CheckConstraint(
|
||||
"pipeline_version >= 1", name="attachment_variants_pipeline_version_check"
|
||||
),
|
||||
sa.CheckConstraint(
|
||||
"name IN ('thumbnail', 'crop', 'optimized')", name="attachment_variants_name_check"
|
||||
),
|
||||
sa.CheckConstraint(
|
||||
"content_type IN ('image/jpeg', 'image/png', 'image/webp')",
|
||||
name="attachment_variants_content_type_check",
|
||||
),
|
||||
sa.CheckConstraint("size_bytes >= 1", name="attachment_variants_size_bytes_check"),
|
||||
sa.CheckConstraint("width >= 1", name="attachment_variants_width_check"),
|
||||
sa.CheckConstraint("height >= 1", name="attachment_variants_height_check"),
|
||||
sa.CheckConstraint("sha256 ~ '^[0-9a-f]{64}$'", name="attachment_variants_sha256_check"),
|
||||
)
|
||||
op.create_table(
|
||||
"jobs",
|
||||
sa.Column("job_id", sa.Uuid(), primary_key=True),
|
||||
sa.Column("attachment_id", sa.Uuid(), sa.ForeignKey("attachments.id"), nullable=False),
|
||||
sa.Column("pipeline_version", sa.Integer(), nullable=False),
|
||||
sa.Column("status", sa.Text(), nullable=False),
|
||||
sa.Column("attempt", sa.Integer(), nullable=False),
|
||||
sa.Column("claims", sa.Integer(), nullable=False, server_default="0"),
|
||||
sa.Column("lease_token", sa.Uuid(), nullable=True),
|
||||
sa.Column("lease_until", sa.DateTime(timezone=True), nullable=True),
|
||||
sa.Column("next_attempt_at", sa.DateTime(timezone=True), nullable=True),
|
||||
sa.Column("last_error", sa.Text(), nullable=True),
|
||||
sa.Column("created_at", sa.DateTime(timezone=True), nullable=False),
|
||||
sa.Column("updated_at", sa.DateTime(timezone=True), nullable=False),
|
||||
sa.UniqueConstraint("attachment_id", "pipeline_version", name="jobs_effect_key"),
|
||||
sa.CheckConstraint("pipeline_version >= 1", name="jobs_pipeline_version_check"),
|
||||
sa.CheckConstraint(
|
||||
"status IN ('queued', 'processing', 'done', 'failed', 'superseded')",
|
||||
name="jobs_status_check",
|
||||
),
|
||||
sa.CheckConstraint("attempt >= 1", name="jobs_attempt_check"),
|
||||
sa.CheckConstraint("claims >= 0", name="jobs_claims_check"),
|
||||
)
|
||||
op.create_index(
|
||||
"jobs_lease_idx",
|
||||
"jobs",
|
||||
["lease_until"],
|
||||
postgresql_where=sa.column("status") == "processing",
|
||||
)
|
||||
op.create_table(
|
||||
"outbox",
|
||||
sa.Column("id", sa.BigInteger(), sa.Identity(always=True), primary_key=True),
|
||||
sa.Column("job_id", sa.Uuid(), sa.ForeignKey("jobs.job_id"), nullable=False),
|
||||
sa.Column("payload", postgresql.JSONB(), nullable=False),
|
||||
sa.Column("available_at", sa.DateTime(timezone=True), nullable=False),
|
||||
sa.Column("published_at", sa.DateTime(timezone=True), nullable=True),
|
||||
)
|
||||
op.create_index(
|
||||
"outbox_pending_idx",
|
||||
"outbox",
|
||||
["available_at", "id"],
|
||||
postgresql_where=sa.column("published_at").is_(None),
|
||||
)
|
||||
op.create_index("outbox_job_idx", "outbox", ["job_id"])
|
||||
op.create_table(
|
||||
"job_events",
|
||||
sa.Column("id", sa.BigInteger(), sa.Identity(always=True), primary_key=True),
|
||||
sa.Column("job_id", sa.Uuid(), nullable=False),
|
||||
sa.Column("attachment_id", sa.Uuid(), nullable=False),
|
||||
sa.Column("kind", sa.Text(), nullable=False),
|
||||
sa.Column("attempt", sa.Integer(), nullable=True),
|
||||
sa.Column("detail", postgresql.JSONB(), nullable=False, server_default="{}"),
|
||||
sa.Column("at", sa.DateTime(timezone=True), nullable=False, server_default=sa.func.now()),
|
||||
)
|
||||
op.create_index("job_events_attachment_idx", "job_events", ["attachment_id", "id"])
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
raise RuntimeError("Downgrade would delete pipeline data")
|
||||
@@ -0,0 +1,20 @@
|
||||
import sqlalchemy as sa
|
||||
from alembic import op
|
||||
|
||||
revision = "0005_failed_registry"
|
||||
down_revision = "0004_jobs"
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
op.create_index(
|
||||
"jobs_failed_idx",
|
||||
"jobs",
|
||||
[sa.column("updated_at").desc()],
|
||||
postgresql_where=sa.column("status") == "failed",
|
||||
)
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
op.drop_index("jobs_failed_idx", table_name="jobs")
|
||||
@@ -0,0 +1,28 @@
|
||||
import sqlalchemy as sa
|
||||
from alembic import op
|
||||
|
||||
revision = "0006_attachment_quarantine"
|
||||
down_revision = "0005_failed_registry"
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
op.add_column("attachments", sa.Column("quarantine_reason", sa.Text(), nullable=True))
|
||||
op.create_check_constraint(
|
||||
"attachments_quarantine_reason_check",
|
||||
"attachments",
|
||||
"quarantine_reason IN ('missing', 'size_mismatch', 'sha_mismatch')",
|
||||
)
|
||||
op.add_column(
|
||||
"attachments", sa.Column("quarantined_at", sa.DateTime(timezone=True), nullable=True)
|
||||
)
|
||||
op.create_check_constraint(
|
||||
"attachments_quarantine_check",
|
||||
"attachments",
|
||||
"(quarantine_reason IS NULL) = (quarantined_at IS NULL)",
|
||||
)
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
raise RuntimeError("Downgrade would delete quarantine data")
|
||||
@@ -0,0 +1,19 @@
|
||||
import sqlalchemy as sa
|
||||
from alembic import op
|
||||
from sqlalchemy.dialects.postgresql import JSONB
|
||||
|
||||
revision = "0007_trace_context"
|
||||
down_revision = "0006_attachment_quarantine"
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
for table in ("jobs", "outbox"):
|
||||
op.add_column(
|
||||
table, sa.Column("trace_context", JSONB(), nullable=False, server_default="{}")
|
||||
)
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
raise RuntimeError("Downgrade would delete trace correlation data")
|
||||
+636
@@ -0,0 +1,636 @@
|
||||
x-app: &app
|
||||
image: ${API_IMAGE:-mtusi-messenger:${COMPOSE_PROJECT_NAME}}
|
||||
networks: [backend]
|
||||
|
||||
x-s3-env: &s3-env
|
||||
S3_ENDPOINT: ${S3_ENDPOINT:-http://s3:9000}
|
||||
S3_REGION: ${S3_REGION:-us-east-1}
|
||||
S3_BUCKET: ${S3_BUCKET:-messenger-attachments}
|
||||
S3_ACCESS_KEY_ID_FILE: /run/secrets/s3_access_key_id
|
||||
S3_SECRET_ACCESS_KEY_FILE: /run/secrets/s3_secret_access_key
|
||||
S3_CONNECT_TIMEOUT_SECONDS: ${S3_CONNECT_TIMEOUT_SECONDS:-1}
|
||||
S3_READ_TIMEOUT_SECONDS: ${S3_READ_TIMEOUT_SECONDS:-2}
|
||||
MAX_UPLOAD_BYTES: ${MAX_UPLOAD_BYTES:-10485760}
|
||||
MAX_IMAGE_PIXELS: ${MAX_IMAGE_PIXELS:-40000000}
|
||||
IMAGE_CHECK_CONCURRENCY: ${IMAGE_CHECK_CONCURRENCY:-2}
|
||||
UPLOAD_CONCURRENCY: ${UPLOAD_CONCURRENCY:-3}
|
||||
UPLOAD_GRACE_SECONDS: ${UPLOAD_GRACE_SECONDS:-900}
|
||||
UPLOAD_SWEEP_INTERVAL_SECONDS: ${UPLOAD_SWEEP_INTERVAL_SECONDS:-30}
|
||||
UPLOAD_SWEEP_BATCH: ${UPLOAD_SWEEP_BATCH:-100}
|
||||
|
||||
x-pipeline: &pipeline
|
||||
image: ${API_IMAGE:-mtusi-messenger:${COMPOSE_PROJECT_NAME}}
|
||||
pull_policy: never
|
||||
restart: unless-stopped
|
||||
init: true
|
||||
read_only: true
|
||||
tmpfs: [/tmp]
|
||||
security_opt: ["no-new-privileges:true"]
|
||||
cap_drop: [ALL]
|
||||
stop_grace_period: 10s
|
||||
networks: [backend]
|
||||
healthcheck:
|
||||
test: ["CMD", "python", "-c", "import os,sys,time;sys.exit(time.time()-os.stat('/tmp/heartbeat').st_mtime>30)"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 3
|
||||
start_period: 30s
|
||||
start_interval: 2s
|
||||
depends_on:
|
||||
migrate:
|
||||
condition: service_completed_successfully
|
||||
s3-init:
|
||||
condition: service_completed_successfully
|
||||
broker:
|
||||
condition: service_healthy
|
||||
|
||||
x-otel-env: &otel-env
|
||||
OTEL_SDK_DISABLED: ${OTEL_SDK_DISABLED:-false}
|
||||
OTEL_EXPORTER_OTLP_ENDPOINT: ${OTEL_EXPORTER_OTLP_ENDPOINT:-http://otel-collector:4318}
|
||||
OTEL_EXPORTER_OTLP_PROTOCOL: ${OTEL_EXPORTER_OTLP_PROTOCOL:-http/protobuf}
|
||||
OTEL_EXPORTER_OTLP_TIMEOUT: ${OTEL_EXPORTER_OTLP_TIMEOUT:-2}
|
||||
OTEL_RESOURCE_ATTRIBUTES: ${OTEL_RESOURCE_ATTRIBUTES:-deployment.environment.name=lab}
|
||||
OTEL_SEMCONV_STABILITY_OPT_IN: http
|
||||
OTEL_METRIC_EXPORT_INTERVAL: ${OTEL_METRIC_EXPORT_INTERVAL:-10000}
|
||||
OTEL_BSP_MAX_QUEUE_SIZE: ${OTEL_BSP_MAX_QUEUE_SIZE:-2048}
|
||||
OTEL_BLRP_MAX_QUEUE_SIZE: ${OTEL_BLRP_MAX_QUEUE_SIZE:-2048}
|
||||
TELEMETRY_SHUTDOWN_SECONDS: ${TELEMETRY_SHUTDOWN_SECONDS:-2}
|
||||
|
||||
x-obs-logging: &obs-logging
|
||||
driver: json-file
|
||||
options:
|
||||
max-size: 10m
|
||||
max-file: "3"
|
||||
|
||||
x-obs-hardening: &obs-hardening
|
||||
restart: unless-stopped
|
||||
stop_grace_period: 10s
|
||||
cap_drop: [ALL]
|
||||
security_opt: ["no-new-privileges:true"]
|
||||
logging: *obs-logging
|
||||
|
||||
x-pipeline-env: &pipeline-env
|
||||
<<: [*s3-env, *otel-env]
|
||||
DATABASE_URL_FILE: /run/secrets/database_url
|
||||
BROKER_URL_FILE: /run/secrets/broker_url
|
||||
DB_POOL_MAX_SIZE: ${PIPELINE_DB_POOL_MAX_SIZE:-4}
|
||||
LOG_LEVEL: ${LOG_LEVEL:-INFO}
|
||||
HEARTBEAT_FILE: /tmp/heartbeat
|
||||
JOB_MAX_ATTEMPTS: ${JOB_MAX_ATTEMPTS:-5}
|
||||
JOB_TIMEOUT_SECONDS: ${JOB_TIMEOUT_SECONDS:-60}
|
||||
JOB_BACKOFF_BASE_SECONDS: ${JOB_BACKOFF_BASE_SECONDS:-2}
|
||||
STAGING_RETENTION_SECONDS: ${STAGING_RETENTION_SECONDS:-86400}
|
||||
|
||||
x-s3-client: &s3-client
|
||||
image: rustfs/rc:v0.1.36@sha256:ab024bfebee49a750ce886b4c70963ccd9ddaa03f491704a90710641d7a26699
|
||||
read_only: true
|
||||
tmpfs: ["/tmp:size=16m"]
|
||||
environment:
|
||||
S3_ENDPOINT: ${S3_ENDPOINT:-http://s3:9000}
|
||||
S3_BUCKET: ${S3_BUCKET:-messenger-attachments}
|
||||
RC_CONFIG_DIR: /tmp/rc
|
||||
user: "65534:65534"
|
||||
volumes: ["./infra/s3:/s3:ro"]
|
||||
secrets:
|
||||
- s3_root_user
|
||||
- s3_root_password
|
||||
- s3_access_key_id
|
||||
- s3_secret_access_key
|
||||
- s3_reconciler_access_key_id
|
||||
- s3_reconciler_secret_access_key
|
||||
- s3_worker_access_key_id
|
||||
- s3_worker_secret_access_key
|
||||
cap_drop: [ALL]
|
||||
security_opt: ["no-new-privileges:true"]
|
||||
restart: "no"
|
||||
networks: [backend]
|
||||
deploy:
|
||||
resources:
|
||||
limits: {cpus: "0.5", memory: 64m}
|
||||
|
||||
services:
|
||||
lb:
|
||||
image: haproxy:3.2.26-alpine@sha256:5893840576071e6217cd52ebdcc14f454c6f7a631056fa6f4e0f40d3cac4215b
|
||||
environment:
|
||||
API_SERVER_MAXCONN: ${API_SERVER_MAXCONN:-64}
|
||||
volumes: [./infra/haproxy/haproxy.cfg:/usr/local/etc/haproxy/haproxy.cfg:ro]
|
||||
ports:
|
||||
- "127.0.0.1:${LB_HTTP_PORT:-18086}:8080"
|
||||
- "127.0.0.1:${LB_STATS_PORT:-26085}:8404"
|
||||
networks: [edge, backend]
|
||||
healthcheck:
|
||||
test: ["CMD", "wget", "-q", "-O", "/dev/null", "http://127.0.0.1:8404/healthz"]
|
||||
interval: 2s
|
||||
timeout: 2s
|
||||
retries: 3
|
||||
start_period: 60s
|
||||
start_interval: 1s
|
||||
sysctls:
|
||||
net.ipv4.ip_local_port_range: "10240 65535"
|
||||
net.ipv4.tcp_tw_reuse: "1"
|
||||
stop_signal: SIGUSR1
|
||||
stop_grace_period: 8s
|
||||
restart: unless-stopped
|
||||
read_only: true
|
||||
cap_drop: [ALL]
|
||||
deploy:
|
||||
resources:
|
||||
limits: {cpus: "${LB_CPUS:-1}", memory: 128m}
|
||||
|
||||
api:
|
||||
<<: *app
|
||||
build: .
|
||||
environment:
|
||||
<<: [*s3-env, *otel-env]
|
||||
OTEL_SERVICE_NAME: ${OTEL_SERVICE_NAME:-messenger-api}
|
||||
DATABASE_URL_FILE: /run/secrets/database_url
|
||||
CACHE_URL_FILE: /run/secrets/cache_url
|
||||
CURSOR_SECRET_FILE: /run/secrets/cursor_secret
|
||||
SESSION_TTL_SECONDS: ${SESSION_TTL_SECONDS:-3600}
|
||||
IDEMPOTENCY_TTL_SECONDS: ${IDEMPOTENCY_TTL_SECONDS:-86400}
|
||||
WEB_CONCURRENCY: ${WEB_CONCURRENCY:-2}
|
||||
DB_POOL_MAX_SIZE: ${DB_POOL_MAX_SIZE:-8}
|
||||
REQUEST_TIMEOUT_SECONDS: ${REQUEST_TIMEOUT_SECONDS:-8}
|
||||
MIN_TRANSFER_RATE_BYTES: ${MIN_TRANSFER_RATE_BYTES:-131072}
|
||||
DB_ACQUIRE_TIMEOUT_SECONDS: ${DB_ACQUIRE_TIMEOUT_SECONDS:-1}
|
||||
DB_COMMAND_TIMEOUT_SECONDS: ${DB_COMMAND_TIMEOUT_SECONDS:-2}
|
||||
DRAIN_SECONDS: ${DRAIN_SECONDS:-2}
|
||||
SHUTDOWN_TIMEOUT_SECONDS: ${SHUTDOWN_TIMEOUT_SECONDS:-6}
|
||||
LOG_LEVEL: ${LOG_LEVEL:-INFO}
|
||||
MALLOC_MMAP_THRESHOLD_: ${MALLOC_MMAP_THRESHOLD_:-131072}
|
||||
secrets: [database_url, cache_url, cursor_secret, s3_access_key_id, s3_secret_access_key]
|
||||
healthcheck:
|
||||
test: ["CMD", "python", "-c", "import sys,urllib.request;sys.exit(urllib.request.urlopen('http://127.0.0.1:8080/health/ready',timeout=2).status!=200)"]
|
||||
interval: 5s
|
||||
timeout: 3s
|
||||
retries: 3
|
||||
start_period: 30s
|
||||
start_interval: 200ms
|
||||
stop_grace_period: 8s
|
||||
restart: unless-stopped
|
||||
read_only: true
|
||||
tmpfs: [/tmp]
|
||||
sysctls:
|
||||
net.ipv4.tcp_rmem: "4096 65536 262144"
|
||||
net.ipv4.tcp_wmem: "4096 65536 262144"
|
||||
depends_on:
|
||||
migrate:
|
||||
condition: service_completed_successfully
|
||||
valkey:
|
||||
condition: service_started
|
||||
s3-init:
|
||||
condition: service_completed_successfully
|
||||
deploy:
|
||||
replicas: ${API_REPLICAS:-2}
|
||||
resources:
|
||||
limits: {cpus: "${API_CPUS:-1}", memory: "${API_MEMORY:-512m}"}
|
||||
|
||||
migrate:
|
||||
<<: *app
|
||||
pull_policy: never
|
||||
init: true
|
||||
command: ["alembic", "upgrade", "head"]
|
||||
environment:
|
||||
DATABASE_URL_FILE: /run/secrets/database_url
|
||||
LOG_LEVEL: ${LOG_LEVEL:-INFO}
|
||||
secrets: [database_url]
|
||||
healthcheck:
|
||||
disable: true
|
||||
restart: "no"
|
||||
depends_on:
|
||||
postgres:
|
||||
condition: service_healthy
|
||||
deploy:
|
||||
resources:
|
||||
limits: {cpus: "0.5", memory: 256m}
|
||||
|
||||
postgres:
|
||||
image: postgres:17.11-alpine@sha256:266d3c257594e195b309ae9d1805e54c788f1d7b375f56bf6c367aac6c917e7b
|
||||
user: "70:70"
|
||||
command:
|
||||
- postgres
|
||||
- -c
|
||||
- max_connections=${PG_MAX_CONNECTIONS:-200}
|
||||
- -c
|
||||
- shared_buffers=${PG_SHARED_BUFFERS:-256MB}
|
||||
- -c
|
||||
- shared_preload_libraries=pg_stat_statements
|
||||
- -c
|
||||
- pg_stat_statements.track=top
|
||||
- -c
|
||||
- track_io_timing=on
|
||||
- -c
|
||||
- idle_in_transaction_session_timeout=10s
|
||||
environment:
|
||||
POSTGRES_DB: messenger
|
||||
POSTGRES_USER: messenger
|
||||
POSTGRES_PASSWORD_FILE: /run/secrets/postgres_password
|
||||
secrets: [postgres_password]
|
||||
volumes: [pgdata:/var/lib/postgresql/data]
|
||||
shm_size: 256m
|
||||
cpuset: ${PG_CPUSET:-}
|
||||
healthcheck:
|
||||
test: ["CMD", "pg_isready", "-h", "127.0.0.1", "-U", "messenger", "-d", "messenger"]
|
||||
interval: 2s
|
||||
timeout: 3s
|
||||
retries: 30
|
||||
start_period: 10s
|
||||
start_interval: 200ms
|
||||
stop_grace_period: 10s
|
||||
restart: unless-stopped
|
||||
networks: [backend]
|
||||
deploy:
|
||||
resources:
|
||||
limits: {cpus: "${PG_CPUS:-2}", memory: "${PG_MEMORY:-1g}"}
|
||||
|
||||
valkey:
|
||||
image: valkey/valkey:8.1.11-alpine@sha256:2602ace2be6569bc2bbb06f873776516ab9089821525be34f4305c67eb9db02a
|
||||
user: "999:1000"
|
||||
command:
|
||||
- valkey-server
|
||||
- /run/secrets/valkey.conf
|
||||
- --appendonly
|
||||
- "yes"
|
||||
- --appendfsync
|
||||
- always
|
||||
- --maxmemory
|
||||
- 64mb
|
||||
- --maxmemory-policy
|
||||
- volatile-lru
|
||||
secrets: [valkey.conf]
|
||||
volumes: [valkeydata:/data]
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "REDISCLI_AUTH=\"$$(sed -n 's/^requirepass //p' /run/secrets/valkey.conf)\" valkey-cli ping | grep -q PONG"]
|
||||
interval: 2s
|
||||
timeout: 3s
|
||||
retries: 30
|
||||
stop_grace_period: 10s
|
||||
restart: unless-stopped
|
||||
networks: [backend]
|
||||
deploy:
|
||||
resources:
|
||||
limits: {cpus: "0.5", memory: 128m}
|
||||
|
||||
s3:
|
||||
image: rustfs/rustfs:1.0.4@sha256:ed9210d6411d77ffceb70d94b964a3cb7d225983368bc25bebe01e995293dcc2
|
||||
environment:
|
||||
RUSTFS_ACCESS_KEY_FILE: /run/secrets/s3_root_user
|
||||
RUSTFS_SECRET_KEY_FILE: /run/secrets/s3_root_password
|
||||
RUSTFS_ADDRESS: ":9000"
|
||||
RUSTFS_CONSOLE_ENABLE: "false"
|
||||
RUSTFS_REGION: ${S3_REGION:-us-east-1}
|
||||
RUSTFS_OBS_LOG_DIRECTORY: ""
|
||||
RUSTFS_OBS_LOGGER_LEVEL: ${S3_LOG_LEVEL:-warn}
|
||||
secrets: [s3_root_user, s3_root_password]
|
||||
volumes: [s3data:/data]
|
||||
cpuset: ${S3_CPUSET:-}
|
||||
read_only: true
|
||||
tmpfs: ["/tmp:size=64m"]
|
||||
cap_drop: [ALL]
|
||||
security_opt: ["no-new-privileges:true"]
|
||||
healthcheck:
|
||||
test: ["CMD", "curl", "-fsS", "-o", "/dev/null", "http://127.0.0.1:9000/health/ready"]
|
||||
interval: 2s
|
||||
timeout: 3s
|
||||
retries: 30
|
||||
start_period: 20s
|
||||
stop_grace_period: 10s
|
||||
restart: unless-stopped
|
||||
networks: [backend]
|
||||
deploy:
|
||||
resources:
|
||||
limits: {cpus: "${S3_CPUS:-1}", memory: "${S3_MEMORY:-512m}"}
|
||||
|
||||
reconciler:
|
||||
<<: *app
|
||||
pull_policy: never
|
||||
profiles: [reconcile]
|
||||
init: true
|
||||
entrypoint: ["python", "-m", "messenger.attachments.entrypoints.reconcile"]
|
||||
command: ["--dry-run"]
|
||||
environment:
|
||||
<<: *s3-env
|
||||
DATABASE_URL_FILE: /run/secrets/database_url
|
||||
S3_ACCESS_KEY_ID_FILE: /run/secrets/s3_reconciler_access_key_id
|
||||
S3_SECRET_ACCESS_KEY_FILE: /run/secrets/s3_reconciler_secret_access_key
|
||||
S3_READ_TIMEOUT_SECONDS: ${RECONCILE_S3_READ_TIMEOUT_SECONDS:-10}
|
||||
LOG_LEVEL: ${LOG_LEVEL:-INFO}
|
||||
secrets: [database_url, s3_reconciler_access_key_id, s3_reconciler_secret_access_key]
|
||||
healthcheck:
|
||||
disable: true
|
||||
restart: "no"
|
||||
read_only: true
|
||||
cpuset: ${RECONCILE_CPUSET:-}
|
||||
depends_on:
|
||||
postgres:
|
||||
condition: service_healthy
|
||||
s3:
|
||||
condition: service_healthy
|
||||
deploy:
|
||||
resources:
|
||||
limits: {cpus: "${RECONCILE_CPUS:-1}", memory: "${RECONCILE_MEMORY:-256m}"}
|
||||
|
||||
s3-init:
|
||||
<<: *s3-client
|
||||
entrypoint: ["/bin/sh", "/s3/init.sh"]
|
||||
depends_on:
|
||||
s3:
|
||||
condition: service_healthy
|
||||
|
||||
s3-cli:
|
||||
<<: *s3-client
|
||||
profiles: [tools]
|
||||
entrypoint: ["/bin/sh", "/s3/cli.sh"]
|
||||
|
||||
broker:
|
||||
image: rabbitmq:4.1.8-management-alpine@sha256:54ef5ff505352c1beef05a97ee9bd6ab95b3559a76629ba0119b1d63d8d6e4b2
|
||||
hostname: broker
|
||||
user: "100:101"
|
||||
restart: unless-stopped
|
||||
read_only: true
|
||||
tmpfs: [/tmp]
|
||||
security_opt: ["no-new-privileges:true"]
|
||||
cap_drop: [ALL]
|
||||
ports:
|
||||
- "127.0.0.1:${BROKER_MANAGEMENT_PORT:-26086}:15672"
|
||||
networks: [backend, edge]
|
||||
volumes:
|
||||
- broker-data:/var/lib/rabbitmq
|
||||
- ./infra/rabbitmq/rabbitmq.conf:/etc/rabbitmq/conf.d/20-messenger.conf:ro
|
||||
- ./infra/rabbitmq/enabled_plugins:/etc/rabbitmq/enabled_plugins:ro
|
||||
- ./infra/rabbitmq/definitions.json:/etc/rabbitmq/definitions.d/10-topology.json:ro
|
||||
secrets:
|
||||
- source: rabbitmq_users
|
||||
target: /etc/rabbitmq/definitions.d/20-users.json
|
||||
- rabbitmq_ops_password
|
||||
healthcheck:
|
||||
test: ["CMD", "rabbitmq-diagnostics", "-q", "check_port_connectivity"]
|
||||
interval: 10s
|
||||
timeout: 10s
|
||||
retries: 5
|
||||
start_period: 60s
|
||||
start_interval: 2s
|
||||
stop_grace_period: 10s
|
||||
deploy:
|
||||
resources:
|
||||
limits: {cpus: "1", memory: 512m}
|
||||
|
||||
relay:
|
||||
<<: *pipeline
|
||||
command: ["python", "-m", "messenger.relay"]
|
||||
environment:
|
||||
<<: *pipeline-env
|
||||
OTEL_SERVICE_NAME: messenger-relay
|
||||
OUTBOX_POLL_SECONDS: ${OUTBOX_POLL_SECONDS:-1}
|
||||
SWEEP_INTERVAL_SECONDS: ${SWEEP_INTERVAL_SECONDS:-5}
|
||||
secrets:
|
||||
- database_url
|
||||
- source: broker_url_api
|
||||
target: broker_url
|
||||
- s3_access_key_id
|
||||
- s3_secret_access_key
|
||||
deploy:
|
||||
resources:
|
||||
limits: {cpus: "0.5", memory: 192m}
|
||||
|
||||
worker:
|
||||
<<: *pipeline
|
||||
command: ["python", "-m", "messenger.worker"]
|
||||
environment:
|
||||
<<: *pipeline-env
|
||||
OTEL_SERVICE_NAME: messenger-worker
|
||||
WORKER_CONCURRENCY: ${WORKER_CONCURRENCY:-2}
|
||||
RENDER_TIMEOUT_SECONDS: ${RENDER_TIMEOUT_SECONDS:-30}
|
||||
RENDER_MEMORY_MB: ${RENDER_MEMORY_MB:-448}
|
||||
RENDER_TASKS_PER_CHILD: ${RENDER_TASKS_PER_CHILD:-100}
|
||||
secrets:
|
||||
- database_url
|
||||
- source: broker_url_worker
|
||||
target: broker_url
|
||||
- source: s3_worker_access_key_id
|
||||
target: s3_access_key_id
|
||||
- source: s3_worker_secret_access_key
|
||||
target: s3_secret_access_key
|
||||
deploy:
|
||||
resources:
|
||||
limits: {cpus: "${WORKER_CPUS:-2}", memory: "${WORKER_MEMORY:-1g}"}
|
||||
|
||||
k6:
|
||||
image: grafana/k6:2.3.0@sha256:2dd4756ec6e14e62778916e1eb850108e4b499304c02df56760fa0bdb0fba0b8
|
||||
profiles: [bench]
|
||||
environment:
|
||||
BASE_URL: http://lb:8080
|
||||
volumes: [./infra/k6:/scripts:ro]
|
||||
networks: [edge]
|
||||
deploy:
|
||||
resources:
|
||||
limits: {cpus: "${K6_CPUS:-2}", memory: "${K6_MEMORY:-512m}"}
|
||||
|
||||
healthtools:
|
||||
image: busybox:1.37.0-musl@sha256:5cec3fc171c87218698e85a52af7087de727372aae264a787b8112901a5b0092
|
||||
command: ["cp", "/bin/busybox", "/hc/busybox"]
|
||||
restart: "no"
|
||||
network_mode: none
|
||||
volumes:
|
||||
- healthtools:/hc
|
||||
logging: *obs-logging
|
||||
|
||||
otel-collector:
|
||||
<<: *obs-hardening
|
||||
image: otel/opentelemetry-collector-contrib:0.163.2@sha256:7f22d2a6748110ffb6a59bc0df448bccbf501cdb667d610ede4c61d3863d5849
|
||||
command: ["--config=/etc/otelcol/collector.yaml"]
|
||||
networks: [backend, edge]
|
||||
environment:
|
||||
GOMEMLIMIT: 200MiB
|
||||
volumes:
|
||||
- ./infra/otel:/etc/otelcol:ro
|
||||
- healthtools:/hc:ro
|
||||
depends_on:
|
||||
healthtools:
|
||||
condition: service_completed_successfully
|
||||
healthcheck:
|
||||
test: ["CMD", "/hc/busybox", "wget", "-q", "-O", "/dev/null", "http://127.0.0.1:13133/"]
|
||||
interval: 10s
|
||||
timeout: 3s
|
||||
retries: 6
|
||||
start_period: 10s
|
||||
start_interval: 2s
|
||||
deploy:
|
||||
resources:
|
||||
limits: {cpus: "0.50", memory: 256M}
|
||||
|
||||
prometheus:
|
||||
<<: *obs-hardening
|
||||
image: prom/prometheus:v3.15.1@sha256:fa3302279710be2f21a8301ec17a8b4f2301fd829bd113839b3b6b02b6f191a2
|
||||
command:
|
||||
- --config.file=/etc/prometheus/prometheus.yml
|
||||
- --storage.tsdb.path=/prometheus
|
||||
- --storage.tsdb.retention.time=${PROMETHEUS_RETENTION:-7d}
|
||||
- --storage.tsdb.retention.size=1GB
|
||||
- --web.enable-otlp-receiver
|
||||
- --enable-feature=exemplar-storage
|
||||
networks: [backend, edge]
|
||||
volumes:
|
||||
- ./infra/prometheus/prometheus.yml:/etc/prometheus/prometheus.yml:ro
|
||||
- ./infra/prometheus/rules:/etc/prometheus/rules:ro
|
||||
- prometheus-data:/prometheus
|
||||
ports:
|
||||
- "127.0.0.1:${PROMETHEUS_PORT:-26090}:9090"
|
||||
healthcheck:
|
||||
test: ["CMD", "wget", "-q", "-O", "/dev/null", "http://127.0.0.1:9090/-/ready"]
|
||||
interval: 10s
|
||||
timeout: 3s
|
||||
retries: 6
|
||||
start_period: 15s
|
||||
start_interval: 2s
|
||||
deploy:
|
||||
resources:
|
||||
limits: {cpus: "0.50", memory: 512M}
|
||||
|
||||
loki:
|
||||
<<: *obs-hardening
|
||||
image: grafana/loki:3.7.9@sha256:0db216b630ae1f348a1584c67f3cead8b4c1fc839169a39501db664744158e28
|
||||
command: ["-config.file=/etc/loki/loki.yaml"]
|
||||
networks: [edge]
|
||||
environment:
|
||||
GOMEMLIMIT: 300MiB
|
||||
volumes:
|
||||
- ./infra/loki/loki.yaml:/etc/loki/loki.yaml:ro
|
||||
- loki-data:/loki
|
||||
- healthtools:/hc:ro
|
||||
depends_on:
|
||||
healthtools:
|
||||
condition: service_completed_successfully
|
||||
ports:
|
||||
- "127.0.0.1:${LOKI_PORT:-26310}:3100"
|
||||
healthcheck:
|
||||
test: ["CMD", "/hc/busybox", "wget", "-q", "-O", "/dev/null", "http://127.0.0.1:3100/ready"]
|
||||
interval: 10s
|
||||
timeout: 3s
|
||||
retries: 10
|
||||
start_period: 30s
|
||||
start_interval: 2s
|
||||
deploy:
|
||||
resources:
|
||||
limits: {cpus: "0.50", memory: 384M}
|
||||
|
||||
tempo:
|
||||
<<: *obs-hardening
|
||||
image: grafana/tempo:2.10.10@sha256:12b0820f13ffa10ce956b6e9acc3b03f3cffded99109be6cc09d106fe56e5d38
|
||||
command: ["-config.file=/etc/tempo/tempo.yaml"]
|
||||
networks: [edge]
|
||||
environment:
|
||||
GOMEMLIMIT: 300MiB
|
||||
volumes:
|
||||
- ./infra/tempo/tempo.yaml:/etc/tempo/tempo.yaml:ro
|
||||
- tempo-data:/var/tempo
|
||||
- healthtools:/hc:ro
|
||||
depends_on:
|
||||
healthtools:
|
||||
condition: service_completed_successfully
|
||||
ports:
|
||||
- "127.0.0.1:${TEMPO_PORT:-26320}:3200"
|
||||
healthcheck:
|
||||
test: ["CMD", "/hc/busybox", "wget", "-q", "-O", "/dev/null", "http://127.0.0.1:3200/ready"]
|
||||
interval: 10s
|
||||
timeout: 3s
|
||||
retries: 10
|
||||
start_period: 30s
|
||||
start_interval: 2s
|
||||
deploy:
|
||||
resources:
|
||||
limits: {cpus: "0.50", memory: 384M}
|
||||
|
||||
grafana:
|
||||
<<: *obs-hardening
|
||||
image: grafana/grafana:12.4.14@sha256:ae509d9ae8c1021ca32ec370a9ca975d40165eda9fccd1e1102d317ff8787cd7
|
||||
networks: [edge]
|
||||
environment:
|
||||
GF_SECURITY_ADMIN_USER: admin
|
||||
GF_SECURITY_ADMIN_PASSWORD__FILE: /run/secrets/grafana_admin_password
|
||||
GF_USERS_ALLOW_SIGN_UP: "false"
|
||||
GF_AUTH_ANONYMOUS_ENABLED: "false"
|
||||
GF_ANALYTICS_REPORTING_ENABLED: "false"
|
||||
GF_ANALYTICS_CHECK_FOR_UPDATES: "false"
|
||||
GF_ANALYTICS_CHECK_FOR_PLUGIN_UPDATES: "false"
|
||||
GF_NEWS_NEWS_FEED_ENABLED: "false"
|
||||
GF_PLUGINS_PREINSTALL_DISABLED: "true"
|
||||
GF_LOG_LEVEL: warn
|
||||
secrets: [grafana_admin_password]
|
||||
volumes:
|
||||
- ./infra/grafana/provisioning:/etc/grafana/provisioning:ro
|
||||
- ./infra/grafana/dashboards:/etc/grafana/dashboards:ro
|
||||
- grafana-data:/var/lib/grafana
|
||||
depends_on:
|
||||
prometheus:
|
||||
condition: service_started
|
||||
loki:
|
||||
condition: service_started
|
||||
tempo:
|
||||
condition: service_started
|
||||
ports:
|
||||
- "127.0.0.1:${GRAFANA_PORT:-26300}:3000"
|
||||
healthcheck:
|
||||
test: ["CMD", "curl", "-fsS", "-o", "/dev/null", "http://127.0.0.1:3000/api/health"]
|
||||
interval: 10s
|
||||
timeout: 3s
|
||||
retries: 10
|
||||
start_period: 30s
|
||||
start_interval: 2s
|
||||
deploy:
|
||||
resources:
|
||||
limits: {cpus: "0.50", memory: 384M}
|
||||
|
||||
secrets:
|
||||
postgres_password:
|
||||
file: ./secrets/postgres_password
|
||||
database_url:
|
||||
file: ./secrets/database_url
|
||||
valkey.conf:
|
||||
file: ./secrets/valkey.conf
|
||||
cache_url:
|
||||
file: ./secrets/cache_url
|
||||
cursor_secret:
|
||||
file: ./secrets/cursor_secret
|
||||
s3_root_user:
|
||||
file: ./secrets/s3_root_user
|
||||
s3_root_password:
|
||||
file: ./secrets/s3_root_password
|
||||
s3_access_key_id:
|
||||
file: ./secrets/s3_access_key_id
|
||||
s3_secret_access_key:
|
||||
file: ./secrets/s3_secret_access_key
|
||||
s3_worker_access_key_id:
|
||||
file: ./secrets/s3_worker_access_key_id
|
||||
s3_worker_secret_access_key:
|
||||
file: ./secrets/s3_worker_secret_access_key
|
||||
rabbitmq_users:
|
||||
file: ./secrets/rabbitmq_users.json
|
||||
rabbitmq_ops_password:
|
||||
file: ./secrets/rabbitmq_ops_password
|
||||
broker_url_api:
|
||||
file: ./secrets/broker_url_api
|
||||
broker_url_worker:
|
||||
file: ./secrets/broker_url_worker
|
||||
grafana_admin_password:
|
||||
file: ./secrets/grafana_admin_password
|
||||
s3_reconciler_access_key_id:
|
||||
file: ./secrets/s3_reconciler_access_key_id
|
||||
s3_reconciler_secret_access_key:
|
||||
file: ./secrets/s3_reconciler_secret_access_key
|
||||
|
||||
volumes:
|
||||
pgdata:
|
||||
valkeydata:
|
||||
s3data:
|
||||
broker-data:
|
||||
healthtools:
|
||||
prometheus-data:
|
||||
loki-data:
|
||||
tempo-data:
|
||||
grafana-data:
|
||||
|
||||
networks:
|
||||
edge:
|
||||
backend:
|
||||
internal: true
|
||||
@@ -0,0 +1,5 @@
|
||||
date: 2026-11-06T09:38:20Z commit: 95511002b12510178a3cc2a22566b43e2b2b6c81
|
||||
environment: {"COMPOSE_PROJECT_NAME": "mtusi2026lab6", "LB_HTTP_PORT": "18086", "LB_STATS_PORT": "26085", "BASE_URL": "http://127.0.0.1:18086", "NO_PROXY": "localhost,127.0.0.1,::1"}
|
||||
$ python3 scripts/obs_check.py query 'count by (__name__,job) ({job=~"messenger-.*"})' 'count by (http_route,http_request_method,http_response_status_code) (http_server_request_duration_seconds_count)' 'count by (job_type,outcome) (messenger_jobs_processed_total)'
|
||||
{"ts": "2026-11-06T09:38:20+00:00", "results": {"count by (__name__,job) ({job=~\"messenger-.*\"})": [{"labels": {"job": "messenger-worker"}, "value": "7"}, {"labels": {"job": "messenger-worker"}, "value": "7"}, {"labels": {"job": "messenger-worker"}, "value": "7"}, {"labels": {"job": "messenger-worker"}, "value": "77"}, {"labels": {"job": "messenger-worker"}, "value": "4"}, {"labels": {"job": "messenger-api"}, "value": "17"}, {"labels": {"job": "messenger-api"}, "value": "66"}, {"labels": {"job": "messenger-api"}, "value": "66"}, {"labels": {"job": "messenger-api"}, "value": "990"}, {"labels": {"job": "messenger-api"}, "value": "66"}, {"labels": {"job": "messenger-api"}, "value": "66"}, {"labels": {"job": "messenger-api"}, "value": "1056"}, {"labels": {"job": "messenger-api"}, "value": "34"}, {"labels": {"job": "messenger-api"}, "value": "34"}, {"labels": {"job": "messenger-api"}, "value": "544"}, {"labels": {"job": "messenger-api"}, "value": "8"}], "count by (http_route,http_request_method,http_response_status_code) (http_server_request_duration_seconds_count)": [{"labels": {"http_request_method": "POST", "http_response_status_code": "201", "http_route": "/api/v1/auth/sessions"}, "value": "5"}, {"labels": {"http_request_method": "POST", "http_response_status_code": "409", "http_route": "/api/v1/users"}, "value": "1"}, {"labels": {"http_request_method": "GET", "http_response_status_code": "404", "http_route": "/api/v1/chats/{chat_id}"}, "value": "1"}, {"labels": {"http_request_method": "GET", "http_response_status_code": "200", "http_route": "/api/v1/chats"}, "value": "2"}, {"labels": {"http_request_method": "POST", "http_response_status_code": "201", "http_route": "/api/v1/chats/{chat_id}/messages"}, "value": "5"}, {"labels": {"http_request_method": "GET", "http_response_status_code": "200", "http_route": "/api/v1/chats/{chat_id}/messages"}, "value": "3"}, {"labels": {"http_request_method": "POST", "http_response_status_code": "400", "http_route": "/api/v1/chats/{chat_id}/messages"}, "value": "2"}, {"labels": {"http_request_method": "GET", "http_response_status_code": "400", "http_route": "/api/v1/chats/{chat_id}/messages"}, "value": "1"}, {"labels": {"http_request_method": "GET", "http_response_status_code": "401", "http_route": "/api/v1/users/me"}, "value": "2"}, {"labels": {"http_request_method": "GET", "http_response_status_code": "200", "http_route": "/api/v1/users/me"}, "value": "4"}, {"labels": {"http_request_method": "POST", "http_response_status_code": "409", "http_route": "/api/v1/chats/{chat_id}/messages"}, "value": "2"}, {"labels": {"http_request_method": "POST", "http_response_status_code": "202", "http_route": "/api/v1/chats/{chat_id}/attachments"}, "value": "7"}, {"labels": {"http_request_method": "GET", "http_response_status_code": "200", "http_route": "/api/v1/attachments/{attachment_id}"}, "value": "7"}, {"labels": {"http_request_method": "GET", "http_response_status_code": "200", "http_route": "/api/v1/attachments/{attachment_id}/content"}, "value": "5"}, {"labels": {"http_request_method": "GET", "http_response_status_code": "404", "http_route": "/api/v1/attachments/{attachment_id}/content"}, "value": "1"}, {"labels": {"http_request_method": "DELETE", "http_response_status_code": "204", "http_route": "/api/v1/auth/sessions/current"}, "value": "2"}, {"labels": {"http_request_method": "DELETE", "http_response_status_code": "401", "http_route": "/api/v1/auth/sessions/current"}, "value": "1"}, {"labels": {"http_request_method": "POST", "http_response_status_code": "201", "http_route": "/api/v1/users"}, "value": "5"}, {"labels": {"http_request_method": "POST", "http_response_status_code": "201", "http_route": "/api/v1/chats"}, "value": "4"}, {"labels": {"http_request_method": "POST", "http_response_status_code": "404", "http_route": "/api/v1/chats/{chat_id}/messages"}, "value": "1"}, {"labels": {"http_request_method": "POST", "http_response_status_code": "401", "http_route": "/api/v1/auth/sessions"}, "value": "1"}, {"labels": {"http_request_method": "GET", "http_response_status_code": "404", "http_route": "/api/v1/attachments/{attachment_id}"}, "value": "1"}, {"labels": {"http_request_method": "GET", "http_response_status_code": "409", "http_route": "/api/v1/attachments/{attachment_id}/content"}, "value": "2"}, {"labels": {"http_request_method": "POST", "http_response_status_code": "415", "http_route": "/api/v1/chats/{chat_id}/attachments"}, "value": "1"}], "count by (job_type,outcome) (messenger_jobs_processed_total)": [{"labels": {"job_type": "attachment.process.v1", "outcome": "done"}, "value": "3"}, {"labels": {"job_type": "attachment.process.v1", "outcome": "duplicate_noop"}, "value": "1"}, {"labels": {"job_type": "attachment.process.v1", "outcome": "retry_scheduled"}, "value": "2"}, {"labels": {"job_type": "attachment.process.v1", "outcome": "failed"}, "value": "1"}]}}
|
||||
exit_code: 0 elapsed_seconds: 0.057
|
||||
@@ -0,0 +1,701 @@
|
||||
date: 2026-11-06T09:41:11Z commit: 2903d9dc73171d988ed0a1118b42ba8e13eaa088 project: hlpipe-lab6-clean-20261106094111
|
||||
HTTP=18086 stats=26085
|
||||
$ git clone --quiet --no-hardlinks /Users/artemkostylev/projects/learning/HL/labs/mtusi2026lab6 /Users/artemkostylev/projects/learning/HL/labs/mtusi2026lab6/.verification/hlpipe-lab6-clean-20261106094111
|
||||
$ git checkout --quiet --detach 2903d9dc73171d988ed0a1118b42ba8e13eaa088
|
||||
$ make secrets
|
||||
sh scripts/secrets.sh
|
||||
создан secrets/postgres_password
|
||||
создан secrets/database_url
|
||||
создан secrets/cursor_secret
|
||||
создан secrets/valkey_password
|
||||
создан secrets/valkey.conf
|
||||
создан secrets/cache_url
|
||||
создан secrets/s3_root_user
|
||||
создан secrets/s3_root_password
|
||||
создан secrets/s3_access_key_id
|
||||
создан secrets/s3_secret_access_key
|
||||
создан secrets/s3_reconciler_access_key_id
|
||||
создан secrets/s3_reconciler_secret_access_key
|
||||
создан .env из .env.example
|
||||
sh scripts/broker-secrets.sh
|
||||
broker and S3 worker secrets ready in secrets/ (values not printed)
|
||||
sh scripts/secrets-lab6.sh
|
||||
secrets/grafana_admin_password is ready (value not printed)
|
||||
$ docker compose --env-file .env config --quiet
|
||||
$ make up
|
||||
sh scripts/secrets.sh
|
||||
sh scripts/broker-secrets.sh
|
||||
broker and S3 worker secrets ready in secrets/ (values not printed)
|
||||
sh scripts/secrets-lab6.sh
|
||||
secrets/grafana_admin_password is ready (value not printed)
|
||||
docker compose build
|
||||
#1 [internal] load local bake definitions
|
||||
#1 reading from stdin 545B done
|
||||
#1 DONE 0.0s
|
||||
|
||||
#2 [internal] load build definition from Dockerfile
|
||||
#2 transferring dockerfile: 1.65kB done
|
||||
#2 DONE 0.0s
|
||||
|
||||
#3 [internal] load metadata for ghcr.io/astral-sh/uv:0.9.7@sha256:ba4857bf2a068e9bc0e64eed8563b065908a4cd6bfb66b531a9c424c8e25e142
|
||||
#3 DONE 0.0s
|
||||
|
||||
#4 [internal] load metadata for docker.io/library/python:3.14-slim-trixie@sha256:51dafde81dbdb6ebde285137a295cf18a47ca95234fe388a343719cb97305b3d
|
||||
#4 DONE 2.0s
|
||||
|
||||
#5 [internal] load .dockerignore
|
||||
#5 transferring context: 453B done
|
||||
#5 DONE 0.0s
|
||||
|
||||
#6 [builder 1/7] FROM docker.io/library/python:3.14-slim-trixie@sha256:51dafde81dbdb6ebde285137a295cf18a47ca95234fe388a343719cb97305b3d
|
||||
#6 resolve docker.io/library/python:3.14-slim-trixie@sha256:51dafde81dbdb6ebde285137a295cf18a47ca95234fe388a343719cb97305b3d 0.0s done
|
||||
#6 DONE 0.0s
|
||||
|
||||
#7 FROM ghcr.io/astral-sh/uv:0.9.7@sha256:ba4857bf2a068e9bc0e64eed8563b065908a4cd6bfb66b531a9c424c8e25e142
|
||||
#7 resolve ghcr.io/astral-sh/uv:0.9.7@sha256:ba4857bf2a068e9bc0e64eed8563b065908a4cd6bfb66b531a9c424c8e25e142 0.0s done
|
||||
#7 DONE 0.0s
|
||||
|
||||
#8 [internal] load build context
|
||||
#8 transferring context: 605.69kB 0.0s done
|
||||
#8 DONE 0.0s
|
||||
|
||||
#9 [builder 3/7] WORKDIR /build
|
||||
#9 CACHED
|
||||
|
||||
#10 [builder 4/7] COPY pyproject.toml uv.lock README.md ./
|
||||
#10 CACHED
|
||||
|
||||
#11 [builder 2/7] COPY --from=ghcr.io/astral-sh/uv:0.9.7@sha256:ba4857bf2a068e9bc0e64eed8563b065908a4cd6bfb66b531a9c424c8e25e142 /uv /usr/local/bin/uv
|
||||
#11 CACHED
|
||||
|
||||
#12 [builder 5/7] RUN uv sync --locked --no-dev --no-install-project --no-editable
|
||||
#12 CACHED
|
||||
|
||||
#13 [builder 6/7] COPY src ./src
|
||||
#13 DONE 0.0s
|
||||
|
||||
#14 [builder 7/7] RUN uv sync --locked --no-dev --no-editable
|
||||
#14 0.140 Resolved 100 packages in 0.45ms
|
||||
#14 0.142 Building mtusi-messenger @ file:///build
|
||||
#14 2.014 Built mtusi-messenger @ file:///build
|
||||
#14 2.018 Prepared 1 package in 1.87s
|
||||
#14 2.022 Installed 1 package in 3ms
|
||||
#14 2.133 Bytecode compiled 2802 files in 110ms
|
||||
#14 2.133 + mtusi-messenger==1.6.0 (from file:///build)
|
||||
#14 DONE 2.2s
|
||||
|
||||
#15 [runtime 2/6] RUN groupadd --system --gid 10001 messenger && useradd --system --uid 10001 --gid messenger --no-create-home --shell /usr/sbin/nologin messenger
|
||||
#15 CACHED
|
||||
|
||||
#16 [runtime 3/6] COPY --from=builder --chown=root:root /opt/venv /opt/venv
|
||||
#16 DONE 0.5s
|
||||
|
||||
#17 [runtime 4/6] WORKDIR /app
|
||||
#17 DONE 0.0s
|
||||
|
||||
#18 [runtime 5/6] COPY --chown=root:root alembic.ini ./
|
||||
#18 DONE 0.0s
|
||||
|
||||
#19 [runtime 6/6] COPY --chown=root:root alembic ./alembic
|
||||
#19 DONE 0.0s
|
||||
|
||||
#20 exporting to image
|
||||
#20 exporting layers
|
||||
#20 exporting layers 3.0s done
|
||||
#20 exporting manifest sha256:e6eecc6e471ef54fae2e845bf4c7872567a514ba260b96e65bfc6ebb7868c7ff
|
||||
#20 exporting manifest sha256:e6eecc6e471ef54fae2e845bf4c7872567a514ba260b96e65bfc6ebb7868c7ff 0.0s done
|
||||
#20 exporting config sha256:809d4de7fd1083c389167c8b5964152777e67c008a3432ca9a7fb77adca5ae62 done
|
||||
#20 exporting attestation manifest sha256:480e3265c87cd9a0025891327b1a265819175c3eb71e6fe75caa02c5d386059e done
|
||||
#20 exporting manifest list sha256:ef4761263d3a88c52b6cfeaa5f75e15c3f0f2c12561c05d0e45ec083f4565606 done
|
||||
#20 naming to docker.io/library/mtusi-messenger:hlpipe-lab6-clean-20261106094111 done
|
||||
#20 unpacking to docker.io/library/mtusi-messenger:hlpipe-lab6-clean-20261106094111
|
||||
#20 unpacking to docker.io/library/mtusi-messenger:hlpipe-lab6-clean-20261106094111 0.7s done
|
||||
#20 DONE 3.8s
|
||||
|
||||
#21 resolving provenance for metadata file
|
||||
#21 DONE 0.0s
|
||||
api Built
|
||||
docker compose up -d --wait
|
||||
Network hlpipe-lab6-clean-20261106094111_backend Creating
|
||||
Network hlpipe-lab6-clean-20261106094111_backend Created
|
||||
Network hlpipe-lab6-clean-20261106094111_edge Creating
|
||||
Network hlpipe-lab6-clean-20261106094111_edge Created
|
||||
Volume "hlpipe-lab6-clean-20261106094111_healthtools" Creating
|
||||
Volume "hlpipe-lab6-clean-20261106094111_healthtools" Created
|
||||
Volume "hlpipe-lab6-clean-20261106094111_broker-data" Creating
|
||||
Volume "hlpipe-lab6-clean-20261106094111_broker-data" Created
|
||||
Volume "hlpipe-lab6-clean-20261106094111_valkeydata" Creating
|
||||
Volume "hlpipe-lab6-clean-20261106094111_valkeydata" Created
|
||||
Volume "hlpipe-lab6-clean-20261106094111_grafana-data" Creating
|
||||
Volume "hlpipe-lab6-clean-20261106094111_grafana-data" Created
|
||||
Volume "hlpipe-lab6-clean-20261106094111_prometheus-data" Creating
|
||||
Volume "hlpipe-lab6-clean-20261106094111_prometheus-data" Created
|
||||
Volume "hlpipe-lab6-clean-20261106094111_pgdata" Creating
|
||||
Volume "hlpipe-lab6-clean-20261106094111_pgdata" Created
|
||||
Volume "hlpipe-lab6-clean-20261106094111_s3data" Creating
|
||||
Volume "hlpipe-lab6-clean-20261106094111_s3data" Created
|
||||
Volume "hlpipe-lab6-clean-20261106094111_tempo-data" Creating
|
||||
Volume "hlpipe-lab6-clean-20261106094111_tempo-data" Created
|
||||
Volume "hlpipe-lab6-clean-20261106094111_loki-data" Creating
|
||||
Volume "hlpipe-lab6-clean-20261106094111_loki-data" Created
|
||||
Container hlpipe-lab6-clean-20261106094111-postgres-1 Creating
|
||||
Container hlpipe-lab6-clean-20261106094111-lb-1 Creating
|
||||
Container hlpipe-lab6-clean-20261106094111-broker-1 Creating
|
||||
Container hlpipe-lab6-clean-20261106094111-prometheus-1 Creating
|
||||
Container hlpipe-lab6-clean-20261106094111-valkey-1 Creating
|
||||
Container hlpipe-lab6-clean-20261106094111-s3-1 Creating
|
||||
Container hlpipe-lab6-clean-20261106094111-healthtools-1 Creating
|
||||
Container hlpipe-lab6-clean-20261106094111-s3-1 Created
|
||||
Container hlpipe-lab6-clean-20261106094111-s3-init-1 Creating
|
||||
Container hlpipe-lab6-clean-20261106094111-valkey-1 Created
|
||||
Container hlpipe-lab6-clean-20261106094111-healthtools-1 Created
|
||||
Container hlpipe-lab6-clean-20261106094111-loki-1 Creating
|
||||
Container hlpipe-lab6-clean-20261106094111-tempo-1 Creating
|
||||
Container hlpipe-lab6-clean-20261106094111-otel-collector-1 Creating
|
||||
Container hlpipe-lab6-clean-20261106094111-prometheus-1 Created
|
||||
Container hlpipe-lab6-clean-20261106094111-lb-1 Created
|
||||
Container hlpipe-lab6-clean-20261106094111-postgres-1 Created
|
||||
Container hlpipe-lab6-clean-20261106094111-broker-1 Created
|
||||
Container hlpipe-lab6-clean-20261106094111-migrate-1 Creating
|
||||
Container hlpipe-lab6-clean-20261106094111-s3-init-1 Created
|
||||
Container hlpipe-lab6-clean-20261106094111-otel-collector-1 Created
|
||||
Container hlpipe-lab6-clean-20261106094111-tempo-1 Created
|
||||
Container hlpipe-lab6-clean-20261106094111-migrate-1 Created
|
||||
Container hlpipe-lab6-clean-20261106094111-worker-1 Creating
|
||||
Container hlpipe-lab6-clean-20261106094111-api-2 Creating
|
||||
Container hlpipe-lab6-clean-20261106094111-relay-1 Creating
|
||||
Container hlpipe-lab6-clean-20261106094111-api-1 Creating
|
||||
Container hlpipe-lab6-clean-20261106094111-loki-1 Created
|
||||
Container hlpipe-lab6-clean-20261106094111-grafana-1 Creating
|
||||
Container hlpipe-lab6-clean-20261106094111-api-1 Created
|
||||
Container hlpipe-lab6-clean-20261106094111-grafana-1 Created
|
||||
Container hlpipe-lab6-clean-20261106094111-relay-1 Created
|
||||
Container hlpipe-lab6-clean-20261106094111-worker-1 Created
|
||||
Container hlpipe-lab6-clean-20261106094111-api-2 Created
|
||||
Container hlpipe-lab6-clean-20261106094111-postgres-1 Starting
|
||||
Container hlpipe-lab6-clean-20261106094111-broker-1 Starting
|
||||
Container hlpipe-lab6-clean-20261106094111-valkey-1 Starting
|
||||
Container hlpipe-lab6-clean-20261106094111-healthtools-1 Starting
|
||||
Container hlpipe-lab6-clean-20261106094111-lb-1 Starting
|
||||
Container hlpipe-lab6-clean-20261106094111-s3-1 Starting
|
||||
Container hlpipe-lab6-clean-20261106094111-prometheus-1 Starting
|
||||
Container hlpipe-lab6-clean-20261106094111-healthtools-1 Started
|
||||
Container hlpipe-lab6-clean-20261106094111-healthtools-1 Waiting
|
||||
Container hlpipe-lab6-clean-20261106094111-healthtools-1 Waiting
|
||||
Container hlpipe-lab6-clean-20261106094111-healthtools-1 Waiting
|
||||
Container hlpipe-lab6-clean-20261106094111-postgres-1 Started
|
||||
Container hlpipe-lab6-clean-20261106094111-postgres-1 Waiting
|
||||
Container hlpipe-lab6-clean-20261106094111-valkey-1 Started
|
||||
Container hlpipe-lab6-clean-20261106094111-s3-1 Started
|
||||
Container hlpipe-lab6-clean-20261106094111-s3-1 Waiting
|
||||
Container hlpipe-lab6-clean-20261106094111-broker-1 Started
|
||||
Container hlpipe-lab6-clean-20261106094111-prometheus-1 Started
|
||||
Container hlpipe-lab6-clean-20261106094111-lb-1 Started
|
||||
Container hlpipe-lab6-clean-20261106094111-healthtools-1 Exited
|
||||
Container hlpipe-lab6-clean-20261106094111-tempo-1 Starting
|
||||
Container hlpipe-lab6-clean-20261106094111-healthtools-1 Exited
|
||||
Container hlpipe-lab6-clean-20261106094111-otel-collector-1 Starting
|
||||
Container hlpipe-lab6-clean-20261106094111-healthtools-1 Exited
|
||||
Container hlpipe-lab6-clean-20261106094111-loki-1 Starting
|
||||
Container hlpipe-lab6-clean-20261106094111-loki-1 Started
|
||||
Container hlpipe-lab6-clean-20261106094111-otel-collector-1 Started
|
||||
Container hlpipe-lab6-clean-20261106094111-tempo-1 Started
|
||||
Container hlpipe-lab6-clean-20261106094111-grafana-1 Starting
|
||||
Container hlpipe-lab6-clean-20261106094111-grafana-1 Started
|
||||
Container hlpipe-lab6-clean-20261106094111-postgres-1 Healthy
|
||||
Container hlpipe-lab6-clean-20261106094111-migrate-1 Starting
|
||||
Container hlpipe-lab6-clean-20261106094111-migrate-1 Started
|
||||
Container hlpipe-lab6-clean-20261106094111-s3-1 Healthy
|
||||
Container hlpipe-lab6-clean-20261106094111-s3-init-1 Starting
|
||||
Container hlpipe-lab6-clean-20261106094111-s3-init-1 Started
|
||||
Container hlpipe-lab6-clean-20261106094111-s3-init-1 Waiting
|
||||
Container hlpipe-lab6-clean-20261106094111-migrate-1 Waiting
|
||||
Container hlpipe-lab6-clean-20261106094111-s3-init-1 Waiting
|
||||
Container hlpipe-lab6-clean-20261106094111-broker-1 Waiting
|
||||
Container hlpipe-lab6-clean-20261106094111-s3-init-1 Waiting
|
||||
Container hlpipe-lab6-clean-20261106094111-broker-1 Waiting
|
||||
Container hlpipe-lab6-clean-20261106094111-migrate-1 Waiting
|
||||
Container hlpipe-lab6-clean-20261106094111-migrate-1 Waiting
|
||||
Container hlpipe-lab6-clean-20261106094111-migrate-1 Exited
|
||||
Container hlpipe-lab6-clean-20261106094111-migrate-1 Exited
|
||||
Container hlpipe-lab6-clean-20261106094111-migrate-1 Exited
|
||||
Container hlpipe-lab6-clean-20261106094111-s3-init-1 Exited
|
||||
Container hlpipe-lab6-clean-20261106094111-s3-init-1 Exited
|
||||
Container hlpipe-lab6-clean-20261106094111-broker-1 Healthy
|
||||
Container hlpipe-lab6-clean-20261106094111-api-2 Starting
|
||||
Container hlpipe-lab6-clean-20261106094111-s3-init-1 Exited
|
||||
Container hlpipe-lab6-clean-20261106094111-relay-1 Starting
|
||||
Container hlpipe-lab6-clean-20261106094111-broker-1 Healthy
|
||||
Container hlpipe-lab6-clean-20261106094111-worker-1 Starting
|
||||
Container hlpipe-lab6-clean-20261106094111-api-2 Started
|
||||
Container hlpipe-lab6-clean-20261106094111-api-1 Starting
|
||||
Container hlpipe-lab6-clean-20261106094111-worker-1 Started
|
||||
Container hlpipe-lab6-clean-20261106094111-relay-1 Started
|
||||
Container hlpipe-lab6-clean-20261106094111-api-1 Started
|
||||
Container hlpipe-lab6-clean-20261106094111-prometheus-1 Waiting
|
||||
Container hlpipe-lab6-clean-20261106094111-migrate-1 Waiting
|
||||
Container hlpipe-lab6-clean-20261106094111-healthtools-1 Waiting
|
||||
Container hlpipe-lab6-clean-20261106094111-broker-1 Waiting
|
||||
Container hlpipe-lab6-clean-20261106094111-worker-1 Waiting
|
||||
Container hlpipe-lab6-clean-20261106094111-relay-1 Waiting
|
||||
Container hlpipe-lab6-clean-20261106094111-s3-1 Waiting
|
||||
Container hlpipe-lab6-clean-20261106094111-tempo-1 Waiting
|
||||
Container hlpipe-lab6-clean-20261106094111-otel-collector-1 Waiting
|
||||
Container hlpipe-lab6-clean-20261106094111-loki-1 Waiting
|
||||
Container hlpipe-lab6-clean-20261106094111-grafana-1 Waiting
|
||||
Container hlpipe-lab6-clean-20261106094111-valkey-1 Waiting
|
||||
Container hlpipe-lab6-clean-20261106094111-s3-init-1 Waiting
|
||||
Container hlpipe-lab6-clean-20261106094111-lb-1 Waiting
|
||||
Container hlpipe-lab6-clean-20261106094111-api-2 Waiting
|
||||
Container hlpipe-lab6-clean-20261106094111-api-1 Waiting
|
||||
Container hlpipe-lab6-clean-20261106094111-postgres-1 Waiting
|
||||
Container hlpipe-lab6-clean-20261106094111-healthtools-1 Exited
|
||||
Container hlpipe-lab6-clean-20261106094111-prometheus-1 Healthy
|
||||
Container hlpipe-lab6-clean-20261106094111-postgres-1 Healthy
|
||||
Container hlpipe-lab6-clean-20261106094111-s3-init-1 Exited
|
||||
Container hlpipe-lab6-clean-20261106094111-grafana-1 Healthy
|
||||
Container hlpipe-lab6-clean-20261106094111-valkey-1 Healthy
|
||||
Container hlpipe-lab6-clean-20261106094111-migrate-1 Exited
|
||||
Container hlpipe-lab6-clean-20261106094111-s3-1 Healthy
|
||||
Container hlpipe-lab6-clean-20261106094111-otel-collector-1 Healthy
|
||||
Container hlpipe-lab6-clean-20261106094111-broker-1 Healthy
|
||||
Container hlpipe-lab6-clean-20261106094111-api-2 Healthy
|
||||
Container hlpipe-lab6-clean-20261106094111-api-1 Healthy
|
||||
Container hlpipe-lab6-clean-20261106094111-worker-1 Healthy
|
||||
Container hlpipe-lab6-clean-20261106094111-relay-1 Healthy
|
||||
Container hlpipe-lab6-clean-20261106094111-lb-1 Healthy
|
||||
Container hlpipe-lab6-clean-20261106094111-loki-1 Healthy
|
||||
Container hlpipe-lab6-clean-20261106094111-tempo-1 Healthy
|
||||
scripts/lb-wait.sh
|
||||
$ docker compose ps -a --format {{.Service}} {{.State}} {{.Status}} {{.Ports}}
|
||||
api running Up 13 seconds (healthy)
|
||||
api running Up 13 seconds (healthy)
|
||||
broker running Up 20 seconds (healthy) 127.0.0.1:26086->15672/tcp
|
||||
grafana running Up 19 seconds (healthy) 127.0.0.1:26300->3000/tcp
|
||||
healthtools exited Exited (0) 20 seconds ago
|
||||
lb running Up 20 seconds (healthy) 127.0.0.1:18086->8080/tcp, 127.0.0.1:26085->8404/tcp
|
||||
loki running Up 19 seconds (healthy) 127.0.0.1:26310->3100/tcp
|
||||
migrate exited Exited (0) 17 seconds ago
|
||||
otel-collector running Up 19 seconds (healthy) 4317-4318/tcp, 55679/tcp
|
||||
postgres running Up 20 seconds (healthy)
|
||||
prometheus running Up 20 seconds (healthy) 127.0.0.1:26090->9090/tcp
|
||||
relay running Up 13 seconds (healthy)
|
||||
s3 running Up 20 seconds (healthy)
|
||||
s3-init exited Exited (0) 14 seconds ago
|
||||
tempo running Up 19 seconds (healthy) 127.0.0.1:26320->3200/tcp
|
||||
valkey running Up 20 seconds (healthy)
|
||||
worker running Up 13 seconds (healthy)
|
||||
$ make test
|
||||
python3 tests/smoke.py --base-url "http://127.0.0.1:18086"
|
||||
PASS: lab6 public API scenario; infrastructure and grading evidence remain separate.
|
||||
$ make test-persistence ACTION_SCRIPT=scripts/restart.sh
|
||||
python3 tests/resilience.py --mode persistence --action-script "scripts/restart.sh" --base-url "http://127.0.0.1:18086"
|
||||
Executing explicit persistence hook; hook output suppressed to avoid leaking secrets.
|
||||
PASS: persistence preserved confirmed data and existing session. Hook scope needs operator evidence.
|
||||
$ make test-failover ACTION_SCRIPT=scripts/stop-one.sh
|
||||
python3 tests/resilience.py --mode failover --action-script "scripts/stop-one.sh" --base-url "http://127.0.0.1:18086"
|
||||
Executing explicit failover hook; hook output suppressed to avoid leaking secrets.
|
||||
{"observed_instances_before": 2, "successful_writes": 133, "failed_attempts": 0, "first_recovery_seconds": 3.19}
|
||||
PASS: failover preserved confirmed data and existing session. Hook scope needs operator evidence.
|
||||
$ docker compose ps -a --format {{.Service}} {{.Name}} {{.State}} api
|
||||
api hlpipe-lab6-clean-20261106094111-api-1 running
|
||||
api hlpipe-lab6-clean-20261106094111-api-2 exited
|
||||
$ make restore
|
||||
scripts/restore.sh
|
||||
Container hlpipe-lab6-clean-20261106094111-api-1 Running
|
||||
Container hlpipe-lab6-clean-20261106094111-api-2 Starting
|
||||
Container hlpipe-lab6-clean-20261106094111-api-2 Started
|
||||
Container hlpipe-lab6-clean-20261106094111-api-2 Waiting
|
||||
Container hlpipe-lab6-clean-20261106094111-api-1 Waiting
|
||||
Container hlpipe-lab6-clean-20261106094111-api-2 Healthy
|
||||
Container hlpipe-lab6-clean-20261106094111-api-1 Healthy
|
||||
$ make scenario SCENARIO=failover-upload
|
||||
python3 scripts/lab4_scenarios.py failover-upload --base-url "http://127.0.0.1:18086" --restore --output evidence/failover-upload.json
|
||||
{
|
||||
"ok": true,
|
||||
"date": "2026-11-06T09:43:15Z",
|
||||
"commit": "2903d9dc73171d988ed0a1118b42ba8e13eaa088",
|
||||
"scenario": "failover-upload",
|
||||
"upload_instance": "405a5a34e1f0",
|
||||
"download_instance": "175536090b12",
|
||||
"sha256_equal": true,
|
||||
"hook_seconds": 2.793,
|
||||
"download_ok_after_seconds": 2.857,
|
||||
"replicas_at_download": [
|
||||
{
|
||||
"hostname": "175536090b12",
|
||||
"status": "running",
|
||||
"exit_code": "0",
|
||||
"started_at": "2026-11-06T09:42:51.597999469Z",
|
||||
"finished_at": "2026-11-06T09:42:45.065840757Z"
|
||||
},
|
||||
{
|
||||
"hostname": "405a5a34e1f0",
|
||||
"status": "exited",
|
||||
"exit_code": "0",
|
||||
"started_at": "2026-11-06T09:43:12.015906006Z",
|
||||
"finished_at": "2026-11-06T09:43:19.750579801Z"
|
||||
}
|
||||
],
|
||||
"restored": true,
|
||||
"replicas_after_restore": [
|
||||
{
|
||||
"hostname": "175536090b12",
|
||||
"status": "running",
|
||||
"exit_code": "0",
|
||||
"started_at": "2026-11-06T09:42:51.597999469Z",
|
||||
"finished_at": "2026-11-06T09:42:45.065840757Z"
|
||||
},
|
||||
{
|
||||
"hostname": "405a5a34e1f0",
|
||||
"status": "running",
|
||||
"exit_code": "0",
|
||||
"started_at": "2026-11-06T09:43:20.21862376Z",
|
||||
"finished_at": "2026-11-06T09:43:19.750579801Z"
|
||||
}
|
||||
]
|
||||
}
|
||||
scripts/lb-wait.sh
|
||||
$ make restore
|
||||
scripts/restore.sh
|
||||
Container hlpipe-lab6-clean-20261106094111-api-1 Running
|
||||
Container hlpipe-lab6-clean-20261106094111-api-2 Running
|
||||
Container hlpipe-lab6-clean-20261106094111-api-2 Waiting
|
||||
Container hlpipe-lab6-clean-20261106094111-api-1 Waiting
|
||||
Container hlpipe-lab6-clean-20261106094111-api-2 Healthy
|
||||
Container hlpipe-lab6-clean-20261106094111-api-1 Healthy
|
||||
$ make scenario SCENARIO=s3-outage
|
||||
python3 scripts/lab4_scenarios.py s3-outage --base-url "http://127.0.0.1:18086" --restore --output evidence/s3-outage.json
|
||||
{
|
||||
"ok": true,
|
||||
"date": "2026-11-06T09:43:24Z",
|
||||
"commit": "2903d9dc73171d988ed0a1118b42ba8e13eaa088",
|
||||
"scenario": "s3-outage",
|
||||
"s3_container_during_outage": [
|
||||
{
|
||||
"hostname": "00bac2bc8917",
|
||||
"status": "exited",
|
||||
"exit_code": "0",
|
||||
"started_at": "2026-11-06T09:42:45.426583091Z",
|
||||
"finished_at": "2026-11-06T09:43:25.572619096Z"
|
||||
}
|
||||
],
|
||||
"during_outage": {
|
||||
"upload": {
|
||||
"status": 503,
|
||||
"seconds": 4.43,
|
||||
"instance": "175536090b12"
|
||||
},
|
||||
"metadata": {
|
||||
"status": 200,
|
||||
"seconds": 0.013,
|
||||
"instance": "405a5a34e1f0"
|
||||
},
|
||||
"download": {
|
||||
"status": 503,
|
||||
"seconds": 2.333,
|
||||
"instance": "175536090b12"
|
||||
},
|
||||
"text_message": {
|
||||
"status": 201,
|
||||
"seconds": 0.029,
|
||||
"instance": "405a5a34e1f0"
|
||||
},
|
||||
"health_ready": {
|
||||
"status": 200,
|
||||
"seconds": 0.003,
|
||||
"instance": "175536090b12"
|
||||
}
|
||||
},
|
||||
"expected": {
|
||||
"upload": 503,
|
||||
"download": 503,
|
||||
"text_message": 201
|
||||
},
|
||||
"as_expected": true,
|
||||
"s3_back_healthy_seconds": 5.772,
|
||||
"download_after_recovery": "sha256 equal"
|
||||
}
|
||||
scripts/lb-wait.sh
|
||||
$ sh scripts/s3-check.sh
|
||||
date: 2026-11-06T09:43:38Z commit: 2903d9dc73171d988ed0a1118b42ba8e13eaa088 == S3 privacy and bootstrap checks
|
||||
PASS s3: опубликованные host-порты: нет
|
||||
PASS s3: консоль :9001 внутри контейнера: 000
|
||||
PASS s3-init: повторный запуск 1: 0
|
||||
PASS s3-init: повторный запуск 2: 0
|
||||
PASS s3-init: состояние IAM/bucket не изменилось: same
|
||||
PASS api: PutObject: allow
|
||||
PASS api: HeadObject: allow
|
||||
PASS api: GetObject: allow
|
||||
PASS api: ListBucket: deny
|
||||
PASS reconciler: ListBucket: allow
|
||||
PASS reconciler: HeadObject: allow
|
||||
PASS reconciler: GetObject: allow
|
||||
PASS reconciler: PutObject: deny
|
||||
PASS reconciler: DeleteObject: allow
|
||||
PASS reconciler: CreateBucket: deny
|
||||
PASS reconciler: PutBucketPolicy (public): deny
|
||||
PASS reconciler: admin ListUsers: deny
|
||||
PASS api: CreateBucket: deny
|
||||
PASS api: DeleteBucket: deny
|
||||
PASS api: PutBucketPolicy (public): deny
|
||||
PASS api: PutBucketLifecycle (HeadBucket уже 403): deny
|
||||
PASS api: admin ListUsers: deny
|
||||
PASS api: PutObject в чужой bucket: deny
|
||||
PASS api: ListBucket чужого bucket: deny
|
||||
PASS anonymous: HeadObject: deny
|
||||
PASS anonymous: ListBucket: deny
|
||||
PASS anonymous: PutObject: deny
|
||||
PASS anonymous: прямой HTTP GET объекта из отдельного контейнера: 403
|
||||
PASS bucket: anonymous policy: private
|
||||
PASS api: DeleteObject: allow
|
||||
PASS s3: консоль :9001 из отдельного контейнера сети стенда: connection refused
|
||||
== IAM/bucket snapshot (без секретов)
|
||||
{
|
||||
"items": [
|
||||
{
|
||||
"key": "messenger-attachments",
|
||||
"last_modified": "2026-11-06T09:42:23Z",
|
||||
"is_dir": true
|
||||
}
|
||||
],
|
||||
"truncated": false
|
||||
}
|
||||
{
|
||||
"path": "root/messenger-attachments",
|
||||
"permission": "private"
|
||||
}
|
||||
{
|
||||
"name": "messenger-api",
|
||||
"policy": {
|
||||
"policy": {
|
||||
"Statement": [
|
||||
{
|
||||
"Action": [
|
||||
"s3:GetObject",
|
||||
"s3:PutObject",
|
||||
"s3:DeleteObject"
|
||||
],
|
||||
"Effect": "Allow",
|
||||
"Resource": [
|
||||
"arn:aws:s3:::messenger-attachments/*"
|
||||
],
|
||||
"Sid": "MessengerApiObjects"
|
||||
}
|
||||
],
|
||||
"Version": "2012-10-17"
|
||||
},
|
||||
"policy_name": "messenger-api"
|
||||
}
|
||||
}
|
||||
{
|
||||
"name": "messenger-reconciler",
|
||||
"policy": {
|
||||
"policy": {
|
||||
"Statement": [
|
||||
{
|
||||
"Action": [
|
||||
"s3:GetObject",
|
||||
"s3:DeleteObject"
|
||||
],
|
||||
"Effect": "Allow",
|
||||
"Resource": [
|
||||
"arn:aws:s3:::messenger-attachments/*"
|
||||
],
|
||||
"Sid": "MessengerReconcilerObjects"
|
||||
},
|
||||
{
|
||||
"Action": [
|
||||
"s3:ListBucket"
|
||||
],
|
||||
"Effect": "Allow",
|
||||
"Resource": [
|
||||
"arn:aws:s3:::messenger-attachments"
|
||||
],
|
||||
"Sid": "MessengerReconcilerListing"
|
||||
}
|
||||
],
|
||||
"Version": "2012-10-17"
|
||||
},
|
||||
"policy_name": "messenger-reconciler"
|
||||
}
|
||||
}
|
||||
{
|
||||
"accessKey": "<api-key>",
|
||||
"status": "enabled",
|
||||
"policies": [
|
||||
"messenger-api"
|
||||
],
|
||||
"memberOf": []
|
||||
}
|
||||
{
|
||||
"accessKey": "<reconciler-key>",
|
||||
"status": "enabled",
|
||||
"policies": [
|
||||
"messenger-reconciler"
|
||||
],
|
||||
"memberOf": []
|
||||
}
|
||||
{
|
||||
"rules": [
|
||||
{
|
||||
"id": "abort-incomplete-uploads",
|
||||
"status": "Enabled",
|
||||
"prefix": "",
|
||||
"abortIncompleteMultipartUploadDays": 1
|
||||
}
|
||||
]
|
||||
}
|
||||
RESULT: PASS
|
||||
$ make reconcile
|
||||
docker compose run --rm --no-deps reconciler
|
||||
{
|
||||
"mode": "dry-run",
|
||||
"skipped": false,
|
||||
"grace_seconds": 3600,
|
||||
"skew_seconds": 60,
|
||||
"deep": false,
|
||||
"page_size": 1000,
|
||||
"scanned": {
|
||||
"objects": 0,
|
||||
"rows": 0
|
||||
},
|
||||
"found": {
|
||||
"orphan_stale": 0,
|
||||
"orphan_fresh": 0,
|
||||
"missing": 0,
|
||||
"size_mismatch": 0,
|
||||
"sha_mismatch": 0,
|
||||
"pending_stale": 0,
|
||||
"pending_fresh": 0,
|
||||
"quarantined": 0,
|
||||
"healed": 0
|
||||
},
|
||||
"fixed": {
|
||||
"orphan_stale": 0,
|
||||
"missing": 0,
|
||||
"size_mismatch": 0,
|
||||
"sha_mismatch": 0,
|
||||
"pending_stale": 0,
|
||||
"healed": 0
|
||||
},
|
||||
"rechecked": {},
|
||||
"errors": 0,
|
||||
"samples": {},
|
||||
"cost": {
|
||||
"seconds": 0.022,
|
||||
"requests": {
|
||||
"s3_list": 1,
|
||||
"s3_head": 0,
|
||||
"s3_get": 0,
|
||||
"s3_delete": 0,
|
||||
"sql": 1
|
||||
},
|
||||
"waited_seconds": {
|
||||
"s3_list": 0.009,
|
||||
"sql": 0.005
|
||||
},
|
||||
"hashed_bytes": 0,
|
||||
"cpu_seconds": 0.655,
|
||||
"max_rss_mib": 120.9
|
||||
}
|
||||
}
|
||||
$ make migrate
|
||||
docker compose run --rm migrate
|
||||
Container hlpipe-lab6-clean-20261106094111-postgres-1 Running
|
||||
$ make down
|
||||
docker compose --profile bench --profile tools --profile reconcile down
|
||||
Container hlpipe-lab6-clean-20261106094111-api-1 Stopping
|
||||
Container hlpipe-lab6-clean-20261106094111-api-2 Stopping
|
||||
Container hlpipe-lab6-clean-20261106094111-otel-collector-1 Stopping
|
||||
Container hlpipe-lab6-clean-20261106094111-worker-1 Stopping
|
||||
Container hlpipe-lab6-clean-20261106094111-relay-1 Stopping
|
||||
Container hlpipe-lab6-clean-20261106094111-grafana-1 Stopping
|
||||
Container hlpipe-lab6-clean-20261106094111-lb-1 Stopping
|
||||
Container hlpipe-lab6-clean-20261106094111-grafana-1 Stopped
|
||||
Container hlpipe-lab6-clean-20261106094111-grafana-1 Removing
|
||||
Container hlpipe-lab6-clean-20261106094111-lb-1 Stopped
|
||||
Container hlpipe-lab6-clean-20261106094111-lb-1 Removing
|
||||
Container hlpipe-lab6-clean-20261106094111-grafana-1 Removed
|
||||
Container hlpipe-lab6-clean-20261106094111-loki-1 Stopping
|
||||
Container hlpipe-lab6-clean-20261106094111-tempo-1 Stopping
|
||||
Container hlpipe-lab6-clean-20261106094111-prometheus-1 Stopping
|
||||
Container hlpipe-lab6-clean-20261106094111-otel-collector-1 Stopped
|
||||
Container hlpipe-lab6-clean-20261106094111-otel-collector-1 Removing
|
||||
Container hlpipe-lab6-clean-20261106094111-lb-1 Removed
|
||||
Container hlpipe-lab6-clean-20261106094111-otel-collector-1 Removed
|
||||
Container hlpipe-lab6-clean-20261106094111-prometheus-1 Stopped
|
||||
Container hlpipe-lab6-clean-20261106094111-prometheus-1 Removing
|
||||
Container hlpipe-lab6-clean-20261106094111-prometheus-1 Removed
|
||||
Container hlpipe-lab6-clean-20261106094111-tempo-1 Stopped
|
||||
Container hlpipe-lab6-clean-20261106094111-tempo-1 Removing
|
||||
Container hlpipe-lab6-clean-20261106094111-tempo-1 Removed
|
||||
Container hlpipe-lab6-clean-20261106094111-loki-1 Stopped
|
||||
Container hlpipe-lab6-clean-20261106094111-loki-1 Removing
|
||||
Container hlpipe-lab6-clean-20261106094111-loki-1 Removed
|
||||
Container hlpipe-lab6-clean-20261106094111-healthtools-1 Stopping
|
||||
Container hlpipe-lab6-clean-20261106094111-healthtools-1 Stopped
|
||||
Container hlpipe-lab6-clean-20261106094111-healthtools-1 Removing
|
||||
Container hlpipe-lab6-clean-20261106094111-healthtools-1 Removed
|
||||
Container hlpipe-lab6-clean-20261106094111-relay-1 Stopped
|
||||
Container hlpipe-lab6-clean-20261106094111-relay-1 Removing
|
||||
Container hlpipe-lab6-clean-20261106094111-relay-1 Removed
|
||||
Container hlpipe-lab6-clean-20261106094111-worker-1 Stopped
|
||||
Container hlpipe-lab6-clean-20261106094111-worker-1 Removing
|
||||
Container hlpipe-lab6-clean-20261106094111-worker-1 Removed
|
||||
Container hlpipe-lab6-clean-20261106094111-broker-1 Stopping
|
||||
Container hlpipe-lab6-clean-20261106094111-broker-1 Stopped
|
||||
Container hlpipe-lab6-clean-20261106094111-broker-1 Removing
|
||||
Container hlpipe-lab6-clean-20261106094111-broker-1 Removed
|
||||
Container hlpipe-lab6-clean-20261106094111-api-2 Stopped
|
||||
Container hlpipe-lab6-clean-20261106094111-api-2 Removing
|
||||
Container hlpipe-lab6-clean-20261106094111-api-2 Removed
|
||||
Container hlpipe-lab6-clean-20261106094111-api-1 Stopped
|
||||
Container hlpipe-lab6-clean-20261106094111-api-1 Removing
|
||||
Container hlpipe-lab6-clean-20261106094111-api-1 Removed
|
||||
Container hlpipe-lab6-clean-20261106094111-migrate-1 Stopping
|
||||
Container hlpipe-lab6-clean-20261106094111-s3-init-1 Stopping
|
||||
Container hlpipe-lab6-clean-20261106094111-valkey-1 Stopping
|
||||
Container hlpipe-lab6-clean-20261106094111-migrate-1 Stopped
|
||||
Container hlpipe-lab6-clean-20261106094111-migrate-1 Removing
|
||||
Container hlpipe-lab6-clean-20261106094111-s3-init-1 Stopped
|
||||
Container hlpipe-lab6-clean-20261106094111-s3-init-1 Removing
|
||||
Container hlpipe-lab6-clean-20261106094111-s3-init-1 Removed
|
||||
Container hlpipe-lab6-clean-20261106094111-s3-1 Stopping
|
||||
Container hlpipe-lab6-clean-20261106094111-migrate-1 Removed
|
||||
Container hlpipe-lab6-clean-20261106094111-postgres-1 Stopping
|
||||
Container hlpipe-lab6-clean-20261106094111-valkey-1 Stopped
|
||||
Container hlpipe-lab6-clean-20261106094111-valkey-1 Removing
|
||||
Container hlpipe-lab6-clean-20261106094111-s3-1 Stopped
|
||||
Container hlpipe-lab6-clean-20261106094111-s3-1 Removing
|
||||
Container hlpipe-lab6-clean-20261106094111-valkey-1 Removed
|
||||
Container hlpipe-lab6-clean-20261106094111-postgres-1 Stopped
|
||||
Container hlpipe-lab6-clean-20261106094111-postgres-1 Removing
|
||||
Container hlpipe-lab6-clean-20261106094111-s3-1 Removed
|
||||
Container hlpipe-lab6-clean-20261106094111-postgres-1 Removed
|
||||
Network hlpipe-lab6-clean-20261106094111_backend Removing
|
||||
Network hlpipe-lab6-clean-20261106094111_edge Removing
|
||||
Network hlpipe-lab6-clean-20261106094111_backend Removed
|
||||
Network hlpipe-lab6-clean-20261106094111_edge Removed
|
||||
$ docker volume ls --filter label=com.docker.compose.project=hlpipe-lab6-clean-20261106094111
|
||||
DRIVER VOLUME NAME
|
||||
local hlpipe-lab6-clean-20261106094111_broker-data
|
||||
local hlpipe-lab6-clean-20261106094111_grafana-data
|
||||
local hlpipe-lab6-clean-20261106094111_healthtools
|
||||
local hlpipe-lab6-clean-20261106094111_loki-data
|
||||
local hlpipe-lab6-clean-20261106094111_pgdata
|
||||
local hlpipe-lab6-clean-20261106094111_prometheus-data
|
||||
local hlpipe-lab6-clean-20261106094111_s3data
|
||||
local hlpipe-lab6-clean-20261106094111_tempo-data
|
||||
local hlpipe-lab6-clean-20261106094111_valkeydata
|
||||
DRIVER VOLUME NAME
|
||||
local hlpipe-lab6-clean-20261106094111_broker-data
|
||||
local hlpipe-lab6-clean-20261106094111_grafana-data
|
||||
local hlpipe-lab6-clean-20261106094111_healthtools
|
||||
local hlpipe-lab6-clean-20261106094111_loki-data
|
||||
local hlpipe-lab6-clean-20261106094111_pgdata
|
||||
local hlpipe-lab6-clean-20261106094111_prometheus-data
|
||||
local hlpipe-lab6-clean-20261106094111_s3data
|
||||
local hlpipe-lab6-clean-20261106094111_tempo-data
|
||||
local hlpipe-lab6-clean-20261106094111_valkeydata
|
||||
exit_code: 0; volumes retained
|
||||
@@ -0,0 +1,153 @@
|
||||
date: 2026-11-06T09:38:20Z commit: 95511002b12510178a3cc2a22566b43e2b2b6c81
|
||||
environment: {"COMPOSE_PROJECT_NAME": "mtusi2026lab6", "LB_HTTP_PORT": "18086", "LB_STATS_PORT": "26085", "BASE_URL": "http://127.0.0.1:18086", "NO_PROXY": "localhost,127.0.0.1,::1"}
|
||||
$ python3 scripts/obs_check.py dashboards --strict
|
||||
{
|
||||
"checked_at": "2026-11-06T09:38:20+00:00",
|
||||
"targets": [
|
||||
{
|
||||
"dashboard": "messenger-api.json",
|
||||
"panel": "RPS бизнес-запросов",
|
||||
"datasource": "prometheus",
|
||||
"series": 1,
|
||||
"missing_metrics": []
|
||||
},
|
||||
{
|
||||
"dashboard": "messenger-api.json",
|
||||
"panel": "Доля 5xx (2m)",
|
||||
"datasource": "prometheus",
|
||||
"series": 1,
|
||||
"missing_metrics": []
|
||||
},
|
||||
{
|
||||
"dashboard": "messenger-api.json",
|
||||
"panel": "p95 latency (5m)",
|
||||
"datasource": "prometheus",
|
||||
"series": 1,
|
||||
"missing_metrics": []
|
||||
},
|
||||
{
|
||||
"dashboard": "messenger-api.json",
|
||||
"panel": "Доля не-5xx (окно 1h)",
|
||||
"datasource": "prometheus",
|
||||
"series": 1,
|
||||
"missing_metrics": []
|
||||
},
|
||||
{
|
||||
"dashboard": "messenger-api.json",
|
||||
"panel": "RPS по маршруту и классу статуса",
|
||||
"datasource": "prometheus",
|
||||
"series": 9,
|
||||
"missing_metrics": []
|
||||
},
|
||||
{
|
||||
"dashboard": "messenger-api.json",
|
||||
"panel": "Доля ошибок",
|
||||
"datasource": "prometheus",
|
||||
"series": 1,
|
||||
"missing_metrics": []
|
||||
},
|
||||
{
|
||||
"dashboard": "messenger-api.json",
|
||||
"panel": "Доля ошибок",
|
||||
"datasource": "prometheus",
|
||||
"series": 1,
|
||||
"missing_metrics": []
|
||||
},
|
||||
{
|
||||
"dashboard": "messenger-api.json",
|
||||
"panel": "Latency p50 / p95 / p99",
|
||||
"datasource": "prometheus",
|
||||
"series": 1,
|
||||
"missing_metrics": []
|
||||
},
|
||||
{
|
||||
"dashboard": "messenger-api.json",
|
||||
"panel": "Latency p50 / p95 / p99",
|
||||
"datasource": "prometheus",
|
||||
"series": 1,
|
||||
"missing_metrics": []
|
||||
},
|
||||
{
|
||||
"dashboard": "messenger-api.json",
|
||||
"panel": "Latency p50 / p95 / p99",
|
||||
"datasource": "prometheus",
|
||||
"series": 1,
|
||||
"missing_metrics": []
|
||||
},
|
||||
{
|
||||
"dashboard": "messenger-api.json",
|
||||
"panel": "p95 по маршруту",
|
||||
"datasource": "prometheus",
|
||||
"series": 7,
|
||||
"missing_metrics": []
|
||||
},
|
||||
{
|
||||
"dashboard": "messenger-api.json",
|
||||
"panel": "RPS по реплике",
|
||||
"datasource": "prometheus",
|
||||
"series": 4,
|
||||
"missing_metrics": []
|
||||
},
|
||||
{
|
||||
"dashboard": "messenger-api.json",
|
||||
"panel": "Активные запросы",
|
||||
"datasource": "prometheus",
|
||||
"series": 8,
|
||||
"missing_metrics": []
|
||||
},
|
||||
{
|
||||
"dashboard": "messenger-api.json",
|
||||
"panel": "Логи API (ошибки и предупреждения)",
|
||||
"datasource": "loki",
|
||||
"lines": 5
|
||||
},
|
||||
{
|
||||
"dashboard": "messenger-api.json",
|
||||
"panel": "Трассы API с ошибкой",
|
||||
"datasource": "tempo",
|
||||
"traces": 0
|
||||
},
|
||||
{
|
||||
"dashboard": "messenger-pipeline.json",
|
||||
"panel": "Jobs по исходу",
|
||||
"datasource": "prometheus",
|
||||
"series": 1,
|
||||
"missing_metrics": []
|
||||
},
|
||||
{
|
||||
"dashboard": "messenger-pipeline.json",
|
||||
"panel": "Длительность обработки job",
|
||||
"datasource": "prometheus",
|
||||
"series": 1,
|
||||
"missing_metrics": []
|
||||
},
|
||||
{
|
||||
"dashboard": "messenger-pipeline.json",
|
||||
"panel": "Длительность обработки job",
|
||||
"datasource": "prometheus",
|
||||
"series": 1,
|
||||
"missing_metrics": []
|
||||
},
|
||||
{
|
||||
"dashboard": "messenger-pipeline.json",
|
||||
"panel": "Длительность обработки job",
|
||||
"datasource": "prometheus",
|
||||
"series": 1,
|
||||
"missing_metrics": []
|
||||
},
|
||||
{
|
||||
"dashboard": "messenger-pipeline.json",
|
||||
"panel": "Логи worker",
|
||||
"datasource": "loki",
|
||||
"lines": 5
|
||||
},
|
||||
{
|
||||
"dashboard": "messenger-pipeline.json",
|
||||
"panel": "Трассы worker",
|
||||
"datasource": "tempo",
|
||||
"traces": 5
|
||||
}
|
||||
],
|
||||
"problems": []
|
||||
}
|
||||
exit_code: 0 elapsed_seconds: 0.089
|
||||
@@ -0,0 +1,43 @@
|
||||
date: 2026-11-06T09:34:33Z commit: 95511002b12510178a3cc2a22566b43e2b2b6c81
|
||||
environment: {"COMPOSE_PROJECT_NAME": "mtusi2026lab6", "LB_HTTP_PORT": "18086", "LB_STATS_PORT": "26085", "BASE_URL": "http://127.0.0.1:18086", "NO_PROXY": "localhost,127.0.0.1,::1"}
|
||||
$ env EVIDENCE_DIR=evidence/grade3/failover-first make failover-evidence SHIFT=0
|
||||
sh scripts/failover-evidence.sh "http://127.0.0.1:18086" "0"
|
||||
date: 2026-11-06T09:34:33Z commit: 95511002b12510178a3cc2a22566b43e2b2b6c81
|
||||
== before: api replicas (hostname = X-Instance-Id), state, StartedAt, FinishedAt
|
||||
9af2280c8af3 running started=2026-11-06T09:33:56.602420846Z finished=2026-11-06T09:33:50.075450885Z
|
||||
943813ecb712 running started=2026-11-06T09:33:56.539288471Z finished=2026-11-06T09:33:50.07508976Z
|
||||
$ make test-failover ACTION_SCRIPT=scripts/stop-one.sh
|
||||
python3 tests/resilience.py --mode failover --action-script "scripts/stop-one.sh" --base-url "http://127.0.0.1:18086"
|
||||
Executing explicit failover hook; hook output suppressed to avoid leaking secrets.
|
||||
{"observed_instances_before": 2, "successful_writes": 134, "failed_attempts": 0, "first_recovery_seconds": 3.03}
|
||||
PASS: failover preserved confirmed data and existing session. Hook scope needs operator evidence.
|
||||
== after: api replicas
|
||||
9af2280c8af3 exited started=2026-11-06T09:33:56.602420846Z finished=2026-11-06T09:34:38.360642671Z
|
||||
943813ecb712 running started=2026-11-06T09:33:56.539288471Z finished=2026-11-06T09:33:50.07508976Z
|
||||
== stopped replica: 9af2280c8af3; shutdown: signal, drain window with readiness 503, close, exit
|
||||
{"event":"Handling signal: term","level":"info","ts":"2026-11-06T09:34:35.851311Z"}
|
||||
{"limit":2.0,"event":"service.draining","level":"info","ts":"2026-11-06T09:34:35.864420Z"}
|
||||
{"limit":2.0,"event":"service.draining","level":"info","ts":"2026-11-06T09:34:35.897236Z"}
|
||||
{"method":"GET","route":"/health/ready","status":503,"request_id":"5818535d613b4b7a8f0607d91e58d3f5","duration_ms":0.837,"event":"request.handled","level":"info","ts":"2026-11-06T09:34:36.062326Z"}
|
||||
{"method":"GET","route":"/health/ready","status":503,"request_id":"4838cbd4822f4181a2e10153a41033d6","duration_ms":0.347,"event":"request.handled","level":"info","ts":"2026-11-06T09:34:36.566176Z"}
|
||||
{"event":"Shutting down","level":"info","ts":"2026-11-06T09:34:37.866622Z"}
|
||||
{"event":"Shutting down","level":"info","ts":"2026-11-06T09:34:37.900282Z"}
|
||||
{"event":"service.stopped","level":"info","ts":"2026-11-06T09:34:37.973761Z"}
|
||||
{"event":"Finished server process [26]","level":"info","ts":"2026-11-06T09:34:37.977541Z"}
|
||||
{"event":"Worker (pid:26) was sent SIGTERM!","level":"info","ts":"2026-11-06T09:34:37.987715Z"}
|
||||
{"event":"service.stopped","level":"info","ts":"2026-11-06T09:34:38.004692Z"}
|
||||
{"event":"Finished server process [21]","level":"info","ts":"2026-11-06T09:34:38.006586Z"}
|
||||
{"event":"Worker (pid:21) was sent SIGTERM!","level":"info","ts":"2026-11-06T09:34:38.093383Z"}
|
||||
{"event":"Shutting down: Master","level":"info","ts":"2026-11-06T09:34:38.195744Z"}
|
||||
$ scripts/restore.sh
|
||||
Container mtusi2026lab6-api-2 Running
|
||||
Container mtusi2026lab6-api-1 Starting
|
||||
Container mtusi2026lab6-api-1 Started
|
||||
Container mtusi2026lab6-api-2 Waiting
|
||||
Container mtusi2026lab6-api-1 Waiting
|
||||
Container mtusi2026lab6-api-2 Healthy
|
||||
Container mtusi2026lab6-api-1 Healthy
|
||||
== after restore
|
||||
9af2280c8af3 running started=2026-11-06T09:34:51.34604076Z finished=2026-11-06T09:34:38.360642671Z
|
||||
943813ecb712 running started=2026-11-06T09:33:56.539288471Z finished=2026-11-06T09:33:50.07508976Z
|
||||
exit_code: 0 elapsed_seconds: 20.584
|
||||
@@ -0,0 +1,38 @@
|
||||
date: 2026-11-06T09:34:33Z commit: 95511002b12510178a3cc2a22566b43e2b2b6c81
|
||||
== before: api replicas (hostname = X-Instance-Id), state, StartedAt, FinishedAt
|
||||
9af2280c8af3 running started=2026-11-06T09:33:56.602420846Z finished=2026-11-06T09:33:50.075450885Z
|
||||
943813ecb712 running started=2026-11-06T09:33:56.539288471Z finished=2026-11-06T09:33:50.07508976Z
|
||||
$ make test-failover ACTION_SCRIPT=scripts/stop-one.sh
|
||||
python3 tests/resilience.py --mode failover --action-script "scripts/stop-one.sh" --base-url "http://127.0.0.1:18086"
|
||||
Executing explicit failover hook; hook output suppressed to avoid leaking secrets.
|
||||
{"observed_instances_before": 2, "successful_writes": 134, "failed_attempts": 0, "first_recovery_seconds": 3.03}
|
||||
PASS: failover preserved confirmed data and existing session. Hook scope needs operator evidence.
|
||||
== after: api replicas
|
||||
9af2280c8af3 exited started=2026-11-06T09:33:56.602420846Z finished=2026-11-06T09:34:38.360642671Z
|
||||
943813ecb712 running started=2026-11-06T09:33:56.539288471Z finished=2026-11-06T09:33:50.07508976Z
|
||||
== stopped replica: 9af2280c8af3; shutdown: signal, drain window with readiness 503, close, exit
|
||||
{"event":"Handling signal: term","level":"info","ts":"2026-11-06T09:34:35.851311Z"}
|
||||
{"limit":2.0,"event":"service.draining","level":"info","ts":"2026-11-06T09:34:35.864420Z"}
|
||||
{"limit":2.0,"event":"service.draining","level":"info","ts":"2026-11-06T09:34:35.897236Z"}
|
||||
{"method":"GET","route":"/health/ready","status":503,"request_id":"5818535d613b4b7a8f0607d91e58d3f5","duration_ms":0.837,"event":"request.handled","level":"info","ts":"2026-11-06T09:34:36.062326Z"}
|
||||
{"method":"GET","route":"/health/ready","status":503,"request_id":"4838cbd4822f4181a2e10153a41033d6","duration_ms":0.347,"event":"request.handled","level":"info","ts":"2026-11-06T09:34:36.566176Z"}
|
||||
{"event":"Shutting down","level":"info","ts":"2026-11-06T09:34:37.866622Z"}
|
||||
{"event":"Shutting down","level":"info","ts":"2026-11-06T09:34:37.900282Z"}
|
||||
{"event":"service.stopped","level":"info","ts":"2026-11-06T09:34:37.973761Z"}
|
||||
{"event":"Finished server process [26]","level":"info","ts":"2026-11-06T09:34:37.977541Z"}
|
||||
{"event":"Worker (pid:26) was sent SIGTERM!","level":"info","ts":"2026-11-06T09:34:37.987715Z"}
|
||||
{"event":"service.stopped","level":"info","ts":"2026-11-06T09:34:38.004692Z"}
|
||||
{"event":"Finished server process [21]","level":"info","ts":"2026-11-06T09:34:38.006586Z"}
|
||||
{"event":"Worker (pid:21) was sent SIGTERM!","level":"info","ts":"2026-11-06T09:34:38.093383Z"}
|
||||
{"event":"Shutting down: Master","level":"info","ts":"2026-11-06T09:34:38.195744Z"}
|
||||
$ scripts/restore.sh
|
||||
Container mtusi2026lab6-api-2 Running
|
||||
Container mtusi2026lab6-api-1 Starting
|
||||
Container mtusi2026lab6-api-1 Started
|
||||
Container mtusi2026lab6-api-2 Waiting
|
||||
Container mtusi2026lab6-api-1 Waiting
|
||||
Container mtusi2026lab6-api-2 Healthy
|
||||
Container mtusi2026lab6-api-1 Healthy
|
||||
== after restore
|
||||
9af2280c8af3 running started=2026-11-06T09:34:51.34604076Z finished=2026-11-06T09:34:38.360642671Z
|
||||
943813ecb712 running started=2026-11-06T09:33:56.539288471Z finished=2026-11-06T09:33:50.07508976Z
|
||||
@@ -0,0 +1,43 @@
|
||||
date: 2026-11-06T09:34:53Z commit: 95511002b12510178a3cc2a22566b43e2b2b6c81
|
||||
environment: {"COMPOSE_PROJECT_NAME": "mtusi2026lab6", "LB_HTTP_PORT": "18086", "LB_STATS_PORT": "26085", "BASE_URL": "http://127.0.0.1:18086", "NO_PROXY": "localhost,127.0.0.1,::1"}
|
||||
$ env EVIDENCE_DIR=evidence/grade3/failover-second make failover-evidence SHIFT=1
|
||||
sh scripts/failover-evidence.sh "http://127.0.0.1:18086" "1"
|
||||
date: 2026-11-06T09:34:53Z commit: 95511002b12510178a3cc2a22566b43e2b2b6c81
|
||||
== before: api replicas (hostname = X-Instance-Id), state, StartedAt, FinishedAt
|
||||
9af2280c8af3 running started=2026-11-06T09:34:51.34604076Z finished=2026-11-06T09:34:38.360642671Z
|
||||
943813ecb712 running started=2026-11-06T09:33:56.539288471Z finished=2026-11-06T09:33:50.07508976Z
|
||||
$ make test-failover ACTION_SCRIPT=scripts/stop-one.sh
|
||||
python3 tests/resilience.py --mode failover --action-script "scripts/stop-one.sh" --base-url "http://127.0.0.1:18086"
|
||||
Executing explicit failover hook; hook output suppressed to avoid leaking secrets.
|
||||
{"observed_instances_before": 2, "successful_writes": 133, "failed_attempts": 0, "first_recovery_seconds": 2.777}
|
||||
PASS: failover preserved confirmed data and existing session. Hook scope needs operator evidence.
|
||||
== after: api replicas
|
||||
9af2280c8af3 running started=2026-11-06T09:34:51.34604076Z finished=2026-11-06T09:34:38.360642671Z
|
||||
943813ecb712 exited started=2026-11-06T09:33:56.539288471Z finished=2026-11-06T09:34:58.204116764Z
|
||||
== stopped replica: 943813ecb712; shutdown: signal, drain window with readiness 503, close, exit
|
||||
{"event":"Handling signal: term","level":"info","ts":"2026-11-06T09:34:55.700248Z"}
|
||||
{"limit":2.0,"event":"service.draining","level":"info","ts":"2026-11-06T09:34:55.784538Z"}
|
||||
{"limit":2.0,"event":"service.draining","level":"info","ts":"2026-11-06T09:34:55.795484Z"}
|
||||
{"method":"GET","route":"/health/ready","status":503,"request_id":"ff6952bfefbe4034ae30489d4e43b93c","duration_ms":0.567,"event":"request.handled","level":"info","ts":"2026-11-06T09:34:56.029040Z"}
|
||||
{"method":"GET","route":"/health/ready","status":503,"request_id":"194add29fb3742db93424a18cf9ff680","duration_ms":1.596,"event":"request.handled","level":"info","ts":"2026-11-06T09:34:56.535013Z"}
|
||||
{"event":"Shutting down","level":"info","ts":"2026-11-06T09:34:57.787659Z"}
|
||||
{"event":"Shutting down","level":"info","ts":"2026-11-06T09:34:57.796586Z"}
|
||||
{"event":"service.stopped","level":"info","ts":"2026-11-06T09:34:57.894245Z"}
|
||||
{"event":"Finished server process [21]","level":"info","ts":"2026-11-06T09:34:57.896210Z"}
|
||||
{"event":"service.stopped","level":"info","ts":"2026-11-06T09:34:57.903471Z"}
|
||||
{"event":"Finished server process [23]","level":"info","ts":"2026-11-06T09:34:57.905749Z"}
|
||||
{"event":"Worker (pid:21) was sent SIGTERM!","level":"info","ts":"2026-11-06T09:34:57.954114Z"}
|
||||
{"event":"Worker (pid:23) was sent SIGTERM!","level":"info","ts":"2026-11-06T09:34:57.954212Z"}
|
||||
{"event":"Shutting down: Master","level":"info","ts":"2026-11-06T09:34:58.057111Z"}
|
||||
$ scripts/restore.sh
|
||||
Container mtusi2026lab6-api-1 Running
|
||||
Container mtusi2026lab6-api-2 Starting
|
||||
Container mtusi2026lab6-api-2 Started
|
||||
Container mtusi2026lab6-api-2 Waiting
|
||||
Container mtusi2026lab6-api-1 Waiting
|
||||
Container mtusi2026lab6-api-2 Healthy
|
||||
Container mtusi2026lab6-api-1 Healthy
|
||||
== after restore
|
||||
9af2280c8af3 running started=2026-11-06T09:34:51.34604076Z finished=2026-11-06T09:34:38.360642671Z
|
||||
943813ecb712 running started=2026-11-06T09:35:11.260329797Z finished=2026-11-06T09:34:58.204116764Z
|
||||
exit_code: 0 elapsed_seconds: 20.372
|
||||
@@ -0,0 +1,38 @@
|
||||
date: 2026-11-06T09:34:53Z commit: 95511002b12510178a3cc2a22566b43e2b2b6c81
|
||||
== before: api replicas (hostname = X-Instance-Id), state, StartedAt, FinishedAt
|
||||
9af2280c8af3 running started=2026-11-06T09:34:51.34604076Z finished=2026-11-06T09:34:38.360642671Z
|
||||
943813ecb712 running started=2026-11-06T09:33:56.539288471Z finished=2026-11-06T09:33:50.07508976Z
|
||||
$ make test-failover ACTION_SCRIPT=scripts/stop-one.sh
|
||||
python3 tests/resilience.py --mode failover --action-script "scripts/stop-one.sh" --base-url "http://127.0.0.1:18086"
|
||||
Executing explicit failover hook; hook output suppressed to avoid leaking secrets.
|
||||
{"observed_instances_before": 2, "successful_writes": 133, "failed_attempts": 0, "first_recovery_seconds": 2.777}
|
||||
PASS: failover preserved confirmed data and existing session. Hook scope needs operator evidence.
|
||||
== after: api replicas
|
||||
9af2280c8af3 running started=2026-11-06T09:34:51.34604076Z finished=2026-11-06T09:34:38.360642671Z
|
||||
943813ecb712 exited started=2026-11-06T09:33:56.539288471Z finished=2026-11-06T09:34:58.204116764Z
|
||||
== stopped replica: 943813ecb712; shutdown: signal, drain window with readiness 503, close, exit
|
||||
{"event":"Handling signal: term","level":"info","ts":"2026-11-06T09:34:55.700248Z"}
|
||||
{"limit":2.0,"event":"service.draining","level":"info","ts":"2026-11-06T09:34:55.784538Z"}
|
||||
{"limit":2.0,"event":"service.draining","level":"info","ts":"2026-11-06T09:34:55.795484Z"}
|
||||
{"method":"GET","route":"/health/ready","status":503,"request_id":"ff6952bfefbe4034ae30489d4e43b93c","duration_ms":0.567,"event":"request.handled","level":"info","ts":"2026-11-06T09:34:56.029040Z"}
|
||||
{"method":"GET","route":"/health/ready","status":503,"request_id":"194add29fb3742db93424a18cf9ff680","duration_ms":1.596,"event":"request.handled","level":"info","ts":"2026-11-06T09:34:56.535013Z"}
|
||||
{"event":"Shutting down","level":"info","ts":"2026-11-06T09:34:57.787659Z"}
|
||||
{"event":"Shutting down","level":"info","ts":"2026-11-06T09:34:57.796586Z"}
|
||||
{"event":"service.stopped","level":"info","ts":"2026-11-06T09:34:57.894245Z"}
|
||||
{"event":"Finished server process [21]","level":"info","ts":"2026-11-06T09:34:57.896210Z"}
|
||||
{"event":"service.stopped","level":"info","ts":"2026-11-06T09:34:57.903471Z"}
|
||||
{"event":"Finished server process [23]","level":"info","ts":"2026-11-06T09:34:57.905749Z"}
|
||||
{"event":"Worker (pid:21) was sent SIGTERM!","level":"info","ts":"2026-11-06T09:34:57.954114Z"}
|
||||
{"event":"Worker (pid:23) was sent SIGTERM!","level":"info","ts":"2026-11-06T09:34:57.954212Z"}
|
||||
{"event":"Shutting down: Master","level":"info","ts":"2026-11-06T09:34:58.057111Z"}
|
||||
$ scripts/restore.sh
|
||||
Container mtusi2026lab6-api-1 Running
|
||||
Container mtusi2026lab6-api-2 Starting
|
||||
Container mtusi2026lab6-api-2 Started
|
||||
Container mtusi2026lab6-api-2 Waiting
|
||||
Container mtusi2026lab6-api-1 Waiting
|
||||
Container mtusi2026lab6-api-2 Healthy
|
||||
Container mtusi2026lab6-api-1 Healthy
|
||||
== after restore
|
||||
9af2280c8af3 running started=2026-11-06T09:34:51.34604076Z finished=2026-11-06T09:34:38.360642671Z
|
||||
943813ecb712 running started=2026-11-06T09:35:11.260329797Z finished=2026-11-06T09:34:58.204116764Z
|
||||
@@ -0,0 +1,42 @@
|
||||
date: 2026-11-06T09:33:43Z commit: 95511002b12510178a3cc2a22566b43e2b2b6c81
|
||||
environment: {"COMPOSE_PROJECT_NAME": "mtusi2026lab6", "LB_HTTP_PORT": "18086", "LB_STATS_PORT": "26085", "BASE_URL": "http://127.0.0.1:18086", "NO_PROXY": "localhost,127.0.0.1,::1"}
|
||||
$ python3 scripts/obs_check.py grafana
|
||||
{
|
||||
"checked_at": "2026-11-06T09:33:43+00:00",
|
||||
"grafana": "12.4.14",
|
||||
"datasources": {
|
||||
"prometheus": {
|
||||
"http": 200,
|
||||
"status": "OK",
|
||||
"message": "Successfully queried the Prometheus API."
|
||||
},
|
||||
"loki": {
|
||||
"http": 200,
|
||||
"status": "OK",
|
||||
"message": "Data source successfully connected."
|
||||
},
|
||||
"tempo": {
|
||||
"http": 200,
|
||||
"status": "OK",
|
||||
"message": "Data source is working. Streaming test succeeded."
|
||||
}
|
||||
},
|
||||
"dashboards": {
|
||||
"messenger-api": {
|
||||
"title": "Messenger · API RED",
|
||||
"http": 200,
|
||||
"provisioned": true,
|
||||
"folder": "Messenger",
|
||||
"panels": 14
|
||||
},
|
||||
"messenger-pipeline": {
|
||||
"title": "Messenger · Worker",
|
||||
"http": 200,
|
||||
"provisioned": true,
|
||||
"folder": "Messenger",
|
||||
"panels": 6
|
||||
}
|
||||
},
|
||||
"missing_dashboards": []
|
||||
}
|
||||
exit_code: 0 elapsed_seconds: 0.124
|
||||
@@ -0,0 +1,316 @@
|
||||
date: 2026-11-06T09:37:45Z commit: 95511002b12510178a3cc2a22566b43e2b2b6c81
|
||||
environment: {"COMPOSE_PROJECT_NAME": "mtusi2026lab6", "LB_HTTP_PORT": "18086", "LB_STATS_PORT": "26085", "BASE_URL": "http://127.0.0.1:18086", "NO_PROXY": "localhost,127.0.0.1,::1"}
|
||||
$ python3 scripts/obs_check.py job
|
||||
{
|
||||
"checked_at": "2026-11-06T09:38:05+00:00",
|
||||
"upload_request_id": "6254becc-0433-44ae-89ea-057e0405f827",
|
||||
"attachment_status": "ready",
|
||||
"traces": [
|
||||
"a020913eec288efb8126ca3a69a513d4"
|
||||
],
|
||||
"spans": [
|
||||
{
|
||||
"service": "messenger-worker",
|
||||
"name": "attachments.attachment.process.v1 create",
|
||||
"kind": "SPAN_KIND_CONSUMER",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"duration_ms": 0.008,
|
||||
"links": 0,
|
||||
"trace_id": "a020913eec288efb8126ca3a69a513d4",
|
||||
"attempt": null
|
||||
},
|
||||
{
|
||||
"service": "messenger-worker",
|
||||
"name": "attachments.attachment.process.v1 process",
|
||||
"kind": "SPAN_KIND_CONSUMER",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"duration_ms": 777.9,
|
||||
"links": 0,
|
||||
"trace_id": "a020913eec288efb8126ca3a69a513d4",
|
||||
"attempt": "1"
|
||||
},
|
||||
{
|
||||
"service": "messenger-worker",
|
||||
"name": "BEGIN;",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"duration_ms": 0.133,
|
||||
"links": 0,
|
||||
"trace_id": "a020913eec288efb8126ca3a69a513d4",
|
||||
"attempt": null
|
||||
},
|
||||
{
|
||||
"service": "messenger-worker",
|
||||
"name": "select",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"duration_ms": 0.111,
|
||||
"links": 0,
|
||||
"trace_id": "a020913eec288efb8126ca3a69a513d4",
|
||||
"attempt": null
|
||||
},
|
||||
{
|
||||
"service": "messenger-worker",
|
||||
"name": "select",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"duration_ms": 0.095,
|
||||
"links": 0,
|
||||
"trace_id": "a020913eec288efb8126ca3a69a513d4",
|
||||
"attempt": null
|
||||
},
|
||||
{
|
||||
"service": "messenger-worker",
|
||||
"name": "show",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"duration_ms": 0.085,
|
||||
"links": 0,
|
||||
"trace_id": "a020913eec288efb8126ca3a69a513d4",
|
||||
"attempt": null
|
||||
},
|
||||
{
|
||||
"service": "messenger-worker",
|
||||
"name": "show",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"duration_ms": 0.081,
|
||||
"links": 0,
|
||||
"trace_id": "a020913eec288efb8126ca3a69a513d4",
|
||||
"attempt": null
|
||||
},
|
||||
{
|
||||
"service": "messenger-worker",
|
||||
"name": "ROLLBACK;",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"duration_ms": 0.081,
|
||||
"links": 0,
|
||||
"trace_id": "a020913eec288efb8126ca3a69a513d4",
|
||||
"attempt": null
|
||||
},
|
||||
{
|
||||
"service": "messenger-worker",
|
||||
"name": "BEGIN;",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"duration_ms": 0.082,
|
||||
"links": 0,
|
||||
"trace_id": "a020913eec288efb8126ca3a69a513d4",
|
||||
"attempt": null
|
||||
},
|
||||
{
|
||||
"service": "messenger-worker",
|
||||
"name": "UPDATE",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"duration_ms": 0.554,
|
||||
"links": 0,
|
||||
"trace_id": "a020913eec288efb8126ca3a69a513d4",
|
||||
"attempt": null
|
||||
},
|
||||
{
|
||||
"service": "messenger-worker",
|
||||
"name": "UPDATE",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"duration_ms": 0.57,
|
||||
"links": 0,
|
||||
"trace_id": "a020913eec288efb8126ca3a69a513d4",
|
||||
"attempt": null
|
||||
},
|
||||
{
|
||||
"service": "messenger-worker",
|
||||
"name": "INSERT",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"duration_ms": 0.199,
|
||||
"links": 0,
|
||||
"trace_id": "a020913eec288efb8126ca3a69a513d4",
|
||||
"attempt": null
|
||||
},
|
||||
{
|
||||
"service": "messenger-worker",
|
||||
"name": "SELECT",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"duration_ms": 0.108,
|
||||
"links": 0,
|
||||
"trace_id": "a020913eec288efb8126ca3a69a513d4",
|
||||
"attempt": null
|
||||
},
|
||||
{
|
||||
"service": "messenger-worker",
|
||||
"name": "COMMIT;",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"duration_ms": 0.331,
|
||||
"links": 0,
|
||||
"trace_id": "a020913eec288efb8126ca3a69a513d4",
|
||||
"attempt": null
|
||||
},
|
||||
{
|
||||
"service": "messenger-worker",
|
||||
"name": "BEGIN;",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"duration_ms": 0.08,
|
||||
"links": 0,
|
||||
"trace_id": "a020913eec288efb8126ca3a69a513d4",
|
||||
"attempt": null
|
||||
},
|
||||
{
|
||||
"service": "messenger-worker",
|
||||
"name": ";",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"duration_ms": 0.155,
|
||||
"links": 0,
|
||||
"trace_id": "a020913eec288efb8126ca3a69a513d4",
|
||||
"attempt": null
|
||||
},
|
||||
{
|
||||
"service": "messenger-worker",
|
||||
"name": "ROLLBACK;",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"duration_ms": 0.07,
|
||||
"links": 0,
|
||||
"trace_id": "a020913eec288efb8126ca3a69a513d4",
|
||||
"attempt": null
|
||||
},
|
||||
{
|
||||
"service": "messenger-worker",
|
||||
"name": "BEGIN;",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"duration_ms": 0.062,
|
||||
"links": 0,
|
||||
"trace_id": "a020913eec288efb8126ca3a69a513d4",
|
||||
"attempt": null
|
||||
},
|
||||
{
|
||||
"service": "messenger-worker",
|
||||
"name": "UPDATE",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"duration_ms": 0.112,
|
||||
"links": 0,
|
||||
"trace_id": "a020913eec288efb8126ca3a69a513d4",
|
||||
"attempt": null
|
||||
},
|
||||
{
|
||||
"service": "messenger-worker",
|
||||
"name": "COMMIT;",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"duration_ms": 0.171,
|
||||
"links": 0,
|
||||
"trace_id": "a020913eec288efb8126ca3a69a513d4",
|
||||
"attempt": null
|
||||
},
|
||||
{
|
||||
"service": "messenger-worker",
|
||||
"name": "BEGIN;",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"duration_ms": 0.124,
|
||||
"links": 0,
|
||||
"trace_id": "a020913eec288efb8126ca3a69a513d4",
|
||||
"attempt": null
|
||||
},
|
||||
{
|
||||
"service": "messenger-worker",
|
||||
"name": ";",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"duration_ms": 0.069,
|
||||
"links": 0,
|
||||
"trace_id": "a020913eec288efb8126ca3a69a513d4",
|
||||
"attempt": null
|
||||
},
|
||||
{
|
||||
"service": "messenger-worker",
|
||||
"name": "ROLLBACK;",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"duration_ms": 0.054,
|
||||
"links": 0,
|
||||
"trace_id": "a020913eec288efb8126ca3a69a513d4",
|
||||
"attempt": null
|
||||
},
|
||||
{
|
||||
"service": "messenger-worker",
|
||||
"name": "BEGIN;",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"duration_ms": 0.073,
|
||||
"links": 0,
|
||||
"trace_id": "a020913eec288efb8126ca3a69a513d4",
|
||||
"attempt": null
|
||||
},
|
||||
{
|
||||
"service": "messenger-worker",
|
||||
"name": "UPDATE",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"duration_ms": 0.179,
|
||||
"links": 0,
|
||||
"trace_id": "a020913eec288efb8126ca3a69a513d4",
|
||||
"attempt": null
|
||||
},
|
||||
{
|
||||
"service": "messenger-worker",
|
||||
"name": "INSERT",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"duration_ms": 0.414,
|
||||
"links": 0,
|
||||
"trace_id": "a020913eec288efb8126ca3a69a513d4",
|
||||
"attempt": null
|
||||
},
|
||||
{
|
||||
"service": "messenger-worker",
|
||||
"name": "UPDATE",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"duration_ms": 0.18,
|
||||
"links": 0,
|
||||
"trace_id": "a020913eec288efb8126ca3a69a513d4",
|
||||
"attempt": null
|
||||
},
|
||||
{
|
||||
"service": "messenger-worker",
|
||||
"name": "INSERT",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"duration_ms": 0.116,
|
||||
"links": 0,
|
||||
"trace_id": "a020913eec288efb8126ca3a69a513d4",
|
||||
"attempt": null
|
||||
},
|
||||
{
|
||||
"service": "messenger-worker",
|
||||
"name": "COMMIT;",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"duration_ms": 0.307,
|
||||
"links": 0,
|
||||
"trace_id": "a020913eec288efb8126ca3a69a513d4",
|
||||
"attempt": null
|
||||
}
|
||||
],
|
||||
"worker_logs": [
|
||||
{
|
||||
"line": "job.processed",
|
||||
"trace_id": "a020913eec288efb8126ca3a69a513d4",
|
||||
"span_id": "ff3e55c7d762c0e1"
|
||||
},
|
||||
{
|
||||
"line": "audit.job_settled",
|
||||
"trace_id": "a020913eec288efb8126ca3a69a513d4",
|
||||
"span_id": "ff3e55c7d762c0e1"
|
||||
}
|
||||
]
|
||||
}
|
||||
exit_code: 0 elapsed_seconds: 19.790
|
||||
@@ -0,0 +1,5 @@
|
||||
date: 2026-11-06T09:33:47Z commit: 95511002b12510178a3cc2a22566b43e2b2b6c81
|
||||
environment: {"COMPOSE_PROJECT_NAME": "mtusi2026lab6", "LB_HTTP_PORT": "18086", "LB_STATS_PORT": "26085", "BASE_URL": "http://127.0.0.1:18086", "NO_PROXY": "localhost,127.0.0.1,::1"}
|
||||
$ python3 scripts/obs_check.py job
|
||||
FAIL: <urlopen error [Errno 61] Connection refused>
|
||||
exit_code: 1 elapsed_seconds: 0.055
|
||||
@@ -0,0 +1,18 @@
|
||||
date: 2026-11-06T09:35:15Z commit: 95511002b12510178a3cc2a22566b43e2b2b6c81
|
||||
environment: {"COMPOSE_PROJECT_NAME": "mtusi2026lab6", "LB_HTTP_PORT": "18086", "LB_STATS_PORT": "26085", "BASE_URL": "http://127.0.0.1:18086", "NO_PROXY": "localhost,127.0.0.1,::1"}
|
||||
$ make level3
|
||||
BASE_URL="http://127.0.0.1:18086" python3 scripts/pipeline_suite.py --level 3 --output evidence/level3.json
|
||||
RUN smoke_pipeline
|
||||
PASS smoke_pipeline
|
||||
RUN worker_down_broker_restart
|
||||
PASS worker_down_broker_restart
|
||||
RUN duplicate_after_ready
|
||||
PASS duplicate_after_ready
|
||||
RUN poison_image
|
||||
PASS poison_image
|
||||
RUN s3_outage_recovers
|
||||
PASS s3_outage_recovers
|
||||
RUN retry_exhausted
|
||||
PASS retry_exhausted
|
||||
PASS: lab5 pipeline suite, report evidence/level3.json
|
||||
exit_code: 0 elapsed_seconds: 76.738
|
||||
@@ -0,0 +1,27 @@
|
||||
date: 2026-11-06T09:38:05Z commit: 95511002b12510178a3cc2a22566b43e2b2b6c81
|
||||
environment: {"COMPOSE_PROJECT_NAME": "mtusi2026lab6", "LB_HTTP_PORT": "18086", "LB_STATS_PORT": "26085", "BASE_URL": "http://127.0.0.1:18086", "NO_PROXY": "localhost,127.0.0.1,::1"}
|
||||
$ python3 scripts/obs_check.py leaks
|
||||
{
|
||||
"checked_at": "2026-11-06T09:38:20+00:00",
|
||||
"window_seconds": 20,
|
||||
"traces_scanned": 9,
|
||||
"hits": {
|
||||
"password": {
|
||||
"loki": 0,
|
||||
"tempo": 0
|
||||
},
|
||||
"token": {
|
||||
"loki": 0,
|
||||
"tempo": 0
|
||||
},
|
||||
"message_text": {
|
||||
"loki": 0,
|
||||
"tempo": 0
|
||||
},
|
||||
"filename": {
|
||||
"loki": 0,
|
||||
"tempo": 0
|
||||
}
|
||||
}
|
||||
}
|
||||
exit_code: 0 elapsed_seconds: 15.275
|
||||
@@ -0,0 +1,26 @@
|
||||
# Уровень 3 — сведения для отдельного отчёта
|
||||
|
||||
Приложение проверено на SQLAlchemy-коде 95511002b12510178a3cc2a22566b43e2b2b6c81. Новый код этой фазы — обвязка запуска и строгая проверка реальных spans. Команды запускаются через `scripts/lab6.sh`, задающий только порты ЛР6, project и NO_PROXY; значения secrets не выводятся. Дата/SHA и exit_code есть в каждом command log.
|
||||
|
||||
| Критерий | Команда и доказательство |
|
||||
|---|---|
|
||||
| Минимум lab5 | make test: smoke-ready.txt; make test-persistence: persistence.txt; failover каждой реплики: failover-first.txt/failover-second.txt; make level3: lab5-minimum.txt и ../level3.json (6 PASS) |
|
||||
| Конфигурации и provisioning | make obs-validate: obs-validate.txt; obs_check.py grafana: grafana.txt (3 OK, 2 dashboards provisioned); runtime.json (non-root, лимиты, volumes, порты) |
|
||||
| RED и worker metrics | obs_check.py dashboards --strict: dashboards.txt; cardinality.txt: реальные HTTP-шаблоны, done/failed/retry_scheduled/duplicate_noop |
|
||||
| Запрос → лог → trace | obs_check.py request: request.txt, реальный POST server span и PostgreSQL client spans |
|
||||
| Job → лог → trace | obs_check.py job: job-stable.txt, ready, consumer spans и trace/span IDs worker |
|
||||
| Отсутствие содержимого | obs_check.py leaks: leaks.txt, все 4 маркера дают 0 в Loki и Tempo |
|
||||
| История и независимость API | obs_recovery.py: telemetry-recovery.txt, прежние trace/log/metric после restart; smoke при остановленном Collector; SIGTERM API 4.592 с, exit 0 |
|
||||
| Проверки кода | quality.txt: check/validate/lint PASS; student-tests.txt: 515 passed, 1 skipped, 19 deselected |
|
||||
|
||||
Collector принимает OTLP/HTTP и обрабатывает/экспортирует сигналы, не заменяя долговременную БД. Prometheus хранит временные ряды, Loki — структурные логи, Tempo — трассы. Grafana запрашивает эти хранилища и связывает сигналы через provisioned datasources. SDK запускается в процессе API после fork и в отдельных relay/worker. Batch processors и periodic reader не блокируют запрос на экспорт.
|
||||
|
||||
HTTP: `http_server_request_duration_seconds_{bucket,sum,count}`, labels `http_route`, `http_request_method`, `http_response_status_code`, service resource. RPS и классы статуса: `messenger:http_requests:rate2m`; error ratio — 5xx/все бизнес-запросы, health исключены. Worker: `messenger_jobs_processed_total`, `messenger_job_duration_seconds_{bucket,sum,count}`, labels `job_type,outcome`. Секунды; HTTP percentiles вычисляются histogram_quantile по сумме buckets реплик. Loki индексирует только service_name и environment; IDs остаются structured metadata. SDK не захватывает HTTP-заголовки и параметры БД, Collector дополнительно redacts подозрительные поля.
|
||||
|
||||
## Ограничения и неуспешные попытки
|
||||
|
||||
smoke.txt запущен до завершения up --wait и закономерно получил connection refused; smoke-ready.txt — исправленный порядок. job.txt попал в рестарт persistence; job-stable.txt выполнен отдельно и прошёл. Эти неудачи сохранены и не объявлены PASS. Полный pipeline/failover выполнялся последовательно. Unit/integration tests использовали свои одноразовые контейнеры одновременно только с проверками чтения телеметрии; нагрузочных замеров уровня 5 здесь нет. Linux-only RLIMIT_AS пропущен на macOS, stack-маркер штатно исключил 19 тестов; обязательные публичные отказы выполнены отдельно.
|
||||
|
||||
Minor из переноса: scripts/limits.py и CI-allowlist ещё не знают сервисы OTel; проверка реальных ограничений выполнена независимо в runtime.json. REPORT.md оставлен отдельному отчётному агенту.
|
||||
|
||||
Чистый clone коммита 2903d9d: `env EVIDENCE_DIR=evidence/grade3/clean sh scripts/clean-clone.sh`, clean/clean-clone.txt. Пустые volumes, secrets, migrate, healthy, smoke, persistence, failover, upload failover, S3 outage, reconcile; exit_code 0. Временный project остановлен, volumes сохранены.
|
||||
@@ -0,0 +1,16 @@
|
||||
date: 2026-11-06T09:31:47Z commit: 95511002b12510178a3cc2a22566b43e2b2b6c81
|
||||
environment: {"COMPOSE_PROJECT_NAME": "mtusi2026lab6", "LB_HTTP_PORT": "18086", "LB_STATS_PORT": "26085", "BASE_URL": "http://127.0.0.1:18086", "NO_PROXY": "localhost,127.0.0.1,::1"}
|
||||
$ make obs-validate
|
||||
sh scripts/obs-validate.sh
|
||||
otelcol-contrib validate collector.yaml: OK
|
||||
Checking /etc/prometheus/prometheus.yml
|
||||
SUCCESS: 1 rule files found
|
||||
SUCCESS: /etc/prometheus/prometheus.yml is valid prometheus config file syntax
|
||||
|
||||
Checking /etc/prometheus/rules/messenger.recording.yml
|
||||
SUCCESS: 8 rules found
|
||||
|
||||
loki -verify-config: OK
|
||||
tempo -config.verify: OK
|
||||
grafana dashboards: valid JSON with uid and panels
|
||||
exit_code: 0 elapsed_seconds: 1.015
|
||||
@@ -0,0 +1,7 @@
|
||||
date: 2026-11-06T09:33:44Z commit: 95511002b12510178a3cc2a22566b43e2b2b6c81
|
||||
environment: {"COMPOSE_PROJECT_NAME": "mtusi2026lab6", "LB_HTTP_PORT": "18086", "LB_STATS_PORT": "26085", "BASE_URL": "http://127.0.0.1:18086", "NO_PROXY": "localhost,127.0.0.1,::1"}
|
||||
$ make test-persistence ACTION_SCRIPT=scripts/restart.sh
|
||||
python3 tests/resilience.py --mode persistence --action-script "scripts/restart.sh" --base-url "http://127.0.0.1:18086"
|
||||
Executing explicit persistence hook; hook output suppressed to avoid leaking secrets.
|
||||
PASS: persistence preserved confirmed data and existing session. Hook scope needs operator evidence.
|
||||
exit_code: 0 elapsed_seconds: 14.842
|
||||
@@ -0,0 +1,14 @@
|
||||
date: 2026-11-06T09:37:46Z commit: 95511002b12510178a3cc2a22566b43e2b2b6c81
|
||||
environment: {"COMPOSE_PROJECT_NAME": "mtusi2026lab6", "LB_HTTP_PORT": "18086", "LB_STATS_PORT": "26085", "BASE_URL": "http://127.0.0.1:18086", "NO_PROXY": "localhost,127.0.0.1,::1"}
|
||||
$ make check validate lint
|
||||
python3 scripts/check_contract.py
|
||||
PASS: offline skeleton structure, local refs and Python syntax; application NOT tested.
|
||||
.venv/bin/python scripts/validate_openapi.py
|
||||
PASS: full OpenAPI 3.1 and JSON Schema validation; application NOT tested.
|
||||
.venv/bin/ruff check src student-tests scripts/capture_evidence.py alembic scripts/scaling.py tools scripts/probe.py scripts/limits.py scripts/lab4_scenarios.py scripts/lab4_seed.py scripts/upload_memory.py scripts/reconcile_check.py scripts/reconcile_track.py scripts/make_images.py scripts/pipeline_suite.py scripts/pipeline_evidence.py
|
||||
All checks passed!
|
||||
.venv/bin/ruff format --check src student-tests scripts/capture_evidence.py alembic scripts/scaling.py tools scripts/probe.py scripts/limits.py scripts/lab4_scenarios.py scripts/lab4_seed.py scripts/upload_memory.py scripts/reconcile_check.py scripts/reconcile_track.py scripts/make_images.py scripts/pipeline_suite.py scripts/pipeline_evidence.py
|
||||
189 files already formatted
|
||||
.venv/bin/ty check src student-tests alembic
|
||||
All checks passed!
|
||||
exit_code: 0 elapsed_seconds: 0.744
|
||||
@@ -0,0 +1,66 @@
|
||||
date: 2026-11-06T09:33:43Z commit: 95511002b12510178a3cc2a22566b43e2b2b6c81
|
||||
environment: {"COMPOSE_PROJECT_NAME": "mtusi2026lab6", "LB_HTTP_PORT": "18086", "LB_STATS_PORT": "26085", "BASE_URL": "http://127.0.0.1:18086", "NO_PROXY": "localhost,127.0.0.1,::1"}
|
||||
$ python3 scripts/obs_check.py request
|
||||
{
|
||||
"checked_at": "2026-11-06T09:33:47+00:00",
|
||||
"request_id": "fea83e54-fa3d-4ad9-af04-93f636b6b386",
|
||||
"log": {
|
||||
"line": "request.handled",
|
||||
"trace_id": "a5bbfed14a0e3087c87d5368f65743aa",
|
||||
"span_id": "62f0ee285437fbfa",
|
||||
"service_name": "messenger-api",
|
||||
"severity": "INFO"
|
||||
},
|
||||
"trace": [
|
||||
{
|
||||
"service": "messenger-api",
|
||||
"name": "BEGIN;",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"duration_ms": 0.134
|
||||
},
|
||||
{
|
||||
"service": "messenger-api",
|
||||
"name": ";",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"duration_ms": 0.074
|
||||
},
|
||||
{
|
||||
"service": "messenger-api",
|
||||
"name": "ROLLBACK;",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"duration_ms": 0.074
|
||||
},
|
||||
{
|
||||
"service": "messenger-api",
|
||||
"name": "BEGIN;",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"duration_ms": 0.056
|
||||
},
|
||||
{
|
||||
"service": "messenger-api",
|
||||
"name": "INSERT",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"duration_ms": 0.18
|
||||
},
|
||||
{
|
||||
"service": "messenger-api",
|
||||
"name": "COMMIT;",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"duration_ms": 0.23
|
||||
},
|
||||
{
|
||||
"service": "messenger-api",
|
||||
"name": "POST /api/v1/users",
|
||||
"kind": "SPAN_KIND_SERVER",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"duration_ms": 13.489
|
||||
}
|
||||
]
|
||||
}
|
||||
exit_code: 0 elapsed_seconds: 4.098
|
||||
@@ -0,0 +1,102 @@
|
||||
{
|
||||
"utc": "2026-11-06T09:40:22.595732+00:00",
|
||||
"sha": "95511002b12510178a3cc2a22566b43e2b2b6c81",
|
||||
"command": "docker inspect selected fields; docker top <project container> -eo pid,uid,comm",
|
||||
"services": [
|
||||
{
|
||||
"service": "grafana",
|
||||
"processes": [
|
||||
"PID UID COMMAND",
|
||||
"74426 472 grafana"
|
||||
],
|
||||
"memory_limit": 402653184,
|
||||
"cpu_limit": 500000000,
|
||||
"ports": {
|
||||
"3000/tcp": [
|
||||
{
|
||||
"HostIp": "127.0.0.1",
|
||||
"HostPort": "26300"
|
||||
}
|
||||
]
|
||||
},
|
||||
"volumes": [
|
||||
"mtusi2026lab6_grafana-data"
|
||||
]
|
||||
},
|
||||
{
|
||||
"service": "loki",
|
||||
"processes": [
|
||||
"PID UID COMMAND",
|
||||
"74652 10001 loki"
|
||||
],
|
||||
"memory_limit": 402653184,
|
||||
"cpu_limit": 500000000,
|
||||
"ports": {
|
||||
"3100/tcp": [
|
||||
{
|
||||
"HostIp": "127.0.0.1",
|
||||
"HostPort": "26310"
|
||||
}
|
||||
]
|
||||
},
|
||||
"volumes": [
|
||||
"mtusi2026lab6_loki-data",
|
||||
"mtusi2026lab6_healthtools"
|
||||
]
|
||||
},
|
||||
{
|
||||
"service": "tempo",
|
||||
"processes": [
|
||||
"PID UID COMMAND",
|
||||
"75480 10001 tempo"
|
||||
],
|
||||
"memory_limit": 402653184,
|
||||
"cpu_limit": 500000000,
|
||||
"ports": {
|
||||
"3200/tcp": [
|
||||
{
|
||||
"HostIp": "127.0.0.1",
|
||||
"HostPort": "26320"
|
||||
}
|
||||
]
|
||||
},
|
||||
"volumes": [
|
||||
"mtusi2026lab6_tempo-data",
|
||||
"mtusi2026lab6_healthtools"
|
||||
]
|
||||
},
|
||||
{
|
||||
"service": "otel-collector",
|
||||
"processes": [
|
||||
"PID UID COMMAND",
|
||||
"76175 10001 otelcol-contrib"
|
||||
],
|
||||
"memory_limit": 268435456,
|
||||
"cpu_limit": 500000000,
|
||||
"ports": {},
|
||||
"volumes": [
|
||||
"mtusi2026lab6_healthtools"
|
||||
]
|
||||
},
|
||||
{
|
||||
"service": "prometheus",
|
||||
"processes": [
|
||||
"PID UID COMMAND",
|
||||
"74496 65534 prometheus"
|
||||
],
|
||||
"memory_limit": 536870912,
|
||||
"cpu_limit": 500000000,
|
||||
"ports": {
|
||||
"9090/tcp": [
|
||||
{
|
||||
"HostIp": "127.0.0.1",
|
||||
"HostPort": "26090"
|
||||
}
|
||||
]
|
||||
},
|
||||
"volumes": [
|
||||
"mtusi2026lab6_prometheus-data"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
date: 2026-11-06T09:33:42Z commit: 95511002b12510178a3cc2a22566b43e2b2b6c81
|
||||
environment: {"COMPOSE_PROJECT_NAME": "mtusi2026lab6", "LB_HTTP_PORT": "18086", "LB_STATS_PORT": "26085", "BASE_URL": "http://127.0.0.1:18086", "NO_PROXY": "localhost,127.0.0.1,::1"}
|
||||
$ make test
|
||||
python3 tests/smoke.py --base-url "http://127.0.0.1:18086"
|
||||
PASS: lab6 public API scenario; infrastructure and grading evidence remain separate.
|
||||
exit_code: 0 elapsed_seconds: 2.455
|
||||
@@ -0,0 +1,7 @@
|
||||
date: 2026-11-06T09:32:40Z commit: 95511002b12510178a3cc2a22566b43e2b2b6c81
|
||||
environment: {"COMPOSE_PROJECT_NAME": "mtusi2026lab6", "LB_HTTP_PORT": "18086", "LB_STATS_PORT": "26085", "BASE_URL": "http://127.0.0.1:18086", "NO_PROXY": "localhost,127.0.0.1,::1"}
|
||||
$ make test
|
||||
python3 tests/smoke.py --base-url "http://127.0.0.1:18086"
|
||||
FAIL: GET /health/live: connection/TLS failure (URLError)
|
||||
make: *** [test] Error 1
|
||||
exit_code: 2 elapsed_seconds: 0.056
|
||||
@@ -0,0 +1,17 @@
|
||||
api running Up 3 minutes (healthy)
|
||||
api running Up 3 minutes (healthy)
|
||||
broker running Up 3 minutes (healthy) 127.0.0.1:26086->15672/tcp
|
||||
grafana running Up 6 minutes (healthy) 127.0.0.1:26300->3000/tcp
|
||||
healthtools exited Exited (0) 5 minutes ago
|
||||
lb running Up 5 minutes (healthy) 127.0.0.1:18086->8080/tcp, 127.0.0.1:26085->8404/tcp
|
||||
loki running Up 6 minutes (healthy) 127.0.0.1:26310->3100/tcp
|
||||
migrate exited Exited (0) 5 minutes ago
|
||||
otel-collector running Up 6 minutes (healthy) 4317-4318/tcp, 55679/tcp
|
||||
postgres running Up 5 minutes (healthy)
|
||||
prometheus running Up 6 minutes (healthy) 127.0.0.1:26090->9090/tcp
|
||||
relay running Up 2 minutes (healthy)
|
||||
s3 running Up 3 minutes (healthy)
|
||||
s3-init exited Exited (0) 5 minutes ago
|
||||
tempo running Up 6 minutes (healthy) 127.0.0.1:26320->3200/tcp
|
||||
valkey running Up 5 minutes (healthy)
|
||||
worker running Up 2 minutes (healthy)
|
||||
@@ -0,0 +1,62 @@
|
||||
date: 2026-11-06T09:37:47Z commit: 95511002b12510178a3cc2a22566b43e2b2b6c81
|
||||
environment: {"COMPOSE_PROJECT_NAME": "mtusi2026lab6", "LB_HTTP_PORT": "18086", "LB_STATS_PORT": "26085", "BASE_URL": "http://127.0.0.1:18086", "NO_PROXY": "localhost,127.0.0.1,::1"}
|
||||
$ make student-test
|
||||
.venv/bin/pytest
|
||||
============================= test session starts ==============================
|
||||
platform darwin -- Python 3.14.5, pytest-9.1.1, pluggy-1.6.0
|
||||
rootdir: <repo>
|
||||
configfile: pyproject.toml
|
||||
testpaths: student-tests
|
||||
plugins: asyncio-1.4.0, anyio-4.15.1
|
||||
asyncio: mode=Mode.AUTO, debug=False, asyncio_default_fixture_loop_scope=function, asyncio_default_test_loop_scope=function
|
||||
collected 535 items / 19 deselected / 516 selected
|
||||
|
||||
student-tests/adapters/test_rabbitmq.py .... [ 0%]
|
||||
student-tests/adapters/test_s3_storage.py ... [ 1%]
|
||||
student-tests/api/test_access.py ......... [ 3%]
|
||||
student-tests/api/test_attachments.py .................................. [ 9%]
|
||||
.... [ 10%]
|
||||
student-tests/api/test_bounded_contexts.py .................... [ 14%]
|
||||
student-tests/api/test_cache.py ...... [ 15%]
|
||||
student-tests/api/test_concurrency.py .... [ 16%]
|
||||
student-tests/api/test_consistency.py ........ [ 17%]
|
||||
student-tests/api/test_drain.py .. [ 18%]
|
||||
student-tests/api/test_events.py ...... [ 19%]
|
||||
student-tests/api/test_http_telemetry.py . [ 19%]
|
||||
student-tests/api/test_idempotency.py ............... [ 22%]
|
||||
student-tests/api/test_instance.py .... [ 23%]
|
||||
student-tests/api/test_job_returning.py . [ 23%]
|
||||
student-tests/api/test_message_attachments.py ............. [ 25%]
|
||||
student-tests/api/test_migrations.py ................................... [ 32%]
|
||||
. [ 32%]
|
||||
student-tests/api/test_negative.py ..................................... [ 40%]
|
||||
[ 40%]
|
||||
student-tests/api/test_operability.py .............. [ 42%]
|
||||
student-tests/api/test_pagination.py .................. [ 46%]
|
||||
student-tests/api/test_pipeline.py ............. [ 48%]
|
||||
student-tests/api/test_pool.py ............ [ 51%]
|
||||
student-tests/api/test_reconciler.py ........... [ 53%]
|
||||
student-tests/api/test_recovery.py ............ [ 55%]
|
||||
student-tests/api/test_sessions.py .................. [ 59%]
|
||||
student-tests/api/test_timeout.py ........ [ 60%]
|
||||
student-tests/api/test_upload_consistency.py ......... [ 62%]
|
||||
student-tests/api/test_versioned_pipeline.py ........... [ 64%]
|
||||
student-tests/api/test_wire_format.py .. [ 64%]
|
||||
student-tests/unit/test_attachments_domain.py .......................... [ 69%]
|
||||
. [ 70%]
|
||||
student-tests/unit/test_authentication.py ..................... [ 74%]
|
||||
student-tests/unit/test_cursor.py ........... [ 76%]
|
||||
student-tests/unit/test_domain.py ...................................... [ 83%]
|
||||
.. [ 84%]
|
||||
student-tests/unit/test_job_observer.py . [ 84%]
|
||||
student-tests/unit/test_pipeline_domain.py ....................... [ 88%]
|
||||
student-tests/unit/test_probe.py .............. [ 91%]
|
||||
student-tests/unit/test_reconcile_measurements.py ...... [ 92%]
|
||||
student-tests/unit/test_render_pool.py .....s. [ 93%]
|
||||
student-tests/unit/test_renderer.py .................... [ 97%]
|
||||
student-tests/unit/test_scaling.py ..... [ 98%]
|
||||
student-tests/unit/test_telemetry_platform.py ..... [ 99%]
|
||||
student-tests/unit/test_timeouts.py . [100%]
|
||||
|
||||
========== 515 passed, 1 skipped, 19 deselected in 152.09s (0:02:32) ===========
|
||||
exit_code: 0 elapsed_seconds: 153.875
|
||||
@@ -0,0 +1,40 @@
|
||||
date: 2026-11-06T09:39:43Z commit: 95511002b12510178a3cc2a22566b43e2b2b6c81
|
||||
environment: {"COMPOSE_PROJECT_NAME": "mtusi2026lab6", "LB_HTTP_PORT": "18086", "LB_STATS_PORT": "26085", "BASE_URL": "http://127.0.0.1:18086", "NO_PROXY": "localhost,127.0.0.1,::1"}
|
||||
$ python3 scripts/obs_recovery.py
|
||||
{
|
||||
"utc": "2026-11-06T09:39:43+00:00",
|
||||
"sha": "95511002b12510178a3cc2a22566b43e2b2b6c81",
|
||||
"history": {
|
||||
"request_id": "895734e9-5c73-4054-ac37-804e02379460",
|
||||
"trace_id": "33f5b0aea4ca28712a72fb9642e589f5",
|
||||
"spans_before": 7,
|
||||
"spans_after": 7,
|
||||
"logs_after": 1,
|
||||
"metric_before": [
|
||||
{
|
||||
"metric": {},
|
||||
"value": [
|
||||
1793957985.684,
|
||||
"352"
|
||||
]
|
||||
}
|
||||
],
|
||||
"metric_after": [
|
||||
{
|
||||
"metric": {},
|
||||
"value": [
|
||||
1793957985.684,
|
||||
"352"
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"collector_down": {
|
||||
"ready": 200,
|
||||
"smoke": "python3 tests/smoke.py --base-url \"http://127.0.0.1:18086\" \nPASS: lab6 public API scenario; infrastructure and grading evidence remain separate.",
|
||||
"api_exit_code": "0",
|
||||
"api_shutdown_seconds": 4.592
|
||||
},
|
||||
"result": "PASS"
|
||||
}
|
||||
exit_code: 0 elapsed_seconds: 22.655
|
||||
@@ -0,0 +1,230 @@
|
||||
date: 2026-11-06T09:32:07Z commit: 95511002b12510178a3cc2a22566b43e2b2b6c81
|
||||
environment: {"COMPOSE_PROJECT_NAME": "mtusi2026lab6", "LB_HTTP_PORT": "18086", "LB_STATS_PORT": "26085", "BASE_URL": "http://127.0.0.1:18086", "NO_PROXY": "localhost,127.0.0.1,::1"}
|
||||
$ make up
|
||||
sh scripts/secrets.sh
|
||||
sh scripts/broker-secrets.sh
|
||||
broker and S3 worker secrets ready in secrets/ (values not printed)
|
||||
sh scripts/secrets-lab6.sh
|
||||
secrets/grafana_admin_password is ready (value not printed)
|
||||
docker compose build
|
||||
#1 [internal] load local bake definitions
|
||||
#1 reading from stdin 432B done
|
||||
#1 DONE 0.0s
|
||||
|
||||
#2 [internal] load build definition from Dockerfile
|
||||
#2 transferring dockerfile: 1.65kB done
|
||||
#2 DONE 0.0s
|
||||
|
||||
#3 [internal] load metadata for docker.io/library/python:3.14-slim-trixie@sha256:51dafde81dbdb6ebde285137a295cf18a47ca95234fe388a343719cb97305b3d
|
||||
#3 DONE 0.0s
|
||||
|
||||
#4 [internal] load metadata for ghcr.io/astral-sh/uv:0.9.7@sha256:ba4857bf2a068e9bc0e64eed8563b065908a4cd6bfb66b531a9c424c8e25e142
|
||||
#4 DONE 0.0s
|
||||
|
||||
#5 [internal] load .dockerignore
|
||||
#5 transferring context: 453B done
|
||||
#5 DONE 0.0s
|
||||
|
||||
#6 FROM ghcr.io/astral-sh/uv:0.9.7@sha256:ba4857bf2a068e9bc0e64eed8563b065908a4cd6bfb66b531a9c424c8e25e142
|
||||
#6 resolve ghcr.io/astral-sh/uv:0.9.7@sha256:ba4857bf2a068e9bc0e64eed8563b065908a4cd6bfb66b531a9c424c8e25e142 0.0s done
|
||||
#6 DONE 0.0s
|
||||
|
||||
#7 [builder 1/7] FROM docker.io/library/python:3.14-slim-trixie@sha256:51dafde81dbdb6ebde285137a295cf18a47ca95234fe388a343719cb97305b3d
|
||||
#7 resolve docker.io/library/python:3.14-slim-trixie@sha256:51dafde81dbdb6ebde285137a295cf18a47ca95234fe388a343719cb97305b3d 0.0s done
|
||||
#7 DONE 0.0s
|
||||
|
||||
#8 [internal] load build context
|
||||
#8 transferring context: 77.10kB 0.0s done
|
||||
#8 DONE 0.0s
|
||||
|
||||
#9 [builder 4/7] COPY pyproject.toml uv.lock README.md ./
|
||||
#9 CACHED
|
||||
|
||||
#10 [builder 2/7] COPY --from=ghcr.io/astral-sh/uv:0.9.7@sha256:ba4857bf2a068e9bc0e64eed8563b065908a4cd6bfb66b531a9c424c8e25e142 /uv /usr/local/bin/uv
|
||||
#10 CACHED
|
||||
|
||||
#11 [builder 3/7] WORKDIR /build
|
||||
#11 CACHED
|
||||
|
||||
#12 [builder 5/7] RUN uv sync --locked --no-dev --no-install-project --no-editable
|
||||
#12 CACHED
|
||||
|
||||
#13 [builder 6/7] COPY src ./src
|
||||
#13 DONE 0.0s
|
||||
|
||||
#14 [builder 7/7] RUN uv sync --locked --no-dev --no-editable
|
||||
#14 0.198 Resolved 100 packages in 1ms
|
||||
#14 0.210 Building mtusi-messenger @ file:///build
|
||||
#14 1.664 Built mtusi-messenger @ file:///build
|
||||
#14 1.669 Prepared 1 package in 1.45s
|
||||
#14 1.673 Installed 1 package in 3ms
|
||||
#14 1.918 Bytecode compiled 2802 files in 245ms
|
||||
#14 1.918 + mtusi-messenger==1.6.0 (from file:///build)
|
||||
#14 DONE 2.0s
|
||||
|
||||
#15 [runtime 2/6] RUN groupadd --system --gid 10001 messenger && useradd --system --uid 10001 --gid messenger --no-create-home --shell /usr/sbin/nologin messenger
|
||||
#15 CACHED
|
||||
|
||||
#16 [runtime 3/6] COPY --from=builder --chown=root:root /opt/venv /opt/venv
|
||||
#16 DONE 0.5s
|
||||
|
||||
#17 [runtime 4/6] WORKDIR /app
|
||||
#17 DONE 0.0s
|
||||
|
||||
#18 [runtime 5/6] COPY --chown=root:root alembic.ini ./
|
||||
#18 DONE 0.0s
|
||||
|
||||
#19 [runtime 6/6] COPY --chown=root:root alembic ./alembic
|
||||
#19 DONE 0.0s
|
||||
|
||||
#20 exporting to image
|
||||
#20 exporting layers
|
||||
#20 exporting layers 3.0s done
|
||||
#20 exporting manifest sha256:d38e0f0539ab16584375a6654edcd69ba0ad8a9dfb5fc3221a88909fbf5a52a9
|
||||
#20 exporting manifest sha256:d38e0f0539ab16584375a6654edcd69ba0ad8a9dfb5fc3221a88909fbf5a52a9 done
|
||||
#20 exporting config sha256:936eb99a24924e6b5f866e8b8ffeb97ced4056f13385a132eda3d8b2cc94c2fb done
|
||||
#20 exporting attestation manifest sha256:329afd3eb83e5c817ea776ccb7f65b18a8da4ff79444c75f85d651eb524cb0a7 done
|
||||
#20 exporting manifest list sha256:be397eab1ba1525d7ad025c7162b7a748a061983dd2895023266825a9a13794b done
|
||||
#20 naming to docker.io/library/mtusi-messenger:mtusi2026lab6 done
|
||||
#20 unpacking to docker.io/library/mtusi-messenger:mtusi2026lab6
|
||||
#20 unpacking to docker.io/library/mtusi-messenger:mtusi2026lab6 0.7s done
|
||||
#20 DONE 3.8s
|
||||
|
||||
#21 resolving provenance for metadata file
|
||||
#21 DONE 0.0s
|
||||
api Built
|
||||
docker compose up -d --wait
|
||||
Network mtusi2026lab6_backend Creating
|
||||
Network mtusi2026lab6_backend Created
|
||||
Network mtusi2026lab6_edge Creating
|
||||
Network mtusi2026lab6_edge Created
|
||||
Container mtusi2026lab6-broker-1 Creating
|
||||
Container mtusi2026lab6-prometheus-1 Creating
|
||||
Container mtusi2026lab6-valkey-1 Creating
|
||||
Container mtusi2026lab6-postgres-1 Creating
|
||||
Container mtusi2026lab6-lb-1 Creating
|
||||
Container mtusi2026lab6-s3-1 Creating
|
||||
Container mtusi2026lab6-healthtools-1 Creating
|
||||
Container mtusi2026lab6-s3-1 Created
|
||||
Container mtusi2026lab6-s3-init-1 Creating
|
||||
Container mtusi2026lab6-valkey-1 Created
|
||||
Container mtusi2026lab6-prometheus-1 Created
|
||||
Container mtusi2026lab6-healthtools-1 Created
|
||||
Container mtusi2026lab6-loki-1 Creating
|
||||
Container mtusi2026lab6-otel-collector-1 Creating
|
||||
Container mtusi2026lab6-tempo-1 Creating
|
||||
Container mtusi2026lab6-lb-1 Created
|
||||
Container mtusi2026lab6-postgres-1 Created
|
||||
Container mtusi2026lab6-migrate-1 Creating
|
||||
Container mtusi2026lab6-broker-1 Created
|
||||
Container mtusi2026lab6-s3-init-1 Created
|
||||
Container mtusi2026lab6-otel-collector-1 Created
|
||||
Container mtusi2026lab6-migrate-1 Created
|
||||
Container mtusi2026lab6-worker-1 Creating
|
||||
Container mtusi2026lab6-api-2 Creating
|
||||
Container mtusi2026lab6-api-1 Creating
|
||||
Container mtusi2026lab6-relay-1 Creating
|
||||
Container mtusi2026lab6-tempo-1 Created
|
||||
Container mtusi2026lab6-loki-1 Created
|
||||
Container mtusi2026lab6-grafana-1 Creating
|
||||
Container mtusi2026lab6-worker-1 Created
|
||||
Container mtusi2026lab6-api-1 Created
|
||||
Container mtusi2026lab6-relay-1 Created
|
||||
Container mtusi2026lab6-api-2 Created
|
||||
Container mtusi2026lab6-grafana-1 Created
|
||||
Container mtusi2026lab6-s3-1 Starting
|
||||
Container mtusi2026lab6-lb-1 Starting
|
||||
Container mtusi2026lab6-valkey-1 Starting
|
||||
Container mtusi2026lab6-broker-1 Starting
|
||||
Container mtusi2026lab6-healthtools-1 Starting
|
||||
Container mtusi2026lab6-prometheus-1 Starting
|
||||
Container mtusi2026lab6-postgres-1 Starting
|
||||
Container mtusi2026lab6-healthtools-1 Started
|
||||
Container mtusi2026lab6-healthtools-1 Waiting
|
||||
Container mtusi2026lab6-healthtools-1 Waiting
|
||||
Container mtusi2026lab6-healthtools-1 Waiting
|
||||
Container mtusi2026lab6-s3-1 Started
|
||||
Container mtusi2026lab6-s3-1 Waiting
|
||||
Container mtusi2026lab6-postgres-1 Started
|
||||
Container mtusi2026lab6-postgres-1 Waiting
|
||||
Container mtusi2026lab6-valkey-1 Started
|
||||
Container mtusi2026lab6-broker-1 Started
|
||||
Container mtusi2026lab6-prometheus-1 Started
|
||||
Container mtusi2026lab6-lb-1 Started
|
||||
Container mtusi2026lab6-healthtools-1 Exited
|
||||
Container mtusi2026lab6-healthtools-1 Exited
|
||||
Container mtusi2026lab6-tempo-1 Starting
|
||||
Container mtusi2026lab6-loki-1 Starting
|
||||
Container mtusi2026lab6-healthtools-1 Exited
|
||||
Container mtusi2026lab6-otel-collector-1 Starting
|
||||
Container mtusi2026lab6-postgres-1 Healthy
|
||||
Container mtusi2026lab6-migrate-1 Starting
|
||||
Container mtusi2026lab6-tempo-1 Started
|
||||
Container mtusi2026lab6-migrate-1 Started
|
||||
Container mtusi2026lab6-loki-1 Started
|
||||
Container mtusi2026lab6-grafana-1 Starting
|
||||
Container mtusi2026lab6-otel-collector-1 Started
|
||||
Container mtusi2026lab6-grafana-1 Started
|
||||
Container mtusi2026lab6-s3-1 Healthy
|
||||
Container mtusi2026lab6-s3-init-1 Starting
|
||||
Container mtusi2026lab6-s3-init-1 Started
|
||||
Container mtusi2026lab6-migrate-1 Waiting
|
||||
Container mtusi2026lab6-s3-init-1 Waiting
|
||||
Container mtusi2026lab6-s3-init-1 Waiting
|
||||
Container mtusi2026lab6-broker-1 Waiting
|
||||
Container mtusi2026lab6-migrate-1 Waiting
|
||||
Container mtusi2026lab6-s3-init-1 Waiting
|
||||
Container mtusi2026lab6-broker-1 Waiting
|
||||
Container mtusi2026lab6-migrate-1 Waiting
|
||||
Container mtusi2026lab6-migrate-1 Exited
|
||||
Container mtusi2026lab6-migrate-1 Exited
|
||||
Container mtusi2026lab6-migrate-1 Exited
|
||||
Container mtusi2026lab6-s3-init-1 Exited
|
||||
Container mtusi2026lab6-broker-1 Healthy
|
||||
Container mtusi2026lab6-s3-init-1 Exited
|
||||
Container mtusi2026lab6-worker-1 Starting
|
||||
Container mtusi2026lab6-broker-1 Healthy
|
||||
Container mtusi2026lab6-relay-1 Starting
|
||||
Container mtusi2026lab6-s3-init-1 Exited
|
||||
Container mtusi2026lab6-api-2 Starting
|
||||
Container mtusi2026lab6-worker-1 Started
|
||||
Container mtusi2026lab6-api-2 Started
|
||||
Container mtusi2026lab6-api-1 Starting
|
||||
Container mtusi2026lab6-relay-1 Started
|
||||
Container mtusi2026lab6-api-1 Started
|
||||
Container mtusi2026lab6-s3-1 Waiting
|
||||
Container mtusi2026lab6-api-2 Waiting
|
||||
Container mtusi2026lab6-api-1 Waiting
|
||||
Container mtusi2026lab6-postgres-1 Waiting
|
||||
Container mtusi2026lab6-prometheus-1 Waiting
|
||||
Container mtusi2026lab6-healthtools-1 Waiting
|
||||
Container mtusi2026lab6-otel-collector-1 Waiting
|
||||
Container mtusi2026lab6-worker-1 Waiting
|
||||
Container mtusi2026lab6-valkey-1 Waiting
|
||||
Container mtusi2026lab6-s3-init-1 Waiting
|
||||
Container mtusi2026lab6-tempo-1 Waiting
|
||||
Container mtusi2026lab6-grafana-1 Waiting
|
||||
Container mtusi2026lab6-relay-1 Waiting
|
||||
Container mtusi2026lab6-lb-1 Waiting
|
||||
Container mtusi2026lab6-broker-1 Waiting
|
||||
Container mtusi2026lab6-migrate-1 Waiting
|
||||
Container mtusi2026lab6-loki-1 Waiting
|
||||
Container mtusi2026lab6-migrate-1 Exited
|
||||
Container mtusi2026lab6-s3-1 Healthy
|
||||
Container mtusi2026lab6-grafana-1 Healthy
|
||||
Container mtusi2026lab6-postgres-1 Healthy
|
||||
Container mtusi2026lab6-s3-init-1 Exited
|
||||
Container mtusi2026lab6-broker-1 Healthy
|
||||
Container mtusi2026lab6-otel-collector-1 Healthy
|
||||
Container mtusi2026lab6-prometheus-1 Healthy
|
||||
Container mtusi2026lab6-valkey-1 Healthy
|
||||
Container mtusi2026lab6-healthtools-1 Exited
|
||||
Container mtusi2026lab6-api-2 Healthy
|
||||
Container mtusi2026lab6-api-1 Healthy
|
||||
Container mtusi2026lab6-relay-1 Healthy
|
||||
Container mtusi2026lab6-worker-1 Healthy
|
||||
Container mtusi2026lab6-lb-1 Healthy
|
||||
Container mtusi2026lab6-loki-1 Healthy
|
||||
Container mtusi2026lab6-tempo-1 Healthy
|
||||
scripts/lb-wait.sh
|
||||
exit_code: 0 elapsed_seconds: 85.592
|
||||
@@ -0,0 +1,18 @@
|
||||
date: 2026-11-06T11:37:50Z commit: 447a6507f973596e612f40c1484dda922bf0e50d
|
||||
environment: {"COMPOSE_PROJECT_NAME": "mtusi2026lab6", "LB_HTTP_PORT": "18086", "LB_STATS_PORT": "26085", "BASE_URL": "http://127.0.0.1:18086", "NO_PROXY": "localhost,127.0.0.1,::1"}
|
||||
$ docker ps --format '{{.Names}} {{.Label "com.docker.compose.project"}}'
|
||||
mtusi2026lab6-relay-1 mtusi2026lab6
|
||||
mtusi2026lab6-api-1 mtusi2026lab6
|
||||
mtusi2026lab6-api-2 mtusi2026lab6
|
||||
mtusi2026lab6-worker-1 mtusi2026lab6
|
||||
mtusi2026lab6-grafana-1 mtusi2026lab6
|
||||
mtusi2026lab6-tempo-1 mtusi2026lab6
|
||||
mtusi2026lab6-loki-1 mtusi2026lab6
|
||||
mtusi2026lab6-otel-collector-1 mtusi2026lab6
|
||||
mtusi2026lab6-postgres-1 mtusi2026lab6
|
||||
mtusi2026lab6-broker-1 mtusi2026lab6
|
||||
mtusi2026lab6-lb-1 mtusi2026lab6
|
||||
mtusi2026lab6-prometheus-1 mtusi2026lab6
|
||||
mtusi2026lab6-s3-1 mtusi2026lab6
|
||||
mtusi2026lab6-valkey-1 mtusi2026lab6
|
||||
exit_code: 0 elapsed_seconds: 0.065
|
||||
@@ -0,0 +1,10 @@
|
||||
date: 2026-11-06T18:17:30Z commit: cd9d91550aa4eeba31489e07b71ee2767acfc7d8
|
||||
environment: {"COMPOSE_PROJECT_NAME": "mtusi2026lab6", "LB_HTTP_PORT": "18086", "LB_STATS_PORT": "26085", "BASE_URL": "http://127.0.0.1:18086", "NO_PROXY": "localhost,127.0.0.1,::1"}
|
||||
$ python3 scripts/obs_check.py cardinality
|
||||
usage: obs_check.py [-h] [--prometheus PROMETHEUS] [--loki LOKI]
|
||||
[--tempo TEMPO] [--grafana GRAFANA]
|
||||
[--grafana-password-file GRAFANA_PASSWORD_FILE]
|
||||
[--timeout TIMEOUT]
|
||||
{probe,request,job,leaks,uploads,query,dashboards,grafana,alerts} ...
|
||||
obs_check.py: error: argument command: invalid choice: 'cardinality' (choose from 'probe', 'request', 'job', 'leaks', 'uploads', 'query', 'dashboards', 'grafana', 'alerts')
|
||||
exit_code: 2 elapsed_seconds: 0.062
|
||||
@@ -0,0 +1,600 @@
|
||||
date: 2026-11-06T09:59:19Z commit: 44d81fd80ee13faa42bca069245ee0943f88b2df
|
||||
environment: {"COMPOSE_PROJECT_NAME": "mtusi2026lab6", "LB_HTTP_PORT": "18086", "LB_STATS_PORT": "26085", "BASE_URL": "http://127.0.0.1:18086", "NO_PROXY": "localhost,127.0.0.1,::1"}
|
||||
$ python3 scripts/obs_incidents.py chain
|
||||
{
|
||||
"started": "2026-11-06T09:59:19+00:00",
|
||||
"finished": "2026-11-06T09:59:26+00:00",
|
||||
"result": "PASS",
|
||||
"scenario": "chain",
|
||||
"observations": {
|
||||
"upload_request_id": "c66198d3-2ee1-4f0d-8b14-3b96158af739",
|
||||
"trace_id": "01b6718401f4aa51e87b3486f50500f0",
|
||||
"retry": false,
|
||||
"outcomes": [
|
||||
"done"
|
||||
],
|
||||
"spans": [
|
||||
{
|
||||
"service": "messenger-worker",
|
||||
"name": "BEGIN;",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"span_id": "ec4R0Bkm03M=",
|
||||
"parent_span_id": "w/WXm6BxeQE=",
|
||||
"duration_ms": 0.125,
|
||||
"attempt": null
|
||||
},
|
||||
{
|
||||
"service": "messenger-worker",
|
||||
"name": "select",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"span_id": "iP97TxdsDLc=",
|
||||
"parent_span_id": "w/WXm6BxeQE=",
|
||||
"duration_ms": 0.111,
|
||||
"attempt": null
|
||||
},
|
||||
{
|
||||
"service": "messenger-worker",
|
||||
"name": "select",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"span_id": "kL5eYNKV2R8=",
|
||||
"parent_span_id": "w/WXm6BxeQE=",
|
||||
"duration_ms": 0.082,
|
||||
"attempt": null
|
||||
},
|
||||
{
|
||||
"service": "messenger-worker",
|
||||
"name": "show",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"span_id": "BHoYqet3w6A=",
|
||||
"parent_span_id": "w/WXm6BxeQE=",
|
||||
"duration_ms": 0.054,
|
||||
"attempt": null
|
||||
},
|
||||
{
|
||||
"service": "messenger-worker",
|
||||
"name": "show",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"span_id": "zORTYvXABOE=",
|
||||
"parent_span_id": "w/WXm6BxeQE=",
|
||||
"duration_ms": 0.085,
|
||||
"attempt": null
|
||||
},
|
||||
{
|
||||
"service": "messenger-worker",
|
||||
"name": "ROLLBACK;",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"span_id": "Q0o68RbCwFo=",
|
||||
"parent_span_id": "w/WXm6BxeQE=",
|
||||
"duration_ms": 0.088,
|
||||
"attempt": null
|
||||
},
|
||||
{
|
||||
"service": "messenger-worker",
|
||||
"name": "BEGIN;",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"span_id": "cPrr2Q9ozzI=",
|
||||
"parent_span_id": "w/WXm6BxeQE=",
|
||||
"duration_ms": 0.085,
|
||||
"attempt": null
|
||||
},
|
||||
{
|
||||
"service": "messenger-worker",
|
||||
"name": "UPDATE",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"span_id": "qmZ1v/7izUs=",
|
||||
"parent_span_id": "w/WXm6BxeQE=",
|
||||
"duration_ms": 0.532,
|
||||
"attempt": null
|
||||
},
|
||||
{
|
||||
"service": "messenger-worker",
|
||||
"name": "UPDATE",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"span_id": "wFTBQugE7AA=",
|
||||
"parent_span_id": "w/WXm6BxeQE=",
|
||||
"duration_ms": 0.69,
|
||||
"attempt": null
|
||||
},
|
||||
{
|
||||
"service": "messenger-worker",
|
||||
"name": "INSERT",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"span_id": "xEM7rVOybXM=",
|
||||
"parent_span_id": "w/WXm6BxeQE=",
|
||||
"duration_ms": 0.228,
|
||||
"attempt": null
|
||||
},
|
||||
{
|
||||
"service": "messenger-worker",
|
||||
"name": "SELECT",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"span_id": "k+pcb/sNrDo=",
|
||||
"parent_span_id": "w/WXm6BxeQE=",
|
||||
"duration_ms": 0.143,
|
||||
"attempt": null
|
||||
},
|
||||
{
|
||||
"service": "messenger-worker",
|
||||
"name": "COMMIT;",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"span_id": "nqLQAASj7ag=",
|
||||
"parent_span_id": "w/WXm6BxeQE=",
|
||||
"duration_ms": 0.339,
|
||||
"attempt": null
|
||||
},
|
||||
{
|
||||
"service": "messenger-worker",
|
||||
"name": "BEGIN;",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"span_id": "KdARxGM8uU4=",
|
||||
"parent_span_id": "w/WXm6BxeQE=",
|
||||
"duration_ms": 0.081,
|
||||
"attempt": null
|
||||
},
|
||||
{
|
||||
"service": "messenger-worker",
|
||||
"name": ";",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"span_id": "vzu7yeNCQ38=",
|
||||
"parent_span_id": "w/WXm6BxeQE=",
|
||||
"duration_ms": 0.154,
|
||||
"attempt": null
|
||||
},
|
||||
{
|
||||
"service": "messenger-worker",
|
||||
"name": "ROLLBACK;",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"span_id": "YICpBi0lB60=",
|
||||
"parent_span_id": "w/WXm6BxeQE=",
|
||||
"duration_ms": 0.307,
|
||||
"attempt": null
|
||||
},
|
||||
{
|
||||
"service": "messenger-worker",
|
||||
"name": "BEGIN;",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"span_id": "MUMKQRPy9v0=",
|
||||
"parent_span_id": "w/WXm6BxeQE=",
|
||||
"duration_ms": 0.077,
|
||||
"attempt": null
|
||||
},
|
||||
{
|
||||
"service": "messenger-worker",
|
||||
"name": "UPDATE",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"span_id": "8a6QeUZ92tU=",
|
||||
"parent_span_id": "w/WXm6BxeQE=",
|
||||
"duration_ms": 0.14,
|
||||
"attempt": null
|
||||
},
|
||||
{
|
||||
"service": "messenger-worker",
|
||||
"name": "COMMIT;",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"span_id": "pzSnDERQ274=",
|
||||
"parent_span_id": "w/WXm6BxeQE=",
|
||||
"duration_ms": 0.188,
|
||||
"attempt": null
|
||||
},
|
||||
{
|
||||
"service": "messenger-worker",
|
||||
"name": "BEGIN;",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"span_id": "T7i1Nuj9yZI=",
|
||||
"parent_span_id": "w/WXm6BxeQE=",
|
||||
"duration_ms": 0.115,
|
||||
"attempt": null
|
||||
},
|
||||
{
|
||||
"service": "messenger-worker",
|
||||
"name": ";",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"span_id": "5Ug86nhSihQ=",
|
||||
"parent_span_id": "w/WXm6BxeQE=",
|
||||
"duration_ms": 0.066,
|
||||
"attempt": null
|
||||
},
|
||||
{
|
||||
"service": "messenger-worker",
|
||||
"name": "ROLLBACK;",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"span_id": "RDYZQQi877o=",
|
||||
"parent_span_id": "w/WXm6BxeQE=",
|
||||
"duration_ms": 0.054,
|
||||
"attempt": null
|
||||
},
|
||||
{
|
||||
"service": "messenger-worker",
|
||||
"name": "BEGIN;",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"span_id": "4yhDxc4Apqw=",
|
||||
"parent_span_id": "w/WXm6BxeQE=",
|
||||
"duration_ms": 0.061,
|
||||
"attempt": null
|
||||
},
|
||||
{
|
||||
"service": "messenger-worker",
|
||||
"name": "UPDATE",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"span_id": "ReyPb9uzq6w=",
|
||||
"parent_span_id": "w/WXm6BxeQE=",
|
||||
"duration_ms": 0.15,
|
||||
"attempt": null
|
||||
},
|
||||
{
|
||||
"service": "messenger-worker",
|
||||
"name": "INSERT",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"span_id": "RD8W0N6iQFA=",
|
||||
"parent_span_id": "w/WXm6BxeQE=",
|
||||
"duration_ms": 0.989,
|
||||
"attempt": null
|
||||
},
|
||||
{
|
||||
"service": "messenger-worker",
|
||||
"name": "UPDATE",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"span_id": "QbGIVarUs/8=",
|
||||
"parent_span_id": "w/WXm6BxeQE=",
|
||||
"duration_ms": 0.273,
|
||||
"attempt": null
|
||||
},
|
||||
{
|
||||
"service": "messenger-worker",
|
||||
"name": "INSERT",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"span_id": "kzQeqKPNtdQ=",
|
||||
"parent_span_id": "w/WXm6BxeQE=",
|
||||
"duration_ms": 0.165,
|
||||
"attempt": null
|
||||
},
|
||||
{
|
||||
"service": "messenger-worker",
|
||||
"name": "COMMIT;",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"span_id": "STVSIs1sK5c=",
|
||||
"parent_span_id": "w/WXm6BxeQE=",
|
||||
"duration_ms": 0.397,
|
||||
"attempt": null
|
||||
},
|
||||
{
|
||||
"service": "messenger-worker",
|
||||
"name": "S3 get_object",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"span_id": "IAVwwJlBgC8=",
|
||||
"parent_span_id": "w/WXm6BxeQE=",
|
||||
"duration_ms": 5.942,
|
||||
"attempt": null
|
||||
},
|
||||
{
|
||||
"service": "messenger-worker",
|
||||
"name": "S3 copy_object",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"span_id": "loyxPmCBLpE=",
|
||||
"parent_span_id": "w/WXm6BxeQE=",
|
||||
"duration_ms": 6.386,
|
||||
"attempt": null
|
||||
},
|
||||
{
|
||||
"service": "messenger-worker",
|
||||
"name": "S3 put_object",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"span_id": "vr1ugVYGVbo=",
|
||||
"parent_span_id": "w/WXm6BxeQE=",
|
||||
"duration_ms": 3.402,
|
||||
"attempt": null
|
||||
},
|
||||
{
|
||||
"service": "messenger-worker",
|
||||
"name": "S3 put_object",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"span_id": "5dIA22MtUOs=",
|
||||
"parent_span_id": "w/WXm6BxeQE=",
|
||||
"duration_ms": 2.928,
|
||||
"attempt": null
|
||||
},
|
||||
{
|
||||
"service": "messenger-worker",
|
||||
"name": "S3 put_object",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"span_id": "/qpDiGf0/ng=",
|
||||
"parent_span_id": "w/WXm6BxeQE=",
|
||||
"duration_ms": 2.51,
|
||||
"attempt": null
|
||||
},
|
||||
{
|
||||
"service": "messenger-worker",
|
||||
"name": "attachments.attachment.process.v1 process",
|
||||
"kind": "SPAN_KIND_CONSUMER",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"span_id": "w/WXm6BxeQE=",
|
||||
"parent_span_id": "HMCCZoDJ2P8=",
|
||||
"duration_ms": 869.643,
|
||||
"attempt": "1"
|
||||
},
|
||||
{
|
||||
"service": "messenger-api",
|
||||
"name": "BEGIN;",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"span_id": "hxQI059hSkw=",
|
||||
"parent_span_id": "xaST2SpTu8w=",
|
||||
"duration_ms": 0.083,
|
||||
"attempt": null
|
||||
},
|
||||
{
|
||||
"service": "messenger-api",
|
||||
"name": ";",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"span_id": "NsPVrscA8YA=",
|
||||
"parent_span_id": "xaST2SpTu8w=",
|
||||
"duration_ms": 0.053,
|
||||
"attempt": null
|
||||
},
|
||||
{
|
||||
"service": "messenger-api",
|
||||
"name": "ROLLBACK;",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"span_id": "Qop6hTTQWRc=",
|
||||
"parent_span_id": "xaST2SpTu8w=",
|
||||
"duration_ms": 0.041,
|
||||
"attempt": null
|
||||
},
|
||||
{
|
||||
"service": "messenger-api",
|
||||
"name": "BEGIN;",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"span_id": "6E82ranJFHM=",
|
||||
"parent_span_id": "xaST2SpTu8w=",
|
||||
"duration_ms": 0.089,
|
||||
"attempt": null
|
||||
},
|
||||
{
|
||||
"service": "messenger-api",
|
||||
"name": "SELECT",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"span_id": "iU2v2s/5Xkg=",
|
||||
"parent_span_id": "xaST2SpTu8w=",
|
||||
"duration_ms": 0.322,
|
||||
"attempt": null
|
||||
},
|
||||
{
|
||||
"service": "messenger-api",
|
||||
"name": "ROLLBACK;",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"span_id": "hgzLMkcD+cw=",
|
||||
"parent_span_id": "xaST2SpTu8w=",
|
||||
"duration_ms": 0.084,
|
||||
"attempt": null
|
||||
},
|
||||
{
|
||||
"service": "messenger-api",
|
||||
"name": "BEGIN;",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"span_id": "nFNN95Ux6uc=",
|
||||
"parent_span_id": "xaST2SpTu8w=",
|
||||
"duration_ms": 0.077,
|
||||
"attempt": null
|
||||
},
|
||||
{
|
||||
"service": "messenger-api",
|
||||
"name": ";",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"span_id": "e4zfBC6mzdE=",
|
||||
"parent_span_id": "xaST2SpTu8w=",
|
||||
"duration_ms": 0.051,
|
||||
"attempt": null
|
||||
},
|
||||
{
|
||||
"service": "messenger-api",
|
||||
"name": "ROLLBACK;",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"span_id": "Hm/K7CNm58A=",
|
||||
"parent_span_id": "xaST2SpTu8w=",
|
||||
"duration_ms": 0.041,
|
||||
"attempt": null
|
||||
},
|
||||
{
|
||||
"service": "messenger-api",
|
||||
"name": "BEGIN;",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"span_id": "0CfqVl34eHY=",
|
||||
"parent_span_id": "xaST2SpTu8w=",
|
||||
"duration_ms": 0.076,
|
||||
"attempt": null
|
||||
},
|
||||
{
|
||||
"service": "messenger-api",
|
||||
"name": "INSERT",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"span_id": "6bLA6xEiYKk=",
|
||||
"parent_span_id": "xaST2SpTu8w=",
|
||||
"duration_ms": 0.692,
|
||||
"attempt": null
|
||||
},
|
||||
{
|
||||
"service": "messenger-api",
|
||||
"name": "COMMIT;",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"span_id": "YYAXSZsGAnk=",
|
||||
"parent_span_id": "xaST2SpTu8w=",
|
||||
"duration_ms": 0.197,
|
||||
"attempt": null
|
||||
},
|
||||
{
|
||||
"service": "messenger-api",
|
||||
"name": "BEGIN;",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"span_id": "21NlRZIh1No=",
|
||||
"parent_span_id": "xaST2SpTu8w=",
|
||||
"duration_ms": 0.118,
|
||||
"attempt": null
|
||||
},
|
||||
{
|
||||
"service": "messenger-api",
|
||||
"name": ";",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"span_id": "9R1Ln0frJkk=",
|
||||
"parent_span_id": "xaST2SpTu8w=",
|
||||
"duration_ms": 0.079,
|
||||
"attempt": null
|
||||
},
|
||||
{
|
||||
"service": "messenger-api",
|
||||
"name": "ROLLBACK;",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"span_id": "q8U6KZsG2gs=",
|
||||
"parent_span_id": "xaST2SpTu8w=",
|
||||
"duration_ms": 0.051,
|
||||
"attempt": null
|
||||
},
|
||||
{
|
||||
"service": "messenger-api",
|
||||
"name": "BEGIN;",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"span_id": "VOUk7s3ASuE=",
|
||||
"parent_span_id": "xaST2SpTu8w=",
|
||||
"duration_ms": 0.073,
|
||||
"attempt": null
|
||||
},
|
||||
{
|
||||
"service": "messenger-api",
|
||||
"name": "UPDATE",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"span_id": "h6J/oZlqmCc=",
|
||||
"parent_span_id": "xaST2SpTu8w=",
|
||||
"duration_ms": 0.248,
|
||||
"attempt": null
|
||||
},
|
||||
{
|
||||
"service": "messenger-api",
|
||||
"name": "INSERT",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"span_id": "Dp/lFj9CYZI=",
|
||||
"parent_span_id": "xaST2SpTu8w=",
|
||||
"duration_ms": 0.633,
|
||||
"attempt": null
|
||||
},
|
||||
{
|
||||
"service": "messenger-api",
|
||||
"name": "INSERT",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"span_id": "rlaTBR5DaUU=",
|
||||
"parent_span_id": "xaST2SpTu8w=",
|
||||
"duration_ms": 0.813,
|
||||
"attempt": null
|
||||
},
|
||||
{
|
||||
"service": "messenger-api",
|
||||
"name": "INSERT",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"span_id": "DSHUXsaYmpo=",
|
||||
"parent_span_id": "xaST2SpTu8w=",
|
||||
"duration_ms": 0.857,
|
||||
"attempt": null
|
||||
},
|
||||
{
|
||||
"service": "messenger-api",
|
||||
"name": "COMMIT;",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"span_id": "FSo9VAOcgeg=",
|
||||
"parent_span_id": "xaST2SpTu8w=",
|
||||
"duration_ms": 0.197,
|
||||
"attempt": null
|
||||
},
|
||||
{
|
||||
"service": "messenger-api",
|
||||
"name": "POST /api/v1/chats/{chat_id}/attachments",
|
||||
"kind": "SPAN_KIND_SERVER",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"span_id": "xaST2SpTu8w=",
|
||||
"parent_span_id": null,
|
||||
"duration_ms": 39.756,
|
||||
"attempt": null
|
||||
},
|
||||
{
|
||||
"service": "messenger-api",
|
||||
"name": "S3 put_object",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"span_id": "Ds7zLc8Tpmc=",
|
||||
"parent_span_id": "xaST2SpTu8w=",
|
||||
"duration_ms": 12.464,
|
||||
"attempt": null
|
||||
},
|
||||
{
|
||||
"service": "messenger-relay",
|
||||
"name": "attachments.attachment.process.v1 create",
|
||||
"kind": "SPAN_KIND_PRODUCER",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"span_id": "HMCCZoDJ2P8=",
|
||||
"parent_span_id": "xaST2SpTu8w=",
|
||||
"duration_ms": 0.013,
|
||||
"attempt": null
|
||||
},
|
||||
{
|
||||
"service": "messenger-relay",
|
||||
"name": "attachments.attachment.process.v1 publish",
|
||||
"kind": "SPAN_KIND_PRODUCER",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"span_id": "2Y5nbdOQT/E=",
|
||||
"parent_span_id": "HMCCZoDJ2P8=",
|
||||
"duration_ms": 2.424,
|
||||
"attempt": null
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
exit_code: 0 elapsed_seconds: 6.315
|
||||
@@ -0,0 +1,230 @@
|
||||
date: 2026-11-06T11:38:29Z commit: 447a6507f973596e612f40c1484dda922bf0e50d
|
||||
environment: {"COMPOSE_PROJECT_NAME": "mtusi2026lab6", "LB_HTTP_PORT": "18086", "LB_STATS_PORT": "26085", "BASE_URL": "http://127.0.0.1:18086", "NO_PROXY": "localhost,127.0.0.1,::1"}
|
||||
$ python3 scripts/obs_check.py dashboards --strict
|
||||
{
|
||||
"checked_at": "2026-11-06T11:38:29+00:00",
|
||||
"targets": [
|
||||
{
|
||||
"dashboard": "messenger-api.json",
|
||||
"panel": "RPS бизнес-запросов",
|
||||
"datasource": "prometheus",
|
||||
"series": 1,
|
||||
"missing_metrics": []
|
||||
},
|
||||
{
|
||||
"dashboard": "messenger-api.json",
|
||||
"panel": "Доля 5xx (2m)",
|
||||
"datasource": "prometheus",
|
||||
"series": 1,
|
||||
"missing_metrics": []
|
||||
},
|
||||
{
|
||||
"dashboard": "messenger-api.json",
|
||||
"panel": "p95 latency (5m)",
|
||||
"datasource": "prometheus",
|
||||
"series": 1,
|
||||
"missing_metrics": []
|
||||
},
|
||||
{
|
||||
"dashboard": "messenger-api.json",
|
||||
"panel": "Доля не-5xx (окно 1h)",
|
||||
"datasource": "prometheus",
|
||||
"series": 1,
|
||||
"missing_metrics": []
|
||||
},
|
||||
{
|
||||
"dashboard": "messenger-api.json",
|
||||
"panel": "RPS по маршруту и классу статуса",
|
||||
"datasource": "prometheus",
|
||||
"series": 9,
|
||||
"missing_metrics": []
|
||||
},
|
||||
{
|
||||
"dashboard": "messenger-api.json",
|
||||
"panel": "Доля ошибок",
|
||||
"datasource": "prometheus",
|
||||
"series": 1,
|
||||
"missing_metrics": []
|
||||
},
|
||||
{
|
||||
"dashboard": "messenger-api.json",
|
||||
"panel": "Доля ошибок",
|
||||
"datasource": "prometheus",
|
||||
"series": 1,
|
||||
"missing_metrics": []
|
||||
},
|
||||
{
|
||||
"dashboard": "messenger-api.json",
|
||||
"panel": "Latency p50 / p95 / p99",
|
||||
"datasource": "prometheus",
|
||||
"series": 1,
|
||||
"missing_metrics": []
|
||||
},
|
||||
{
|
||||
"dashboard": "messenger-api.json",
|
||||
"panel": "Latency p50 / p95 / p99",
|
||||
"datasource": "prometheus",
|
||||
"series": 1,
|
||||
"missing_metrics": []
|
||||
},
|
||||
{
|
||||
"dashboard": "messenger-api.json",
|
||||
"panel": "Latency p50 / p95 / p99",
|
||||
"datasource": "prometheus",
|
||||
"series": 1,
|
||||
"missing_metrics": []
|
||||
},
|
||||
{
|
||||
"dashboard": "messenger-api.json",
|
||||
"panel": "p95 по маршруту",
|
||||
"datasource": "prometheus",
|
||||
"series": 8,
|
||||
"missing_metrics": []
|
||||
},
|
||||
{
|
||||
"dashboard": "messenger-api.json",
|
||||
"panel": "RPS по реплике",
|
||||
"datasource": "prometheus",
|
||||
"series": 3,
|
||||
"missing_metrics": []
|
||||
},
|
||||
{
|
||||
"dashboard": "messenger-api.json",
|
||||
"panel": "Активные запросы",
|
||||
"datasource": "prometheus",
|
||||
"series": 8,
|
||||
"missing_metrics": []
|
||||
},
|
||||
{
|
||||
"dashboard": "messenger-api.json",
|
||||
"panel": "Логи API (ошибки и предупреждения)",
|
||||
"datasource": "loki",
|
||||
"lines": 5
|
||||
},
|
||||
{
|
||||
"dashboard": "messenger-api.json",
|
||||
"panel": "Трассы API с ошибкой",
|
||||
"datasource": "tempo",
|
||||
"traces": 0
|
||||
},
|
||||
{
|
||||
"dashboard": "messenger-pipeline.json",
|
||||
"panel": "Jobs по исходу",
|
||||
"datasource": "prometheus",
|
||||
"series": 1,
|
||||
"missing_metrics": []
|
||||
},
|
||||
{
|
||||
"dashboard": "messenger-pipeline.json",
|
||||
"panel": "Длительность обработки job",
|
||||
"datasource": "prometheus",
|
||||
"series": 1,
|
||||
"missing_metrics": []
|
||||
},
|
||||
{
|
||||
"dashboard": "messenger-pipeline.json",
|
||||
"panel": "Длительность обработки job",
|
||||
"datasource": "prometheus",
|
||||
"series": 1,
|
||||
"missing_metrics": []
|
||||
},
|
||||
{
|
||||
"dashboard": "messenger-pipeline.json",
|
||||
"panel": "Длительность обработки job",
|
||||
"datasource": "prometheus",
|
||||
"series": 1,
|
||||
"missing_metrics": []
|
||||
},
|
||||
{
|
||||
"dashboard": "messenger-pipeline.json",
|
||||
"panel": "Логи worker",
|
||||
"datasource": "loki",
|
||||
"lines": 5
|
||||
},
|
||||
{
|
||||
"dashboard": "messenger-pipeline.json",
|
||||
"panel": "Трассы worker",
|
||||
"datasource": "tempo",
|
||||
"traces": 2
|
||||
},
|
||||
{
|
||||
"dashboard": "messenger-pipeline.json",
|
||||
"panel": "Durable queue depth (includes retry)",
|
||||
"datasource": "prometheus",
|
||||
"series": 1,
|
||||
"missing_metrics": []
|
||||
},
|
||||
{
|
||||
"dashboard": "messenger-pipeline.json",
|
||||
"panel": "Oldest durable job age",
|
||||
"datasource": "prometheus",
|
||||
"series": 1,
|
||||
"missing_metrics": []
|
||||
},
|
||||
{
|
||||
"dashboard": "messenger-pipeline.json",
|
||||
"panel": "DB pool used / waiting / capacity",
|
||||
"datasource": "prometheus",
|
||||
"series": 9,
|
||||
"missing_metrics": []
|
||||
},
|
||||
{
|
||||
"dashboard": "messenger-pipeline.json",
|
||||
"panel": "Worker busy / capacity",
|
||||
"datasource": "prometheus",
|
||||
"series": 2,
|
||||
"missing_metrics": []
|
||||
},
|
||||
{
|
||||
"dashboard": "messenger-pipeline.json",
|
||||
"panel": "Process CPU cores",
|
||||
"datasource": "prometheus",
|
||||
"series": 3,
|
||||
"missing_metrics": []
|
||||
},
|
||||
{
|
||||
"dashboard": "messenger-pipeline.json",
|
||||
"panel": "Process resident memory",
|
||||
"datasource": "prometheus",
|
||||
"series": 3,
|
||||
"missing_metrics": []
|
||||
},
|
||||
{
|
||||
"dashboard": "messenger-pipeline.json",
|
||||
"panel": "Time to ready p50 / p95 / p99",
|
||||
"datasource": "prometheus",
|
||||
"series": 1,
|
||||
"missing_metrics": []
|
||||
},
|
||||
{
|
||||
"dashboard": "messenger-pipeline.json",
|
||||
"panel": "Time to ready p50 / p95 / p99",
|
||||
"datasource": "prometheus",
|
||||
"series": 1,
|
||||
"missing_metrics": []
|
||||
},
|
||||
{
|
||||
"dashboard": "messenger-pipeline.json",
|
||||
"panel": "Time to ready p50 / p95 / p99",
|
||||
"datasource": "prometheus",
|
||||
"series": 1,
|
||||
"missing_metrics": []
|
||||
},
|
||||
{
|
||||
"dashboard": "messenger-pipeline.json",
|
||||
"panel": "Ready within 30s, SLO 95% / 1h",
|
||||
"datasource": "prometheus",
|
||||
"series": 1,
|
||||
"missing_metrics": []
|
||||
},
|
||||
{
|
||||
"dashboard": "messenger-pipeline.json",
|
||||
"panel": "API availability, SLO 99% / 1h",
|
||||
"datasource": "prometheus",
|
||||
"series": 1,
|
||||
"missing_metrics": []
|
||||
}
|
||||
],
|
||||
"problems": []
|
||||
}
|
||||
exit_code: 0 elapsed_seconds: 0.105
|
||||
@@ -0,0 +1,18 @@
|
||||
date: 2026-11-06T11:38:44Z commit: 447a6507f973596e612f40c1484dda922bf0e50d
|
||||
environment: {"COMPOSE_PROJECT_NAME": "mtusi2026lab6", "LB_HTTP_PORT": "18086", "LB_STATS_PORT": "26085", "BASE_URL": "http://127.0.0.1:18086", "NO_PROXY": "localhost,127.0.0.1,::1"}
|
||||
$ python3 scripts/obs_incidents.py database
|
||||
Traceback (most recent call last):
|
||||
File "<repo>/scripts/obs_incidents.py", line 349, in <module>
|
||||
main()
|
||||
~~~~^^
|
||||
File "<repo>/scripts/obs_incidents.py", line 332, in main
|
||||
else {"worker": worker, "database": database, "storage": storage}[args.scenario](b)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^
|
||||
File "<repo>/scripts/obs_incidents.py", line 185, in database
|
||||
firing = alert(b, "MessengerHighErrorRate", True)
|
||||
File "<repo>/scripts/obs_incidents.py", line 56, in alert
|
||||
return wait_for(name, check, 150)
|
||||
File "<repo>/scripts/obs_check.py", line 72, in wait_for
|
||||
raise Failure(f"timeout waiting for {what}")
|
||||
obs_check.Failure: timeout waiting for MessengerHighErrorRate
|
||||
exit_code: 1 elapsed_seconds: 167.429
|
||||
@@ -0,0 +1,656 @@
|
||||
date: 2026-11-06T18:12:24Z commit: cd9d91550aa4eeba31489e07b71ee2767acfc7d8
|
||||
environment: {"COMPOSE_PROJECT_NAME": "mtusi2026lab6", "LB_HTTP_PORT": "18086", "LB_STATS_PORT": "26085", "BASE_URL": "http://127.0.0.1:18086", "NO_PROXY": "localhost,127.0.0.1,::1"}
|
||||
$ python3 scripts/obs_incidents.py database
|
||||
{
|
||||
"started": "2026-11-06T18:12:25+00:00",
|
||||
"finished": "2026-11-06T18:14:15+00:00",
|
||||
"result": "PASS",
|
||||
"scenario": "database",
|
||||
"observations": {
|
||||
"paused": "2026-11-06T18:12:37+00:00",
|
||||
"restored": "2026-11-06T18:13:13+00:00",
|
||||
"requests": [
|
||||
{
|
||||
"request_id": "db-incident-8985ff30724f-10",
|
||||
"status": 503
|
||||
},
|
||||
{
|
||||
"request_id": "db-incident-8985ff30724f-11",
|
||||
"status": 503
|
||||
},
|
||||
{
|
||||
"request_id": "db-incident-8985ff30724f-12",
|
||||
"status": 503
|
||||
},
|
||||
{
|
||||
"request_id": "db-incident-8985ff30724f-13",
|
||||
"status": 503
|
||||
},
|
||||
{
|
||||
"request_id": "db-incident-8985ff30724f-14",
|
||||
"status": 503
|
||||
},
|
||||
{
|
||||
"request_id": "db-incident-8985ff30724f-15",
|
||||
"status": 503
|
||||
},
|
||||
{
|
||||
"request_id": "db-incident-8985ff30724f-16",
|
||||
"status": 503
|
||||
},
|
||||
{
|
||||
"request_id": "db-incident-8985ff30724f-17",
|
||||
"status": 503
|
||||
},
|
||||
{
|
||||
"request_id": "db-incident-8985ff30724f-18",
|
||||
"status": 503
|
||||
},
|
||||
{
|
||||
"request_id": "db-incident-8985ff30724f-19",
|
||||
"status": 503
|
||||
},
|
||||
{
|
||||
"request_id": "db-incident-8985ff30724f-20",
|
||||
"status": 503
|
||||
},
|
||||
{
|
||||
"request_id": "db-incident-8985ff30724f-21",
|
||||
"status": 503
|
||||
},
|
||||
{
|
||||
"request_id": "db-incident-8985ff30724f-22",
|
||||
"status": 503
|
||||
},
|
||||
{
|
||||
"request_id": "db-incident-8985ff30724f-23",
|
||||
"status": 503
|
||||
},
|
||||
{
|
||||
"request_id": "db-incident-8985ff30724f-24",
|
||||
"status": 503
|
||||
},
|
||||
{
|
||||
"request_id": "db-incident-8985ff30724f-25",
|
||||
"status": 503
|
||||
},
|
||||
{
|
||||
"request_id": "db-incident-8985ff30724f-26",
|
||||
"status": 503
|
||||
},
|
||||
{
|
||||
"request_id": "db-incident-8985ff30724f-27",
|
||||
"status": 503
|
||||
},
|
||||
{
|
||||
"request_id": "db-incident-8985ff30724f-28",
|
||||
"status": 503
|
||||
},
|
||||
{
|
||||
"request_id": "db-incident-8985ff30724f-29",
|
||||
"status": 503
|
||||
},
|
||||
{
|
||||
"request_id": "db-incident-8985ff30724f-30",
|
||||
"status": 503
|
||||
},
|
||||
{
|
||||
"request_id": "db-incident-8985ff30724f-31",
|
||||
"status": 503
|
||||
},
|
||||
{
|
||||
"request_id": "db-incident-8985ff30724f-32",
|
||||
"status": 503
|
||||
},
|
||||
{
|
||||
"request_id": "db-incident-8985ff30724f-33",
|
||||
"status": 503
|
||||
},
|
||||
{
|
||||
"request_id": "db-incident-8985ff30724f-34",
|
||||
"status": 503
|
||||
},
|
||||
{
|
||||
"request_id": "db-incident-8985ff30724f-35",
|
||||
"status": 503
|
||||
},
|
||||
{
|
||||
"request_id": "db-incident-8985ff30724f-36",
|
||||
"status": 503
|
||||
},
|
||||
{
|
||||
"request_id": "db-incident-8985ff30724f-37",
|
||||
"status": 503
|
||||
},
|
||||
{
|
||||
"request_id": "db-incident-8985ff30724f-38",
|
||||
"status": 503
|
||||
},
|
||||
{
|
||||
"request_id": "db-incident-8985ff30724f-39",
|
||||
"status": 503
|
||||
},
|
||||
{
|
||||
"request_id": "db-incident-8985ff30724f-40",
|
||||
"status": 503
|
||||
},
|
||||
{
|
||||
"request_id": "db-incident-8985ff30724f-41",
|
||||
"status": 503
|
||||
},
|
||||
{
|
||||
"request_id": "db-incident-8985ff30724f-42",
|
||||
"status": 503
|
||||
},
|
||||
{
|
||||
"request_id": "db-incident-8985ff30724f-43",
|
||||
"status": 503
|
||||
},
|
||||
{
|
||||
"request_id": "db-incident-8985ff30724f-44",
|
||||
"status": 503
|
||||
},
|
||||
{
|
||||
"request_id": "db-incident-8985ff30724f-45",
|
||||
"status": 503
|
||||
},
|
||||
{
|
||||
"request_id": "db-incident-8985ff30724f-46",
|
||||
"status": 503
|
||||
},
|
||||
{
|
||||
"request_id": "db-incident-8985ff30724f-47",
|
||||
"status": 503
|
||||
},
|
||||
{
|
||||
"request_id": "db-incident-8985ff30724f-48",
|
||||
"status": 503
|
||||
},
|
||||
{
|
||||
"request_id": "db-incident-8985ff30724f-49",
|
||||
"status": 503
|
||||
},
|
||||
{
|
||||
"request_id": "db-incident-8985ff30724f-50",
|
||||
"status": 503
|
||||
},
|
||||
{
|
||||
"request_id": "db-incident-8985ff30724f-51",
|
||||
"status": 503
|
||||
},
|
||||
{
|
||||
"request_id": "db-incident-8985ff30724f-52",
|
||||
"status": 503
|
||||
},
|
||||
{
|
||||
"request_id": "db-incident-8985ff30724f-53",
|
||||
"status": 503
|
||||
},
|
||||
{
|
||||
"request_id": "db-incident-8985ff30724f-54",
|
||||
"status": 503
|
||||
},
|
||||
{
|
||||
"request_id": "db-incident-8985ff30724f-55",
|
||||
"status": 503
|
||||
},
|
||||
{
|
||||
"request_id": "db-incident-8985ff30724f-56",
|
||||
"status": 503
|
||||
},
|
||||
{
|
||||
"request_id": "db-incident-8985ff30724f-57",
|
||||
"status": 503
|
||||
},
|
||||
{
|
||||
"request_id": "db-incident-8985ff30724f-58",
|
||||
"status": 503
|
||||
},
|
||||
{
|
||||
"request_id": "db-incident-8985ff30724f-59",
|
||||
"status": 503
|
||||
},
|
||||
{
|
||||
"request_id": "db-incident-8985ff30724f-60",
|
||||
"status": 503
|
||||
},
|
||||
{
|
||||
"request_id": "db-incident-8985ff30724f-61",
|
||||
"status": 503
|
||||
},
|
||||
{
|
||||
"request_id": "db-incident-8985ff30724f-62",
|
||||
"status": 503
|
||||
},
|
||||
{
|
||||
"request_id": "db-incident-8985ff30724f-63",
|
||||
"status": 503
|
||||
},
|
||||
{
|
||||
"request_id": "db-incident-8985ff30724f-64",
|
||||
"status": 503
|
||||
},
|
||||
{
|
||||
"request_id": "db-incident-8985ff30724f-65",
|
||||
"status": 503
|
||||
},
|
||||
{
|
||||
"request_id": "db-incident-8985ff30724f-66",
|
||||
"status": 503
|
||||
},
|
||||
{
|
||||
"request_id": "db-incident-8985ff30724f-67",
|
||||
"status": 503
|
||||
},
|
||||
{
|
||||
"request_id": "db-incident-8985ff30724f-68",
|
||||
"status": 503
|
||||
},
|
||||
{
|
||||
"request_id": "db-incident-8985ff30724f-69",
|
||||
"status": 503
|
||||
},
|
||||
{
|
||||
"request_id": "db-incident-8985ff30724f-70",
|
||||
"status": 503
|
||||
},
|
||||
{
|
||||
"request_id": "db-incident-8985ff30724f-71",
|
||||
"status": 503
|
||||
},
|
||||
{
|
||||
"request_id": "db-incident-8985ff30724f-72",
|
||||
"status": 503
|
||||
},
|
||||
{
|
||||
"request_id": "db-incident-8985ff30724f-73",
|
||||
"status": 503
|
||||
},
|
||||
{
|
||||
"request_id": "db-incident-8985ff30724f-74",
|
||||
"status": 503
|
||||
},
|
||||
{
|
||||
"request_id": "db-incident-8985ff30724f-75",
|
||||
"status": 503
|
||||
},
|
||||
{
|
||||
"request_id": "db-incident-8985ff30724f-76",
|
||||
"status": 503
|
||||
},
|
||||
{
|
||||
"request_id": "db-incident-8985ff30724f-77",
|
||||
"status": 503
|
||||
},
|
||||
{
|
||||
"request_id": "db-incident-8985ff30724f-78",
|
||||
"status": 503
|
||||
},
|
||||
{
|
||||
"request_id": "db-incident-8985ff30724f-79",
|
||||
"status": 503
|
||||
},
|
||||
{
|
||||
"request_id": "db-incident-8985ff30724f-80",
|
||||
"status": 503
|
||||
},
|
||||
{
|
||||
"request_id": "db-incident-8985ff30724f-81",
|
||||
"status": 503
|
||||
},
|
||||
{
|
||||
"request_id": "db-incident-8985ff30724f-82",
|
||||
"status": 503
|
||||
},
|
||||
{
|
||||
"request_id": "db-incident-8985ff30724f-83",
|
||||
"status": 503
|
||||
},
|
||||
{
|
||||
"request_id": "db-incident-8985ff30724f-84",
|
||||
"status": 503
|
||||
},
|
||||
{
|
||||
"request_id": "db-incident-8985ff30724f-85",
|
||||
"status": 503
|
||||
},
|
||||
{
|
||||
"request_id": "db-incident-8985ff30724f-86",
|
||||
"status": 503
|
||||
},
|
||||
{
|
||||
"request_id": "db-incident-8985ff30724f-87",
|
||||
"status": 503
|
||||
},
|
||||
{
|
||||
"request_id": "db-incident-8985ff30724f-88",
|
||||
"status": 503
|
||||
},
|
||||
{
|
||||
"request_id": "db-incident-8985ff30724f-89",
|
||||
"status": 503
|
||||
},
|
||||
{
|
||||
"request_id": "db-incident-8985ff30724f-90",
|
||||
"status": 503
|
||||
},
|
||||
{
|
||||
"request_id": "db-incident-8985ff30724f-91",
|
||||
"status": 503
|
||||
},
|
||||
{
|
||||
"request_id": "db-incident-8985ff30724f-92",
|
||||
"status": 503
|
||||
},
|
||||
{
|
||||
"request_id": "db-incident-8985ff30724f-93",
|
||||
"status": 503
|
||||
},
|
||||
{
|
||||
"request_id": "db-incident-8985ff30724f-94",
|
||||
"status": 503
|
||||
},
|
||||
{
|
||||
"request_id": "db-incident-8985ff30724f-95",
|
||||
"status": 503
|
||||
},
|
||||
{
|
||||
"request_id": "db-incident-8985ff30724f-96",
|
||||
"status": 503
|
||||
},
|
||||
{
|
||||
"request_id": "db-incident-8985ff30724f-97",
|
||||
"status": 503
|
||||
},
|
||||
{
|
||||
"request_id": "db-incident-8985ff30724f-98",
|
||||
"status": 503
|
||||
},
|
||||
{
|
||||
"request_id": "db-incident-8985ff30724f-99",
|
||||
"status": 503
|
||||
},
|
||||
{
|
||||
"request_id": "db-incident-8985ff30724f-100",
|
||||
"status": 503
|
||||
},
|
||||
{
|
||||
"request_id": "db-incident-8985ff30724f-101",
|
||||
"status": 503
|
||||
},
|
||||
{
|
||||
"request_id": "db-incident-8985ff30724f-102",
|
||||
"status": 503
|
||||
},
|
||||
{
|
||||
"request_id": "db-incident-8985ff30724f-103",
|
||||
"status": 503
|
||||
},
|
||||
{
|
||||
"request_id": "db-incident-8985ff30724f-104",
|
||||
"status": 503
|
||||
},
|
||||
{
|
||||
"request_id": "db-incident-8985ff30724f-105",
|
||||
"status": 503
|
||||
},
|
||||
{
|
||||
"request_id": "db-incident-8985ff30724f-106",
|
||||
"status": 503
|
||||
},
|
||||
{
|
||||
"request_id": "db-incident-8985ff30724f-107",
|
||||
"status": 503
|
||||
},
|
||||
{
|
||||
"request_id": "db-incident-8985ff30724f-108",
|
||||
"status": 503
|
||||
},
|
||||
{
|
||||
"request_id": "db-incident-8985ff30724f-109",
|
||||
"status": 503
|
||||
},
|
||||
{
|
||||
"request_id": "db-incident-8985ff30724f-110",
|
||||
"status": 503
|
||||
},
|
||||
{
|
||||
"request_id": "db-incident-8985ff30724f-111",
|
||||
"status": 503
|
||||
},
|
||||
{
|
||||
"request_id": "db-incident-8985ff30724f-112",
|
||||
"status": 503
|
||||
},
|
||||
{
|
||||
"request_id": "db-incident-8985ff30724f-113",
|
||||
"status": 503
|
||||
},
|
||||
{
|
||||
"request_id": "db-incident-8985ff30724f-114",
|
||||
"status": 503
|
||||
},
|
||||
{
|
||||
"request_id": "db-incident-8985ff30724f-115",
|
||||
"status": 503
|
||||
},
|
||||
{
|
||||
"request_id": "db-incident-8985ff30724f-116",
|
||||
"status": 503
|
||||
},
|
||||
{
|
||||
"request_id": "db-incident-8985ff30724f-117",
|
||||
"status": 503
|
||||
},
|
||||
{
|
||||
"request_id": "db-incident-8985ff30724f-118",
|
||||
"status": 503
|
||||
},
|
||||
{
|
||||
"request_id": "db-incident-8985ff30724f-119",
|
||||
"status": 503
|
||||
},
|
||||
{
|
||||
"request_id": "db-incident-8985ff30724f-120",
|
||||
"status": 503
|
||||
},
|
||||
{
|
||||
"request_id": "db-incident-8985ff30724f-121",
|
||||
"status": 503
|
||||
},
|
||||
{
|
||||
"request_id": "db-incident-8985ff30724f-122",
|
||||
"status": 503
|
||||
},
|
||||
{
|
||||
"request_id": "db-incident-8985ff30724f-123",
|
||||
"status": 503
|
||||
},
|
||||
{
|
||||
"request_id": "db-incident-8985ff30724f-124",
|
||||
"status": 503
|
||||
},
|
||||
{
|
||||
"request_id": "db-incident-8985ff30724f-125",
|
||||
"status": 503
|
||||
},
|
||||
{
|
||||
"request_id": "db-incident-8985ff30724f-126",
|
||||
"status": 503
|
||||
},
|
||||
{
|
||||
"request_id": "db-incident-8985ff30724f-127",
|
||||
"status": 503
|
||||
},
|
||||
{
|
||||
"request_id": "db-incident-8985ff30724f-128",
|
||||
"status": 503
|
||||
},
|
||||
{
|
||||
"request_id": "db-incident-8985ff30724f-129",
|
||||
"status": 503
|
||||
},
|
||||
{
|
||||
"request_id": "db-incident-8985ff30724f-130",
|
||||
"status": 503
|
||||
},
|
||||
{
|
||||
"request_id": "db-incident-8985ff30724f-131",
|
||||
"status": 503
|
||||
},
|
||||
{
|
||||
"request_id": "db-incident-8985ff30724f-132",
|
||||
"status": 503
|
||||
},
|
||||
{
|
||||
"request_id": "db-incident-8985ff30724f-133",
|
||||
"status": 503
|
||||
},
|
||||
{
|
||||
"request_id": "db-incident-8985ff30724f-134",
|
||||
"status": 503
|
||||
},
|
||||
{
|
||||
"request_id": "db-incident-8985ff30724f-135",
|
||||
"status": 503
|
||||
},
|
||||
{
|
||||
"request_id": "db-incident-8985ff30724f-136",
|
||||
"status": 503
|
||||
},
|
||||
{
|
||||
"request_id": "db-incident-8985ff30724f-137",
|
||||
"status": 503
|
||||
},
|
||||
{
|
||||
"request_id": "db-incident-8985ff30724f-138",
|
||||
"status": 503
|
||||
},
|
||||
{
|
||||
"request_id": "db-incident-8985ff30724f-139",
|
||||
"status": 503
|
||||
},
|
||||
{
|
||||
"request_id": "db-incident-8985ff30724f-140",
|
||||
"status": 503
|
||||
},
|
||||
{
|
||||
"request_id": "db-incident-8985ff30724f-141",
|
||||
"status": 503
|
||||
},
|
||||
{
|
||||
"request_id": "db-incident-8985ff30724f-142",
|
||||
"status": 503
|
||||
},
|
||||
{
|
||||
"request_id": "db-incident-8985ff30724f-143",
|
||||
"status": 503
|
||||
},
|
||||
{
|
||||
"request_id": "db-incident-8985ff30724f-144",
|
||||
"status": 503
|
||||
},
|
||||
{
|
||||
"request_id": "db-incident-8985ff30724f-145",
|
||||
"status": 503
|
||||
},
|
||||
{
|
||||
"request_id": "db-incident-8985ff30724f-146",
|
||||
"status": 503
|
||||
},
|
||||
{
|
||||
"request_id": "db-incident-8985ff30724f-147",
|
||||
"status": 503
|
||||
},
|
||||
{
|
||||
"request_id": "db-incident-8985ff30724f-148",
|
||||
"status": 503
|
||||
},
|
||||
{
|
||||
"request_id": "db-incident-8985ff30724f-149",
|
||||
"status": 503
|
||||
},
|
||||
{
|
||||
"request_id": "db-incident-8985ff30724f-150",
|
||||
"status": 503
|
||||
},
|
||||
{
|
||||
"request_id": "db-incident-8985ff30724f-151",
|
||||
"status": 503
|
||||
},
|
||||
{
|
||||
"request_id": "db-incident-8985ff30724f-152",
|
||||
"status": 503
|
||||
},
|
||||
{
|
||||
"request_id": "db-incident-8985ff30724f-153",
|
||||
"status": 503
|
||||
}
|
||||
],
|
||||
"signals": {
|
||||
"error_ratio": 1.0,
|
||||
"pool_waiting": 0.0
|
||||
},
|
||||
"firing": {
|
||||
"utc": "2026-11-06T18:13:13+00:00",
|
||||
"state": "firing",
|
||||
"alerts": [
|
||||
{
|
||||
"labels": {
|
||||
"alertname": "MessengerHighErrorRate",
|
||||
"severity": "warning"
|
||||
},
|
||||
"annotations": {
|
||||
"description": "Availability target is 99% over 1 hour; health and client 4xx are excluded from failures.",
|
||||
"runbook": "infra/prometheus/runbooks.md#messengerhigherrorrate",
|
||||
"summary": "More than 5% business HTTP 5xx over 1 minute"
|
||||
},
|
||||
"state": "firing",
|
||||
"activeAt": "2026-11-06T18:12:58.389340978Z",
|
||||
"value": "1e+00"
|
||||
}
|
||||
]
|
||||
},
|
||||
"resolved": {
|
||||
"utc": "2026-11-06T18:14:14+00:00",
|
||||
"state": "resolved",
|
||||
"alerts": []
|
||||
},
|
||||
"dependency_traces": [
|
||||
{
|
||||
"trace_id": "56a65d4cf3881f888a2550ca344f578e",
|
||||
"db_errors": [
|
||||
{
|
||||
"name": "SELECT",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_ERROR",
|
||||
"duration_ms": 2002.331
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"trace_id": "36ab8690d98f80687f5983bfa9a50d3c",
|
||||
"db_errors": [
|
||||
{
|
||||
"name": "SELECT",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_ERROR",
|
||||
"duration_ms": 2004.439
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"trace_id": "ef191d8d6bc7ab4d4d87feefaa464ffe",
|
||||
"db_errors": [
|
||||
{
|
||||
"name": "SELECT",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_ERROR",
|
||||
"duration_ms": 2010.771
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
exit_code: 0 elapsed_seconds: 110.856
|
||||
@@ -0,0 +1,44 @@
|
||||
date: 2026-11-06T11:34:43Z commit: 447a6507f973596e612f40c1484dda922bf0e50d
|
||||
environment: {"COMPOSE_PROJECT_NAME": "mtusi2026lab6", "LB_HTTP_PORT": "18086", "LB_STATS_PORT": "26085", "BASE_URL": "http://127.0.0.1:18086", "NO_PROXY": "localhost,127.0.0.1,::1"}
|
||||
$ env EVIDENCE_DIR=evidence/grade4/failover make failover-evidence SHIFT=0
|
||||
sh scripts/failover-evidence.sh "http://127.0.0.1:18086" "0"
|
||||
date: 2026-11-06T11:34:43Z commit: 447a6507f973596e612f40c1484dda922bf0e50d
|
||||
== before: api replicas (hostname = X-Instance-Id), state, StartedAt, FinishedAt
|
||||
60787bbfae10 running started=2026-11-06T11:34:39.928086134Z finished=2026-11-06T11:34:33.549212797Z
|
||||
b3d83f79f546 running started=2026-11-06T11:34:40.000869551Z finished=2026-11-06T11:34:33.543407339Z
|
||||
$ make test-failover ACTION_SCRIPT=scripts/stop-one.sh
|
||||
python3 tests/resilience.py --mode failover --action-script "scripts/stop-one.sh" --base-url "http://127.0.0.1:18086"
|
||||
Executing explicit failover hook; hook output suppressed to avoid leaking secrets.
|
||||
{"observed_instances_before": 2, "successful_writes": 131, "failed_attempts": 0, "first_recovery_seconds": 2.844}
|
||||
PASS: failover preserved confirmed data and existing session. Hook scope needs operator evidence.
|
||||
== after: api replicas
|
||||
60787bbfae10 running started=2026-11-06T11:34:39.928086134Z finished=2026-11-06T11:34:33.549212797Z
|
||||
b3d83f79f546 exited started=2026-11-06T11:34:40.000869551Z finished=2026-11-06T11:34:48.429366971Z
|
||||
== stopped replica: b3d83f79f546; shutdown: signal, drain window with readiness 503, close, exit
|
||||
{"event":"Handling signal: term","level":"info","ts":"2026-11-06T11:34:45.913524Z"}
|
||||
{"limit":2.0,"event":"service.draining","level":"info","ts":"2026-11-06T11:34:45.938489Z"}
|
||||
{"limit":2.0,"event":"service.draining","level":"info","ts":"2026-11-06T11:34:45.977221Z"}
|
||||
{"method":"GET","route":"/health/ready","status":503,"request_id":"41dd383e94a3402eb46cbb33a22d66bf","duration_ms":1.036,"event":"request.handled","level":"info","ts":"2026-11-06T11:34:46.188407Z"}
|
||||
{"method":"GET","route":"/health/ready","status":503,"request_id":"977969cc9efe4c68b46a1b03730fa3d7","duration_ms":0.288,"event":"request.handled","level":"info","ts":"2026-11-06T11:34:46.560434Z"}
|
||||
{"method":"GET","route":"/health/ready","status":503,"request_id":"1d1cd824e63f42d6bc35f8162ac660bd","duration_ms":0.344,"event":"request.handled","level":"info","ts":"2026-11-06T11:34:46.695325Z"}
|
||||
{"event":"Shutting down","level":"info","ts":"2026-11-06T11:34:47.938966Z"}
|
||||
{"event":"Shutting down","level":"info","ts":"2026-11-06T11:34:47.978946Z"}
|
||||
{"event":"service.stopped","level":"info","ts":"2026-11-06T11:34:48.041941Z"}
|
||||
{"event":"Finished server process [21]","level":"info","ts":"2026-11-06T11:34:48.045395Z"}
|
||||
{"event":"Worker (pid:21) was sent SIGTERM!","level":"info","ts":"2026-11-06T11:34:48.057249Z"}
|
||||
{"event":"service.stopped","level":"info","ts":"2026-11-06T11:34:48.081771Z"}
|
||||
{"event":"Finished server process [26]","level":"info","ts":"2026-11-06T11:34:48.086046Z"}
|
||||
{"event":"Worker (pid:26) was sent SIGTERM!","level":"info","ts":"2026-11-06T11:34:48.158260Z"}
|
||||
{"event":"Shutting down: Master","level":"info","ts":"2026-11-06T11:34:48.263693Z"}
|
||||
$ scripts/restore.sh
|
||||
Container mtusi2026lab6-api-1 Running
|
||||
Container mtusi2026lab6-api-2 Starting
|
||||
Container mtusi2026lab6-api-2 Started
|
||||
Container mtusi2026lab6-api-1 Waiting
|
||||
Container mtusi2026lab6-api-2 Waiting
|
||||
Container mtusi2026lab6-api-1 Healthy
|
||||
Container mtusi2026lab6-api-2 Healthy
|
||||
== after restore
|
||||
60787bbfae10 running started=2026-11-06T11:34:39.928086134Z finished=2026-11-06T11:34:33.549212797Z
|
||||
b3d83f79f546 running started=2026-11-06T11:35:01.309446421Z finished=2026-11-06T11:34:48.429366971Z
|
||||
exit_code: 0 elapsed_seconds: 21.152
|
||||
@@ -0,0 +1,39 @@
|
||||
date: 2026-11-06T11:34:43Z commit: 447a6507f973596e612f40c1484dda922bf0e50d
|
||||
== before: api replicas (hostname = X-Instance-Id), state, StartedAt, FinishedAt
|
||||
60787bbfae10 running started=2026-11-06T11:34:39.928086134Z finished=2026-11-06T11:34:33.549212797Z
|
||||
b3d83f79f546 running started=2026-11-06T11:34:40.000869551Z finished=2026-11-06T11:34:33.543407339Z
|
||||
$ make test-failover ACTION_SCRIPT=scripts/stop-one.sh
|
||||
python3 tests/resilience.py --mode failover --action-script "scripts/stop-one.sh" --base-url "http://127.0.0.1:18086"
|
||||
Executing explicit failover hook; hook output suppressed to avoid leaking secrets.
|
||||
{"observed_instances_before": 2, "successful_writes": 131, "failed_attempts": 0, "first_recovery_seconds": 2.844}
|
||||
PASS: failover preserved confirmed data and existing session. Hook scope needs operator evidence.
|
||||
== after: api replicas
|
||||
60787bbfae10 running started=2026-11-06T11:34:39.928086134Z finished=2026-11-06T11:34:33.549212797Z
|
||||
b3d83f79f546 exited started=2026-11-06T11:34:40.000869551Z finished=2026-11-06T11:34:48.429366971Z
|
||||
== stopped replica: b3d83f79f546; shutdown: signal, drain window with readiness 503, close, exit
|
||||
{"event":"Handling signal: term","level":"info","ts":"2026-11-06T11:34:45.913524Z"}
|
||||
{"limit":2.0,"event":"service.draining","level":"info","ts":"2026-11-06T11:34:45.938489Z"}
|
||||
{"limit":2.0,"event":"service.draining","level":"info","ts":"2026-11-06T11:34:45.977221Z"}
|
||||
{"method":"GET","route":"/health/ready","status":503,"request_id":"41dd383e94a3402eb46cbb33a22d66bf","duration_ms":1.036,"event":"request.handled","level":"info","ts":"2026-11-06T11:34:46.188407Z"}
|
||||
{"method":"GET","route":"/health/ready","status":503,"request_id":"977969cc9efe4c68b46a1b03730fa3d7","duration_ms":0.288,"event":"request.handled","level":"info","ts":"2026-11-06T11:34:46.560434Z"}
|
||||
{"method":"GET","route":"/health/ready","status":503,"request_id":"1d1cd824e63f42d6bc35f8162ac660bd","duration_ms":0.344,"event":"request.handled","level":"info","ts":"2026-11-06T11:34:46.695325Z"}
|
||||
{"event":"Shutting down","level":"info","ts":"2026-11-06T11:34:47.938966Z"}
|
||||
{"event":"Shutting down","level":"info","ts":"2026-11-06T11:34:47.978946Z"}
|
||||
{"event":"service.stopped","level":"info","ts":"2026-11-06T11:34:48.041941Z"}
|
||||
{"event":"Finished server process [21]","level":"info","ts":"2026-11-06T11:34:48.045395Z"}
|
||||
{"event":"Worker (pid:21) was sent SIGTERM!","level":"info","ts":"2026-11-06T11:34:48.057249Z"}
|
||||
{"event":"service.stopped","level":"info","ts":"2026-11-06T11:34:48.081771Z"}
|
||||
{"event":"Finished server process [26]","level":"info","ts":"2026-11-06T11:34:48.086046Z"}
|
||||
{"event":"Worker (pid:26) was sent SIGTERM!","level":"info","ts":"2026-11-06T11:34:48.158260Z"}
|
||||
{"event":"Shutting down: Master","level":"info","ts":"2026-11-06T11:34:48.263693Z"}
|
||||
$ scripts/restore.sh
|
||||
Container mtusi2026lab6-api-1 Running
|
||||
Container mtusi2026lab6-api-2 Starting
|
||||
Container mtusi2026lab6-api-2 Started
|
||||
Container mtusi2026lab6-api-1 Waiting
|
||||
Container mtusi2026lab6-api-2 Waiting
|
||||
Container mtusi2026lab6-api-1 Healthy
|
||||
Container mtusi2026lab6-api-2 Healthy
|
||||
== after restore
|
||||
60787bbfae10 running started=2026-11-06T11:34:39.928086134Z finished=2026-11-06T11:34:33.549212797Z
|
||||
b3d83f79f546 running started=2026-11-06T11:35:01.309446421Z finished=2026-11-06T11:34:48.429366971Z
|
||||
@@ -0,0 +1,12 @@
|
||||
[
|
||||
{
|
||||
"severity": "minor",
|
||||
"file": "scripts/limits.py:33; .github/workflows/application.yml:85",
|
||||
"problem": "Inherited service allowlists omit OTel/helper services. Runtime limits checked independently in evidence/grade3/runtime.json; helper audit remains incompatible."
|
||||
},
|
||||
{
|
||||
"severity": "minor",
|
||||
"file": "infra/prometheus/rules/messenger.alerts.yml",
|
||||
"problem": "API error-rate SLI excludes HAProxy-generated 503 and can miss the first burst of a new counter series. Full PostgreSQL pause did not fire (database-incident.txt); sustained SQL-lock incident is verified separately."
|
||||
}
|
||||
]
|
||||
@@ -0,0 +1,27 @@
|
||||
date: 2026-11-06T18:17:15Z commit: cd9d91550aa4eeba31489e07b71ee2767acfc7d8
|
||||
environment: {"COMPOSE_PROJECT_NAME": "mtusi2026lab6", "LB_HTTP_PORT": "18086", "LB_STATS_PORT": "26085", "BASE_URL": "http://127.0.0.1:18086", "NO_PROXY": "localhost,127.0.0.1,::1"}
|
||||
$ python3 scripts/obs_check.py leaks
|
||||
{
|
||||
"checked_at": "2026-11-06T18:17:30+00:00",
|
||||
"window_seconds": 20,
|
||||
"traces_scanned": 0,
|
||||
"hits": {
|
||||
"password": {
|
||||
"loki": 0,
|
||||
"tempo": 0
|
||||
},
|
||||
"token": {
|
||||
"loki": 0,
|
||||
"tempo": 0
|
||||
},
|
||||
"message_text": {
|
||||
"loki": 0,
|
||||
"tempo": 0
|
||||
},
|
||||
"filename": {
|
||||
"loki": 0,
|
||||
"tempo": 0
|
||||
}
|
||||
}
|
||||
}
|
||||
exit_code: 0 elapsed_seconds: 15.205
|
||||
@@ -0,0 +1,45 @@
|
||||
# Уровень 4 — заметки для отдельного отчёта
|
||||
|
||||
Код приложения: 44d81fd80ee13faa42bca069245ee0943f88b2df. Обвязка retry: 447a6507f973596e612f40c1484dda922bf0e50d. Даты UTC, SHA, команды и exit_code находятся в command logs. Команды выполняются через scripts/lab6.sh.
|
||||
|
||||
## Реализованные сигналы
|
||||
|
||||
Контекст traceparent/tracestate хранится отдельно от job payload в JSONB jobs/outbox (Alembic 0007); retry использует consumer context, восстановление аренды — сохранённый origin. FastStream relay создаёт producer spans; consumer сохраняет родителя. S3 client spans содержат только операцию, rpc.service=S3, тип ошибки; ключи и exception payload не записываются. SQLAlchemy/asyncpg дают DB client spans. Ack после COMMIT сохранён.
|
||||
|
||||
| Сигнал | Источник, единица, labels |
|
||||
|---|---|
|
||||
| messenger_queue_depth / messenger_queue_oldest_age_seconds | SQLAlchemy poll каждые 5 s: durable queued/processing, включая retry; jobs / s; queue_name=attachments.process |
|
||||
| messenger_db_pool_used/waiting/capacity | SQLAlchemy ObservedPool; connections / acquisitions / connections; service resource, без IDs в labels |
|
||||
| messenger_worker_busy/capacity | текущие выполняемые deliveries / prefetch capacity, jobs |
|
||||
| messenger_job_time_to_ready_seconds_* | histogram от Job.created_at до done после commit; buckets 0.05,0.1,0.25,0.5,1,2,5,10,30,60,+Inf; job_type |
|
||||
| process_cpu_time_seconds_total | os.times user+system процесса; s; rate даёт cores; CPU дочерних renderer не включён |
|
||||
| process_memory_usage_bytes | текущий RSS /proc/self/statm внутри Linux container; bytes |
|
||||
|
||||
API p50/p95/p99 = histogram_quantile по sum(rate(bucket[5m])) всех реплик. Доля ошибок — 5xx/все бизнес-HTTP без health. Availability SLO 99% за 1 h; time-to-ready SLO 95% <=30 s за 1 h среди завершённых jobs; pending отдельно контролирует queue lag. Все запросы и единицы находятся в provisioned dashboards. Runbooks: infra/prometheus/runbooks.md. Alerts локальные, без внешней отправки.
|
||||
|
||||
## Проверки
|
||||
|
||||
- obs-validate.txt: Collector, Prometheus, Loki, Tempo, dashboard JSON — PASS.
|
||||
- quality.txt: check, validate, lint — PASS.
|
||||
- student-tests-final.txt: 516 passed, 1 Linux-only skip, 19 stack deselected; migrations fresh/legacy/idempotence и context/lease recovery проходят.
|
||||
- chain.txt: реальный upload trace API→S3/DB→producer→consumer→DB COMMIT.
|
||||
- retry-isolated.txt: тот же trace включает retry_scheduled и done после отказа S3.
|
||||
- smoke.txt, persistence-resumed.txt, failover.txt: публичные сценарии PASS; replica restored.
|
||||
|
||||
## Неуспешные и прерванные попытки
|
||||
|
||||
student-tests-first.txt выявил раннее получение DB connection: нарушались lazy session и advisory-lock autocommit. Исправлено обёрткой ObservedPool._do_get без изменения границ транзакции. student-tests.txt затем обнаружил неверно расширенный allowlist собственного архитектурного теста; исправлено, итоговый полный прогон зелёный. retry.txt не создал отказ: docker compose start worker запускал зависимости, включая S3. retry-isolated.txt использует up --no-deps и подтверждает настоящий retry. persistence.txt прерван извне без exit_code и не является PASS; persistence-resumed.txt завершён после восстановления того же образа с прежними volumes.
|
||||
|
||||
## Ограничения
|
||||
|
||||
Waiting включает получение/создание connection, а не только время ожидания свободного слота; используется закреплённый SQLAlchemy 2.0.45. Gauge после остановки процесса может оставаться видимым в Prometheus до lookback expiry. Queue metric описывает durable backlog, не AMQP messages_ready. Учебные пороги alerts (5%/1m и age>15s, for15s) не являются production-рекомендацией. Корректность off/on cost пока не оценивается этим уровнем.
|
||||
|
||||
Minor из foundation: scripts/limits.py и CI allowlist не учитывают OTel/helper services; отдельные runtime проверки лимитов есть в grade3/runtime.json. REPORT.md не изменяется: финальный отчёт подготовит следующий агент.
|
||||
|
||||
## Дополнительные ограничения проверки
|
||||
|
||||
Полная пауза PostgreSQL (database-incident.txt) дала реальные 503, но не firing: HAProxy быстро снял API с ротации, а первоначальный скачок новой серии 503 не дал положительного rate. Ответы LB не входят в SLI приложения. Это minor ограничение охвата alert; итоговый обязательный сценарий использует ограниченную 120 s SQL-блокировку users при работающем readiness, а не объявляет первую попытку успешной. Блокировка освобождается finally и не изменяет данные.
|
||||
|
||||
SQL-инцидент: 3 error traces PostgreSQL, error ratio 1.000; firing 2026-11-06T18:13:13+00:00, resolved 2026-11-06T18:14:14+00:00. Блокировка началась 2026-11-06T18:12:37+00:00, освобождена 2026-11-06T18:13:13+00:00. Диагностика: server 503 → client PostgreSQL ERROR около 2 s; это зависимость, не просто медленный handler. См. database-lock.txt.
|
||||
|
||||
Telemetry storage: 74 успешных probes, сохранено 72 traces, потеряно 2; максимум RAM 98.7% лимита. smoke PASS во время отказа. Raw memory samples и counters accepted/sent/send_failed/queue до/во время/после — storage-incident.txt. Backend остановлен 2026-11-06T18:14:29+00:00, восстановлен 2026-11-06T18:16:16+00:00. Потеря trace после retry budget 60 s допустима; бизнес-данные сохранены.
|
||||
@@ -0,0 +1,19 @@
|
||||
date: 2026-11-06T09:52:30Z commit: 1a171d0d0f13ab71661a0f63e695031addd88dc0
|
||||
environment: {"COMPOSE_PROJECT_NAME": "mtusi2026lab6", "LB_HTTP_PORT": "18086", "LB_STATS_PORT": "26085", "BASE_URL": "http://127.0.0.1:18086", "NO_PROXY": "localhost,127.0.0.1,::1"}
|
||||
$ make obs-validate
|
||||
sh scripts/obs-validate.sh
|
||||
otelcol-contrib validate collector.yaml: OK
|
||||
Checking /etc/prometheus/prometheus.yml
|
||||
SUCCESS: 2 rule files found
|
||||
SUCCESS: /etc/prometheus/prometheus.yml is valid prometheus config file syntax
|
||||
|
||||
Checking /etc/prometheus/rules/messenger.alerts.yml
|
||||
SUCCESS: 5 rules found
|
||||
|
||||
Checking /etc/prometheus/rules/messenger.recording.yml
|
||||
SUCCESS: 8 rules found
|
||||
|
||||
loki -verify-config: OK
|
||||
tempo -config.verify: OK
|
||||
grafana dashboards: valid JSON with uid and panels
|
||||
exit_code: 0 elapsed_seconds: 2.837
|
||||
@@ -0,0 +1,7 @@
|
||||
date: 2026-11-06T11:34:29Z commit: 447a6507f973596e612f40c1484dda922bf0e50d
|
||||
environment: {"COMPOSE_PROJECT_NAME": "mtusi2026lab6", "LB_HTTP_PORT": "18086", "LB_STATS_PORT": "26085", "BASE_URL": "http://127.0.0.1:18086", "NO_PROXY": "localhost,127.0.0.1,::1"}
|
||||
$ make test-persistence ACTION_SCRIPT=scripts/restart.sh
|
||||
python3 tests/resilience.py --mode persistence --action-script "scripts/restart.sh" --base-url "http://127.0.0.1:18086"
|
||||
Executing explicit persistence hook; hook output suppressed to avoid leaking secrets.
|
||||
PASS: persistence preserved confirmed data and existing session. Hook scope needs operator evidence.
|
||||
exit_code: 0 elapsed_seconds: 14.086
|
||||
@@ -0,0 +1,5 @@
|
||||
date: 2026-11-06T10:04:41Z commit: 447a6507f973596e612f40c1484dda922bf0e50d
|
||||
environment: {"COMPOSE_PROJECT_NAME": "mtusi2026lab6", "LB_HTTP_PORT": "18086", "LB_STATS_PORT": "26085", "BASE_URL": "http://127.0.0.1:18086", "NO_PROXY": "localhost,127.0.0.1,::1"}
|
||||
$ make test-persistence ACTION_SCRIPT=scripts/restart.sh
|
||||
python3 tests/resilience.py --mode persistence --action-script "scripts/restart.sh" --base-url "http://127.0.0.1:18086"
|
||||
Executing explicit persistence hook; hook output suppressed to avoid leaking secrets.
|
||||
@@ -0,0 +1,14 @@
|
||||
date: 2026-11-06T10:00:29Z commit: 44d81fd80ee13faa42bca069245ee0943f88b2df
|
||||
environment: {"COMPOSE_PROJECT_NAME": "mtusi2026lab6", "LB_HTTP_PORT": "18086", "LB_STATS_PORT": "26085", "BASE_URL": "http://127.0.0.1:18086", "NO_PROXY": "localhost,127.0.0.1,::1"}
|
||||
$ make check validate lint
|
||||
python3 scripts/check_contract.py
|
||||
PASS: offline skeleton structure, local refs and Python syntax; application NOT tested.
|
||||
.venv/bin/python scripts/validate_openapi.py
|
||||
PASS: full OpenAPI 3.1 and JSON Schema validation; application NOT tested.
|
||||
.venv/bin/ruff check src student-tests scripts/obs_incidents.py scripts/obs_recovery.py scripts/capture_evidence.py alembic scripts/scaling.py tools scripts/probe.py scripts/limits.py scripts/lab4_scenarios.py scripts/lab4_seed.py scripts/upload_memory.py scripts/reconcile_check.py scripts/reconcile_track.py scripts/make_images.py scripts/pipeline_suite.py scripts/pipeline_evidence.py
|
||||
All checks passed!
|
||||
.venv/bin/ruff format --check src student-tests scripts/obs_incidents.py scripts/obs_recovery.py scripts/capture_evidence.py alembic scripts/scaling.py tools scripts/probe.py scripts/limits.py scripts/lab4_scenarios.py scripts/lab4_seed.py scripts/upload_memory.py scripts/reconcile_check.py scripts/reconcile_track.py scripts/make_images.py scripts/pipeline_suite.py scripts/pipeline_evidence.py
|
||||
196 files already formatted
|
||||
.venv/bin/ty check src student-tests alembic
|
||||
All checks passed!
|
||||
exit_code: 0 elapsed_seconds: 0.616
|
||||
@@ -0,0 +1,98 @@
|
||||
date: 2026-11-06T18:12:05Z commit: 447a6507f973596e612f40c1484dda922bf0e50d
|
||||
environment: {"COMPOSE_PROJECT_NAME": "mtusi2026lab6", "LB_HTTP_PORT": "18086", "LB_STATS_PORT": "26085", "BASE_URL": "http://127.0.0.1:18086", "NO_PROXY": "localhost,127.0.0.1,::1"}
|
||||
$ docker compose up -d --no-build --wait
|
||||
Container mtusi2026lab6-lb-1 Starting
|
||||
Container mtusi2026lab6-prometheus-1 Starting
|
||||
Container mtusi2026lab6-broker-1 Starting
|
||||
Container mtusi2026lab6-valkey-1 Starting
|
||||
Container mtusi2026lab6-s3-1 Starting
|
||||
Container mtusi2026lab6-postgres-1 Starting
|
||||
Container mtusi2026lab6-healthtools-1 Starting
|
||||
Container mtusi2026lab6-healthtools-1 Started
|
||||
Container mtusi2026lab6-healthtools-1 Waiting
|
||||
Container mtusi2026lab6-healthtools-1 Waiting
|
||||
Container mtusi2026lab6-healthtools-1 Waiting
|
||||
Container mtusi2026lab6-s3-1 Started
|
||||
Container mtusi2026lab6-s3-1 Waiting
|
||||
Container mtusi2026lab6-postgres-1 Started
|
||||
Container mtusi2026lab6-postgres-1 Waiting
|
||||
Container mtusi2026lab6-valkey-1 Started
|
||||
Container mtusi2026lab6-prometheus-1 Started
|
||||
Container mtusi2026lab6-lb-1 Started
|
||||
Container mtusi2026lab6-broker-1 Started
|
||||
Container mtusi2026lab6-healthtools-1 Exited
|
||||
Container mtusi2026lab6-healthtools-1 Exited
|
||||
Container mtusi2026lab6-loki-1 Starting
|
||||
Container mtusi2026lab6-tempo-1 Starting
|
||||
Container mtusi2026lab6-healthtools-1 Exited
|
||||
Container mtusi2026lab6-otel-collector-1 Starting
|
||||
Container mtusi2026lab6-postgres-1 Healthy
|
||||
Container mtusi2026lab6-migrate-1 Starting
|
||||
Container mtusi2026lab6-migrate-1 Started
|
||||
Container mtusi2026lab6-otel-collector-1 Started
|
||||
Container mtusi2026lab6-tempo-1 Started
|
||||
Container mtusi2026lab6-loki-1 Started
|
||||
Container mtusi2026lab6-grafana-1 Starting
|
||||
Container mtusi2026lab6-grafana-1 Started
|
||||
Container mtusi2026lab6-s3-1 Healthy
|
||||
Container mtusi2026lab6-s3-init-1 Starting
|
||||
Container mtusi2026lab6-s3-init-1 Started
|
||||
Container mtusi2026lab6-migrate-1 Waiting
|
||||
Container mtusi2026lab6-s3-init-1 Waiting
|
||||
Container mtusi2026lab6-broker-1 Waiting
|
||||
Container mtusi2026lab6-s3-init-1 Waiting
|
||||
Container mtusi2026lab6-broker-1 Waiting
|
||||
Container mtusi2026lab6-s3-init-1 Waiting
|
||||
Container mtusi2026lab6-migrate-1 Waiting
|
||||
Container mtusi2026lab6-migrate-1 Waiting
|
||||
Container mtusi2026lab6-migrate-1 Exited
|
||||
Container mtusi2026lab6-migrate-1 Exited
|
||||
Container mtusi2026lab6-migrate-1 Exited
|
||||
Container mtusi2026lab6-s3-init-1 Exited
|
||||
Container mtusi2026lab6-s3-init-1 Exited
|
||||
Container mtusi2026lab6-api-1 Starting
|
||||
Container mtusi2026lab6-broker-1 Healthy
|
||||
Container mtusi2026lab6-worker-1 Starting
|
||||
Container mtusi2026lab6-broker-1 Healthy
|
||||
Container mtusi2026lab6-s3-init-1 Exited
|
||||
Container mtusi2026lab6-relay-1 Starting
|
||||
Container mtusi2026lab6-api-1 Started
|
||||
Container mtusi2026lab6-api-2 Starting
|
||||
Container mtusi2026lab6-relay-1 Started
|
||||
Container mtusi2026lab6-worker-1 Started
|
||||
Container mtusi2026lab6-api-2 Started
|
||||
Container mtusi2026lab6-relay-1 Waiting
|
||||
Container mtusi2026lab6-lb-1 Waiting
|
||||
Container mtusi2026lab6-worker-1 Waiting
|
||||
Container mtusi2026lab6-otel-collector-1 Waiting
|
||||
Container mtusi2026lab6-s3-1 Waiting
|
||||
Container mtusi2026lab6-loki-1 Waiting
|
||||
Container mtusi2026lab6-api-1 Waiting
|
||||
Container mtusi2026lab6-api-2 Waiting
|
||||
Container mtusi2026lab6-broker-1 Waiting
|
||||
Container mtusi2026lab6-tempo-1 Waiting
|
||||
Container mtusi2026lab6-healthtools-1 Waiting
|
||||
Container mtusi2026lab6-migrate-1 Waiting
|
||||
Container mtusi2026lab6-postgres-1 Waiting
|
||||
Container mtusi2026lab6-valkey-1 Waiting
|
||||
Container mtusi2026lab6-grafana-1 Waiting
|
||||
Container mtusi2026lab6-prometheus-1 Waiting
|
||||
Container mtusi2026lab6-s3-init-1 Waiting
|
||||
Container mtusi2026lab6-s3-init-1 Exited
|
||||
Container mtusi2026lab6-valkey-1 Healthy
|
||||
Container mtusi2026lab6-prometheus-1 Healthy
|
||||
Container mtusi2026lab6-grafana-1 Healthy
|
||||
Container mtusi2026lab6-healthtools-1 Exited
|
||||
Container mtusi2026lab6-s3-1 Healthy
|
||||
Container mtusi2026lab6-otel-collector-1 Healthy
|
||||
Container mtusi2026lab6-migrate-1 Exited
|
||||
Container mtusi2026lab6-postgres-1 Healthy
|
||||
Container mtusi2026lab6-broker-1 Healthy
|
||||
Container mtusi2026lab6-api-1 Healthy
|
||||
Container mtusi2026lab6-api-2 Healthy
|
||||
Container mtusi2026lab6-relay-1 Healthy
|
||||
Container mtusi2026lab6-worker-1 Healthy
|
||||
Container mtusi2026lab6-lb-1 Healthy
|
||||
Container mtusi2026lab6-loki-1 Healthy
|
||||
Container mtusi2026lab6-tempo-1 Healthy
|
||||
exit_code: 0 elapsed_seconds: 19.561
|
||||
@@ -0,0 +1,98 @@
|
||||
date: 2026-11-06T11:34:09Z commit: 447a6507f973596e612f40c1484dda922bf0e50d
|
||||
environment: {"COMPOSE_PROJECT_NAME": "mtusi2026lab6", "LB_HTTP_PORT": "18086", "LB_STATS_PORT": "26085", "BASE_URL": "http://127.0.0.1:18086", "NO_PROXY": "localhost,127.0.0.1,::1"}
|
||||
$ docker compose up -d --no-build --wait
|
||||
Container mtusi2026lab6-healthtools-1 Starting
|
||||
Container mtusi2026lab6-prometheus-1 Starting
|
||||
Container mtusi2026lab6-broker-1 Starting
|
||||
Container mtusi2026lab6-s3-1 Starting
|
||||
Container mtusi2026lab6-lb-1 Starting
|
||||
Container mtusi2026lab6-valkey-1 Starting
|
||||
Container mtusi2026lab6-postgres-1 Starting
|
||||
Container mtusi2026lab6-healthtools-1 Started
|
||||
Container mtusi2026lab6-healthtools-1 Waiting
|
||||
Container mtusi2026lab6-healthtools-1 Waiting
|
||||
Container mtusi2026lab6-healthtools-1 Waiting
|
||||
Container mtusi2026lab6-s3-1 Started
|
||||
Container mtusi2026lab6-s3-1 Waiting
|
||||
Container mtusi2026lab6-valkey-1 Started
|
||||
Container mtusi2026lab6-postgres-1 Started
|
||||
Container mtusi2026lab6-postgres-1 Waiting
|
||||
Container mtusi2026lab6-lb-1 Started
|
||||
Container mtusi2026lab6-prometheus-1 Started
|
||||
Container mtusi2026lab6-broker-1 Started
|
||||
Container mtusi2026lab6-healthtools-1 Exited
|
||||
Container mtusi2026lab6-loki-1 Starting
|
||||
Container mtusi2026lab6-healthtools-1 Exited
|
||||
Container mtusi2026lab6-otel-collector-1 Starting
|
||||
Container mtusi2026lab6-healthtools-1 Exited
|
||||
Container mtusi2026lab6-tempo-1 Starting
|
||||
Container mtusi2026lab6-postgres-1 Healthy
|
||||
Container mtusi2026lab6-migrate-1 Starting
|
||||
Container mtusi2026lab6-migrate-1 Started
|
||||
Container mtusi2026lab6-loki-1 Started
|
||||
Container mtusi2026lab6-otel-collector-1 Started
|
||||
Container mtusi2026lab6-tempo-1 Started
|
||||
Container mtusi2026lab6-grafana-1 Starting
|
||||
Container mtusi2026lab6-grafana-1 Started
|
||||
Container mtusi2026lab6-s3-1 Healthy
|
||||
Container mtusi2026lab6-s3-init-1 Starting
|
||||
Container mtusi2026lab6-s3-init-1 Started
|
||||
Container mtusi2026lab6-s3-init-1 Waiting
|
||||
Container mtusi2026lab6-s3-init-1 Waiting
|
||||
Container mtusi2026lab6-migrate-1 Waiting
|
||||
Container mtusi2026lab6-migrate-1 Waiting
|
||||
Container mtusi2026lab6-s3-init-1 Waiting
|
||||
Container mtusi2026lab6-broker-1 Waiting
|
||||
Container mtusi2026lab6-broker-1 Waiting
|
||||
Container mtusi2026lab6-migrate-1 Waiting
|
||||
Container mtusi2026lab6-migrate-1 Exited
|
||||
Container mtusi2026lab6-migrate-1 Exited
|
||||
Container mtusi2026lab6-s3-init-1 Exited
|
||||
Container mtusi2026lab6-migrate-1 Exited
|
||||
Container mtusi2026lab6-api-1 Starting
|
||||
Container mtusi2026lab6-broker-1 Healthy
|
||||
Container mtusi2026lab6-broker-1 Healthy
|
||||
Container mtusi2026lab6-s3-init-1 Exited
|
||||
Container mtusi2026lab6-relay-1 Starting
|
||||
Container mtusi2026lab6-s3-init-1 Exited
|
||||
Container mtusi2026lab6-worker-1 Starting
|
||||
Container mtusi2026lab6-api-1 Started
|
||||
Container mtusi2026lab6-api-2 Starting
|
||||
Container mtusi2026lab6-worker-1 Started
|
||||
Container mtusi2026lab6-relay-1 Started
|
||||
Container mtusi2026lab6-api-2 Started
|
||||
Container mtusi2026lab6-healthtools-1 Waiting
|
||||
Container mtusi2026lab6-grafana-1 Waiting
|
||||
Container mtusi2026lab6-migrate-1 Waiting
|
||||
Container mtusi2026lab6-s3-1 Waiting
|
||||
Container mtusi2026lab6-valkey-1 Waiting
|
||||
Container mtusi2026lab6-lb-1 Waiting
|
||||
Container mtusi2026lab6-s3-init-1 Waiting
|
||||
Container mtusi2026lab6-broker-1 Waiting
|
||||
Container mtusi2026lab6-tempo-1 Waiting
|
||||
Container mtusi2026lab6-loki-1 Waiting
|
||||
Container mtusi2026lab6-prometheus-1 Waiting
|
||||
Container mtusi2026lab6-api-1 Waiting
|
||||
Container mtusi2026lab6-api-2 Waiting
|
||||
Container mtusi2026lab6-relay-1 Waiting
|
||||
Container mtusi2026lab6-otel-collector-1 Waiting
|
||||
Container mtusi2026lab6-worker-1 Waiting
|
||||
Container mtusi2026lab6-postgres-1 Waiting
|
||||
Container mtusi2026lab6-postgres-1 Healthy
|
||||
Container mtusi2026lab6-migrate-1 Exited
|
||||
Container mtusi2026lab6-healthtools-1 Exited
|
||||
Container mtusi2026lab6-otel-collector-1 Healthy
|
||||
Container mtusi2026lab6-s3-1 Healthy
|
||||
Container mtusi2026lab6-prometheus-1 Healthy
|
||||
Container mtusi2026lab6-valkey-1 Healthy
|
||||
Container mtusi2026lab6-grafana-1 Healthy
|
||||
Container mtusi2026lab6-s3-init-1 Exited
|
||||
Container mtusi2026lab6-broker-1 Healthy
|
||||
Container mtusi2026lab6-api-1 Healthy
|
||||
Container mtusi2026lab6-api-2 Healthy
|
||||
Container mtusi2026lab6-worker-1 Healthy
|
||||
Container mtusi2026lab6-relay-1 Healthy
|
||||
Container mtusi2026lab6-lb-1 Healthy
|
||||
Container mtusi2026lab6-loki-1 Healthy
|
||||
Container mtusi2026lab6-tempo-1 Healthy
|
||||
exit_code: 0 elapsed_seconds: 19.572
|
||||
@@ -0,0 +1,881 @@
|
||||
date: 2026-11-06T10:01:28Z commit: 447a6507f973596e612f40c1484dda922bf0e50d
|
||||
environment: {"COMPOSE_PROJECT_NAME": "mtusi2026lab6", "LB_HTTP_PORT": "18086", "LB_STATS_PORT": "26085", "BASE_URL": "http://127.0.0.1:18086", "NO_PROXY": "localhost,127.0.0.1,::1"}
|
||||
$ python3 scripts/obs_incidents.py retry
|
||||
{
|
||||
"started": "2026-11-06T10:01:28+00:00",
|
||||
"finished": "2026-11-06T10:04:39+00:00",
|
||||
"result": "PASS",
|
||||
"scenario": "retry",
|
||||
"observations": {
|
||||
"upload_request_id": "a9174dd6-03bc-4eb9-a175-97976ebb5a27",
|
||||
"trace_id": "6e54b186a23385c78757721e00540fe0",
|
||||
"retry": true,
|
||||
"outcomes": [
|
||||
"retry_scheduled",
|
||||
"done"
|
||||
],
|
||||
"spans": [
|
||||
{
|
||||
"service": "messenger-api",
|
||||
"name": "POST /api/v1/chats/{chat_id}/attachments",
|
||||
"kind": "SPAN_KIND_SERVER",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"span_id": "y2HJN1o754Q=",
|
||||
"parent_span_id": null,
|
||||
"duration_ms": 19.13,
|
||||
"attempt": null
|
||||
},
|
||||
{
|
||||
"service": "messenger-api",
|
||||
"name": "BEGIN;",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"span_id": "79T0OS4x6j4=",
|
||||
"parent_span_id": "y2HJN1o754Q=",
|
||||
"duration_ms": 0.161,
|
||||
"attempt": null
|
||||
},
|
||||
{
|
||||
"service": "messenger-api",
|
||||
"name": ";",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"span_id": "jA+hfBOYY7Y=",
|
||||
"parent_span_id": "y2HJN1o754Q=",
|
||||
"duration_ms": 0.086,
|
||||
"attempt": null
|
||||
},
|
||||
{
|
||||
"service": "messenger-api",
|
||||
"name": "ROLLBACK;",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"span_id": "adlQpOS+yb0=",
|
||||
"parent_span_id": "y2HJN1o754Q=",
|
||||
"duration_ms": 0.127,
|
||||
"attempt": null
|
||||
},
|
||||
{
|
||||
"service": "messenger-api",
|
||||
"name": "BEGIN;",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"span_id": "dGfhnXTkNZE=",
|
||||
"parent_span_id": "y2HJN1o754Q=",
|
||||
"duration_ms": 0.138,
|
||||
"attempt": null
|
||||
},
|
||||
{
|
||||
"service": "messenger-api",
|
||||
"name": "SELECT",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"span_id": "HoZo26PbJ8E=",
|
||||
"parent_span_id": "y2HJN1o754Q=",
|
||||
"duration_ms": 0.391,
|
||||
"attempt": null
|
||||
},
|
||||
{
|
||||
"service": "messenger-api",
|
||||
"name": "ROLLBACK;",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"span_id": "mUidBRiK1IU=",
|
||||
"parent_span_id": "y2HJN1o754Q=",
|
||||
"duration_ms": 0.096,
|
||||
"attempt": null
|
||||
},
|
||||
{
|
||||
"service": "messenger-api",
|
||||
"name": "BEGIN;",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"span_id": "23ntEo2MC5w=",
|
||||
"parent_span_id": "y2HJN1o754Q=",
|
||||
"duration_ms": 0.08,
|
||||
"attempt": null
|
||||
},
|
||||
{
|
||||
"service": "messenger-api",
|
||||
"name": ";",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"span_id": "efimFyLMhKE=",
|
||||
"parent_span_id": "y2HJN1o754Q=",
|
||||
"duration_ms": 0.101,
|
||||
"attempt": null
|
||||
},
|
||||
{
|
||||
"service": "messenger-api",
|
||||
"name": "ROLLBACK;",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"span_id": "5uIwYLv0XX8=",
|
||||
"parent_span_id": "y2HJN1o754Q=",
|
||||
"duration_ms": 0.099,
|
||||
"attempt": null
|
||||
},
|
||||
{
|
||||
"service": "messenger-api",
|
||||
"name": "BEGIN;",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"span_id": "m5ue9pVQNPw=",
|
||||
"parent_span_id": "y2HJN1o754Q=",
|
||||
"duration_ms": 0.081,
|
||||
"attempt": null
|
||||
},
|
||||
{
|
||||
"service": "messenger-api",
|
||||
"name": "INSERT",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"span_id": "ymYPNIo3M08=",
|
||||
"parent_span_id": "y2HJN1o754Q=",
|
||||
"duration_ms": 0.581,
|
||||
"attempt": null
|
||||
},
|
||||
{
|
||||
"service": "messenger-api",
|
||||
"name": "COMMIT;",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"span_id": "V8IG+RB8wKs=",
|
||||
"parent_span_id": "y2HJN1o754Q=",
|
||||
"duration_ms": 0.322,
|
||||
"attempt": null
|
||||
},
|
||||
{
|
||||
"service": "messenger-api",
|
||||
"name": "BEGIN;",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"span_id": "hnGkAWoIqVE=",
|
||||
"parent_span_id": "y2HJN1o754Q=",
|
||||
"duration_ms": 0.099,
|
||||
"attempt": null
|
||||
},
|
||||
{
|
||||
"service": "messenger-api",
|
||||
"name": ";",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"span_id": "jC1VnzukYG4=",
|
||||
"parent_span_id": "y2HJN1o754Q=",
|
||||
"duration_ms": 0.081,
|
||||
"attempt": null
|
||||
},
|
||||
{
|
||||
"service": "messenger-api",
|
||||
"name": "ROLLBACK;",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"span_id": "MnbqBcTDMlU=",
|
||||
"parent_span_id": "y2HJN1o754Q=",
|
||||
"duration_ms": 0.101,
|
||||
"attempt": null
|
||||
},
|
||||
{
|
||||
"service": "messenger-api",
|
||||
"name": "BEGIN;",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"span_id": "7UmSm35vGHw=",
|
||||
"parent_span_id": "y2HJN1o754Q=",
|
||||
"duration_ms": 0.062,
|
||||
"attempt": null
|
||||
},
|
||||
{
|
||||
"service": "messenger-api",
|
||||
"name": "UPDATE",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"span_id": "C8zkBA8JQTc=",
|
||||
"parent_span_id": "y2HJN1o754Q=",
|
||||
"duration_ms": 0.292,
|
||||
"attempt": null
|
||||
},
|
||||
{
|
||||
"service": "messenger-api",
|
||||
"name": "INSERT",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"span_id": "BZ8+T2pSLXM=",
|
||||
"parent_span_id": "y2HJN1o754Q=",
|
||||
"duration_ms": 0.244,
|
||||
"attempt": null
|
||||
},
|
||||
{
|
||||
"service": "messenger-api",
|
||||
"name": "INSERT",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"span_id": "M0ptOEdC8mM=",
|
||||
"parent_span_id": "y2HJN1o754Q=",
|
||||
"duration_ms": 0.266,
|
||||
"attempt": null
|
||||
},
|
||||
{
|
||||
"service": "messenger-api",
|
||||
"name": "INSERT",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"span_id": "YmOm9bHrN6Q=",
|
||||
"parent_span_id": "y2HJN1o754Q=",
|
||||
"duration_ms": 0.16,
|
||||
"attempt": null
|
||||
},
|
||||
{
|
||||
"service": "messenger-api",
|
||||
"name": "COMMIT;",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"span_id": "UfB8iSRiouE=",
|
||||
"parent_span_id": "y2HJN1o754Q=",
|
||||
"duration_ms": 0.199,
|
||||
"attempt": null
|
||||
},
|
||||
{
|
||||
"service": "messenger-api",
|
||||
"name": "S3 put_object",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"span_id": "rlFzBwYXjfc=",
|
||||
"parent_span_id": "y2HJN1o754Q=",
|
||||
"duration_ms": 5.044,
|
||||
"attempt": null
|
||||
},
|
||||
{
|
||||
"service": "messenger-relay",
|
||||
"name": "attachments.attachment.process.v1 create",
|
||||
"kind": "SPAN_KIND_PRODUCER",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"span_id": "Ih2oPBzUUgc=",
|
||||
"parent_span_id": "y2HJN1o754Q=",
|
||||
"duration_ms": 0.009,
|
||||
"attempt": null
|
||||
},
|
||||
{
|
||||
"service": "messenger-relay",
|
||||
"name": "attachments.attachment.process.v1 publish",
|
||||
"kind": "SPAN_KIND_PRODUCER",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"span_id": "rFD9hkLrc0g=",
|
||||
"parent_span_id": "Ih2oPBzUUgc=",
|
||||
"duration_ms": 1.139,
|
||||
"attempt": null
|
||||
},
|
||||
{
|
||||
"service": "messenger-worker",
|
||||
"name": "attachments.attachment.process.v1 process",
|
||||
"kind": "SPAN_KIND_CONSUMER",
|
||||
"status": "STATUS_CODE_ERROR",
|
||||
"span_id": "kEXksGW8DXE=",
|
||||
"parent_span_id": "Ih2oPBzUUgc=",
|
||||
"duration_ms": 2713.042,
|
||||
"attempt": "1"
|
||||
},
|
||||
{
|
||||
"service": "messenger-worker",
|
||||
"name": "BEGIN;",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"span_id": "vctbMOdli9o=",
|
||||
"parent_span_id": "kEXksGW8DXE=",
|
||||
"duration_ms": 0.189,
|
||||
"attempt": null
|
||||
},
|
||||
{
|
||||
"service": "messenger-worker",
|
||||
"name": "select",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"span_id": "5+ACzZ817bE=",
|
||||
"parent_span_id": "kEXksGW8DXE=",
|
||||
"duration_ms": 0.114,
|
||||
"attempt": null
|
||||
},
|
||||
{
|
||||
"service": "messenger-worker",
|
||||
"name": "select",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"span_id": "FlbW1uK5JSY=",
|
||||
"parent_span_id": "kEXksGW8DXE=",
|
||||
"duration_ms": 0.105,
|
||||
"attempt": null
|
||||
},
|
||||
{
|
||||
"service": "messenger-worker",
|
||||
"name": "show",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"span_id": "8AcL2qB2jrw=",
|
||||
"parent_span_id": "kEXksGW8DXE=",
|
||||
"duration_ms": 0.063,
|
||||
"attempt": null
|
||||
},
|
||||
{
|
||||
"service": "messenger-worker",
|
||||
"name": "show",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"span_id": "yH4TJznSUIQ=",
|
||||
"parent_span_id": "kEXksGW8DXE=",
|
||||
"duration_ms": 0.047,
|
||||
"attempt": null
|
||||
},
|
||||
{
|
||||
"service": "messenger-worker",
|
||||
"name": "ROLLBACK;",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"span_id": "i0EI/0qRMgQ=",
|
||||
"parent_span_id": "kEXksGW8DXE=",
|
||||
"duration_ms": 0.05,
|
||||
"attempt": null
|
||||
},
|
||||
{
|
||||
"service": "messenger-worker",
|
||||
"name": "BEGIN;",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"span_id": "kpnEiG2rpBA=",
|
||||
"parent_span_id": "kEXksGW8DXE=",
|
||||
"duration_ms": 0.061,
|
||||
"attempt": null
|
||||
},
|
||||
{
|
||||
"service": "messenger-worker",
|
||||
"name": "UPDATE",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"span_id": "AFsWPLjfQIU=",
|
||||
"parent_span_id": "kEXksGW8DXE=",
|
||||
"duration_ms": 0.523,
|
||||
"attempt": null
|
||||
},
|
||||
{
|
||||
"service": "messenger-worker",
|
||||
"name": "UPDATE",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"span_id": "gzsVFvV7eXM=",
|
||||
"parent_span_id": "kEXksGW8DXE=",
|
||||
"duration_ms": 0.637,
|
||||
"attempt": null
|
||||
},
|
||||
{
|
||||
"service": "messenger-worker",
|
||||
"name": "INSERT",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"span_id": "FboVP7mvVC4=",
|
||||
"parent_span_id": "kEXksGW8DXE=",
|
||||
"duration_ms": 0.199,
|
||||
"attempt": null
|
||||
},
|
||||
{
|
||||
"service": "messenger-worker",
|
||||
"name": "SELECT",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"span_id": "mV4WCbh/AO8=",
|
||||
"parent_span_id": "kEXksGW8DXE=",
|
||||
"duration_ms": 0.109,
|
||||
"attempt": null
|
||||
},
|
||||
{
|
||||
"service": "messenger-worker",
|
||||
"name": "COMMIT;",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"span_id": "0lW6W3JfBGE=",
|
||||
"parent_span_id": "kEXksGW8DXE=",
|
||||
"duration_ms": 0.288,
|
||||
"attempt": null
|
||||
},
|
||||
{
|
||||
"service": "messenger-worker",
|
||||
"name": "BEGIN;",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"span_id": "qt8r1O7DW7k=",
|
||||
"parent_span_id": "kEXksGW8DXE=",
|
||||
"duration_ms": 0.075,
|
||||
"attempt": null
|
||||
},
|
||||
{
|
||||
"service": "messenger-worker",
|
||||
"name": ";",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"span_id": "k6Un3ViBqdI=",
|
||||
"parent_span_id": "kEXksGW8DXE=",
|
||||
"duration_ms": 0.112,
|
||||
"attempt": null
|
||||
},
|
||||
{
|
||||
"service": "messenger-worker",
|
||||
"name": "ROLLBACK;",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"span_id": "b8bvwMEOR7E=",
|
||||
"parent_span_id": "kEXksGW8DXE=",
|
||||
"duration_ms": 0.043,
|
||||
"attempt": null
|
||||
},
|
||||
{
|
||||
"service": "messenger-worker",
|
||||
"name": "BEGIN;",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"span_id": "e+7vKBTyle0=",
|
||||
"parent_span_id": "kEXksGW8DXE=",
|
||||
"duration_ms": 0.062,
|
||||
"attempt": null
|
||||
},
|
||||
{
|
||||
"service": "messenger-worker",
|
||||
"name": "UPDATE",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"span_id": "HqUbe2ofwe8=",
|
||||
"parent_span_id": "kEXksGW8DXE=",
|
||||
"duration_ms": 0.173,
|
||||
"attempt": null
|
||||
},
|
||||
{
|
||||
"service": "messenger-worker",
|
||||
"name": "COMMIT;",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"span_id": "TOle7/uQVJw=",
|
||||
"parent_span_id": "kEXksGW8DXE=",
|
||||
"duration_ms": 0.168,
|
||||
"attempt": null
|
||||
},
|
||||
{
|
||||
"service": "messenger-worker",
|
||||
"name": "BEGIN;",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"span_id": "Pq+p8ni6BfY=",
|
||||
"parent_span_id": "kEXksGW8DXE=",
|
||||
"duration_ms": 0.53,
|
||||
"attempt": null
|
||||
},
|
||||
{
|
||||
"service": "messenger-worker",
|
||||
"name": ";",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"span_id": "uI9ReQX6MDc=",
|
||||
"parent_span_id": "kEXksGW8DXE=",
|
||||
"duration_ms": 0.266,
|
||||
"attempt": null
|
||||
},
|
||||
{
|
||||
"service": "messenger-worker",
|
||||
"name": "ROLLBACK;",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"span_id": "Dp3i567FC7Y=",
|
||||
"parent_span_id": "kEXksGW8DXE=",
|
||||
"duration_ms": 0.312,
|
||||
"attempt": null
|
||||
},
|
||||
{
|
||||
"service": "messenger-worker",
|
||||
"name": "BEGIN;",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"span_id": "lt/BMQ99wDk=",
|
||||
"parent_span_id": "kEXksGW8DXE=",
|
||||
"duration_ms": 0.362,
|
||||
"attempt": null
|
||||
},
|
||||
{
|
||||
"service": "messenger-worker",
|
||||
"name": "UPDATE",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"span_id": "GLCftn0qa5k=",
|
||||
"parent_span_id": "kEXksGW8DXE=",
|
||||
"duration_ms": 0.608,
|
||||
"attempt": null
|
||||
},
|
||||
{
|
||||
"service": "messenger-worker",
|
||||
"name": "UPDATE",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"span_id": "xGpDCrebQlI=",
|
||||
"parent_span_id": "kEXksGW8DXE=",
|
||||
"duration_ms": 0.398,
|
||||
"attempt": null
|
||||
},
|
||||
{
|
||||
"service": "messenger-worker",
|
||||
"name": "INSERT",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"span_id": "iHx6VHOSrlg=",
|
||||
"parent_span_id": "kEXksGW8DXE=",
|
||||
"duration_ms": 0.244,
|
||||
"attempt": null
|
||||
},
|
||||
{
|
||||
"service": "messenger-worker",
|
||||
"name": "INSERT",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"span_id": "lJ4xp8OMr60=",
|
||||
"parent_span_id": "kEXksGW8DXE=",
|
||||
"duration_ms": 0.643,
|
||||
"attempt": null
|
||||
},
|
||||
{
|
||||
"service": "messenger-worker",
|
||||
"name": "COMMIT;",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"span_id": "YwElqVZxfeE=",
|
||||
"parent_span_id": "kEXksGW8DXE=",
|
||||
"duration_ms": 1.178,
|
||||
"attempt": null
|
||||
},
|
||||
{
|
||||
"service": "messenger-worker",
|
||||
"name": "BEGIN;",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"span_id": "VUr+jQ211S4=",
|
||||
"parent_span_id": "5FdSinM8g/I=",
|
||||
"duration_ms": 0.123,
|
||||
"attempt": null
|
||||
},
|
||||
{
|
||||
"service": "messenger-worker",
|
||||
"name": ";",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"span_id": "yiaG28vdQ0o=",
|
||||
"parent_span_id": "5FdSinM8g/I=",
|
||||
"duration_ms": 0.095,
|
||||
"attempt": null
|
||||
},
|
||||
{
|
||||
"service": "messenger-worker",
|
||||
"name": "ROLLBACK;",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"span_id": "INvMu6Dcs7U=",
|
||||
"parent_span_id": "5FdSinM8g/I=",
|
||||
"duration_ms": 0.074,
|
||||
"attempt": null
|
||||
},
|
||||
{
|
||||
"service": "messenger-worker",
|
||||
"name": "BEGIN;",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"span_id": "5nUCWHmRWD4=",
|
||||
"parent_span_id": "5FdSinM8g/I=",
|
||||
"duration_ms": 0.064,
|
||||
"attempt": null
|
||||
},
|
||||
{
|
||||
"service": "messenger-worker",
|
||||
"name": "UPDATE",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"span_id": "pzI2Tbuy7Qs=",
|
||||
"parent_span_id": "5FdSinM8g/I=",
|
||||
"duration_ms": 0.2,
|
||||
"attempt": null
|
||||
},
|
||||
{
|
||||
"service": "messenger-worker",
|
||||
"name": "UPDATE",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"span_id": "tupwPWFePe8=",
|
||||
"parent_span_id": "5FdSinM8g/I=",
|
||||
"duration_ms": 0.206,
|
||||
"attempt": null
|
||||
},
|
||||
{
|
||||
"service": "messenger-worker",
|
||||
"name": "INSERT",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"span_id": "KD4IIvqufFI=",
|
||||
"parent_span_id": "5FdSinM8g/I=",
|
||||
"duration_ms": 0.099,
|
||||
"attempt": null
|
||||
},
|
||||
{
|
||||
"service": "messenger-worker",
|
||||
"name": "SELECT",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"span_id": "K+7+L6qJcuM=",
|
||||
"parent_span_id": "5FdSinM8g/I=",
|
||||
"duration_ms": 0.099,
|
||||
"attempt": null
|
||||
},
|
||||
{
|
||||
"service": "messenger-worker",
|
||||
"name": "COMMIT;",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"span_id": "yXe79B5ddGw=",
|
||||
"parent_span_id": "5FdSinM8g/I=",
|
||||
"duration_ms": 0.286,
|
||||
"attempt": null
|
||||
},
|
||||
{
|
||||
"service": "messenger-worker",
|
||||
"name": "BEGIN;",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"span_id": "X5vQNrLEMnE=",
|
||||
"parent_span_id": "5FdSinM8g/I=",
|
||||
"duration_ms": 0.068,
|
||||
"attempt": null
|
||||
},
|
||||
{
|
||||
"service": "messenger-worker",
|
||||
"name": ";",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"span_id": "swuJPCl1Z0Q=",
|
||||
"parent_span_id": "5FdSinM8g/I=",
|
||||
"duration_ms": 0.066,
|
||||
"attempt": null
|
||||
},
|
||||
{
|
||||
"service": "messenger-worker",
|
||||
"name": "ROLLBACK;",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"span_id": "UCCn71xKKdI=",
|
||||
"parent_span_id": "5FdSinM8g/I=",
|
||||
"duration_ms": 0.054,
|
||||
"attempt": null
|
||||
},
|
||||
{
|
||||
"service": "messenger-worker",
|
||||
"name": "BEGIN;",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"span_id": "pPUmGj6KCQE=",
|
||||
"parent_span_id": "5FdSinM8g/I=",
|
||||
"duration_ms": 0.054,
|
||||
"attempt": null
|
||||
},
|
||||
{
|
||||
"service": "messenger-worker",
|
||||
"name": "UPDATE",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"span_id": "pCLMMPCg9q0=",
|
||||
"parent_span_id": "5FdSinM8g/I=",
|
||||
"duration_ms": 0.116,
|
||||
"attempt": null
|
||||
},
|
||||
{
|
||||
"service": "messenger-worker",
|
||||
"name": "COMMIT;",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"span_id": "16J3ACLeVDA=",
|
||||
"parent_span_id": "5FdSinM8g/I=",
|
||||
"duration_ms": 0.182,
|
||||
"attempt": null
|
||||
},
|
||||
{
|
||||
"service": "messenger-worker",
|
||||
"name": "S3 get_object",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_ERROR",
|
||||
"span_id": "n3qnniKhyYs=",
|
||||
"parent_span_id": "kEXksGW8DXE=",
|
||||
"duration_ms": 2643.324,
|
||||
"attempt": null
|
||||
},
|
||||
{
|
||||
"service": "messenger-worker",
|
||||
"name": "S3 get_object",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"span_id": "lrWmvDODn8Y=",
|
||||
"parent_span_id": "5FdSinM8g/I=",
|
||||
"duration_ms": 2.461,
|
||||
"attempt": null
|
||||
},
|
||||
{
|
||||
"service": "messenger-relay",
|
||||
"name": "attachments.attachment.process.v1 create",
|
||||
"kind": "SPAN_KIND_PRODUCER",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"span_id": "nYWo9sEJuO4=",
|
||||
"parent_span_id": "kEXksGW8DXE=",
|
||||
"duration_ms": 0.01,
|
||||
"attempt": null
|
||||
},
|
||||
{
|
||||
"service": "messenger-relay",
|
||||
"name": "attachments.attachment.process.v1 publish",
|
||||
"kind": "SPAN_KIND_PRODUCER",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"span_id": "91CmUd9RVok=",
|
||||
"parent_span_id": "nYWo9sEJuO4=",
|
||||
"duration_ms": 6.188,
|
||||
"attempt": null
|
||||
},
|
||||
{
|
||||
"service": "messenger-worker",
|
||||
"name": "attachments.attachment.process.v1 process",
|
||||
"kind": "SPAN_KIND_CONSUMER",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"span_id": "5FdSinM8g/I=",
|
||||
"parent_span_id": "nYWo9sEJuO4=",
|
||||
"duration_ms": 740.915,
|
||||
"attempt": "2"
|
||||
},
|
||||
{
|
||||
"service": "messenger-worker",
|
||||
"name": "S3 copy_object",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"span_id": "qpWqWo1+vJw=",
|
||||
"parent_span_id": "5FdSinM8g/I=",
|
||||
"duration_ms": 5.771,
|
||||
"attempt": null
|
||||
},
|
||||
{
|
||||
"service": "messenger-worker",
|
||||
"name": "S3 put_object",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"span_id": "xVnbGqSwIyM=",
|
||||
"parent_span_id": "5FdSinM8g/I=",
|
||||
"duration_ms": 3.068,
|
||||
"attempt": null
|
||||
},
|
||||
{
|
||||
"service": "messenger-worker",
|
||||
"name": "S3 put_object",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"span_id": "xlsNqUduAJg=",
|
||||
"parent_span_id": "5FdSinM8g/I=",
|
||||
"duration_ms": 2.116,
|
||||
"attempt": null
|
||||
},
|
||||
{
|
||||
"service": "messenger-worker",
|
||||
"name": "S3 put_object",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"span_id": "b1yVsz3MXXU=",
|
||||
"parent_span_id": "5FdSinM8g/I=",
|
||||
"duration_ms": 2.15,
|
||||
"attempt": null
|
||||
},
|
||||
{
|
||||
"service": "messenger-worker",
|
||||
"name": "BEGIN;",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"span_id": "BQ9ygc2ijJ4=",
|
||||
"parent_span_id": "5FdSinM8g/I=",
|
||||
"duration_ms": 0.118,
|
||||
"attempt": null
|
||||
},
|
||||
{
|
||||
"service": "messenger-worker",
|
||||
"name": ";",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"span_id": "HDUv+6emOrs=",
|
||||
"parent_span_id": "5FdSinM8g/I=",
|
||||
"duration_ms": 0.056,
|
||||
"attempt": null
|
||||
},
|
||||
{
|
||||
"service": "messenger-worker",
|
||||
"name": "ROLLBACK;",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"span_id": "AbMWZAykxew=",
|
||||
"parent_span_id": "5FdSinM8g/I=",
|
||||
"duration_ms": 0.047,
|
||||
"attempt": null
|
||||
},
|
||||
{
|
||||
"service": "messenger-worker",
|
||||
"name": "BEGIN;",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"span_id": "ajiQzRZGl40=",
|
||||
"parent_span_id": "5FdSinM8g/I=",
|
||||
"duration_ms": 0.063,
|
||||
"attempt": null
|
||||
},
|
||||
{
|
||||
"service": "messenger-worker",
|
||||
"name": "UPDATE",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"span_id": "Gutvv1G6/W0=",
|
||||
"parent_span_id": "5FdSinM8g/I=",
|
||||
"duration_ms": 0.18,
|
||||
"attempt": null
|
||||
},
|
||||
{
|
||||
"service": "messenger-worker",
|
||||
"name": "INSERT",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"span_id": "LH3hKhCnOfU=",
|
||||
"parent_span_id": "5FdSinM8g/I=",
|
||||
"duration_ms": 0.311,
|
||||
"attempt": null
|
||||
},
|
||||
{
|
||||
"service": "messenger-worker",
|
||||
"name": "UPDATE",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"span_id": "7Qrp8PCcAbU=",
|
||||
"parent_span_id": "5FdSinM8g/I=",
|
||||
"duration_ms": 0.143,
|
||||
"attempt": null
|
||||
},
|
||||
{
|
||||
"service": "messenger-worker",
|
||||
"name": "INSERT",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"span_id": "1nP4RrrfEvE=",
|
||||
"parent_span_id": "5FdSinM8g/I=",
|
||||
"duration_ms": 0.217,
|
||||
"attempt": null
|
||||
},
|
||||
{
|
||||
"service": "messenger-worker",
|
||||
"name": "COMMIT;",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"status": "STATUS_CODE_UNSET",
|
||||
"span_id": "fz28vhFBmpM=",
|
||||
"parent_span_id": "5FdSinM8g/I=",
|
||||
"duration_ms": 0.26,
|
||||
"attempt": null
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
exit_code: 0 elapsed_seconds: 13.411
|
||||
@@ -0,0 +1,17 @@
|
||||
date: 2026-11-06T09:59:26Z commit: 44d81fd80ee13faa42bca069245ee0943f88b2df
|
||||
environment: {"COMPOSE_PROJECT_NAME": "mtusi2026lab6", "LB_HTTP_PORT": "18086", "LB_STATS_PORT": "26085", "BASE_URL": "http://127.0.0.1:18086", "NO_PROXY": "localhost,127.0.0.1,::1"}
|
||||
$ python3 scripts/obs_incidents.py retry
|
||||
Traceback (most recent call last):
|
||||
File "<repo>/scripts/obs_incidents.py", line 349, in <module>
|
||||
main()
|
||||
~~~~^^
|
||||
File "<repo>/scripts/obs_incidents.py", line 330, in main
|
||||
chain(b, args.scenario == "retry")
|
||||
~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
File "<repo>/scripts/obs_incidents.py", line 74, in chain
|
||||
wait_for("real S3 retry", lambda: b.logs(query, started, time.time() + 1), 60)
|
||||
~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
File "<repo>/scripts/obs_check.py", line 72, in wait_for
|
||||
raise Failure(f"timeout waiting for {what}")
|
||||
obs_check.Failure: timeout waiting for real S3 retry
|
||||
exit_code: 1 elapsed_seconds: 68.320
|
||||
@@ -0,0 +1,6 @@
|
||||
date: 2026-11-06T10:04:39Z commit: 447a6507f973596e612f40c1484dda922bf0e50d
|
||||
environment: {"COMPOSE_PROJECT_NAME": "mtusi2026lab6", "LB_HTTP_PORT": "18086", "LB_STATS_PORT": "26085", "BASE_URL": "http://127.0.0.1:18086", "NO_PROXY": "localhost,127.0.0.1,::1"}
|
||||
$ make test
|
||||
python3 tests/smoke.py --base-url "http://127.0.0.1:18086"
|
||||
PASS: lab6 public API scenario; infrastructure and grading evidence remain separate.
|
||||
exit_code: 0 elapsed_seconds: 1.991
|
||||
@@ -0,0 +1,279 @@
|
||||
date: 2026-11-06T18:14:15Z commit: cd9d91550aa4eeba31489e07b71ee2767acfc7d8
|
||||
environment: {"COMPOSE_PROJECT_NAME": "mtusi2026lab6", "LB_HTTP_PORT": "18086", "LB_STATS_PORT": "26085", "BASE_URL": "http://127.0.0.1:18086", "NO_PROXY": "localhost,127.0.0.1,::1"}
|
||||
$ python3 scripts/obs_incidents.py storage
|
||||
{
|
||||
"started": "2026-11-06T18:14:15+00:00",
|
||||
"finished": "2026-11-06T18:16:39+00:00",
|
||||
"result": "PASS",
|
||||
"scenario": "storage",
|
||||
"observations": {
|
||||
"stopped": "2026-11-06T18:14:29+00:00",
|
||||
"restored": "2026-11-06T18:16:16+00:00",
|
||||
"peak_memory_percent_of_limit": 98.7,
|
||||
"smoke": "python3 tests/smoke.py --base-url \"http://127.0.0.1:18086\" \nPASS: lab6 public API scenario; infrastructure and grading evidence remain separate.\n",
|
||||
"successful_probes": 74,
|
||||
"stored_probe_traces": 72,
|
||||
"lost_probe_traces": 2,
|
||||
"memory_samples": [
|
||||
{
|
||||
"utc": "2026-11-06T18:14:16+00:00",
|
||||
"containers": [
|
||||
{
|
||||
"Name": "mtusi2026lab6-api-1",
|
||||
"MemUsage": "246.6MiB / 512MiB",
|
||||
"MemPerc": "48.16%",
|
||||
"CPUPerc": "1.94%"
|
||||
},
|
||||
{
|
||||
"Name": "mtusi2026lab6-api-2",
|
||||
"MemUsage": "241.7MiB / 512MiB",
|
||||
"MemPerc": "47.20%",
|
||||
"CPUPerc": "1.12%"
|
||||
},
|
||||
{
|
||||
"Name": "mtusi2026lab6-otel-collector-1",
|
||||
"MemUsage": "246.2MiB / 256MiB",
|
||||
"MemPerc": "96.18%",
|
||||
"CPUPerc": "0.63%"
|
||||
},
|
||||
{
|
||||
"Name": "mtusi2026lab6-relay-1",
|
||||
"MemUsage": "119.4MiB / 192MiB",
|
||||
"MemPerc": "62.18%",
|
||||
"CPUPerc": "0.38%"
|
||||
},
|
||||
{
|
||||
"Name": "mtusi2026lab6-worker-1",
|
||||
"MemUsage": "121.3MiB / 1GiB",
|
||||
"MemPerc": "11.84%",
|
||||
"CPUPerc": "0.10%"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"utc": "2026-11-06T18:14:45+00:00",
|
||||
"containers": [
|
||||
{
|
||||
"Name": "mtusi2026lab6-api-1",
|
||||
"MemUsage": "259.7MiB / 512MiB",
|
||||
"MemPerc": "50.72%",
|
||||
"CPUPerc": "1.59%"
|
||||
},
|
||||
{
|
||||
"Name": "mtusi2026lab6-api-2",
|
||||
"MemUsage": "249.4MiB / 512MiB",
|
||||
"MemPerc": "48.71%",
|
||||
"CPUPerc": "1.56%"
|
||||
},
|
||||
{
|
||||
"Name": "mtusi2026lab6-otel-collector-1",
|
||||
"MemUsage": "248.5MiB / 256MiB",
|
||||
"MemPerc": "97.08%",
|
||||
"CPUPerc": "0.30%"
|
||||
},
|
||||
{
|
||||
"Name": "mtusi2026lab6-relay-1",
|
||||
"MemUsage": "120.2MiB / 192MiB",
|
||||
"MemPerc": "62.59%",
|
||||
"CPUPerc": "0.48%"
|
||||
},
|
||||
{
|
||||
"Name": "mtusi2026lab6-worker-1",
|
||||
"MemUsage": "253.4MiB / 1GiB",
|
||||
"MemPerc": "24.75%",
|
||||
"CPUPerc": "0.35%"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"utc": "2026-11-06T18:15:03+00:00",
|
||||
"containers": [
|
||||
{
|
||||
"Name": "mtusi2026lab6-api-1",
|
||||
"MemUsage": "259.5MiB / 512MiB",
|
||||
"MemPerc": "50.69%",
|
||||
"CPUPerc": "1.10%"
|
||||
},
|
||||
{
|
||||
"Name": "mtusi2026lab6-api-2",
|
||||
"MemUsage": "249.4MiB / 512MiB",
|
||||
"MemPerc": "48.71%",
|
||||
"CPUPerc": "1.19%"
|
||||
},
|
||||
{
|
||||
"Name": "mtusi2026lab6-otel-collector-1",
|
||||
"MemUsage": "250.5MiB / 256MiB",
|
||||
"MemPerc": "97.87%",
|
||||
"CPUPerc": "0.20%"
|
||||
},
|
||||
{
|
||||
"Name": "mtusi2026lab6-relay-1",
|
||||
"MemUsage": "119.9MiB / 192MiB",
|
||||
"MemPerc": "62.46%",
|
||||
"CPUPerc": "0.18%"
|
||||
},
|
||||
{
|
||||
"Name": "mtusi2026lab6-worker-1",
|
||||
"MemUsage": "253.5MiB / 1GiB",
|
||||
"MemPerc": "24.75%",
|
||||
"CPUPerc": "2.07%"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"utc": "2026-11-06T18:15:21+00:00",
|
||||
"containers": [
|
||||
{
|
||||
"Name": "mtusi2026lab6-api-1",
|
||||
"MemUsage": "259.6MiB / 512MiB",
|
||||
"MemPerc": "50.70%",
|
||||
"CPUPerc": "2.63%"
|
||||
},
|
||||
{
|
||||
"Name": "mtusi2026lab6-api-2",
|
||||
"MemUsage": "249.5MiB / 512MiB",
|
||||
"MemPerc": "48.73%",
|
||||
"CPUPerc": "1.35%"
|
||||
},
|
||||
{
|
||||
"Name": "mtusi2026lab6-otel-collector-1",
|
||||
"MemUsage": "250.6MiB / 256MiB",
|
||||
"MemPerc": "97.89%",
|
||||
"CPUPerc": "1.18%"
|
||||
},
|
||||
{
|
||||
"Name": "mtusi2026lab6-relay-1",
|
||||
"MemUsage": "119.9MiB / 192MiB",
|
||||
"MemPerc": "62.47%",
|
||||
"CPUPerc": "1.77%"
|
||||
},
|
||||
{
|
||||
"Name": "mtusi2026lab6-worker-1",
|
||||
"MemUsage": "253.4MiB / 1GiB",
|
||||
"MemPerc": "24.75%",
|
||||
"CPUPerc": "0.75%"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"utc": "2026-11-06T18:15:39+00:00",
|
||||
"containers": [
|
||||
{
|
||||
"Name": "mtusi2026lab6-api-1",
|
||||
"MemUsage": "259.6MiB / 512MiB",
|
||||
"MemPerc": "50.71%",
|
||||
"CPUPerc": "0.50%"
|
||||
},
|
||||
{
|
||||
"Name": "mtusi2026lab6-api-2",
|
||||
"MemUsage": "249.1MiB / 512MiB",
|
||||
"MemPerc": "48.66%",
|
||||
"CPUPerc": "0.47%"
|
||||
},
|
||||
{
|
||||
"Name": "mtusi2026lab6-otel-collector-1",
|
||||
"MemUsage": "250.6MiB / 256MiB",
|
||||
"MemPerc": "97.88%",
|
||||
"CPUPerc": "0.07%"
|
||||
},
|
||||
{
|
||||
"Name": "mtusi2026lab6-relay-1",
|
||||
"MemUsage": "120MiB / 192MiB",
|
||||
"MemPerc": "62.48%",
|
||||
"CPUPerc": "0.18%"
|
||||
},
|
||||
{
|
||||
"Name": "mtusi2026lab6-worker-1",
|
||||
"MemUsage": "253.4MiB / 1GiB",
|
||||
"MemPerc": "24.75%",
|
||||
"CPUPerc": "0.20%"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"utc": "2026-11-06T18:16:36+00:00",
|
||||
"containers": [
|
||||
{
|
||||
"Name": "mtusi2026lab6-api-1",
|
||||
"MemUsage": "259.6MiB / 512MiB",
|
||||
"MemPerc": "50.70%",
|
||||
"CPUPerc": "1.35%"
|
||||
},
|
||||
{
|
||||
"Name": "mtusi2026lab6-api-2",
|
||||
"MemUsage": "249.1MiB / 512MiB",
|
||||
"MemPerc": "48.65%",
|
||||
"CPUPerc": "1.59%"
|
||||
},
|
||||
{
|
||||
"Name": "mtusi2026lab6-otel-collector-1",
|
||||
"MemUsage": "252.7MiB / 256MiB",
|
||||
"MemPerc": "98.70%",
|
||||
"CPUPerc": "0.23%"
|
||||
},
|
||||
{
|
||||
"Name": "mtusi2026lab6-relay-1",
|
||||
"MemUsage": "120MiB / 192MiB",
|
||||
"MemPerc": "62.49%",
|
||||
"CPUPerc": "0.77%"
|
||||
},
|
||||
{
|
||||
"Name": "mtusi2026lab6-worker-1",
|
||||
"MemUsage": "253.4MiB / 1GiB",
|
||||
"MemPerc": "24.75%",
|
||||
"CPUPerc": "0.29%"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"collector_before": {
|
||||
"otelcol_exporter_queue_capacity{data_type=\"logs\",exporter=\"otlp_http/loki\"}": 20000.0,
|
||||
"otelcol_exporter_queue_capacity{data_type=\"metrics\",exporter=\"otlp_http/prometheus\"}": 50000.0,
|
||||
"otelcol_exporter_queue_capacity{data_type=\"traces\",exporter=\"otlp_http/tempo\"}": 20000.0,
|
||||
"otelcol_exporter_queue_size{data_type=\"logs\",exporter=\"otlp_http/loki\"}": 0.0,
|
||||
"otelcol_exporter_queue_size{data_type=\"metrics\",exporter=\"otlp_http/prometheus\"}": 0.0,
|
||||
"otelcol_exporter_queue_size{data_type=\"traces\",exporter=\"otlp_http/tempo\"}": 0.0,
|
||||
"otelcol_exporter_sent_log_records_total{exporter=\"otlp_http/loki\",server_address=\"loki\",server_port=\"3100\",url_path=\"/otlp/v1/logs\"}": 807.0,
|
||||
"otelcol_exporter_sent_metric_points_total{exporter=\"otlp_http/prometheus\",server_address=\"prometheus\",server_port=\"9090\",url_path=\"/api/v1/otlp/v1/metrics\"}": 656.0,
|
||||
"otelcol_exporter_sent_spans_total{exporter=\"otlp_http/tempo\",server_address=\"tempo\",server_port=\"4318\",url_path=\"/v1/traces\"}": 784.0,
|
||||
"otelcol_receiver_accepted_log_records_total{receiver=\"otlp\",transport=\"http\"}": 810.0,
|
||||
"otelcol_receiver_accepted_metric_points_total{receiver=\"otlp\",transport=\"http\"}": 656.0,
|
||||
"otelcol_receiver_accepted_spans_total{receiver=\"otlp\",transport=\"http\"}": 784.0
|
||||
},
|
||||
"collector_during": {
|
||||
"otelcol_exporter_queue_capacity{data_type=\"logs\",exporter=\"otlp_http/loki\"}": 20000.0,
|
||||
"otelcol_exporter_queue_capacity{data_type=\"metrics\",exporter=\"otlp_http/prometheus\"}": 50000.0,
|
||||
"otelcol_exporter_queue_capacity{data_type=\"traces\",exporter=\"otlp_http/tempo\"}": 20000.0,
|
||||
"otelcol_exporter_queue_size{data_type=\"logs\",exporter=\"otlp_http/loki\"}": 381.0,
|
||||
"otelcol_exporter_queue_size{data_type=\"metrics\",exporter=\"otlp_http/prometheus\"}": 1287.0,
|
||||
"otelcol_exporter_queue_size{data_type=\"traces\",exporter=\"otlp_http/tempo\"}": 465.0,
|
||||
"otelcol_exporter_send_failed_log_records_total{exporter=\"otlp_http/loki\",server_address=\"loki\",server_port=\"3100\",url_path=\"/otlp/v1/logs\"}": 11.0,
|
||||
"otelcol_exporter_send_failed_metric_points_total{exporter=\"otlp_http/prometheus\",server_address=\"prometheus\",server_port=\"9090\",url_path=\"/api/v1/otlp/v1/metrics\"}": 72.0,
|
||||
"otelcol_exporter_send_failed_spans_total{exporter=\"otlp_http/tempo\",server_address=\"tempo\",server_port=\"4318\",url_path=\"/v1/traces\"}": 440.0,
|
||||
"otelcol_exporter_sent_log_records_total{exporter=\"otlp_http/loki\",server_address=\"loki\",server_port=\"3100\",url_path=\"/otlp/v1/logs\"}": 833.0,
|
||||
"otelcol_exporter_sent_metric_points_total{exporter=\"otlp_http/prometheus\",server_address=\"prometheus\",server_port=\"9090\",url_path=\"/api/v1/otlp/v1/metrics\"}": 656.0,
|
||||
"otelcol_exporter_sent_spans_total{exporter=\"otlp_http/tempo\",server_address=\"tempo\",server_port=\"4318\",url_path=\"/v1/traces\"}": 807.0,
|
||||
"otelcol_receiver_accepted_log_records_total{receiver=\"otlp\",transport=\"http\"}": 1228.0,
|
||||
"otelcol_receiver_accepted_metric_points_total{receiver=\"otlp\",transport=\"http\"}": 2015.0,
|
||||
"otelcol_receiver_accepted_spans_total{receiver=\"otlp\",transport=\"http\"}": 1712.0
|
||||
},
|
||||
"collector_after": {
|
||||
"otelcol_exporter_queue_capacity{data_type=\"logs\",exporter=\"otlp_http/loki\"}": 20000.0,
|
||||
"otelcol_exporter_queue_capacity{data_type=\"metrics\",exporter=\"otlp_http/prometheus\"}": 50000.0,
|
||||
"otelcol_exporter_queue_capacity{data_type=\"traces\",exporter=\"otlp_http/tempo\"}": 20000.0,
|
||||
"otelcol_exporter_queue_size{data_type=\"logs\",exporter=\"otlp_http/loki\"}": 0.0,
|
||||
"otelcol_exporter_queue_size{data_type=\"metrics\",exporter=\"otlp_http/prometheus\"}": 0.0,
|
||||
"otelcol_exporter_queue_size{data_type=\"traces\",exporter=\"otlp_http/tempo\"}": 0.0,
|
||||
"otelcol_exporter_send_failed_log_records_total{exporter=\"otlp_http/loki\",server_address=\"loki\",server_port=\"3100\",url_path=\"/otlp/v1/logs\"}": 11.0,
|
||||
"otelcol_exporter_send_failed_metric_points_total{exporter=\"otlp_http/prometheus\",server_address=\"prometheus\",server_port=\"9090\",url_path=\"/api/v1/otlp/v1/metrics\"}": 72.0,
|
||||
"otelcol_exporter_send_failed_spans_total{exporter=\"otlp_http/tempo\",server_address=\"tempo\",server_port=\"4318\",url_path=\"/v1/traces\"}": 440.0,
|
||||
"otelcol_exporter_sent_log_records_total{exporter=\"otlp_http/loki\",server_address=\"loki\",server_port=\"3100\",url_path=\"/otlp/v1/logs\"}": 1320.0,
|
||||
"otelcol_exporter_sent_metric_points_total{exporter=\"otlp_http/prometheus\",server_address=\"prometheus\",server_port=\"9090\",url_path=\"/api/v1/otlp/v1/metrics\"}": 2515.0,
|
||||
"otelcol_exporter_sent_spans_total{exporter=\"otlp_http/tempo\",server_address=\"tempo\",server_port=\"4318\",url_path=\"/v1/traces\"}": 1293.0,
|
||||
"otelcol_receiver_accepted_log_records_total{receiver=\"otlp\",transport=\"http\"}": 1335.0,
|
||||
"otelcol_receiver_accepted_metric_points_total{receiver=\"otlp\",transport=\"http\"}": 2587.0,
|
||||
"otelcol_receiver_accepted_spans_total{receiver=\"otlp\",transport=\"http\"}": 1733.0
|
||||
}
|
||||
}
|
||||
}
|
||||
exit_code: 0 elapsed_seconds: 143.965
|
||||
@@ -0,0 +1,63 @@
|
||||
date: 2026-11-06T09:58:18Z commit: 44d81fd80ee13faa42bca069245ee0943f88b2df
|
||||
environment: {"COMPOSE_PROJECT_NAME": "mtusi2026lab6", "LB_HTTP_PORT": "18086", "LB_STATS_PORT": "26085", "BASE_URL": "http://127.0.0.1:18086", "NO_PROXY": "localhost,127.0.0.1,::1"}
|
||||
$ make student-test
|
||||
.venv/bin/pytest
|
||||
============================= test session starts ==============================
|
||||
platform darwin -- Python 3.14.5, pytest-9.1.1, pluggy-1.6.0
|
||||
rootdir: <repo>
|
||||
configfile: pyproject.toml
|
||||
testpaths: student-tests
|
||||
plugins: asyncio-1.4.0, anyio-4.15.1
|
||||
asyncio: mode=Mode.AUTO, debug=False, asyncio_default_fixture_loop_scope=function, asyncio_default_test_loop_scope=function
|
||||
collected 536 items / 19 deselected / 517 selected
|
||||
|
||||
student-tests/adapters/test_rabbitmq.py .... [ 0%]
|
||||
student-tests/adapters/test_s3_storage.py ... [ 1%]
|
||||
student-tests/api/test_access.py ......... [ 3%]
|
||||
student-tests/api/test_attachments.py .................................. [ 9%]
|
||||
.... [ 10%]
|
||||
student-tests/api/test_bounded_contexts.py .................... [ 14%]
|
||||
student-tests/api/test_cache.py ...... [ 15%]
|
||||
student-tests/api/test_concurrency.py .... [ 16%]
|
||||
student-tests/api/test_consistency.py ........ [ 17%]
|
||||
student-tests/api/test_drain.py .. [ 18%]
|
||||
student-tests/api/test_events.py ...... [ 19%]
|
||||
student-tests/api/test_http_telemetry.py . [ 19%]
|
||||
student-tests/api/test_idempotency.py ............... [ 22%]
|
||||
student-tests/api/test_instance.py .... [ 23%]
|
||||
student-tests/api/test_job_returning.py . [ 23%]
|
||||
student-tests/api/test_message_attachments.py ............. [ 25%]
|
||||
student-tests/api/test_migrations.py ................................... [ 32%]
|
||||
. [ 32%]
|
||||
student-tests/api/test_negative.py ..................................... [ 40%]
|
||||
[ 40%]
|
||||
student-tests/api/test_operability.py .............. [ 42%]
|
||||
student-tests/api/test_pagination.py .................. [ 46%]
|
||||
student-tests/api/test_pipeline.py ............. [ 48%]
|
||||
student-tests/api/test_pool.py ............ [ 51%]
|
||||
student-tests/api/test_reconciler.py ........... [ 53%]
|
||||
student-tests/api/test_recovery.py ............ [ 55%]
|
||||
student-tests/api/test_sessions.py .................. [ 58%]
|
||||
student-tests/api/test_timeout.py ........ [ 60%]
|
||||
student-tests/api/test_trace_context.py . [ 60%]
|
||||
student-tests/api/test_upload_consistency.py ......... [ 62%]
|
||||
student-tests/api/test_versioned_pipeline.py ........... [ 64%]
|
||||
student-tests/api/test_wire_format.py .. [ 64%]
|
||||
student-tests/unit/test_attachments_domain.py .......................... [ 70%]
|
||||
. [ 70%]
|
||||
student-tests/unit/test_authentication.py ..................... [ 74%]
|
||||
student-tests/unit/test_cursor.py ........... [ 76%]
|
||||
student-tests/unit/test_domain.py ...................................... [ 83%]
|
||||
.. [ 84%]
|
||||
student-tests/unit/test_job_observer.py . [ 84%]
|
||||
student-tests/unit/test_pipeline_domain.py ....................... [ 88%]
|
||||
student-tests/unit/test_probe.py .............. [ 91%]
|
||||
student-tests/unit/test_reconcile_measurements.py ...... [ 92%]
|
||||
student-tests/unit/test_render_pool.py .....s. [ 94%]
|
||||
student-tests/unit/test_renderer.py .................... [ 97%]
|
||||
student-tests/unit/test_scaling.py ..... [ 98%]
|
||||
student-tests/unit/test_telemetry_platform.py ..... [ 99%]
|
||||
student-tests/unit/test_timeouts.py . [100%]
|
||||
|
||||
========== 516 passed, 1 skipped, 19 deselected in 152.10s (0:02:32) ===========
|
||||
exit_code: 0 elapsed_seconds: 154.509
|
||||
@@ -0,0 +1,243 @@
|
||||
date: 2026-11-06T09:52:20Z commit: 1a171d0d0f13ab71661a0f63e695031addd88dc0
|
||||
environment: {"COMPOSE_PROJECT_NAME": "mtusi2026lab6", "LB_HTTP_PORT": "18086", "LB_STATS_PORT": "26085", "BASE_URL": "http://127.0.0.1:18086", "NO_PROXY": "localhost,127.0.0.1,::1"}
|
||||
$ make student-test
|
||||
.venv/bin/pytest
|
||||
============================= test session starts ==============================
|
||||
platform darwin -- Python 3.14.5, pytest-9.1.1, pluggy-1.6.0
|
||||
rootdir: <repo>
|
||||
configfile: pyproject.toml
|
||||
testpaths: student-tests
|
||||
plugins: asyncio-1.4.0, anyio-4.15.1
|
||||
asyncio: mode=Mode.AUTO, debug=False, asyncio_default_fixture_loop_scope=function, asyncio_default_test_loop_scope=function
|
||||
collected 536 items / 19 deselected / 517 selected
|
||||
|
||||
student-tests/adapters/test_rabbitmq.py .... [ 0%]
|
||||
student-tests/adapters/test_s3_storage.py ... [ 1%]
|
||||
student-tests/api/test_access.py ......... [ 3%]
|
||||
student-tests/api/test_attachments.py .................................. [ 9%]
|
||||
.... [ 10%]
|
||||
student-tests/api/test_bounded_contexts.py ......F............. [ 14%]
|
||||
student-tests/api/test_cache.py ...... [ 15%]
|
||||
student-tests/api/test_concurrency.py .... [ 16%]
|
||||
student-tests/api/test_consistency.py ........ [ 17%]
|
||||
student-tests/api/test_drain.py .. [ 18%]
|
||||
student-tests/api/test_events.py ...... [ 19%]
|
||||
student-tests/api/test_http_telemetry.py . [ 19%]
|
||||
student-tests/api/test_idempotency.py ............... [ 22%]
|
||||
student-tests/api/test_instance.py .... [ 23%]
|
||||
student-tests/api/test_job_returning.py . [ 23%]
|
||||
student-tests/api/test_message_attachments.py ............. [ 25%]
|
||||
student-tests/api/test_migrations.py ................................... [ 32%]
|
||||
. [ 32%]
|
||||
student-tests/api/test_negative.py ..................................... [ 40%]
|
||||
[ 40%]
|
||||
student-tests/api/test_operability.py .............. [ 42%]
|
||||
student-tests/api/test_pagination.py .................. [ 46%]
|
||||
student-tests/api/test_pipeline.py ............. [ 48%]
|
||||
student-tests/api/test_pool.py ..F......... [ 51%]
|
||||
student-tests/api/test_reconciler.py .........F. [ 53%]
|
||||
student-tests/api/test_recovery.py ............ [ 55%]
|
||||
student-tests/api/test_sessions.py .................. [ 58%]
|
||||
student-tests/api/test_timeout.py ........ [ 60%]
|
||||
student-tests/api/test_trace_context.py . [ 60%]
|
||||
student-tests/api/test_upload_consistency.py ......... [ 62%]
|
||||
student-tests/api/test_versioned_pipeline.py ........... [ 64%]
|
||||
student-tests/api/test_wire_format.py .. [ 64%]
|
||||
student-tests/unit/test_attachments_domain.py .......................... [ 70%]
|
||||
. [ 70%]
|
||||
student-tests/unit/test_authentication.py ..................... [ 74%]
|
||||
student-tests/unit/test_cursor.py ........... [ 76%]
|
||||
student-tests/unit/test_domain.py ...................................... [ 83%]
|
||||
.. [ 84%]
|
||||
student-tests/unit/test_job_observer.py . [ 84%]
|
||||
student-tests/unit/test_pipeline_domain.py ....................... [ 88%]
|
||||
student-tests/unit/test_probe.py .............. [ 91%]
|
||||
student-tests/unit/test_reconcile_measurements.py ...... [ 92%]
|
||||
student-tests/unit/test_render_pool.py .....s. [ 94%]
|
||||
student-tests/unit/test_renderer.py .................... [ 97%]
|
||||
student-tests/unit/test_scaling.py ..... [ 98%]
|
||||
student-tests/unit/test_telemetry_platform.py ..... [ 99%]
|
||||
student-tests/unit/test_timeouts.py . [100%]
|
||||
|
||||
=================================== FAILURES ===================================
|
||||
_____________________ test_shared_core_holds_only_platform _____________________
|
||||
|
||||
def test_shared_core_holds_only_platform() -> None:
|
||||
names = {
|
||||
path.name
|
||||
for layer in ("domain", "application", "infrastructure")
|
||||
for path in modules_under("shared", layer)
|
||||
}
|
||||
> assert names == {
|
||||
"errors.py",
|
||||
"events.py",
|
||||
"commands.py",
|
||||
"messagebus.py",
|
||||
"ports.py",
|
||||
"clock.py",
|
||||
"ids.py",
|
||||
"logging.py",
|
||||
"postgres.py",
|
||||
"telemetry.py",
|
||||
"readiness.py",
|
||||
}
|
||||
E AssertionError: assert {'clock.py', ...ging.py', ...} == {'clock.py', ...ging.py', ...}
|
||||
E
|
||||
E Extra items in the left set:
|
||||
E 'trace_context.py'
|
||||
E 'runtime_metrics.py'
|
||||
E Use -v to get more diff
|
||||
|
||||
student-tests/api/test_bounded_contexts.py:104: AssertionError
|
||||
________________ test_idle_session_does_not_acquire_connection _________________
|
||||
|
||||
self = <messenger.shared.infrastructure.postgres.Database object at 0x32428de00>
|
||||
|
||||
@asynccontextmanager
|
||||
async def session(self) -> AsyncIterator[DatabaseSession]:
|
||||
try:
|
||||
async with self._sessions() as session:
|
||||
self._waiting += 1
|
||||
try:
|
||||
> await session.connection()
|
||||
|
||||
src/messenger/shared/infrastructure/postgres.py:106:
|
||||
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
||||
.venv/lib/python3.14/site-packages/sqlalchemy/ext/asyncio/session.py:930: in connection
|
||||
sync_connection = await greenlet_spawn(
|
||||
.venv/lib/python3.14/site-packages/sqlalchemy/util/_concurrency_py3k.py:201: in greenlet_spawn
|
||||
result = context.throw(*sys.exc_info())
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
.venv/lib/python3.14/site-packages/sqlalchemy/orm/session.py:2092: in connection
|
||||
return self._connection_for_bind(
|
||||
.venv/lib/python3.14/site-packages/sqlalchemy/orm/session.py:2108: in _connection_for_bind
|
||||
return trans._connection_for_bind(engine, execution_options)
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
.venv/lib/python3.14/site-packages/sqlalchemy/orm/state_changes.py:137: in _go
|
||||
ret_value = fn(self, *arg, **kw)
|
||||
^^^^^^^^^^^^^^^^^^^^
|
||||
.venv/lib/python3.14/site-packages/sqlalchemy/orm/session.py:1187: in _connection_for_bind
|
||||
conn = bind.connect()
|
||||
^^^^^^^^^^^^^^
|
||||
.venv/lib/python3.14/site-packages/sqlalchemy/engine/base.py:3285: in connect
|
||||
return self._connection_cls(self)
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
.venv/lib/python3.14/site-packages/sqlalchemy/engine/base.py:143: in __init__
|
||||
self._dbapi_connection = engine.raw_connection()
|
||||
^^^^^^^^^^^^^^^^^^^^^^^
|
||||
.venv/lib/python3.14/site-packages/sqlalchemy/engine/base.py:3309: in raw_connection
|
||||
return self.pool.connect()
|
||||
^^^^^^^^^^^^^^^^^^^
|
||||
.venv/lib/python3.14/site-packages/sqlalchemy/pool/base.py:447: in connect
|
||||
return _ConnectionFairy._checkout(self)
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
.venv/lib/python3.14/site-packages/sqlalchemy/pool/base.py:1264: in _checkout
|
||||
fairy = _ConnectionRecord.checkout(pool)
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
.venv/lib/python3.14/site-packages/sqlalchemy/pool/base.py:711: in checkout
|
||||
rec = pool._do_get()
|
||||
^^^^^^^^^^^^^^
|
||||
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
||||
|
||||
self = <sqlalchemy.pool.impl.AsyncAdaptedQueuePool object at 0x324289390>
|
||||
|
||||
def _do_get(self) -> ConnectionPoolEntry:
|
||||
use_overflow = self._max_overflow > -1
|
||||
|
||||
wait = use_overflow and self._overflow >= self._max_overflow
|
||||
try:
|
||||
return self._pool.get(wait, self._timeout)
|
||||
except sqla_queue.Empty:
|
||||
# don't do things inside of "except Empty", because when we say
|
||||
# we timed out or can't connect and raise, Python 3 tells
|
||||
# people the real error is queue.Empty which it isn't.
|
||||
pass
|
||||
if use_overflow and self._overflow >= self._max_overflow:
|
||||
if not wait:
|
||||
return self._do_get()
|
||||
else:
|
||||
> raise exc.TimeoutError(
|
||||
"QueuePool limit of size %d overflow %d reached, "
|
||||
"connection timed out, timeout %0.2f"
|
||||
% (self.size(), self.overflow(), self._timeout),
|
||||
code="3o7r",
|
||||
)
|
||||
E sqlalchemy.exc.TimeoutError: QueuePool limit of size 1 overflow 0 reached, connection timed out, timeout 1.00 (Background on this error at: https://sqlalche.me/e/20/3o7r)
|
||||
|
||||
.venv/lib/python3.14/site-packages/sqlalchemy/pool/impl.py:166: TimeoutError
|
||||
|
||||
The above exception was the direct cause of the following exception:
|
||||
|
||||
async def test_idle_session_does_not_acquire_connection() -> None:
|
||||
async with running_app(db_pool_max_size=1) as http:
|
||||
database = await resolve(http, Database)
|
||||
> async with database.session(), database.session() as active:
|
||||
^^^^^^^^^^^^^^^^^^
|
||||
|
||||
student-tests/api/test_pool.py:74:
|
||||
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
||||
../../../../../.local/share/uv/python/cpython-3.14.5-macos-aarch64-none/lib/python3.14/contextlib.py:214: in __aenter__
|
||||
return await anext(self.gen)
|
||||
^^^^^^^^^^^^^^^^^^^^^
|
||||
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
||||
|
||||
self = <messenger.shared.infrastructure.postgres.Database object at 0x32428de00>
|
||||
|
||||
@asynccontextmanager
|
||||
async def session(self) -> AsyncIterator[DatabaseSession]:
|
||||
try:
|
||||
async with self._sessions() as session:
|
||||
self._waiting += 1
|
||||
try:
|
||||
await session.connection()
|
||||
finally:
|
||||
self._waiting -= 1
|
||||
yield session
|
||||
except Exception as error:
|
||||
if not unavailable(error):
|
||||
raise
|
||||
> raise Unavailable("PostgreSQL недоступен") from error
|
||||
E messenger.shared.application.errors.Unavailable: PostgreSQL недоступен
|
||||
|
||||
src/messenger/shared/infrastructure/postgres.py:113: Unavailable
|
||||
_______________ test_cancelled_pass_releases_its_autocommit_lock _______________
|
||||
|
||||
dsn = 'postgresql://postgres:test@127.0.0.1:26002/reconcile_07e983d849c3'
|
||||
|
||||
async def test_cancelled_pass_releases_its_autocommit_lock(dsn: str) -> None:
|
||||
async with stand(dsn) as s:
|
||||
entered = asyncio.Event()
|
||||
|
||||
async def hold() -> None:
|
||||
async with PostgresSingleRun(s.database, LOCK_KEY).hold() as held:
|
||||
assert held
|
||||
entered.set()
|
||||
await asyncio.Event().wait()
|
||||
|
||||
task = asyncio.create_task(hold())
|
||||
try:
|
||||
await asyncio.wait_for(entered.wait(), 2)
|
||||
states = await s.sql(
|
||||
"SELECT a.state FROM pg_locks l JOIN pg_stat_activity a ON a.pid = l.pid "
|
||||
"WHERE l.locktype = 'advisory' AND l.objid = $1",
|
||||
LOCK_KEY,
|
||||
)
|
||||
> assert [row["state"] for row in states] == ["idle"]
|
||||
E AssertionError: assert ['idle in transaction'] == ['idle']
|
||||
E
|
||||
E At index 0 diff: 'idle in transaction' != 'idle'
|
||||
E Use -v to get more diff
|
||||
|
||||
student-tests/api/test_reconciler.py:403: AssertionError
|
||||
=============================== warnings summary ===============================
|
||||
student-tests/api/test_reconciler.py: 11 warnings
|
||||
<sys>:0: SAWarning: Connection is already established for the given bind; execution_options ignored
|
||||
|
||||
-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
|
||||
=========================== short test summary info ============================
|
||||
FAILED student-tests/api/test_bounded_contexts.py::test_shared_core_holds_only_platform
|
||||
FAILED student-tests/api/test_pool.py::test_idle_session_does_not_acquire_connection
|
||||
FAILED student-tests/api/test_reconciler.py::test_cancelled_pass_releases_its_autocommit_lock
|
||||
= 3 failed, 513 passed, 1 skipped, 19 deselected, 11 warnings in 156.67s (0:02:36) =
|
||||
make: *** [student-test] Error 1
|
||||
exit_code: 2 elapsed_seconds: 159.760
|
||||
@@ -0,0 +1,91 @@
|
||||
date: 2026-11-06T09:55:35Z commit: 1a171d0d0f13ab71661a0f63e695031addd88dc0
|
||||
environment: {"COMPOSE_PROJECT_NAME": "mtusi2026lab6", "LB_HTTP_PORT": "18086", "LB_STATS_PORT": "26085", "BASE_URL": "http://127.0.0.1:18086", "NO_PROXY": "localhost,127.0.0.1,::1"}
|
||||
$ make student-test
|
||||
.venv/bin/pytest
|
||||
============================= test session starts ==============================
|
||||
platform darwin -- Python 3.14.5, pytest-9.1.1, pluggy-1.6.0
|
||||
rootdir: <repo>
|
||||
configfile: pyproject.toml
|
||||
testpaths: student-tests
|
||||
plugins: asyncio-1.4.0, anyio-4.15.1
|
||||
asyncio: mode=Mode.AUTO, debug=False, asyncio_default_fixture_loop_scope=function, asyncio_default_test_loop_scope=function
|
||||
collected 536 items / 19 deselected / 517 selected
|
||||
|
||||
student-tests/adapters/test_rabbitmq.py .... [ 0%]
|
||||
student-tests/adapters/test_s3_storage.py ... [ 1%]
|
||||
student-tests/api/test_access.py ......... [ 3%]
|
||||
student-tests/api/test_attachments.py .................................. [ 9%]
|
||||
.... [ 10%]
|
||||
student-tests/api/test_bounded_contexts.py .......F............ [ 14%]
|
||||
student-tests/api/test_cache.py ...... [ 15%]
|
||||
student-tests/api/test_concurrency.py .... [ 16%]
|
||||
student-tests/api/test_consistency.py ........ [ 17%]
|
||||
student-tests/api/test_drain.py .. [ 18%]
|
||||
student-tests/api/test_events.py ...... [ 19%]
|
||||
student-tests/api/test_http_telemetry.py . [ 19%]
|
||||
student-tests/api/test_idempotency.py ............... [ 22%]
|
||||
student-tests/api/test_instance.py .... [ 23%]
|
||||
student-tests/api/test_job_returning.py . [ 23%]
|
||||
student-tests/api/test_message_attachments.py ............. [ 25%]
|
||||
student-tests/api/test_migrations.py ................................... [ 32%]
|
||||
. [ 32%]
|
||||
student-tests/api/test_negative.py ..................................... [ 40%]
|
||||
[ 40%]
|
||||
student-tests/api/test_operability.py .............. [ 42%]
|
||||
student-tests/api/test_pagination.py .................. [ 46%]
|
||||
student-tests/api/test_pipeline.py ............. [ 48%]
|
||||
student-tests/api/test_pool.py ............ [ 51%]
|
||||
student-tests/api/test_reconciler.py ........... [ 53%]
|
||||
student-tests/api/test_recovery.py ............ [ 55%]
|
||||
student-tests/api/test_sessions.py .................. [ 58%]
|
||||
student-tests/api/test_timeout.py ........ [ 60%]
|
||||
student-tests/api/test_trace_context.py . [ 60%]
|
||||
student-tests/api/test_upload_consistency.py ......... [ 62%]
|
||||
student-tests/api/test_versioned_pipeline.py ........... [ 64%]
|
||||
student-tests/api/test_wire_format.py .. [ 64%]
|
||||
student-tests/unit/test_attachments_domain.py .......................... [ 70%]
|
||||
. [ 70%]
|
||||
student-tests/unit/test_authentication.py ..................... [ 74%]
|
||||
student-tests/unit/test_cursor.py ........... [ 76%]
|
||||
student-tests/unit/test_domain.py ...................................... [ 83%]
|
||||
.. [ 84%]
|
||||
student-tests/unit/test_job_observer.py . [ 84%]
|
||||
student-tests/unit/test_pipeline_domain.py ....................... [ 88%]
|
||||
student-tests/unit/test_probe.py .............. [ 91%]
|
||||
student-tests/unit/test_reconcile_measurements.py ...... [ 92%]
|
||||
student-tests/unit/test_render_pool.py .....s. [ 94%]
|
||||
student-tests/unit/test_renderer.py .................... [ 97%]
|
||||
student-tests/unit/test_scaling.py ..... [ 98%]
|
||||
student-tests/unit/test_telemetry_platform.py ..... [ 99%]
|
||||
student-tests/unit/test_timeouts.py . [100%]
|
||||
|
||||
=================================== FAILURES ===================================
|
||||
_________________ test_shared_entrypoints_hold_only_transport __________________
|
||||
|
||||
def test_shared_entrypoints_hold_only_transport() -> None:
|
||||
names = {path.name for path in modules_under("shared", "entrypoints")}
|
||||
> assert names == {
|
||||
"actor.py",
|
||||
"config.py",
|
||||
"errors.py",
|
||||
"health.py",
|
||||
"ioc.py",
|
||||
"pipeline.py",
|
||||
"schemas.py",
|
||||
"telemetry.py",
|
||||
"trace_context.py",
|
||||
"runtime_metrics.py",
|
||||
}
|
||||
E AssertionError: assert {'actor.py', ...line.py', ...} == {'actor.py', ...line.py', ...}
|
||||
E
|
||||
E Extra items in the right set:
|
||||
E 'runtime_metrics.py'
|
||||
E 'trace_context.py'
|
||||
E Use -v to get more diff
|
||||
|
||||
student-tests/api/test_bounded_contexts.py:123: AssertionError
|
||||
=========================== short test summary info ============================
|
||||
FAILED student-tests/api/test_bounded_contexts.py::test_shared_entrypoints_hold_only_transport
|
||||
===== 1 failed, 515 passed, 1 skipped, 19 deselected in 155.56s (0:02:35) ======
|
||||
make: *** [student-test] Error 1
|
||||
exit_code: 2 elapsed_seconds: 157.936
|
||||
@@ -0,0 +1,230 @@
|
||||
date: 2026-11-06T09:57:10Z commit: 44d81fd80ee13faa42bca069245ee0943f88b2df
|
||||
environment: {"COMPOSE_PROJECT_NAME": "mtusi2026lab6", "LB_HTTP_PORT": "18086", "LB_STATS_PORT": "26085", "BASE_URL": "http://127.0.0.1:18086", "NO_PROXY": "localhost,127.0.0.1,::1"}
|
||||
$ make up
|
||||
sh scripts/secrets.sh
|
||||
sh scripts/broker-secrets.sh
|
||||
broker and S3 worker secrets ready in secrets/ (values not printed)
|
||||
sh scripts/secrets-lab6.sh
|
||||
secrets/grafana_admin_password is ready (value not printed)
|
||||
docker compose build
|
||||
#1 [internal] load local bake definitions
|
||||
#1 reading from stdin 432B done
|
||||
#1 DONE 0.0s
|
||||
|
||||
#2 [internal] load build definition from Dockerfile
|
||||
#2 transferring dockerfile: 1.65kB done
|
||||
#2 DONE 0.0s
|
||||
|
||||
#3 [internal] load metadata for ghcr.io/astral-sh/uv:0.9.7@sha256:ba4857bf2a068e9bc0e64eed8563b065908a4cd6bfb66b531a9c424c8e25e142
|
||||
#3 DONE 0.0s
|
||||
|
||||
#4 [internal] load metadata for docker.io/library/python:3.14-slim-trixie@sha256:51dafde81dbdb6ebde285137a295cf18a47ca95234fe388a343719cb97305b3d
|
||||
#4 DONE 1.4s
|
||||
|
||||
#5 [internal] load .dockerignore
|
||||
#5 transferring context: 453B done
|
||||
#5 DONE 0.0s
|
||||
|
||||
#6 FROM ghcr.io/astral-sh/uv:0.9.7@sha256:ba4857bf2a068e9bc0e64eed8563b065908a4cd6bfb66b531a9c424c8e25e142
|
||||
#6 resolve ghcr.io/astral-sh/uv:0.9.7@sha256:ba4857bf2a068e9bc0e64eed8563b065908a4cd6bfb66b531a9c424c8e25e142 0.0s done
|
||||
#6 DONE 0.0s
|
||||
|
||||
#7 [builder 1/7] FROM docker.io/library/python:3.14-slim-trixie@sha256:51dafde81dbdb6ebde285137a295cf18a47ca95234fe388a343719cb97305b3d
|
||||
#7 resolve docker.io/library/python:3.14-slim-trixie@sha256:51dafde81dbdb6ebde285137a295cf18a47ca95234fe388a343719cb97305b3d 0.0s done
|
||||
#7 DONE 0.0s
|
||||
|
||||
#8 [internal] load build context
|
||||
#8 transferring context: 305.62kB 0.0s done
|
||||
#8 DONE 0.0s
|
||||
|
||||
#9 [builder 4/7] COPY pyproject.toml uv.lock README.md ./
|
||||
#9 CACHED
|
||||
|
||||
#10 [builder 3/7] WORKDIR /build
|
||||
#10 CACHED
|
||||
|
||||
#11 [builder 2/7] COPY --from=ghcr.io/astral-sh/uv:0.9.7@sha256:ba4857bf2a068e9bc0e64eed8563b065908a4cd6bfb66b531a9c424c8e25e142 /uv /usr/local/bin/uv
|
||||
#11 CACHED
|
||||
|
||||
#12 [builder 5/7] RUN uv sync --locked --no-dev --no-install-project --no-editable
|
||||
#12 CACHED
|
||||
|
||||
#13 [builder 6/7] COPY src ./src
|
||||
#13 DONE 0.1s
|
||||
|
||||
#14 [builder 7/7] RUN uv sync --locked --no-dev --no-editable
|
||||
#14 0.231 Resolved 100 packages in 11ms
|
||||
#14 0.248 Building mtusi-messenger @ file:///build
|
||||
#14 1.818 Built mtusi-messenger @ file:///build
|
||||
#14 1.824 Prepared 1 package in 1.57s
|
||||
#14 1.828 Installed 1 package in 3ms
|
||||
#14 2.068 Bytecode compiled 2805 files in 240ms
|
||||
#14 2.068 + mtusi-messenger==1.6.0 (from file:///build)
|
||||
#14 DONE 2.1s
|
||||
|
||||
#15 [runtime 2/6] RUN groupadd --system --gid 10001 messenger && useradd --system --uid 10001 --gid messenger --no-create-home --shell /usr/sbin/nologin messenger
|
||||
#15 CACHED
|
||||
|
||||
#16 [runtime 3/6] COPY --from=builder --chown=root:root /opt/venv /opt/venv
|
||||
#16 DONE 0.5s
|
||||
|
||||
#17 [runtime 4/6] WORKDIR /app
|
||||
#17 DONE 0.1s
|
||||
|
||||
#18 [runtime 5/6] COPY --chown=root:root alembic.ini ./
|
||||
#18 DONE 0.0s
|
||||
|
||||
#19 [runtime 6/6] COPY --chown=root:root alembic ./alembic
|
||||
#19 DONE 0.0s
|
||||
|
||||
#20 exporting to image
|
||||
#20 exporting layers
|
||||
#20 exporting layers 3.4s done
|
||||
#20 exporting manifest sha256:e611ff8072cef7f330ca373cc74464be3c219851d9c7210c932b0f9edcd4f113
|
||||
#20 exporting manifest sha256:e611ff8072cef7f330ca373cc74464be3c219851d9c7210c932b0f9edcd4f113 done
|
||||
#20 exporting config sha256:ebe6a2493a7d49a508b76b70e0895ff95bd41c91db5c1953e2fc80d95bc8835e done
|
||||
#20 exporting attestation manifest sha256:ee30177f12179366bd66d631272804ab91a4b8c87a28b1aad8a59424e1524daf done
|
||||
#20 exporting manifest list sha256:e1701e04d5f6dcaf33b07246843b703fc3e506f5d65e0cd4d2d7603105e1c4a2 done
|
||||
#20 naming to docker.io/library/mtusi-messenger:mtusi2026lab6 done
|
||||
#20 unpacking to docker.io/library/mtusi-messenger:mtusi2026lab6
|
||||
#20 unpacking to docker.io/library/mtusi-messenger:mtusi2026lab6 0.7s done
|
||||
#20 DONE 4.1s
|
||||
|
||||
#21 resolving provenance for metadata file
|
||||
#21 DONE 0.0s
|
||||
api Built
|
||||
docker compose up -d --wait
|
||||
Network mtusi2026lab6_edge Creating
|
||||
Network mtusi2026lab6_edge Created
|
||||
Network mtusi2026lab6_backend Creating
|
||||
Network mtusi2026lab6_backend Created
|
||||
Container mtusi2026lab6-broker-1 Creating
|
||||
Container mtusi2026lab6-lb-1 Creating
|
||||
Container mtusi2026lab6-postgres-1 Creating
|
||||
Container mtusi2026lab6-prometheus-1 Creating
|
||||
Container mtusi2026lab6-healthtools-1 Creating
|
||||
Container mtusi2026lab6-valkey-1 Creating
|
||||
Container mtusi2026lab6-s3-1 Creating
|
||||
Container mtusi2026lab6-valkey-1 Created
|
||||
Container mtusi2026lab6-s3-1 Created
|
||||
Container mtusi2026lab6-s3-init-1 Creating
|
||||
Container mtusi2026lab6-healthtools-1 Created
|
||||
Container mtusi2026lab6-loki-1 Creating
|
||||
Container mtusi2026lab6-tempo-1 Creating
|
||||
Container mtusi2026lab6-otel-collector-1 Creating
|
||||
Container mtusi2026lab6-prometheus-1 Created
|
||||
Container mtusi2026lab6-postgres-1 Created
|
||||
Container mtusi2026lab6-migrate-1 Creating
|
||||
Container mtusi2026lab6-lb-1 Created
|
||||
Container mtusi2026lab6-broker-1 Created
|
||||
Container mtusi2026lab6-s3-init-1 Created
|
||||
Container mtusi2026lab6-otel-collector-1 Created
|
||||
Container mtusi2026lab6-loki-1 Created
|
||||
Container mtusi2026lab6-tempo-1 Created
|
||||
Container mtusi2026lab6-grafana-1 Creating
|
||||
Container mtusi2026lab6-migrate-1 Created
|
||||
Container mtusi2026lab6-worker-1 Creating
|
||||
Container mtusi2026lab6-api-1 Creating
|
||||
Container mtusi2026lab6-relay-1 Creating
|
||||
Container mtusi2026lab6-api-2 Creating
|
||||
Container mtusi2026lab6-worker-1 Created
|
||||
Container mtusi2026lab6-api-2 Created
|
||||
Container mtusi2026lab6-grafana-1 Created
|
||||
Container mtusi2026lab6-api-1 Created
|
||||
Container mtusi2026lab6-relay-1 Created
|
||||
Container mtusi2026lab6-broker-1 Starting
|
||||
Container mtusi2026lab6-postgres-1 Starting
|
||||
Container mtusi2026lab6-valkey-1 Starting
|
||||
Container mtusi2026lab6-s3-1 Starting
|
||||
Container mtusi2026lab6-prometheus-1 Starting
|
||||
Container mtusi2026lab6-lb-1 Starting
|
||||
Container mtusi2026lab6-healthtools-1 Starting
|
||||
Container mtusi2026lab6-healthtools-1 Started
|
||||
Container mtusi2026lab6-healthtools-1 Waiting
|
||||
Container mtusi2026lab6-healthtools-1 Waiting
|
||||
Container mtusi2026lab6-healthtools-1 Waiting
|
||||
Container mtusi2026lab6-valkey-1 Started
|
||||
Container mtusi2026lab6-s3-1 Started
|
||||
Container mtusi2026lab6-s3-1 Waiting
|
||||
Container mtusi2026lab6-postgres-1 Started
|
||||
Container mtusi2026lab6-postgres-1 Waiting
|
||||
Container mtusi2026lab6-lb-1 Started
|
||||
Container mtusi2026lab6-prometheus-1 Started
|
||||
Container mtusi2026lab6-broker-1 Started
|
||||
Container mtusi2026lab6-healthtools-1 Exited
|
||||
Container mtusi2026lab6-otel-collector-1 Starting
|
||||
Container mtusi2026lab6-healthtools-1 Exited
|
||||
Container mtusi2026lab6-loki-1 Starting
|
||||
Container mtusi2026lab6-healthtools-1 Exited
|
||||
Container mtusi2026lab6-tempo-1 Starting
|
||||
Container mtusi2026lab6-postgres-1 Healthy
|
||||
Container mtusi2026lab6-migrate-1 Starting
|
||||
Container mtusi2026lab6-tempo-1 Started
|
||||
Container mtusi2026lab6-migrate-1 Started
|
||||
Container mtusi2026lab6-otel-collector-1 Started
|
||||
Container mtusi2026lab6-loki-1 Started
|
||||
Container mtusi2026lab6-grafana-1 Starting
|
||||
Container mtusi2026lab6-grafana-1 Started
|
||||
Container mtusi2026lab6-s3-1 Healthy
|
||||
Container mtusi2026lab6-s3-init-1 Starting
|
||||
Container mtusi2026lab6-s3-init-1 Started
|
||||
Container mtusi2026lab6-s3-init-1 Waiting
|
||||
Container mtusi2026lab6-broker-1 Waiting
|
||||
Container mtusi2026lab6-migrate-1 Waiting
|
||||
Container mtusi2026lab6-migrate-1 Waiting
|
||||
Container mtusi2026lab6-s3-init-1 Waiting
|
||||
Container mtusi2026lab6-s3-init-1 Waiting
|
||||
Container mtusi2026lab6-migrate-1 Waiting
|
||||
Container mtusi2026lab6-broker-1 Waiting
|
||||
Container mtusi2026lab6-s3-init-1 Exited
|
||||
Container mtusi2026lab6-broker-1 Healthy
|
||||
Container mtusi2026lab6-migrate-1 Exited
|
||||
Container mtusi2026lab6-migrate-1 Exited
|
||||
Container mtusi2026lab6-s3-init-1 Exited
|
||||
Container mtusi2026lab6-s3-init-1 Exited
|
||||
Container mtusi2026lab6-api-1 Starting
|
||||
Container mtusi2026lab6-migrate-1 Exited
|
||||
Container mtusi2026lab6-relay-1 Starting
|
||||
Container mtusi2026lab6-broker-1 Healthy
|
||||
Container mtusi2026lab6-worker-1 Starting
|
||||
Container mtusi2026lab6-api-1 Started
|
||||
Container mtusi2026lab6-api-2 Starting
|
||||
Container mtusi2026lab6-worker-1 Started
|
||||
Container mtusi2026lab6-relay-1 Started
|
||||
Container mtusi2026lab6-api-2 Started
|
||||
Container mtusi2026lab6-relay-1 Waiting
|
||||
Container mtusi2026lab6-api-1 Waiting
|
||||
Container mtusi2026lab6-api-2 Waiting
|
||||
Container mtusi2026lab6-worker-1 Waiting
|
||||
Container mtusi2026lab6-postgres-1 Waiting
|
||||
Container mtusi2026lab6-s3-init-1 Waiting
|
||||
Container mtusi2026lab6-healthtools-1 Waiting
|
||||
Container mtusi2026lab6-migrate-1 Waiting
|
||||
Container mtusi2026lab6-valkey-1 Waiting
|
||||
Container mtusi2026lab6-lb-1 Waiting
|
||||
Container mtusi2026lab6-s3-1 Waiting
|
||||
Container mtusi2026lab6-loki-1 Waiting
|
||||
Container mtusi2026lab6-tempo-1 Waiting
|
||||
Container mtusi2026lab6-otel-collector-1 Waiting
|
||||
Container mtusi2026lab6-broker-1 Waiting
|
||||
Container mtusi2026lab6-prometheus-1 Waiting
|
||||
Container mtusi2026lab6-grafana-1 Waiting
|
||||
Container mtusi2026lab6-migrate-1 Exited
|
||||
Container mtusi2026lab6-prometheus-1 Healthy
|
||||
Container mtusi2026lab6-grafana-1 Healthy
|
||||
Container mtusi2026lab6-valkey-1 Healthy
|
||||
Container mtusi2026lab6-otel-collector-1 Healthy
|
||||
Container mtusi2026lab6-s3-1 Healthy
|
||||
Container mtusi2026lab6-healthtools-1 Exited
|
||||
Container mtusi2026lab6-postgres-1 Healthy
|
||||
Container mtusi2026lab6-s3-init-1 Exited
|
||||
Container mtusi2026lab6-broker-1 Healthy
|
||||
Container mtusi2026lab6-worker-1 Healthy
|
||||
Container mtusi2026lab6-relay-1 Healthy
|
||||
Container mtusi2026lab6-api-1 Healthy
|
||||
Container mtusi2026lab6-api-2 Healthy
|
||||
Container mtusi2026lab6-lb-1 Healthy
|
||||
Container mtusi2026lab6-loki-1 Healthy
|
||||
Container mtusi2026lab6-tempo-1 Healthy
|
||||
scripts/lb-wait.sh
|
||||
exit_code: 0 elapsed_seconds: 85.736
|
||||
@@ -0,0 +1,45 @@
|
||||
date: 2026-11-06T11:37:50Z commit: 447a6507f973596e612f40c1484dda922bf0e50d
|
||||
environment: {"COMPOSE_PROJECT_NAME": "mtusi2026lab6", "LB_HTTP_PORT": "18086", "LB_STATS_PORT": "26085", "BASE_URL": "http://127.0.0.1:18086", "NO_PROXY": "localhost,127.0.0.1,::1"}
|
||||
$ python3 scripts/obs_incidents.py worker
|
||||
{
|
||||
"started": "2026-11-06T11:37:50+00:00",
|
||||
"finished": "2026-11-06T11:38:44+00:00",
|
||||
"result": "PASS",
|
||||
"scenario": "worker",
|
||||
"observations": {
|
||||
"stopped": "2026-11-06T11:37:51+00:00",
|
||||
"restored": "2026-11-06T11:38:32+00:00",
|
||||
"jobs": 8,
|
||||
"backlog": {
|
||||
"depth": 8.0,
|
||||
"age_seconds": 30.558317
|
||||
},
|
||||
"firing": {
|
||||
"utc": "2026-11-06T11:38:29+00:00",
|
||||
"state": "firing",
|
||||
"alerts": [
|
||||
{
|
||||
"labels": {
|
||||
"alertname": "MessengerQueueLag",
|
||||
"severity": "warning"
|
||||
},
|
||||
"annotations": {
|
||||
"description": "Target is 95% ready within 30 seconds over 1 hour; depth includes retry and leased work.",
|
||||
"runbook": "infra/prometheus/runbooks.md#messengerqueuelag",
|
||||
"summary": "Durable attachment backlog has waited more than 15 seconds"
|
||||
},
|
||||
"state": "firing",
|
||||
"activeAt": "2026-11-06T11:38:13.389340978Z",
|
||||
"value": "3.0558317e+01"
|
||||
}
|
||||
]
|
||||
},
|
||||
"resolved": {
|
||||
"utc": "2026-11-06T11:38:44+00:00",
|
||||
"state": "resolved",
|
||||
"alerts": []
|
||||
},
|
||||
"depth_after": 0.0
|
||||
}
|
||||
}
|
||||
exit_code: 0 elapsed_seconds: 53.624
|
||||
@@ -0,0 +1,270 @@
|
||||
{
|
||||
"suite": "lab5-pipeline-idempotency",
|
||||
"started_at": "2026-11-06T09:35:15.796014Z",
|
||||
"source_sha": "95511002b12510178a3cc2a22566b43e2b2b6c81",
|
||||
"config": {
|
||||
"base_url": "http://127.0.0.1:18086",
|
||||
"level": 3,
|
||||
"only": "",
|
||||
"expect_variants": "thumbnail",
|
||||
"max_attempts": 5,
|
||||
"stall_seconds": 15.0,
|
||||
"compose": "docker compose",
|
||||
"compose_faults": "docker compose -f compose.yaml -f infra/compose.faults.yaml"
|
||||
},
|
||||
"invariants": [
|
||||
{
|
||||
"id": "terminal",
|
||||
"statement": "every 202 reaches its expected terminal state",
|
||||
"result": "PASS",
|
||||
"details": {
|
||||
"accepted": 5
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "single_effect",
|
||||
"statement": "one variant set per (attachment_id, pipeline_version, variant)",
|
||||
"result": "PASS",
|
||||
"details": {
|
||||
"rows": 0
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "no_ready_rollback",
|
||||
"statement": "ready never returns to queued or processing",
|
||||
"result": "PASS",
|
||||
"details": {
|
||||
"traced": 5
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "monotonic_publication",
|
||||
"statement": "published_version only moves forward",
|
||||
"result": "PASS",
|
||||
"details": {
|
||||
"sampled": 2
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "bytes_match_metadata",
|
||||
"statement": "sha256, size and real dimensions match served bytes",
|
||||
"result": "PASS",
|
||||
"details": {
|
||||
"verified": 4
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "bounded_attempts",
|
||||
"statement": "attempt <= JOB_MAX_ATTEMPTS",
|
||||
"result": "PASS",
|
||||
"details": {
|
||||
"rows": 0
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "no_orphans",
|
||||
"statement": "no pending outbox, messages, dead letters, staging, objects",
|
||||
"result": "PASS",
|
||||
"details": {
|
||||
"queues": {
|
||||
"attachments.process": [
|
||||
0,
|
||||
0
|
||||
],
|
||||
"attachments.process.dlq": [
|
||||
0,
|
||||
0
|
||||
]
|
||||
},
|
||||
"s3_objects": 17,
|
||||
"scoped_attachments": 5
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "no_lost_202",
|
||||
"statement": "every 202 is present in PostgreSQL and the API",
|
||||
"result": "PASS",
|
||||
"details": {
|
||||
"accepted": 5
|
||||
}
|
||||
}
|
||||
],
|
||||
"accepted_ids": [
|
||||
"01a1b036-7bdb-72a8-9a20-d784124b6f09",
|
||||
"01a1b036-838f-7073-a603-58ef2ffca05d",
|
||||
"01a1b036-d38a-7375-ba48-c82f1e984740",
|
||||
"01a1b036-e669-7726-8ed5-eb948e03323e",
|
||||
"01a1b037-1c4a-72b4-8027-95bdd74c185a"
|
||||
],
|
||||
"scenarios": [
|
||||
{
|
||||
"name": "smoke_pipeline",
|
||||
"level": 3,
|
||||
"window": "upload, ready, variants match metadata",
|
||||
"seconds": 1.4,
|
||||
"result": "PASS",
|
||||
"observed": {
|
||||
"attachment_id": "01a1b036-7bdb-72a8-9a20-d784124b6f09",
|
||||
"variants": [
|
||||
"crop",
|
||||
"optimized",
|
||||
"thumbnail"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "worker_down_broker_restart",
|
||||
"level": 3,
|
||||
"window": "worker down, API and broker restart",
|
||||
"seconds": 21.1,
|
||||
"result": "PASS",
|
||||
"observed": {
|
||||
"attachment_id": "01a1b036-838f-7073-a603-58ef2ffca05d",
|
||||
"timeline": [
|
||||
{
|
||||
"at": "2026-11-06T09:35:25.067956Z",
|
||||
"step": "worker stopped",
|
||||
"containers": [
|
||||
"mtusi2026lab6-worker-1 cd5b9bcf05a3 exited Exited (0) Less than a second ago"
|
||||
]
|
||||
},
|
||||
{
|
||||
"at": "2026-11-06T09:35:25.081364Z",
|
||||
"step": "upload 202 queued",
|
||||
"attachment_id": "01a1b036-838f-7073-a603-58ef2ffca05d"
|
||||
},
|
||||
{
|
||||
"at": "2026-11-06T09:35:25.086007Z",
|
||||
"step": "content 409 while queued"
|
||||
},
|
||||
{
|
||||
"at": "2026-11-06T09:35:25.109208Z",
|
||||
"step": "message with attachment 201, other messages work",
|
||||
"message_id": "01a1b036-839e-71c7-9abc-6d747695610e"
|
||||
},
|
||||
{
|
||||
"at": "2026-11-06T09:35:30.399187Z",
|
||||
"step": "job is in the broker queue",
|
||||
"queues": {
|
||||
"attachments.process": [
|
||||
1,
|
||||
0
|
||||
],
|
||||
"attachments.process.dlq": [
|
||||
0,
|
||||
0
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"at": "2026-11-06T09:35:36.592722Z",
|
||||
"step": "API replicas and relay restarted"
|
||||
},
|
||||
{
|
||||
"at": "2026-11-06T09:35:42.601391Z",
|
||||
"step": "broker restarted with its volume, job survived",
|
||||
"queues": {
|
||||
"attachments.process": [
|
||||
1,
|
||||
0
|
||||
],
|
||||
"attachments.process.dlq": [
|
||||
0,
|
||||
0
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"at": "2026-11-06T09:35:45.362335Z",
|
||||
"step": "worker started"
|
||||
},
|
||||
{
|
||||
"at": "2026-11-06T09:35:45.539899Z",
|
||||
"step": "ready",
|
||||
"variants": [
|
||||
"crop",
|
||||
"optimized",
|
||||
"thumbnail"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "duplicate_after_ready",
|
||||
"level": 3,
|
||||
"window": "redelivery of a finished job",
|
||||
"seconds": 4.4,
|
||||
"result": "PASS",
|
||||
"observed": {
|
||||
"attachment_id": "01a1b036-d38a-7375-ba48-c82f1e984740",
|
||||
"events": [
|
||||
{
|
||||
"kind": "enqueued",
|
||||
"attempt": 1
|
||||
},
|
||||
{
|
||||
"kind": "claimed",
|
||||
"attempt": 1
|
||||
},
|
||||
{
|
||||
"kind": "done",
|
||||
"attempt": 1
|
||||
},
|
||||
{
|
||||
"kind": "duplicate_noop",
|
||||
"attempt": 1
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "poison_image",
|
||||
"level": 3,
|
||||
"window": "permanent error without retries",
|
||||
"seconds": 0.0,
|
||||
"result": "PASS",
|
||||
"observed": {
|
||||
"rejected_by_api": 415
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "s3_outage_recovers",
|
||||
"level": 3,
|
||||
"window": "transient error with retry",
|
||||
"seconds": 10.3,
|
||||
"result": "PASS",
|
||||
"observed": {
|
||||
"attachment_id": "01a1b036-e669-7726-8ed5-eb948e03323e",
|
||||
"jobs": [
|
||||
{
|
||||
"job_id": "01a1b036-e671-7294-8d09-37bc4619030b",
|
||||
"pipeline_version": 1,
|
||||
"status": "done",
|
||||
"attempt": 2
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "retry_exhausted",
|
||||
"level": 3,
|
||||
"window": "transient error until JOB_MAX_ATTEMPTS",
|
||||
"seconds": 20.3,
|
||||
"result": "PASS",
|
||||
"observed": {
|
||||
"attachment_id": "01a1b037-1c4a-72b4-8027-95bdd74c185a",
|
||||
"jobs": [
|
||||
{
|
||||
"job_id": "01a1b037-1c57-7496-8cc0-61aa229fd7a2",
|
||||
"pipeline_version": 1,
|
||||
"status": "failed",
|
||||
"attempt": 5
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
],
|
||||
"result": "PASS",
|
||||
"finished_at": "2026-11-06T09:36:32.454476Z"
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
services:
|
||||
relay:
|
||||
restart: "no"
|
||||
environment:
|
||||
FAULT_POINT: ${RELAY_FAULT_POINT:-}
|
||||
OUTBOX_POLL_SECONDS: "0.5"
|
||||
SWEEP_INTERVAL_SECONDS: "1"
|
||||
STAGING_RETENTION_SECONDS: ${FAULT_STAGING_RETENTION_SECONDS:-${STAGING_RETENTION_SECONDS:-86400}}
|
||||
|
||||
worker:
|
||||
restart: "no"
|
||||
environment:
|
||||
FAULT_POINT: ${WORKER_FAULT_POINT:-}
|
||||
FAULT_STALL_SECONDS: ${FAULT_STALL_SECONDS:-15}
|
||||
JOB_TIMEOUT_SECONDS: ${FAULT_JOB_TIMEOUT_SECONDS:-5}
|
||||
JOB_BACKOFF_BASE_SECONDS: ${FAULT_BACKOFF_BASE_SECONDS:-1}
|
||||
RENDER_TIMEOUT_SECONDS: ${FAULT_RENDER_TIMEOUT_SECONDS:-${RENDER_TIMEOUT_SECONDS:-30}}
|
||||
RENDER_MEMORY_MB: ${FAULT_RENDER_MEMORY_MB:-${RENDER_MEMORY_MB:-448}}
|
||||
@@ -0,0 +1,863 @@
|
||||
{
|
||||
"uid": "messenger-api",
|
||||
"title": "Messenger · API RED",
|
||||
"description": "RED по endpoint, SLI/SLO, логи и трассы API.",
|
||||
"tags": [
|
||||
"messenger",
|
||||
"lab6",
|
||||
"red"
|
||||
],
|
||||
"timezone": "browser",
|
||||
"editable": false,
|
||||
"graphTooltip": 1,
|
||||
"refresh": "10s",
|
||||
"schemaVersion": 41,
|
||||
"version": 1,
|
||||
"time": {
|
||||
"from": "now-30m",
|
||||
"to": "now"
|
||||
},
|
||||
"timepicker": {},
|
||||
"fiscalYearStartMonth": 0,
|
||||
"liveNow": false,
|
||||
"links": [
|
||||
{
|
||||
"title": "Messenger",
|
||||
"type": "dashboards",
|
||||
"tags": [
|
||||
"messenger"
|
||||
],
|
||||
"asDropdown": true,
|
||||
"includeVars": false,
|
||||
"keepTime": true
|
||||
}
|
||||
],
|
||||
"annotations": {
|
||||
"list": [
|
||||
{
|
||||
"builtIn": 1,
|
||||
"datasource": {
|
||||
"type": "grafana",
|
||||
"uid": "-- Grafana --"
|
||||
},
|
||||
"enable": true,
|
||||
"hide": true,
|
||||
"iconColor": "rgba(0, 211, 255, 1)",
|
||||
"name": "Annotations & Alerts",
|
||||
"type": "dashboard"
|
||||
},
|
||||
{
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"enable": true,
|
||||
"iconColor": "red",
|
||||
"name": "Firing alerts",
|
||||
"expr": "ALERTS{alertstate=\"firing\"}",
|
||||
"step": "15s",
|
||||
"titleFormat": "{{alertname}}",
|
||||
"textFormat": "{{alertname}} firing",
|
||||
"useValueForTime": false
|
||||
}
|
||||
]
|
||||
},
|
||||
"templating": {
|
||||
"list": [
|
||||
{
|
||||
"name": "route",
|
||||
"label": "Маршрут",
|
||||
"type": "query",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"query": {
|
||||
"query": "label_values(http_server_request_duration_seconds_count{job=\"messenger-api\"}, http_route)",
|
||||
"refId": "PrometheusVariableQueryEditor-VariableQuery",
|
||||
"qryType": 1
|
||||
},
|
||||
"definition": "label_values(http_server_request_duration_seconds_count{job=\"messenger-api\"}, http_route)",
|
||||
"refresh": 2,
|
||||
"includeAll": true,
|
||||
"multi": true,
|
||||
"allValue": ".*",
|
||||
"current": {
|
||||
"selected": true,
|
||||
"text": [
|
||||
"All"
|
||||
],
|
||||
"value": [
|
||||
"$__all"
|
||||
]
|
||||
},
|
||||
"sort": 1
|
||||
},
|
||||
{
|
||||
"name": "instance",
|
||||
"label": "Реплика",
|
||||
"type": "query",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"query": {
|
||||
"query": "label_values(http_server_request_duration_seconds_count{job=\"messenger-api\"}, instance)",
|
||||
"refId": "PrometheusVariableQueryEditor-VariableQuery",
|
||||
"qryType": 1
|
||||
},
|
||||
"definition": "label_values(http_server_request_duration_seconds_count{job=\"messenger-api\"}, instance)",
|
||||
"refresh": 2,
|
||||
"includeAll": true,
|
||||
"multi": true,
|
||||
"allValue": ".*",
|
||||
"current": {
|
||||
"selected": true,
|
||||
"text": [
|
||||
"All"
|
||||
],
|
||||
"value": [
|
||||
"$__all"
|
||||
]
|
||||
},
|
||||
"sort": 1
|
||||
}
|
||||
]
|
||||
},
|
||||
"panels": [
|
||||
{
|
||||
"type": "stat",
|
||||
"title": "RPS бизнес-запросов",
|
||||
"description": "Все маршруты, кроме /health/*; сумма по репликам.",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"refId": "A",
|
||||
"expr": "sum(rate(http_server_request_duration_seconds_count{job=\"messenger-api\", http_route!~\"/health/.*\"}[$__rate_interval]))",
|
||||
"legendFormat": "__auto",
|
||||
"range": true,
|
||||
"exemplar": false
|
||||
}
|
||||
],
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"unit": "reqps",
|
||||
"thresholds": {
|
||||
"mode": "absolute",
|
||||
"steps": [
|
||||
{
|
||||
"color": "green",
|
||||
"value": null
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"overrides": []
|
||||
},
|
||||
"options": {
|
||||
"reduceOptions": {
|
||||
"calcs": [
|
||||
"lastNotNull"
|
||||
],
|
||||
"fields": "",
|
||||
"values": false
|
||||
},
|
||||
"colorMode": "value",
|
||||
"graphMode": "area",
|
||||
"textMode": "auto"
|
||||
},
|
||||
"id": 1,
|
||||
"gridPos": {
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"w": 6,
|
||||
"h": 4
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "stat",
|
||||
"title": "Доля 5xx (2m)",
|
||||
"description": "SLI доступности: 5xx / все бизнес-запросы без /health/*. Неверный пароль (401) не считается отказом.",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"refId": "A",
|
||||
"expr": "messenger:http_errors:ratio_rate2m",
|
||||
"legendFormat": "__auto",
|
||||
"range": true,
|
||||
"exemplar": false
|
||||
}
|
||||
],
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"unit": "percentunit",
|
||||
"thresholds": {
|
||||
"mode": "absolute",
|
||||
"steps": [
|
||||
{
|
||||
"color": "green",
|
||||
"value": null
|
||||
},
|
||||
{
|
||||
"color": "orange",
|
||||
"value": 0.01
|
||||
},
|
||||
{
|
||||
"color": "red",
|
||||
"value": 0.05
|
||||
}
|
||||
]
|
||||
},
|
||||
"decimals": 2
|
||||
},
|
||||
"overrides": []
|
||||
},
|
||||
"options": {
|
||||
"reduceOptions": {
|
||||
"calcs": [
|
||||
"lastNotNull"
|
||||
],
|
||||
"fields": "",
|
||||
"values": false
|
||||
},
|
||||
"colorMode": "value",
|
||||
"graphMode": "area",
|
||||
"textMode": "auto"
|
||||
},
|
||||
"id": 2,
|
||||
"gridPos": {
|
||||
"x": 6,
|
||||
"y": 0,
|
||||
"w": 6,
|
||||
"h": 4
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "stat",
|
||||
"title": "p95 latency (5m)",
|
||||
"description": "histogram_quantile по сумме buckets всех реплик, не среднее p95.",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"refId": "A",
|
||||
"expr": "messenger:http_request_duration_seconds:p95_5m",
|
||||
"legendFormat": "__auto",
|
||||
"range": true,
|
||||
"exemplar": false
|
||||
}
|
||||
],
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"unit": "s",
|
||||
"thresholds": {
|
||||
"mode": "absolute",
|
||||
"steps": [
|
||||
{
|
||||
"color": "green",
|
||||
"value": null
|
||||
},
|
||||
{
|
||||
"color": "orange",
|
||||
"value": 0.3
|
||||
},
|
||||
{
|
||||
"color": "red",
|
||||
"value": 0.5
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"overrides": []
|
||||
},
|
||||
"options": {
|
||||
"reduceOptions": {
|
||||
"calcs": [
|
||||
"lastNotNull"
|
||||
],
|
||||
"fields": "",
|
||||
"values": false
|
||||
},
|
||||
"colorMode": "value",
|
||||
"graphMode": "area",
|
||||
"textMode": "auto"
|
||||
},
|
||||
"id": 3,
|
||||
"gridPos": {
|
||||
"x": 12,
|
||||
"y": 0,
|
||||
"w": 6,
|
||||
"h": 4
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "stat",
|
||||
"title": "Доля не-5xx (окно 1h)",
|
||||
"description": "Доля не-5xx бизнес-запросов за 1h; цель 99%.",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"refId": "A",
|
||||
"expr": "1 - messenger:http_errors:ratio_rate1h",
|
||||
"legendFormat": "__auto",
|
||||
"range": true,
|
||||
"exemplar": false
|
||||
}
|
||||
],
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"unit": "percentunit",
|
||||
"thresholds": {
|
||||
"mode": "absolute",
|
||||
"steps": [
|
||||
{
|
||||
"color": "green",
|
||||
"value": null
|
||||
}
|
||||
]
|
||||
},
|
||||
"decimals": 3
|
||||
},
|
||||
"overrides": []
|
||||
},
|
||||
"options": {
|
||||
"reduceOptions": {
|
||||
"calcs": [
|
||||
"lastNotNull"
|
||||
],
|
||||
"fields": "",
|
||||
"values": false
|
||||
},
|
||||
"colorMode": "value",
|
||||
"graphMode": "area",
|
||||
"textMode": "auto"
|
||||
},
|
||||
"id": 4,
|
||||
"gridPos": {
|
||||
"x": 18,
|
||||
"y": 0,
|
||||
"w": 6,
|
||||
"h": 4
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "row",
|
||||
"title": "Rate / Errors / Duration по endpoint",
|
||||
"collapsed": false,
|
||||
"panels": [],
|
||||
"id": 5,
|
||||
"gridPos": {
|
||||
"x": 0,
|
||||
"y": 4,
|
||||
"w": 24,
|
||||
"h": 1
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "timeseries",
|
||||
"title": "RPS по маршруту и классу статуса",
|
||||
"description": "Recording rule messenger:http_requests:rate2m; status class выводится из http.response.status_code.",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"refId": "A",
|
||||
"expr": "sum by (http_route, http_request_method, status_class) (messenger:http_requests:rate2m{http_route=~\"$route\"})",
|
||||
"legendFormat": "{{http_request_method}} {{http_route}} {{status_class}}",
|
||||
"range": true,
|
||||
"exemplar": false
|
||||
}
|
||||
],
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"unit": "reqps",
|
||||
"custom": {
|
||||
"drawStyle": "line",
|
||||
"lineWidth": 1,
|
||||
"fillOpacity": 10,
|
||||
"showPoints": "never",
|
||||
"spanNulls": false,
|
||||
"stacking": {
|
||||
"mode": "none",
|
||||
"group": "A"
|
||||
}
|
||||
},
|
||||
"min": 0
|
||||
},
|
||||
"overrides": []
|
||||
},
|
||||
"options": {
|
||||
"legend": {
|
||||
"displayMode": "table",
|
||||
"placement": "bottom",
|
||||
"calcs": [
|
||||
"lastNotNull",
|
||||
"max"
|
||||
]
|
||||
},
|
||||
"tooltip": {
|
||||
"mode": "multi",
|
||||
"sort": "desc"
|
||||
}
|
||||
},
|
||||
"id": 6,
|
||||
"gridPos": {
|
||||
"x": 0,
|
||||
"y": 5,
|
||||
"w": 12,
|
||||
"h": 8
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "timeseries",
|
||||
"title": "Доля ошибок",
|
||||
"description": "Числитель SLI — только 5xx; 4xx показаны отдельно и в SLO не входят.",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"refId": "A",
|
||||
"expr": "(sum(rate(http_server_request_duration_seconds_count{job=\"messenger-api\", http_route!~\"/health/.*\", http_route=~\"$route\", instance=~\"$instance\", http_response_status_code=~\"5..\"}[$__rate_interval])) or vector(0)) / sum(rate(http_server_request_duration_seconds_count{job=\"messenger-api\", http_route!~\"/health/.*\", http_route=~\"$route\", instance=~\"$instance\"}[$__rate_interval]))",
|
||||
"legendFormat": "5xx / все (SLI)",
|
||||
"range": true,
|
||||
"exemplar": false
|
||||
},
|
||||
{
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"refId": "B",
|
||||
"expr": "(sum(rate(http_server_request_duration_seconds_count{job=\"messenger-api\", http_route!~\"/health/.*\", http_route=~\"$route\", instance=~\"$instance\", http_response_status_code=~\"4..\"}[$__rate_interval])) or vector(0)) / sum(rate(http_server_request_duration_seconds_count{job=\"messenger-api\", http_route!~\"/health/.*\", http_route=~\"$route\", instance=~\"$instance\"}[$__rate_interval]))",
|
||||
"legendFormat": "4xx / все (клиент)",
|
||||
"range": true,
|
||||
"exemplar": false
|
||||
}
|
||||
],
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"unit": "percentunit",
|
||||
"custom": {
|
||||
"drawStyle": "line",
|
||||
"lineWidth": 1,
|
||||
"fillOpacity": 10,
|
||||
"showPoints": "never",
|
||||
"spanNulls": false,
|
||||
"stacking": {
|
||||
"mode": "none",
|
||||
"group": "A"
|
||||
}
|
||||
},
|
||||
"min": 0
|
||||
},
|
||||
"overrides": []
|
||||
},
|
||||
"options": {
|
||||
"legend": {
|
||||
"displayMode": "table",
|
||||
"placement": "bottom",
|
||||
"calcs": [
|
||||
"lastNotNull",
|
||||
"max"
|
||||
]
|
||||
},
|
||||
"tooltip": {
|
||||
"mode": "multi",
|
||||
"sort": "desc"
|
||||
}
|
||||
},
|
||||
"id": 7,
|
||||
"gridPos": {
|
||||
"x": 12,
|
||||
"y": 5,
|
||||
"w": 12,
|
||||
"h": 8
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "timeseries",
|
||||
"title": "Latency p50 / p95 / p99",
|
||||
"description": "Из histogram buckets (секунды) всех выбранных реплик; exemplars ведут в Tempo.",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"refId": "A",
|
||||
"expr": "histogram_quantile(0.5, sum by (le) (rate(http_server_request_duration_seconds_bucket{job=\"messenger-api\", http_route!~\"/health/.*\", http_route=~\"$route\", instance=~\"$instance\"}[$__rate_interval])))",
|
||||
"legendFormat": "p50",
|
||||
"range": true,
|
||||
"exemplar": true
|
||||
},
|
||||
{
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"refId": "B",
|
||||
"expr": "histogram_quantile(0.95, sum by (le) (rate(http_server_request_duration_seconds_bucket{job=\"messenger-api\", http_route!~\"/health/.*\", http_route=~\"$route\", instance=~\"$instance\"}[$__rate_interval])))",
|
||||
"legendFormat": "p95",
|
||||
"range": true,
|
||||
"exemplar": true
|
||||
},
|
||||
{
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"refId": "C",
|
||||
"expr": "histogram_quantile(0.99, sum by (le) (rate(http_server_request_duration_seconds_bucket{job=\"messenger-api\", http_route!~\"/health/.*\", http_route=~\"$route\", instance=~\"$instance\"}[$__rate_interval])))",
|
||||
"legendFormat": "p99",
|
||||
"range": true,
|
||||
"exemplar": true
|
||||
}
|
||||
],
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"unit": "s",
|
||||
"custom": {
|
||||
"drawStyle": "line",
|
||||
"lineWidth": 1,
|
||||
"fillOpacity": 10,
|
||||
"showPoints": "never",
|
||||
"spanNulls": false,
|
||||
"stacking": {
|
||||
"mode": "none",
|
||||
"group": "A"
|
||||
}
|
||||
},
|
||||
"min": 0
|
||||
},
|
||||
"overrides": []
|
||||
},
|
||||
"options": {
|
||||
"legend": {
|
||||
"displayMode": "table",
|
||||
"placement": "bottom",
|
||||
"calcs": [
|
||||
"lastNotNull",
|
||||
"max"
|
||||
]
|
||||
},
|
||||
"tooltip": {
|
||||
"mode": "multi",
|
||||
"sort": "desc"
|
||||
}
|
||||
},
|
||||
"id": 8,
|
||||
"gridPos": {
|
||||
"x": 0,
|
||||
"y": 13,
|
||||
"w": 12,
|
||||
"h": 8
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "timeseries",
|
||||
"title": "p95 по маршруту",
|
||||
"description": "",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"refId": "A",
|
||||
"expr": "histogram_quantile(0.95, sum by (le, http_route) (rate(http_server_request_duration_seconds_bucket{job=\"messenger-api\", http_route!~\"/health/.*\", http_route=~\"$route\", instance=~\"$instance\"}[$__rate_interval])))",
|
||||
"legendFormat": "{{http_route}}",
|
||||
"range": true,
|
||||
"exemplar": false
|
||||
}
|
||||
],
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"unit": "s",
|
||||
"custom": {
|
||||
"drawStyle": "line",
|
||||
"lineWidth": 1,
|
||||
"fillOpacity": 10,
|
||||
"showPoints": "never",
|
||||
"spanNulls": false,
|
||||
"stacking": {
|
||||
"mode": "none",
|
||||
"group": "A"
|
||||
}
|
||||
},
|
||||
"min": 0
|
||||
},
|
||||
"overrides": []
|
||||
},
|
||||
"options": {
|
||||
"legend": {
|
||||
"displayMode": "table",
|
||||
"placement": "bottom",
|
||||
"calcs": [
|
||||
"lastNotNull",
|
||||
"max"
|
||||
]
|
||||
},
|
||||
"tooltip": {
|
||||
"mode": "multi",
|
||||
"sort": "desc"
|
||||
}
|
||||
},
|
||||
"id": 9,
|
||||
"gridPos": {
|
||||
"x": 12,
|
||||
"y": 13,
|
||||
"w": 12,
|
||||
"h": 8
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "timeseries",
|
||||
"title": "RPS по реплике",
|
||||
"description": "instance = service.instance.id (реплика + pid процесса gunicorn).",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"refId": "A",
|
||||
"expr": "sum by (instance) (rate(http_server_request_duration_seconds_count{job=\"messenger-api\", http_route!~\"/health/.*\", http_route=~\"$route\", instance=~\"$instance\"}[$__rate_interval]))",
|
||||
"legendFormat": "{{instance}}",
|
||||
"range": true,
|
||||
"exemplar": false
|
||||
}
|
||||
],
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"unit": "reqps",
|
||||
"custom": {
|
||||
"drawStyle": "line",
|
||||
"lineWidth": 1,
|
||||
"fillOpacity": 10,
|
||||
"showPoints": "never",
|
||||
"spanNulls": false,
|
||||
"stacking": {
|
||||
"mode": "none",
|
||||
"group": "A"
|
||||
}
|
||||
},
|
||||
"min": 0
|
||||
},
|
||||
"overrides": []
|
||||
},
|
||||
"options": {
|
||||
"legend": {
|
||||
"displayMode": "table",
|
||||
"placement": "bottom",
|
||||
"calcs": [
|
||||
"lastNotNull",
|
||||
"max"
|
||||
]
|
||||
},
|
||||
"tooltip": {
|
||||
"mode": "multi",
|
||||
"sort": "desc"
|
||||
}
|
||||
},
|
||||
"id": 10,
|
||||
"gridPos": {
|
||||
"x": 0,
|
||||
"y": 21,
|
||||
"w": 12,
|
||||
"h": 8
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "timeseries",
|
||||
"title": "Активные запросы",
|
||||
"description": "",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"refId": "A",
|
||||
"expr": "sum by (instance) (http_server_active_requests{job=\"messenger-api\"})",
|
||||
"legendFormat": "{{instance}}",
|
||||
"range": true,
|
||||
"exemplar": false
|
||||
}
|
||||
],
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"unit": "short",
|
||||
"custom": {
|
||||
"drawStyle": "line",
|
||||
"lineWidth": 1,
|
||||
"fillOpacity": 10,
|
||||
"showPoints": "never",
|
||||
"spanNulls": false,
|
||||
"stacking": {
|
||||
"mode": "none",
|
||||
"group": "A"
|
||||
}
|
||||
},
|
||||
"min": 0
|
||||
},
|
||||
"overrides": []
|
||||
},
|
||||
"options": {
|
||||
"legend": {
|
||||
"displayMode": "table",
|
||||
"placement": "bottom",
|
||||
"calcs": [
|
||||
"lastNotNull",
|
||||
"max"
|
||||
]
|
||||
},
|
||||
"tooltip": {
|
||||
"mode": "multi",
|
||||
"sort": "desc"
|
||||
}
|
||||
},
|
||||
"id": 11,
|
||||
"gridPos": {
|
||||
"x": 12,
|
||||
"y": 21,
|
||||
"w": 12,
|
||||
"h": 8
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "row",
|
||||
"title": "Логи и трассы API",
|
||||
"collapsed": false,
|
||||
"panels": [],
|
||||
"id": 12,
|
||||
"gridPos": {
|
||||
"x": 0,
|
||||
"y": 29,
|
||||
"w": 24,
|
||||
"h": 1
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "logs",
|
||||
"title": "Логи API (ошибки и предупреждения)",
|
||||
"datasource": {
|
||||
"type": "loki",
|
||||
"uid": "loki"
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"datasource": {
|
||||
"type": "loki",
|
||||
"uid": "loki"
|
||||
},
|
||||
"refId": "A",
|
||||
"expr": "{service_name=\"messenger-api\"} | severity_text=~\"(?i)error|warn.*\"",
|
||||
"queryType": "range"
|
||||
}
|
||||
],
|
||||
"options": {
|
||||
"showTime": true,
|
||||
"wrapLogMessage": true,
|
||||
"sortOrder": "Descending",
|
||||
"enableLogDetails": true,
|
||||
"dedupStrategy": "none",
|
||||
"prettifyLogMessage": false
|
||||
},
|
||||
"id": 13,
|
||||
"gridPos": {
|
||||
"x": 0,
|
||||
"y": 30,
|
||||
"w": 12,
|
||||
"h": 10
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "table",
|
||||
"title": "Трассы API с ошибкой",
|
||||
"datasource": {
|
||||
"type": "tempo",
|
||||
"uid": "tempo"
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"datasource": {
|
||||
"type": "tempo",
|
||||
"uid": "tempo"
|
||||
},
|
||||
"refId": "A",
|
||||
"queryType": "traceql",
|
||||
"query": "{ resource.service.name = \"messenger-api\" && status = error }",
|
||||
"limit": 20,
|
||||
"tableType": "traces"
|
||||
}
|
||||
],
|
||||
"fieldConfig": {
|
||||
"defaults": {},
|
||||
"overrides": []
|
||||
},
|
||||
"options": {},
|
||||
"id": 14,
|
||||
"gridPos": {
|
||||
"x": 12,
|
||||
"y": 30,
|
||||
"w": 12,
|
||||
"h": 10
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,569 @@
|
||||
{
|
||||
"uid": "messenger-pipeline",
|
||||
"title": "Messenger · Worker",
|
||||
"description": "Задания worker: исходы, длительность обработки, логи и трассы.",
|
||||
"tags": [
|
||||
"messenger",
|
||||
"lab6",
|
||||
"worker"
|
||||
],
|
||||
"timezone": "browser",
|
||||
"editable": false,
|
||||
"graphTooltip": 1,
|
||||
"refresh": "10s",
|
||||
"schemaVersion": 41,
|
||||
"version": 2,
|
||||
"time": {
|
||||
"from": "now-30m",
|
||||
"to": "now"
|
||||
},
|
||||
"timepicker": {},
|
||||
"fiscalYearStartMonth": 0,
|
||||
"liveNow": false,
|
||||
"links": [
|
||||
{
|
||||
"title": "Messenger",
|
||||
"type": "dashboards",
|
||||
"tags": [
|
||||
"messenger"
|
||||
],
|
||||
"asDropdown": true,
|
||||
"includeVars": false,
|
||||
"keepTime": true
|
||||
}
|
||||
],
|
||||
"annotations": {
|
||||
"list": [
|
||||
{
|
||||
"builtIn": 1,
|
||||
"datasource": {
|
||||
"type": "grafana",
|
||||
"uid": "-- Grafana --"
|
||||
},
|
||||
"enable": true,
|
||||
"hide": true,
|
||||
"iconColor": "rgba(0, 211, 255, 1)",
|
||||
"name": "Annotations & Alerts",
|
||||
"type": "dashboard"
|
||||
},
|
||||
{
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"enable": true,
|
||||
"iconColor": "red",
|
||||
"name": "Firing alerts",
|
||||
"expr": "ALERTS{alertstate=\"firing\"}",
|
||||
"step": "15s",
|
||||
"titleFormat": "{{alertname}}",
|
||||
"textFormat": "{{alertname}} firing",
|
||||
"useValueForTime": false
|
||||
}
|
||||
]
|
||||
},
|
||||
"templating": {
|
||||
"list": []
|
||||
},
|
||||
"panels": [
|
||||
{
|
||||
"type": "row",
|
||||
"title": "Worker",
|
||||
"collapsed": false,
|
||||
"panels": [],
|
||||
"id": 8,
|
||||
"gridPos": {
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"w": 24,
|
||||
"h": 1
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "timeseries",
|
||||
"title": "Jobs по исходу",
|
||||
"description": "",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"refId": "A",
|
||||
"expr": "sum by (job_type, outcome) (rate(messenger_jobs_processed_total[$__rate_interval]))",
|
||||
"legendFormat": "{{job_type}} {{outcome}}",
|
||||
"range": true,
|
||||
"exemplar": false
|
||||
}
|
||||
],
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"unit": "ops",
|
||||
"custom": {
|
||||
"drawStyle": "line",
|
||||
"lineWidth": 1,
|
||||
"fillOpacity": 10,
|
||||
"showPoints": "never",
|
||||
"spanNulls": false,
|
||||
"stacking": {
|
||||
"mode": "normal",
|
||||
"group": "A"
|
||||
}
|
||||
},
|
||||
"min": 0
|
||||
},
|
||||
"overrides": []
|
||||
},
|
||||
"options": {
|
||||
"legend": {
|
||||
"displayMode": "table",
|
||||
"placement": "bottom",
|
||||
"calcs": [
|
||||
"lastNotNull",
|
||||
"max"
|
||||
]
|
||||
},
|
||||
"tooltip": {
|
||||
"mode": "multi",
|
||||
"sort": "desc"
|
||||
}
|
||||
},
|
||||
"id": 9,
|
||||
"gridPos": {
|
||||
"x": 0,
|
||||
"y": 1,
|
||||
"w": 12,
|
||||
"h": 8
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "timeseries",
|
||||
"title": "Длительность обработки job",
|
||||
"description": "",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"refId": "A",
|
||||
"expr": "histogram_quantile(0.5, sum by (le, job_type) (rate(messenger_job_duration_seconds_bucket{}[$__rate_interval])))",
|
||||
"legendFormat": "p50 {{job_type}}",
|
||||
"range": true,
|
||||
"exemplar": true
|
||||
},
|
||||
{
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"refId": "B",
|
||||
"expr": "histogram_quantile(0.95, sum by (le, job_type) (rate(messenger_job_duration_seconds_bucket{}[$__rate_interval])))",
|
||||
"legendFormat": "p95 {{job_type}}",
|
||||
"range": true,
|
||||
"exemplar": true
|
||||
},
|
||||
{
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"refId": "C",
|
||||
"expr": "histogram_quantile(0.99, sum by (le, job_type) (rate(messenger_job_duration_seconds_bucket{}[$__rate_interval])))",
|
||||
"legendFormat": "p99 {{job_type}}",
|
||||
"range": true,
|
||||
"exemplar": true
|
||||
}
|
||||
],
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"unit": "s",
|
||||
"custom": {
|
||||
"drawStyle": "line",
|
||||
"lineWidth": 1,
|
||||
"fillOpacity": 10,
|
||||
"showPoints": "never",
|
||||
"spanNulls": false,
|
||||
"stacking": {
|
||||
"mode": "none",
|
||||
"group": "A"
|
||||
}
|
||||
},
|
||||
"min": 0
|
||||
},
|
||||
"overrides": []
|
||||
},
|
||||
"options": {
|
||||
"legend": {
|
||||
"displayMode": "table",
|
||||
"placement": "bottom",
|
||||
"calcs": [
|
||||
"lastNotNull",
|
||||
"max"
|
||||
]
|
||||
},
|
||||
"tooltip": {
|
||||
"mode": "multi",
|
||||
"sort": "desc"
|
||||
}
|
||||
},
|
||||
"id": 10,
|
||||
"gridPos": {
|
||||
"x": 12,
|
||||
"y": 1,
|
||||
"w": 12,
|
||||
"h": 8
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "row",
|
||||
"title": "Логи и трассы worker",
|
||||
"collapsed": false,
|
||||
"panels": [],
|
||||
"id": 13,
|
||||
"gridPos": {
|
||||
"x": 0,
|
||||
"y": 9,
|
||||
"w": 24,
|
||||
"h": 1
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "logs",
|
||||
"title": "Логи worker",
|
||||
"datasource": {
|
||||
"type": "loki",
|
||||
"uid": "loki"
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"datasource": {
|
||||
"type": "loki",
|
||||
"uid": "loki"
|
||||
},
|
||||
"refId": "A",
|
||||
"expr": "{service_name=\"messenger-worker\"}",
|
||||
"queryType": "range"
|
||||
}
|
||||
],
|
||||
"options": {
|
||||
"showTime": true,
|
||||
"wrapLogMessage": true,
|
||||
"sortOrder": "Descending",
|
||||
"enableLogDetails": true,
|
||||
"dedupStrategy": "none",
|
||||
"prettifyLogMessage": false
|
||||
},
|
||||
"id": 14,
|
||||
"gridPos": {
|
||||
"x": 0,
|
||||
"y": 10,
|
||||
"w": 12,
|
||||
"h": 10
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "table",
|
||||
"title": "Трассы worker",
|
||||
"datasource": {
|
||||
"type": "tempo",
|
||||
"uid": "tempo"
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"datasource": {
|
||||
"type": "tempo",
|
||||
"uid": "tempo"
|
||||
},
|
||||
"refId": "A",
|
||||
"queryType": "traceql",
|
||||
"query": "{ resource.service.name = \"messenger-worker\" }",
|
||||
"limit": 20,
|
||||
"tableType": "traces"
|
||||
}
|
||||
],
|
||||
"fieldConfig": {
|
||||
"defaults": {},
|
||||
"overrides": []
|
||||
},
|
||||
"options": {},
|
||||
"id": 15,
|
||||
"gridPos": {
|
||||
"x": 12,
|
||||
"y": 10,
|
||||
"w": 12,
|
||||
"h": 10
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 16,
|
||||
"type": "timeseries",
|
||||
"title": "Durable queue depth (includes retry)",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"gridPos": {
|
||||
"x": 0,
|
||||
"y": 20,
|
||||
"w": 12,
|
||||
"h": 8
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"refId": "A",
|
||||
"expr": "max(messenger_queue_depth)",
|
||||
"legendFormat": "{{job}} {{__name__}}"
|
||||
}
|
||||
],
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"unit": "short"
|
||||
},
|
||||
"overrides": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 17,
|
||||
"type": "timeseries",
|
||||
"title": "Oldest durable job age",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"gridPos": {
|
||||
"x": 12,
|
||||
"y": 20,
|
||||
"w": 12,
|
||||
"h": 8
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"refId": "A",
|
||||
"expr": "max(messenger_queue_oldest_age_seconds)",
|
||||
"legendFormat": "{{job}} {{__name__}}"
|
||||
}
|
||||
],
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"unit": "s"
|
||||
},
|
||||
"overrides": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 18,
|
||||
"type": "timeseries",
|
||||
"title": "DB pool used / waiting / capacity",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"gridPos": {
|
||||
"x": 0,
|
||||
"y": 28,
|
||||
"w": 12,
|
||||
"h": 8
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"refId": "A",
|
||||
"expr": "sum by (__name__,job) ({__name__=~\"messenger_db_pool_(used|waiting|capacity)\"})",
|
||||
"legendFormat": "{{job}} {{__name__}}"
|
||||
}
|
||||
],
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"unit": "short"
|
||||
},
|
||||
"overrides": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 19,
|
||||
"type": "timeseries",
|
||||
"title": "Worker busy / capacity",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"gridPos": {
|
||||
"x": 12,
|
||||
"y": 28,
|
||||
"w": 12,
|
||||
"h": 8
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"refId": "A",
|
||||
"expr": "sum by (__name__) ({__name__=~\"messenger_worker_(busy|capacity)\"})",
|
||||
"legendFormat": "{{job}} {{__name__}}"
|
||||
}
|
||||
],
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"unit": "short"
|
||||
},
|
||||
"overrides": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 20,
|
||||
"type": "timeseries",
|
||||
"title": "Process CPU cores",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"gridPos": {
|
||||
"x": 0,
|
||||
"y": 36,
|
||||
"w": 12,
|
||||
"h": 8
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"refId": "A",
|
||||
"expr": "sum by (job) (rate(process_cpu_time_seconds_total{job=~\"messenger-.*\"}[1m]))",
|
||||
"legendFormat": "{{job}} {{__name__}}"
|
||||
}
|
||||
],
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"unit": "short"
|
||||
},
|
||||
"overrides": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 21,
|
||||
"type": "timeseries",
|
||||
"title": "Process resident memory",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"gridPos": {
|
||||
"x": 12,
|
||||
"y": 36,
|
||||
"w": 12,
|
||||
"h": 8
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"refId": "A",
|
||||
"expr": "sum by (job) (process_memory_usage_bytes{job=~\"messenger-.*\"})",
|
||||
"legendFormat": "{{job}} {{__name__}}"
|
||||
}
|
||||
],
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"unit": "bytes"
|
||||
},
|
||||
"overrides": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 22,
|
||||
"type": "timeseries",
|
||||
"title": "Time to ready p50 / p95 / p99",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"gridPos": {
|
||||
"x": 0,
|
||||
"y": 44,
|
||||
"w": 12,
|
||||
"h": 8
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"refId": "A",
|
||||
"expr": "histogram_quantile(0.5,sum by (le) (rate(messenger_job_time_to_ready_seconds_bucket[5m])))",
|
||||
"legendFormat": "0.5"
|
||||
},
|
||||
{
|
||||
"refId": "B",
|
||||
"expr": "histogram_quantile(0.95,sum by (le) (rate(messenger_job_time_to_ready_seconds_bucket[5m])))",
|
||||
"legendFormat": "0.95"
|
||||
},
|
||||
{
|
||||
"refId": "C",
|
||||
"expr": "histogram_quantile(0.99,sum by (le) (rate(messenger_job_time_to_ready_seconds_bucket[5m])))",
|
||||
"legendFormat": "0.99"
|
||||
}
|
||||
],
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"unit": "s"
|
||||
},
|
||||
"overrides": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 23,
|
||||
"type": "timeseries",
|
||||
"title": "Ready within 30s, SLO 95% / 1h",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"gridPos": {
|
||||
"x": 12,
|
||||
"y": 44,
|
||||
"w": 12,
|
||||
"h": 8
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"refId": "A",
|
||||
"expr": "messenger:ready_under_30s:ratio1h",
|
||||
"legendFormat": "{{job}} {{__name__}}"
|
||||
}
|
||||
],
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"unit": "percentunit"
|
||||
},
|
||||
"overrides": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 24,
|
||||
"type": "timeseries",
|
||||
"title": "API availability, SLO 99% / 1h",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"gridPos": {
|
||||
"x": 0,
|
||||
"y": 52,
|
||||
"w": 12,
|
||||
"h": 8
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"refId": "A",
|
||||
"expr": "messenger:availability:ratio1h",
|
||||
"legendFormat": "{{job}} {{__name__}}"
|
||||
}
|
||||
],
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"unit": "percentunit"
|
||||
},
|
||||
"overrides": []
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
apiVersion: 1
|
||||
@@ -0,0 +1,14 @@
|
||||
apiVersion: 1
|
||||
|
||||
providers:
|
||||
- name: messenger
|
||||
orgId: 1
|
||||
folder: Messenger
|
||||
folderUid: messenger
|
||||
type: file
|
||||
disableDeletion: true
|
||||
allowUiUpdates: false
|
||||
updateIntervalSeconds: 30
|
||||
options:
|
||||
path: /etc/grafana/dashboards
|
||||
foldersFromFilesStructure: false
|
||||
@@ -0,0 +1,79 @@
|
||||
apiVersion: 1
|
||||
|
||||
prune: true
|
||||
|
||||
datasources:
|
||||
- name: Prometheus
|
||||
uid: prometheus
|
||||
type: prometheus
|
||||
access: proxy
|
||||
url: http://prometheus:9090
|
||||
isDefault: true
|
||||
editable: false
|
||||
jsonData:
|
||||
httpMethod: POST
|
||||
prometheusType: Prometheus
|
||||
prometheusVersion: 3.15.1
|
||||
timeInterval: 15s
|
||||
exemplarTraceIdDestinations:
|
||||
- name: trace_id
|
||||
datasourceUid: tempo
|
||||
urlDisplayLabel: Trace
|
||||
|
||||
- name: Loki
|
||||
uid: loki
|
||||
type: loki
|
||||
access: proxy
|
||||
url: http://loki:3100
|
||||
editable: false
|
||||
jsonData:
|
||||
maxLines: 1000
|
||||
derivedFields:
|
||||
- name: TraceID
|
||||
matcherType: label
|
||||
matcherRegex: trace_id
|
||||
datasourceUid: tempo
|
||||
url: "$${__value.raw}"
|
||||
urlDisplayLabel: Trace
|
||||
|
||||
- name: Tempo
|
||||
uid: tempo
|
||||
type: tempo
|
||||
access: proxy
|
||||
url: http://tempo:3200
|
||||
editable: false
|
||||
jsonData:
|
||||
nodeGraph:
|
||||
enabled: true
|
||||
search:
|
||||
hide: false
|
||||
traceQuery:
|
||||
timeShiftEnabled: true
|
||||
spanStartTimeShift: -30m
|
||||
spanEndTimeShift: 30m
|
||||
streamingEnabled:
|
||||
search: true
|
||||
metrics: false
|
||||
tracesToLogsV2:
|
||||
datasourceUid: loki
|
||||
spanStartTimeShift: -5m
|
||||
spanEndTimeShift: 5m
|
||||
filterByTraceID: true
|
||||
filterBySpanID: false
|
||||
tags:
|
||||
- key: service.name
|
||||
value: service_name
|
||||
tracesToMetrics:
|
||||
datasourceUid: prometheus
|
||||
spanStartTimeShift: -5m
|
||||
spanEndTimeShift: 5m
|
||||
tags:
|
||||
- key: service.name
|
||||
value: job
|
||||
queries:
|
||||
- name: RPS маршрута
|
||||
query: sum(rate(http_server_request_duration_seconds_count{$$__tags}[1m]))
|
||||
- name: p95 маршрута
|
||||
query: histogram_quantile(0.95, sum by (le) (rate(http_server_request_duration_seconds_bucket{$$__tags}[5m])))
|
||||
lokiSearch:
|
||||
datasourceUid: loki
|
||||
@@ -0,0 +1,3 @@
|
||||
apiVersion: 1
|
||||
|
||||
apps: []
|
||||
@@ -0,0 +1,71 @@
|
||||
global
|
||||
log stdout format raw local0 info
|
||||
maxconn 4096
|
||||
hard-stop-after 5s
|
||||
tune.bufsize 32768
|
||||
tune.rcvbuf.client 65536
|
||||
tune.rcvbuf.server 65536
|
||||
tune.sndbuf.client 65536
|
||||
tune.sndbuf.server 65536
|
||||
|
||||
resolvers docker
|
||||
nameserver dns 127.0.0.11:53
|
||||
accepted_payload_size 8192
|
||||
resolve_retries 3
|
||||
timeout resolve 1s
|
||||
timeout retry 1s
|
||||
hold nx 2s
|
||||
hold other 2s
|
||||
hold refused 2s
|
||||
hold timeout 2s
|
||||
|
||||
defaults
|
||||
mode http
|
||||
log global
|
||||
option dontlognull
|
||||
option dontlog-normal
|
||||
log-format "%ci [%tr] %ft %b/%s %TR/%Tw/%Tc/%Tr/%Ta %ST %B %tsc %ac/%fc/%bc/%sc/%rc %sq/%bq rid=%[var(txn.request_id)] %HM %HPO"
|
||||
option http-server-close
|
||||
option redispatch 1
|
||||
retries 2
|
||||
retry-on conn-failure empty-response
|
||||
timeout connect 500ms
|
||||
timeout client 30s
|
||||
timeout server 10s
|
||||
timeout http-request 5s
|
||||
timeout http-keep-alive 5s
|
||||
timeout queue 3s
|
||||
timeout check 1s
|
||||
http-error status 502 content-type application/json hdr X-Request-Id "%[var(txn.request_id)]" lf-string '{"error":{"code":"unavailable","message":"Upstream replica failed","request_id":"%[var(txn.request_id)]"}}'
|
||||
http-error status 503 content-type application/json hdr X-Request-Id "%[var(txn.request_id)]" lf-string '{"error":{"code":"unavailable","message":"No ready API replica","request_id":"%[var(txn.request_id)]"}}'
|
||||
http-error status 504 content-type application/json hdr X-Request-Id "%[var(txn.request_id)]" lf-string '{"error":{"code":"unavailable","message":"Upstream timeout","request_id":"%[var(txn.request_id)]"}}'
|
||||
|
||||
frontend public
|
||||
bind :8080
|
||||
option forwardfor
|
||||
http-request set-var(txn.request_id) req.fhdr(X-Request-Id) if { req.fhdr(X-Request-Id) -m len 1:200 }
|
||||
http-request set-var(txn.request_id) uuid(4) unless { var(txn.request_id) -m found }
|
||||
http-request set-header X-Request-Id %[var(txn.request_id)]
|
||||
default_backend api
|
||||
|
||||
backend api
|
||||
balance roundrobin
|
||||
option httpchk
|
||||
http-check send meth GET uri /health/ready ver HTTP/1.1 hdr Host lb
|
||||
http-check expect status 200
|
||||
acl message_path path_reg ^/api/v1/chats/[^/]+/messages$
|
||||
acl has_key req.hdr(Idempotency-Key) -m found
|
||||
http-request set-var(txn.replay_safe) bool(1) if METH_GET
|
||||
http-request set-var(txn.replay_safe) bool(1) if METH_POST message_path has_key
|
||||
http-request disable-l7-retry unless { var(txn.replay_safe) -m bool }
|
||||
default-server check init-state fully-down inter 1s fastinter 500ms downinter 2s fall 2 rise 2 resolvers docker resolve-prefer ipv4 init-addr none maxconn "${API_SERVER_MAXCONN-64}"
|
||||
server-template api 8 api:8080
|
||||
|
||||
frontend stats
|
||||
bind :8404
|
||||
monitor-uri /healthz
|
||||
monitor fail if { nbsrv(api) lt 1 }
|
||||
http-request use-service prometheus-exporter if { path /metrics }
|
||||
stats enable
|
||||
stats uri /stats
|
||||
stats refresh 5s
|
||||
@@ -0,0 +1,106 @@
|
||||
import http from 'k6/http';
|
||||
import { check } from 'k6';
|
||||
import encoding from 'k6/encoding';
|
||||
import exec from 'k6/execution';
|
||||
|
||||
const BASE = __ENV.BASE_URL || 'http://lb:8080';
|
||||
const RATE = Number(__ENV.RATE || 50);
|
||||
const WARMUP = Number(__ENV.WARMUP || 10);
|
||||
const DURATION = Number(__ENV.DURATION || 60);
|
||||
const USERS = Math.max(2, Number(__ENV.USERS || 20));
|
||||
const READ_RATIO = Number(__ENV.READ_RATIO || 0.2);
|
||||
const VUS = Number(__ENV.VUS || Math.max(10, Math.ceil(RATE / 10)));
|
||||
const MAX_VUS = Number(__ENV.MAX_VUS || Math.max(VUS, Math.min(VUS * 4, 1000)));
|
||||
const RUN = __ENV.RUN_ID || Date.now().toString(36);
|
||||
const SUMMARY = __ENV.SUMMARY || '/out/summary.json';
|
||||
const JSON_HEADERS = { 'Content-Type': 'application/json' };
|
||||
|
||||
const phase = (startTime, duration) => ({
|
||||
executor: 'constant-arrival-rate',
|
||||
rate: RATE,
|
||||
timeUnit: '1s',
|
||||
startTime: `${startTime}s`,
|
||||
duration: `${duration}s`,
|
||||
preAllocatedVUs: VUS,
|
||||
maxVUs: MAX_VUS,
|
||||
gracefulStop: '5s',
|
||||
});
|
||||
|
||||
const measured = ['http_reqs', 'http_req_failed', 'http_req_duration', 'dropped_iterations', 'iterations'];
|
||||
|
||||
export const options = {
|
||||
setupTimeout: '180s',
|
||||
summaryTrendStats: ['avg', 'min', 'med', 'p(90)', 'p(95)', 'p(99)', 'max'],
|
||||
scenarios: Object.assign(WARMUP > 0 ? { warmup: phase(0, WARMUP) } : {}, { measure: phase(WARMUP, DURATION) }),
|
||||
thresholds: Object.fromEntries([
|
||||
...measured.map((metric) => [`${metric}{scenario:measure}`, []]),
|
||||
['http_req_duration{scenario:measure,name:post_message}', []],
|
||||
['http_req_duration{scenario:measure,name:get_history}', []],
|
||||
]),
|
||||
};
|
||||
|
||||
function created(response, what) {
|
||||
if (response.status !== 201) {
|
||||
throw new Error(`${what}: HTTP ${response.status}`);
|
||||
}
|
||||
return response.json();
|
||||
}
|
||||
|
||||
const bearer = (token, extra) => Object.assign({ Authorization: `Bearer ${token}` }, extra || {});
|
||||
|
||||
export function setup() {
|
||||
const actors = [];
|
||||
for (let i = 0; i < USERS; i++) {
|
||||
const username = `k6_${RUN}_${i}`.slice(0, 32);
|
||||
const password = `K6-${RUN}-${i}-synthetic`;
|
||||
const user = created(
|
||||
http.post(`${BASE}/api/v1/users`, JSON.stringify({ username, display_name: `k6 ${i}`, password }), { headers: JSON_HEADERS }),
|
||||
'register',
|
||||
);
|
||||
const basic = encoding.b64encode(`${username}:${password}`);
|
||||
const session = created(
|
||||
http.post(`${BASE}/api/v1/auth/sessions`, null, { headers: { Authorization: `Basic ${basic}` } }),
|
||||
'login',
|
||||
);
|
||||
actors.push({ id: user.id, token: session.token });
|
||||
}
|
||||
const chats = [];
|
||||
for (let i = 0; i < USERS; i += 2) {
|
||||
const [a, b] = [actors[i], actors[(i + 1) % USERS]];
|
||||
const body = JSON.stringify({ title: `k6 ${RUN} ${i}`, member_ids: [a.id, b.id] });
|
||||
const chat = created(http.post(`${BASE}/api/v1/chats`, body, { headers: bearer(a.token, JSON_HEADERS) }), 'chat');
|
||||
chats.push({ id: chat.id, tokens: [a.token, b.token] });
|
||||
}
|
||||
console.log('LOAD-START');
|
||||
return { chats };
|
||||
}
|
||||
|
||||
export default function (data) {
|
||||
const n = exec.scenario.iterationInTest;
|
||||
const chat = data.chats[n % data.chats.length];
|
||||
const token = chat.tokens[Math.floor(n / data.chats.length) % 2];
|
||||
if (Math.random() < READ_RATIO) {
|
||||
const response = http.get(`${BASE}/api/v1/chats/${chat.id}/messages?limit=50`, {
|
||||
headers: bearer(token),
|
||||
tags: { name: 'get_history' },
|
||||
timeout: '10s',
|
||||
});
|
||||
check(response, { 'history 200': (r) => r.status === 200 });
|
||||
return;
|
||||
}
|
||||
const key = `${RUN}-${exec.scenario.name}-${n}`;
|
||||
const response = http.post(`${BASE}/api/v1/chats/${chat.id}/messages`, JSON.stringify({ text: `k6 ${key}` }), {
|
||||
headers: bearer(token, Object.assign({ 'Idempotency-Key': key }, JSON_HEADERS)),
|
||||
tags: { name: 'post_message' },
|
||||
timeout: '10s',
|
||||
});
|
||||
check(response, { 'message 201': (r) => r.status === 201 });
|
||||
}
|
||||
|
||||
export function handleSummary(data) {
|
||||
delete data.setup_data;
|
||||
const reqs = data.metrics['http_reqs{scenario:measure}'];
|
||||
const failed = data.metrics['http_req_failed{scenario:measure}'];
|
||||
const line = `measure: ${reqs ? reqs.values.count : 0} requests, failed ratio ${failed ? failed.values.rate : 'n/a'}\n`;
|
||||
return { [SUMMARY]: JSON.stringify(data, null, 1), stdout: line };
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
auth_enabled: false
|
||||
|
||||
server:
|
||||
http_listen_address: 0.0.0.0
|
||||
http_listen_port: 3100
|
||||
grpc_listen_port: 9096
|
||||
log_level: warn
|
||||
|
||||
common:
|
||||
instance_addr: 127.0.0.1
|
||||
path_prefix: /loki
|
||||
replication_factor: 1
|
||||
storage:
|
||||
filesystem:
|
||||
chunks_directory: /loki/chunks
|
||||
rules_directory: /loki/rules
|
||||
ring:
|
||||
kvstore:
|
||||
store: inmemory
|
||||
|
||||
schema_config:
|
||||
configs:
|
||||
- from: "2026-01-01"
|
||||
store: tsdb
|
||||
object_store: filesystem
|
||||
schema: v13
|
||||
index:
|
||||
prefix: index_
|
||||
period: 24h
|
||||
|
||||
ingester:
|
||||
chunk_idle_period: 5m
|
||||
max_chunk_age: 1h
|
||||
|
||||
limits_config:
|
||||
allow_structured_metadata: true
|
||||
volume_enabled: true
|
||||
retention_period: 168h
|
||||
reject_old_samples: true
|
||||
reject_old_samples_max_age: 24h
|
||||
ingestion_rate_mb: 8
|
||||
ingestion_burst_size_mb: 16
|
||||
max_query_lookback: 168h
|
||||
otlp_config:
|
||||
resource_attributes:
|
||||
ignore_defaults: true
|
||||
attributes_config:
|
||||
- action: index_label
|
||||
attributes:
|
||||
- service.name
|
||||
- deployment.environment.name
|
||||
- action: structured_metadata
|
||||
attributes:
|
||||
- service.instance.id
|
||||
- service.version
|
||||
|
||||
compactor:
|
||||
working_directory: /loki/compactor
|
||||
retention_enabled: true
|
||||
delete_request_store: filesystem
|
||||
compaction_interval: 10m
|
||||
|
||||
query_range:
|
||||
results_cache:
|
||||
cache:
|
||||
embedded_cache:
|
||||
enabled: true
|
||||
max_size_mb: 64
|
||||
|
||||
pattern_ingester:
|
||||
enabled: false
|
||||
|
||||
ruler:
|
||||
enable_api: false
|
||||
|
||||
analytics:
|
||||
reporting_enabled: false
|
||||
@@ -0,0 +1,105 @@
|
||||
extensions:
|
||||
health_check:
|
||||
endpoint: 0.0.0.0:13133
|
||||
|
||||
receivers:
|
||||
otlp:
|
||||
protocols:
|
||||
http:
|
||||
endpoint: 0.0.0.0:4318
|
||||
max_request_body_size: 8388608
|
||||
|
||||
processors:
|
||||
memory_limiter:
|
||||
check_interval: 1s
|
||||
limit_percentage: 75
|
||||
spike_limit_percentage: 20
|
||||
redaction:
|
||||
allow_all_keys: true
|
||||
summary: silent
|
||||
blocked_key_patterns:
|
||||
- "(?i)^(.*[._-])?(password|passwd|secret|token|authorization|cookie|api[._-]?key|private[._-]?key|credentials?)$"
|
||||
- "^http\\.(request|response)\\.header\\..+"
|
||||
- "^url\\.(query|full)$"
|
||||
- "^http\\.(url|target)$"
|
||||
- "^(messenger\\.)?(message\\.)?(text|body)$"
|
||||
- "^(file\\.)?filename$"
|
||||
blocked_values:
|
||||
- "(?i)bearer\\s+[A-Za-z0-9._~+/=-]{8,}"
|
||||
- "(?i)basic\\s+[A-Za-z0-9+/=]{8,}"
|
||||
- "(?i)x-amz-(signature|credential)=[^&\\s]+"
|
||||
- "-----BEGIN [A-Z ]*PRIVATE KEY-----"
|
||||
batch:
|
||||
send_batch_size: 1024
|
||||
send_batch_max_size: 2048
|
||||
timeout: 2s
|
||||
|
||||
exporters:
|
||||
otlp_http/tempo:
|
||||
traces_endpoint: http://tempo:4318/v1/traces
|
||||
timeout: 5s
|
||||
sending_queue:
|
||||
enabled: true
|
||||
num_consumers: 2
|
||||
sizer: items
|
||||
queue_size: 20000
|
||||
retry_on_failure:
|
||||
enabled: true
|
||||
initial_interval: 1s
|
||||
max_interval: 10s
|
||||
max_elapsed_time: 60s
|
||||
otlp_http/prometheus:
|
||||
metrics_endpoint: http://prometheus:9090/api/v1/otlp/v1/metrics
|
||||
timeout: 5s
|
||||
sending_queue:
|
||||
enabled: true
|
||||
num_consumers: 2
|
||||
sizer: items
|
||||
queue_size: 50000
|
||||
retry_on_failure:
|
||||
enabled: true
|
||||
initial_interval: 1s
|
||||
max_interval: 10s
|
||||
max_elapsed_time: 60s
|
||||
otlp_http/loki:
|
||||
logs_endpoint: http://loki:3100/otlp/v1/logs
|
||||
timeout: 5s
|
||||
sending_queue:
|
||||
enabled: true
|
||||
num_consumers: 2
|
||||
sizer: items
|
||||
queue_size: 20000
|
||||
retry_on_failure:
|
||||
enabled: true
|
||||
initial_interval: 1s
|
||||
max_interval: 10s
|
||||
max_elapsed_time: 60s
|
||||
|
||||
service:
|
||||
extensions: [health_check]
|
||||
telemetry:
|
||||
logs:
|
||||
level: info
|
||||
metrics:
|
||||
level: normal
|
||||
readers:
|
||||
- pull:
|
||||
exporter:
|
||||
prometheus:
|
||||
host: 0.0.0.0
|
||||
port: 8888
|
||||
without_type_suffix: false
|
||||
without_units: false
|
||||
pipelines:
|
||||
traces:
|
||||
receivers: [otlp]
|
||||
processors: [memory_limiter, redaction, batch]
|
||||
exporters: [otlp_http/tempo]
|
||||
metrics:
|
||||
receivers: [otlp]
|
||||
processors: [memory_limiter, redaction, batch]
|
||||
exporters: [otlp_http/prometheus]
|
||||
logs:
|
||||
receivers: [otlp]
|
||||
processors: [memory_limiter, redaction, batch]
|
||||
exporters: [otlp_http/loki]
|
||||
@@ -0,0 +1,41 @@
|
||||
global:
|
||||
scrape_interval: 15s
|
||||
scrape_timeout: 10s
|
||||
evaluation_interval: 15s
|
||||
|
||||
rule_files:
|
||||
- /etc/prometheus/rules/*.yml
|
||||
|
||||
otlp:
|
||||
translation_strategy: UnderscoreEscapingWithSuffixes
|
||||
promote_resource_attributes:
|
||||
- service.name
|
||||
- service.version
|
||||
- deployment.environment.name
|
||||
- container.name
|
||||
- compose.project
|
||||
- compose.service
|
||||
keep_identifying_resource_attributes: true
|
||||
|
||||
storage:
|
||||
tsdb:
|
||||
out_of_order_time_window: 30m
|
||||
exemplars:
|
||||
max_exemplars: 100000
|
||||
|
||||
scrape_configs:
|
||||
- job_name: prometheus
|
||||
static_configs:
|
||||
- targets: ["localhost:9090"]
|
||||
- job_name: otel-collector
|
||||
static_configs:
|
||||
- targets: ["otel-collector:8888"]
|
||||
- job_name: loki
|
||||
static_configs:
|
||||
- targets: ["loki:3100"]
|
||||
- job_name: tempo
|
||||
static_configs:
|
||||
- targets: ["tempo:3200"]
|
||||
- job_name: grafana
|
||||
static_configs:
|
||||
- targets: ["grafana:3000"]
|
||||
@@ -0,0 +1,30 @@
|
||||
groups:
|
||||
- name: messenger-slo
|
||||
interval: 5s
|
||||
rules:
|
||||
- record: messenger:http_errors:ratio_rate1m
|
||||
expr: |
|
||||
(sum(rate(http_server_request_duration_seconds_count{job="messenger-api",http_route!~"/health/.*",http_response_status_code=~"5.."}[1m])) or vector(0))
|
||||
/ clamp_min(sum(rate(http_server_request_duration_seconds_count{job="messenger-api",http_route!~"/health/.*"}[1m])), 0.001)
|
||||
- record: messenger:availability:ratio1h
|
||||
expr: 1 - messenger:http_errors:ratio_rate1h
|
||||
- record: messenger:ready_under_30s:ratio1h
|
||||
expr: sum(increase(messenger_job_time_to_ready_seconds_bucket{le="30"}[1h])) / clamp_min(sum(increase(messenger_job_time_to_ready_seconds_count[1h])), 1)
|
||||
- alert: MessengerHighErrorRate
|
||||
expr: messenger:http_errors:ratio_rate1m > 0.05
|
||||
for: 15s
|
||||
labels:
|
||||
severity: warning
|
||||
annotations:
|
||||
summary: More than 5% business HTTP 5xx over 1 minute
|
||||
description: Availability target is 99% over 1 hour; health and client 4xx are excluded from failures.
|
||||
runbook: infra/prometheus/runbooks.md#messengerhigherrorrate
|
||||
- alert: MessengerQueueLag
|
||||
expr: max(messenger_queue_oldest_age_seconds{queue_name="attachments.process"}) > 15 and max(messenger_queue_depth{queue_name="attachments.process"}) > 0
|
||||
for: 15s
|
||||
labels:
|
||||
severity: warning
|
||||
annotations:
|
||||
summary: Durable attachment backlog has waited more than 15 seconds
|
||||
description: Target is 95% ready within 30 seconds over 1 hour; depth includes retry and leased work.
|
||||
runbook: infra/prometheus/runbooks.md#messengerqueuelag
|
||||
@@ -0,0 +1,32 @@
|
||||
groups:
|
||||
- name: messenger-http
|
||||
interval: 15s
|
||||
rules:
|
||||
- record: messenger:http_requests:rate2m
|
||||
expr: |
|
||||
sum by (http_route, http_request_method, status_class) (
|
||||
label_replace(
|
||||
rate(http_server_request_duration_seconds_count{job="messenger-api", http_route!~"/health/.*"}[2m]),
|
||||
"status_class", "${1}xx", "http_response_status_code", "([1-5])[0-9][0-9]"
|
||||
)
|
||||
)
|
||||
- record: messenger:http_errors:ratio_rate2m
|
||||
expr: |
|
||||
(sum(rate(http_server_request_duration_seconds_count{job="messenger-api", http_route!~"/health/.*", http_response_status_code=~"5.."}[2m])) or vector(0))
|
||||
/
|
||||
sum(rate(http_server_request_duration_seconds_count{job="messenger-api", http_route!~"/health/.*"}[2m]))
|
||||
- record: messenger:http_errors:ratio_rate1h
|
||||
expr: |
|
||||
(sum(rate(http_server_request_duration_seconds_count{job="messenger-api", http_route!~"/health/.*", http_response_status_code=~"5.."}[1h])) or vector(0))
|
||||
/
|
||||
sum(rate(http_server_request_duration_seconds_count{job="messenger-api", http_route!~"/health/.*"}[1h]))
|
||||
- record: messenger:http_request_duration_seconds:p50_5m
|
||||
expr: histogram_quantile(0.50, sum by (le) (rate(http_server_request_duration_seconds_bucket{job="messenger-api", http_route!~"/health/.*"}[5m])))
|
||||
- record: messenger:http_request_duration_seconds:p95_5m
|
||||
expr: histogram_quantile(0.95, sum by (le) (rate(http_server_request_duration_seconds_bucket{job="messenger-api", http_route!~"/health/.*"}[5m])))
|
||||
- record: messenger:http_request_duration_seconds:p99_5m
|
||||
expr: histogram_quantile(0.99, sum by (le) (rate(http_server_request_duration_seconds_bucket{job="messenger-api", http_route!~"/health/.*"}[5m])))
|
||||
- record: messenger:jobs:rate5m
|
||||
expr: sum by (job_type, outcome) (rate(messenger_jobs_processed_total[5m]))
|
||||
- record: messenger:job_duration_seconds:p95_5m
|
||||
expr: histogram_quantile(0.95, sum by (le, job_type) (rate(messenger_job_duration_seconds_bucket[5m])))
|
||||
@@ -0,0 +1,15 @@
|
||||
# Локальная диагностика
|
||||
|
||||
SLI availability = 1 − business HTTP 5xx / все business HTTP за 1 h, цель 99%; health исключены, 4xx остаются в знаменателе. SLI ready = доля завершённых jobs с time-to-ready <=30 s за 1 h, цель 95%. Незавершённые jobs не входят в histogram, поэтому возраст/depth контролируются отдельно. Учебные alerts реагируют раньше окна SLO: это пороговые предупреждения, не multi-window burn rates.
|
||||
|
||||
## MessengerHighErrorRate
|
||||
|
||||
Условие: 5xx/все >5% за 1 m непрерывно 15 s; вычисление каждые 5 s. В API dashboard проверить error ratio и p95. По request_id найти лог и trace. Длинный/ошибочный PostgreSQL client span указывает на зависимость; длинный server span без медленных client spans — на handler. Проверить used/waiting/capacity пула и ресурсы процесса. В своём стенде восстановить postgres, дождаться ready обеих API и успешных запросов. Alert должен исчезнуть после ухода ошибок из минутного окна.
|
||||
|
||||
## MessengerQueueLag
|
||||
|
||||
Условие: durable depth>0 и oldest age>15 s непрерывно 15 s. Проверить jobs outcomes, worker busy/capacity, CPU/RAM и наличие worker logs. Отсутствие worker signal при растущем backlog указывает на остановку процесса; retry с S3 ERROR spans — на хранилище. Проверить producer/consumer цепочку конкретного attachment. Восстановить только свой worker/зависимость; дождаться ready, depth=0, age=0 и отсутствия firing alert. Queue depth относится к PostgreSQL queued/processing, включая scheduled retry, а не только AMQP ready messages.
|
||||
|
||||
## Отказ telemetry backend
|
||||
|
||||
Readiness API не зависит от Collector/хранилищ. Сначала проверить бизнес-smoke. Collector: queue_size/capacity, send_failed и sent counters; Docker RAM против mem_limit. Retry ограничен 60 s, очереди ограничены; потеря диагностических данных при заполнении допустима, потеря сообщений — нет. Восстановить backend и проверить новый request trace/log и метрики. Не удалять volumes для восстановления.
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user