Skip to content

docs(OTel): Add backend event catalogue#7286

Merged
emyller merged 12 commits intomainfrom
feat/otel-events-catalogue
Apr 21, 2026
Merged

docs(OTel): Add backend event catalogue#7286
emyller merged 12 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 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.

@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 17, 2026

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

Project Deployment Actions Updated (UTC)
docs Ready Ready Preview, Comment Apr 21, 2026 2:35pm
2 Skipped Deployments
Project Deployment Actions Updated (UTC)
flagsmith-frontend-preview Ignored Ignored Preview Apr 21, 2026 2:35pm
flagsmith-frontend-staging Ignored Ignored Preview Apr 21, 2026 2:35pm

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 (0c96217) to head (69ebd2a).
⚠️ Report is 3 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #7286   +/-   ##
=======================================
  Coverage   98.37%   98.37%           
=======================================
  Files        1366     1366           
  Lines       51215    51215           
=======================================
  Hits        50384    50384           
  Misses        831      831           

☔ 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.

@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
@github-actions github-actions Bot added feature New feature or request docs Documentation updates and removed feature New feature or request docs Documentation updates labels 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 docs Documentation updates and removed docs Documentation updates labels Apr 20, 2026
Copy link
Copy Markdown
Contributor

@emyller emyller left a comment

Choose a reason for hiding this comment

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

The outcome of this is great.

  1. Minor non-blocking comments on making wording more consistent.
  2. I see several attributes in the event catalogue that could be improved, e.g. environment_id to environment.id, segments.serializers.segment_revision_created to segments.segment_revision_created, etc, but I'm not sure this is the right pull request to address these?

Otherwise LGTM!

Comment thread api/README.md Outdated
Comment thread docs/docs/deployment-self-hosting/observability/events.mdx Outdated
Comment thread docs/docs/deployment-self-hosting/observability/metrics.mdx Outdated
Comment thread CODEOWNERS Outdated
@khvn26 khvn26 requested a review from emyller April 21, 2026 14:14
@khvn26
Copy link
Copy Markdown
Member Author

khvn26 commented Apr 21, 2026

but I'm not sure this is the right pull request to address these?

Yup we'll fix them as needed.

@github-actions github-actions Bot added docs Documentation updates and removed docs Documentation updates labels Apr 21, 2026
khvn26 and others added 12 commits April 21, 2026 15:33
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
Switch back from the branch pin now that the docgen events subcommand
is released.

beep boop
3.8.1 normalises legacy kebab-case event names to snake_case in the
catalogue.

beep boop
…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
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
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
Switch back from the PR branch pin now that Flagsmith/flagsmith-common#210
(pure-data docgen templates) has been released.

beep boop
Co-authored-by: Evandro Myller <22429+emyller@users.noreply.github.com>
@khvn26 khvn26 force-pushed the feat/otel-events-catalogue branch from fbcd069 to 69ebd2a Compare April 21, 2026 14:35
@github-actions github-actions Bot added docs Documentation updates and removed docs Documentation updates labels Apr 21, 2026
@emyller emyller merged commit ec95aef into main Apr 21, 2026
37 of 40 checks passed
@emyller emyller deleted the feat/otel-events-catalogue branch April 21, 2026 15:04
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.

OTel: Scaffold a backend event catalogue

2 participants