Skip to content

docs(OTel): Add backend event catalogue#7286

Open
khvn26 wants to merge 10 commits intomainfrom
feat/otel-events-catalogue
Open

docs(OTel): Add backend event catalogue#7286
khvn26 wants to merge 10 commits intomainfrom
feat/otel-events-catalogue

Conversation

@khvn26
Copy link
Copy Markdown
Member

@khvn26 khvn26 commented Apr 17, 2026

Thanks for submitting a PR! Please check the boxes below:

  • I have read the Contributing Guide.
  • I have added information to docs/ if required so people know about the feature.
  • I have filled in the "Changes" section below.
  • I have filled in the "How did you test this code" section below.

Changes

Closes to Flagsmith/flagsmith-common#201

Adds a checked-in catalogue of every structured event the backend emits, generated from the source on each pre-commit run. Product and ops can use it to curate the OTel allowlist without grepping the codebase, and any PR that adds, renames, or changes an emit surfaces the diff in review.

flagsmith docgen events, shipped in flagsmith-common 3.8.1, scans structlog call sites and emits per-event markdown entries. The existing pre-commit hook that runs make -C api generate-docs keeps the catalogue in sync alongside the metrics doc.

The metrics and events references live under a new Observability category — a sibling to Scaling & Performance under Deployment and Self-hosting, alongside the existing Monitoring and OpenTelemetry pages they were already cross-linked to. Old URLs continue to work via redirects in docs/vercel.json.

The flagsmith-common docgen templates used to emit a full page — frontmatter, intro prose, section heading, and catalogue entries — with intro links that were necessarily site-specific. flagsmith-common 3.8.2 strips them to pure data. Here, the page shell becomes hand-authored MDX (events.mdx, metrics.mdx) that imports the generated partial (_events-catalogue.md, _metrics-catalogue.md). Docusaurus ignores underscore-prefixed files from routing, so the partials don't serve on their own.

_events-catalogue.md is owned by @flagsmith/flagsmith-product in CODEOWNERS so every catalogue diff auto-requests product review. Validated via GitHub's codeowners/errors API.

Also flesh out the StatsD section on the Monitoring page with the STATSD_HOST/STATSD_PORT/STATSD_PREFIX env vars and cross-link it from the Metrics page.

Follow-ups, not in this PR: GitHub-linked source locations in the catalogue; implicit bind_contextvars context support once the backend uses it.

Preview

Docs preview (rebuilds per push):

Review

Complexity: 2/5. Mostly docs and config changes; no runtime code. Risk is bounded to docs rendering and the generated catalogue. Novelty sits in the MDX-plus-partial pattern and the entity.action event convention — aim is editorial review: does the catalogue read right, do the pages flow, are the env vars accurate.

Suggested flow, ~15 min:

  1. Open the events preview. Scan the catalogue — anything misnamed, missing attributes, or emitted from a domain that doesn't show up?
  2. Hit one of the old URLs to confirm the redirect works, e.g. old metrics URL should land on the new path.
  3. Confirm the sidebar in the preview reads Monitoring → OpenTelemetry → Metrics → Events.
  4. Read the StatsD section on Monitoring — enough for an SRE coming in cold?
  5. Check the CODEOWNERS diff — the _events-catalogue.md rule puts future catalogue changes in front of product.

How did you test this code?

Ran make -C api generate-docs locally against flagsmith-common 3.8.2. The resulting catalogue captures every domain called out in the issue — code_references, workflows, launch_darkly, feature_health, sentry_change_tracking — plus emits from app_analytics, dynamodb, gitlab, platform_hub, and segments.

Verified the Docusaurus build passes locally (npm run build). Spot-checked that old URLs redirect correctly: /administration-and-security/platform-configuration/{metrics,events} and /deployment-self-hosting/scaling-and-performance/{monitoring,opentelemetry} all point to the new observability paths.

CODEOWNERS validated via gh api repos/Flagsmith/flagsmith/codeowners/errors — no errors.

Generates `docs/.../events.md` via `flagsmith docgen events` — the
new subcommand shipped in Flagsmith/flagsmith-common#202. The
catalogue lists every structured event the backend emits, the log
level each is emitted at, its source locations, and the attributes
it carries, so product and ops can curate the OTel allowlist without
grepping the codebase.

Wired into `make generate-docs` so the catalogue stays in sync with
the source on the existing pre-commit hook — any PR that adds or
changes an emit surfaces the diff in review.

Points `flagsmith-common` at the PR branch for smoke testing; switch
to a released version before merging.

beep boop
@vercel
Copy link
Copy Markdown

vercel bot commented Apr 17, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

3 Skipped Deployments
Project Deployment Actions Updated (UTC)
docs Ignored Ignored Preview Apr 20, 2026 5:43pm
flagsmith-frontend-preview Ignored Ignored Preview Apr 20, 2026 5:43pm
flagsmith-frontend-staging Ignored Ignored Preview Apr 20, 2026 5:43pm

Request Review

@github-actions github-actions bot added api Issue related to the REST API docs Documentation updates feature New feature or request and removed docs Documentation updates labels Apr 17, 2026
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 17, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.37%. Comparing base (1b8145a) to head (d30adec).
⚠️ Report is 4 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #7286   +/-   ##
=======================================
  Coverage   98.37%   98.37%           
=======================================
  Files        1364     1364           
  Lines       51071    51071           
=======================================
  Hits        50239    50239           
  Misses        832      832           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Switch back from the branch pin now that the docgen events subcommand
is released.

beep boop
@github-actions github-actions bot added docs Documentation updates feature New feature or request and removed feature New feature or request docs Documentation updates labels Apr 20, 2026
khvn26 added 2 commits April 20, 2026 12:07
3.8.1 normalises legacy kebab-case event names to snake_case in the
catalogue.

beep boop
@github-actions github-actions bot added the docs Documentation updates label Apr 20, 2026
@github-actions github-actions bot added feature New feature or request and removed feature New feature or request docs Documentation updates labels Apr 20, 2026
khvn26 added 3 commits April 20, 2026 17:05
…Observability category

These four files are operator observability artefacts, not
Flagsmith-tenant settings — they shared a category (Platform
Configuration) with environment-settings.md that was aimed at a
different audience, and monitoring.md already linked cross-tree to
the metrics reference.

Lifts all four under a new `deployment-self-hosting/observability/`
category, updates inbound references in the docs tree and in
`api/{Makefile,README.md}`, updates the parent
`deployment-self-hosting/index.md` to surface the new section, and
adds redirects in `vercel.json` so the old URLs continue to work.

beep boop
…artial

The flagsmith-common docgen templates used to emit a full Docusaurus
page — frontmatter, intro prose, a section heading, and the catalogue
entries. The intro links and framing were necessarily site-specific,
which meant upstream owned URLs that only made sense for one consumer
and silently broke on docs-tree moves (see Flagsmith/flagsmith-common#210).

Switch to an MDX + partial pattern. The `docgen events` and
`docgen metrics` commands now write only the catalogue entries to
underscore-prefixed partial files (`_events-catalogue.md`,
`_metrics-catalogue.md`) — Docusaurus ignores these from routing. The
page shell moves to hand-authored `events.mdx` and `metrics.mdx` that
import the partials, owning the frontmatter, intro prose, and internal
links.

Pins flagsmith-common to the PR branch temporarily; swap for a version
pin once that lands and releases.

beep boop
The generated events catalogue partial is the authoritative list of
structured events the backend emits. Routing it through the product
team means new events automatically summon product review at PR time.

beep boop
@github-actions github-actions bot added docs Documentation updates feature New feature or request and removed feature New feature or request docs Documentation updates labels Apr 20, 2026
The README is imported as a component into the docs site via
docs/docs/project-and-community/development.md. Relative paths written
from api/README.md's perspective on disk don't resolve when the README
is rendered at /project-and-community/development — Docusaurus treats
them as literal URL paths, which fail the broken-link check.

Use an absolute docs.flagsmith.com URL so the link works both when
reading the README on GitHub and when the README is composed into the
docs site.

beep boop
@github-actions github-actions bot added docs Documentation updates and removed feature New feature or request docs Documentation updates labels Apr 20, 2026
@github-actions github-actions bot added the feature New feature or request label Apr 20, 2026
@khvn26 khvn26 marked this pull request as ready for review April 20, 2026 17:14
@khvn26 khvn26 requested review from a team as code owners April 20, 2026 17:14
@khvn26 khvn26 requested review from matthewelwell and removed request for a team April 20, 2026 17:14
Copy link
Copy Markdown

@claude claude bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Code review skipped — your organization's overage spend limit has been reached.

Code review is billed via overage credits. To resume reviews, an organization admin can raise the monthly limit at claude.ai/admin-settings/claude-code.

Once credits are available, reopen this pull request to trigger a review.

@github-actions github-actions bot added feature New feature or request and removed feature New feature or request labels Apr 20, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 20, 2026

Docker builds report

Image Build Status Security report
ghcr.io/flagsmith/flagsmith-e2e:pr-7286 Finished ✅ Skipped
ghcr.io/flagsmith/flagsmith-frontend:pr-7286 Finished ✅ Results
ghcr.io/flagsmith/flagsmith-api-test:pr-7286 Finished ✅ Skipped
ghcr.io/flagsmith/flagsmith-api:pr-7286 Finished ✅ Results
ghcr.io/flagsmith/flagsmith:pr-7286 Finished ✅ Results
ghcr.io/flagsmith/flagsmith-private-cloud:pr-7286 Finished ✅ Results

@khvn26 khvn26 changed the title feat(OTel): Add backend event catalogue docs(OTel): Add backend event catalogue Apr 20, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 20, 2026

Playwright Test Results (oss - depot-ubuntu-latest-16)

passed  11 passed

Details

stats  11 tests across 8 suites
duration  10.7 seconds
commit  e699973
info  🔄 Run: #16198 (attempt 1)

Playwright Test Results (oss - depot-ubuntu-latest-arm-16)

passed  11 passed

Details

stats  11 tests across 8 suites
duration  28.6 seconds
commit  e699973
info  🔄 Run: #16198 (attempt 1)

Playwright Test Results (private-cloud - depot-ubuntu-latest-16)

passed  2 passed

Details

stats  2 tests across 2 suites
duration  58.7 seconds
commit  e699973
info  🔄 Run: #16198 (attempt 1)

Playwright Test Results (private-cloud - depot-ubuntu-latest-arm-16)

passed  1 passed

Details

stats  1 test across 1 suite
duration  1 minute, 19 seconds
commit  e699973
info  🔄 Run: #16198 (attempt 1)

Playwright Test Results (oss - depot-ubuntu-latest-16)

passed  11 passed

Details

stats  11 tests across 8 suites
duration  45.8 seconds
commit  d48bb63
info  🔄 Run: #16199 (attempt 1)

Playwright Test Results (oss - depot-ubuntu-latest-arm-16)

passed  11 passed

Details

stats  11 tests across 8 suites
duration  57.2 seconds
commit  d48bb63
info  🔄 Run: #16199 (attempt 1)

Playwright Test Results (private-cloud - depot-ubuntu-latest-16)

passed  2 passed

Details

stats  2 tests across 2 suites
duration  47.7 seconds
commit  d48bb63
info  🔄 Run: #16199 (attempt 1)

Playwright Test Results (private-cloud - depot-ubuntu-latest-arm-16)

passed  1 passed

Details

stats  1 test across 1 suite
duration  1 minute, 6 seconds
commit  d48bb63
info  🔄 Run: #16199 (attempt 1)

Playwright Test Results (oss - depot-ubuntu-latest-16)

passed  11 passed

Details

stats  11 tests across 8 suites
duration  43.9 seconds
commit  d30adec
info  🔄 Run: #16200 (attempt 1)

Playwright Test Results (oss - depot-ubuntu-latest-arm-16)

passed  11 passed

Details

stats  11 tests across 8 suites
duration  53.6 seconds
commit  d30adec
info  🔄 Run: #16200 (attempt 1)

Playwright Test Results (private-cloud - depot-ubuntu-latest-16)

passed  2 passed

Details

stats  2 tests across 2 suites
duration  46.4 seconds
commit  d30adec
info  🔄 Run: #16200 (attempt 1)

Playwright Test Results (private-cloud - depot-ubuntu-latest-arm-16)

passed  1 passed

Details

stats  1 test across 1 suite
duration  1 minute, 13 seconds
commit  d30adec
info  🔄 Run: #16200 (attempt 1)

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 20, 2026

Visual Regression

16 screenshots compared. See report for details.
View full report

Move Monitoring and OpenTelemetry above Metrics and Events in the
Observability category — the walkthrough pages should come before the
references.

Flesh out the StatsD section in Monitoring with the env vars that
enable Gunicorn's built-in access log metrics, and cross-link it from
the Metrics page so readers looking for StatsD metrics find their way
there. Add a pointer from the OpenTelemetry logs section to the Events
reference.

beep boop
@github-actions github-actions bot added the docs Documentation updates label Apr 20, 2026
@github-actions github-actions bot added docs Documentation updates and removed feature New feature or request docs Documentation updates labels Apr 20, 2026
Switch back from the PR branch pin now that Flagsmith/flagsmith-common#210
(pure-data docgen templates) has been released.

beep boop
@github-actions github-actions bot added docs Documentation updates and removed docs Documentation updates labels Apr 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api Issue related to the REST API docs Documentation updates

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant