From 4cee5266249e354441cfd052a831f5a7b31103ed Mon Sep 17 00:00:00 2001 From: Kim Gustyr Date: Mon, 20 Apr 2026 17:22:42 +0100 Subject: [PATCH] refactor: Strip site-specific framing from docgen templates MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Consumers of `flagsmith docgen {events,metrics}` previously got a page with a hard-coded Flagsmith-shaped header — frontmatter, intro prose, and a section heading. The opentelemetry link in the events header turned out to be a relative URL that only resolved correctly when the events page happened to live where the library author put it; moves in the consumer's docs tree silently broke it. Strip both templates to pure data (just the event / metric entries), letting consumers own the page header via their own MDX or a concat step. Regenerate snapshots. BREAKING CHANGE: consumers of `docgen events` / `docgen metrics` must now supply their own page header (frontmatter + intro) when wiring the output into their docs site. beep boop --- src/common/core/templates/docgen-events.md | 11 ----------- src/common/core/templates/docgen-metrics.md | 14 -------------- .../test_docgen__events__runs_expected.txt | 11 ----------- .../test_docgen__metrics__runs_expected.txt | 14 -------------- 4 files changed, 50 deletions(-) diff --git a/src/common/core/templates/docgen-events.md b/src/common/core/templates/docgen-events.md index 54acc31..d84cdce 100644 --- a/src/common/core/templates/docgen-events.md +++ b/src/common/core/templates/docgen-events.md @@ -1,14 +1,3 @@ ---- -title: Events -sidebar_label: Events -sidebar_position: 30 ---- - -Flagsmith backend emits [OpenTelemetry events](https://opentelemetry.io/docs/specs/otel/logs/data-model/#events) -that can be ingested to downstream observability systems and/or a data warehouse of your choice via OTLP. -To learn how to configure this, see [OpenTelemetry](deployment-self-hosting/scaling-and-performance/opentelemetry). - -## Event catalogue {% for event in flagsmith_events %} ### `{{ event.name }}` diff --git a/src/common/core/templates/docgen-metrics.md b/src/common/core/templates/docgen-metrics.md index 17f6b19..dd6fc29 100644 --- a/src/common/core/templates/docgen-metrics.md +++ b/src/common/core/templates/docgen-metrics.md @@ -1,17 +1,3 @@ ---- -title: Metrics -sidebar_label: Metrics -sidebar_position: 20 ---- - -## Prometheus - -To enable the Prometheus `/metrics` endpoint, set the `PROMETHEUS_ENABLED` environment variable to `true`. - -When enabled, Flagsmith serves the `/metrics` endpoint on port 9100. - -The metrics provided by Flagsmith are described below. - {% for metric in flagsmith_metrics %} ### `{{ metric.name }}` diff --git a/tests/integration/core/snapshots/test_docgen__events__runs_expected.txt b/tests/integration/core/snapshots/test_docgen__events__runs_expected.txt index 0db01cd..870bf62 100644 --- a/tests/integration/core/snapshots/test_docgen__events__runs_expected.txt +++ b/tests/integration/core/snapshots/test_docgen__events__runs_expected.txt @@ -1,14 +1,3 @@ ---- -title: Events -sidebar_label: Events -sidebar_position: 30 ---- - -Flagsmith backend emits [OpenTelemetry events](https://opentelemetry.io/docs/specs/otel/logs/data-model/#events) -that can be ingested to downstream observability systems and/or a data warehouse of your choice via OTLP. -To learn how to configure this, see [OpenTelemetry](deployment-self-hosting/scaling-and-performance/opentelemetry). - -## Event catalogue ### `code_references.scan.created` diff --git a/tests/integration/core/snapshots/test_docgen__metrics__runs_expected.txt b/tests/integration/core/snapshots/test_docgen__metrics__runs_expected.txt index fbb3f89..44f6b6b 100644 --- a/tests/integration/core/snapshots/test_docgen__metrics__runs_expected.txt +++ b/tests/integration/core/snapshots/test_docgen__metrics__runs_expected.txt @@ -1,17 +1,3 @@ ---- -title: Metrics -sidebar_label: Metrics -sidebar_position: 20 ---- - -## Prometheus - -To enable the Prometheus `/metrics` endpoint, set the `PROMETHEUS_ENABLED` environment variable to `true`. - -When enabled, Flagsmith serves the `/metrics` endpoint on port 9100. - -The metrics provided by Flagsmith are described below. - ### `flagsmith_build_info`