← Back to Pull requests

Add mongo evalya full-coverage fixture #25423

Closed
unknown closed this pull request without merging on Oct 21, 2026 15:56 UTC
View on GitHub
unknown unknown commented on Sep 28, 2026 23:58 UTC
Author

What does this PR do?

TL;DR: Adds a mongo-full evalya fixture (mongo/tests/evalya.yaml): the smallest sharded MongoDB 8.0 cluster that exercises both the mongos and the replica-set collectors, a seed, and a continuous workload that includes lock contention. Stacked on #25153 (onboard-evalya skill). Test fixtures only.

  • Topology: 1-member config replica set; shard01 with a primary (shard-a) and a hidden delayed secondary (shard-b: priority 0, votes 0, secondaryDelaySecs 5) so replication lag and repl. counters move; mongos; a socat entrypoint forwarding 27017 (mongos), 27018 (shard-a), 27019 (shard-b), same pattern as #25224.

  • seed.sh: adds the shard, creates the datadog user, seeds a pre-split sharded collection with indexes.

  • activity-gen.sh: a mixed workload through mongos (inserts, indexed and scan queries, getMores, updates, aggregates, deletes, periodic DDL, a long-lived session), plus lock contention in lockdrill:

  • - on shard-a: a slow $where writer holding intent locks, two fast writers and dbStats, and a holder every 3s running createIndexes/dropIndexes, dbHash, a cross-database renameCollection, and an fsync lock;
    - through mongos: a capped insert (Metadata X) and setUserWriteBlockMode on then off (Global X).
  • logicalSessionRefreshMillis=10000, so sessions.count appears within a short run.

  • README: inputs, the three-instance check config, zero-by-nature metrics, and the lock workload.
  • Knobs (Compose interpolation, read from the environment of the evalya run, e.g. LOCK_DRILL=0 evalya run ... or evalya run -e LOCK_DRILL=0 ...):

    | Variable | Default | Effect |
    |---|---|---|
    | MONGO_VERSION | 8.0 | Image tag for every mongo service (6.0+). |
    | DB_USERNAME / DB_PASSWORD | datadog / datadog | Monitoring user created by seed. |
    | ACTIVITY_GEN | 1 | 0 keeps activity-gen up but idle. |
    | LOCK_DRILL | 1 | 0 skips the fsync lock and the setUserWriteBlockMode holder; the rest of the lock contention still runs. |

    Side effect of the lock drill: setUserWriteBlockMode with global: true blocks all user writes cluster-wide for its window, every 3s. That includes the fixture's own activity-gen iteration, the shard holder's index build (logged, restarted 5s later), and any consumer writing through the forwarded ports. Read-only scrapers are not blocked. LOCK_DRILL=0 opts out. An exit trap kills the holders and runs fsyncUnlock then setUserWriteBlockMode off, best effort, so stopping activity-gen mid-window does not leave the cluster blocked. ACTIVITY_DURATION (script-only, not passed by the compose file) is documented in the README.

    Motivation

    semantic-core's FTF federates -full fixtures (redis-full, rabbitmq-full #25224) to compare the Datadog mongo check with the OTel mongodbreceiver. Mongo had no evalya fixture, and the existing mongo-shard.yaml compose (11 mongods, no healthchecks, docker exec init) is not usable as one. The lock workload exists because serverStatus reports locks.<type>.acquireWaitCount and timeAcquiringMicros only after an acquisition waits, which one-at-a-time traffic never causes, so the comparator had no data on either side for 27 lock metric pairs.

    Validation

  • Lock pairs: 21 of the 27 are non-zero on the shard primary, from both the mongo check and the mongodbreceiver (MongoDB 8.0.32, three 15s windows, LOCK_DRILL=1). The other 6 read modes 8.0 never acquires in steady state (Metadata R, oplog R, and waits on oplog w); the README records why.

  • Coverage, measured before the lock workload was added (not re-measured on this head):

  • - dashboard and monitor metrics: 29/29 emitted, 25 non-zero with agent check mongo (Agent 7.83.1, three instances: mongos, primary, secondary). The 4 zeros: chunks.jumbo, globallock.currentqueue.{readers,writers}, extra_info.page_faultsps. The two queue gauges are point-in-time, and the lock workload queues operations only in ~100ms bursts, so they are still expected to read 0 at scrape time; that expectation is reasoned, not measured.
    - metadata.csv: 221/328 emitted, 162 non-zero.
    - OTel mongodbreceiver (otelcol-contrib 0.161.0, all metrics enabled): 50/52 emitted, 43 non-zero.
  • LOCK_DRILL, live on this head:

  • - LOCK_DRILL=1: shard-a serverStatus().locks showed non-zero acquireWaitCount for Global, Database, and Collection in all four modes. With an fsync lock held by hand, docker stop on activity-gen returned in 0.5s, logged lock drill released, the fsyncLockWorker lock was gone, and a write through mongos succeeded.
    - LOCK_DRILL=0: the container got LOCK_DRILL=0, the log showed lock drill disabled and 40+ iterations with no UserWritesBlocked and no failures. Database, Collection, and Metadata lock fields were still populated; the Global wait fields were absent, since the drill's holders are the only Global S/X requests.
  • evalya manifest validate --path mongo/tests/evalya.yaml: OK (warnings: ignored restart: policies, no registry mirror).

  • ddev --no-interactive test --lint mongo: pass. Tests-only change, no changelog.

  • Not verified: consumption through an OCI federation context, non-default MONGO_VERSION, ACTIVITY_GEN=0.
  • Review checklist (to be filled by reviewers)

  • Feature or bugfix MUST have appropriate tests (unit, integration, e2e)

  • Add qa/required if this PR needs QA validation, or qa/skip-qa if it does not. Exactly one of the two is required.

  • If you need to backport this PR to another branch, you can add the backport/<branch-name> label to the PR and it will automatically open a backport PR once this one is merged
  • 🤖 Generated with Claude Code

    Diff: 650 lines (+487 / -163) across 8 files Reviewer: HadhemiDD Review duration: 32637m
    All Vouch review confidence checks passed
    Residual risk 0.22 = Change Risk (0.52) × (1 − Review Confidence (0.57)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.52 · 650 lines diff across 8 files
    0.52
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    56%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.388
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #25423"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 56.8% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 52% (MEDIUM) · Higher = larger blast radius
    52%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 56.8% · Lower = rushed or shallow review
    56.8%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 22.5% · Safe to merge
    22.5%