Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

feat(apm): add application observability services list behind the product flag (#118842)

Daniel Visca0f631dba69b2
diff --git a/frontend/src/layout/panel-layout/sidebarProductMeta.ts b/frontend/src/layout/panel-layout/sidebarProductMeta.ts
index 4129d5ee4af8..405a0d74f426 100644
--- a/frontend/src/layout/panel-layout/sidebarProductMeta.ts
+++ b/frontend/src/layout/panel-layout/sidebarProductMeta.ts
@@ -65,6 +65,7 @@ const descriptions: Record<string, string> = {
* Every other sidebar product must have one — `sidebarProductMeta.test.ts` fails when a new product has neither.
*/
export const SIDEBAR_PRODUCTS_WITHOUT_DOCS = new Set<string>([
+ 'Application observability',
'Apps',
'Autoresearch',
'Broadcasts',
diff --git a/frontend/src/lib/constants.tsx b/frontend/src/lib/constants.tsx
index 135b31886d49..1bee0f8a750b 100644
--- a/frontend/src/lib/constants.tsx
+++ b/frontend/src/lib/constants.tsx
@@ -261,6 +261,7 @@ export const FEATURE_FLAGS = {
ALERTS_LLM_DETECTOR: 'alerts-llm-detector', // owner: #team-analytics-platform, gates the AI anomaly detector for insight alerts
AMPLITUDE_BATCH_IMPORT_OPTIONS: 'amplitude-batch-import-options', // owner: #team-ingestion
ANOMALY_ALERT_GUIDANCE_EXPERIMENT: 'anomaly-alert-guidance',
+ APPLICATION_OBSERVABILITY: 'unified-apm-product', // owner: #team-apm — gates the Application observability scene, nav entry, and services API; the backend reads the same key
APPROVALS: 'approvals', // owner: @yasen-posthog #team-platform-features
APPROVALS_SCOPE_BY_FLAG_OWNER: 'approvals-scope-by-flag-owner', // owner: @yasen-posthog #team-platform-features, scopes approval policies by the product that owns the flag
AUTORESEARCH: 'autoresearch', // owner: @andrewm4894 #team-platform-features
diff --git a/frontend/src/productScenes.tsx b/frontend/src/productScenes.tsx
index 1c47525f73d5..49d5139eff3d 100644
--- a/frontend/src/productScenes.tsx
+++ b/frontend/src/productScenes.tsx
@@ -49,6 +49,7 @@ export const productScenes: Record<string, () => Promise<any>> = {
PlatformAlert: () => import('../../products/alerts_platform/frontend/PlatformAlertScene'),
PrecomputeDebug: () => import('../../products/analytics_platform/frontend/PrecomputeDebugScene'),
Annotations: () => import('../../products/annotations/frontend/pages/Annotations'),
+ ApplicationObservability: () => import('../../products/apm/frontend/ApplicationObservabilityScene'),
Autoresearch: () => import('../../products/autoresearch/frontend/AutoresearchScene'),
AutoresearchNew: () => import('../../products/autoresearch/frontend/AutoresearchNewScene'),
AutoresearchPipeline: () => import('../../products/autoresearch/frontend/AutoresearchPipelineScene'),
diff --git a/frontend/src/products.json b/frontend/src/products.json
index a1fb76cb42a8..f0e80a505b04 100644
--- a/frontend/src/products.json
+++ b/frontend/src/products.json
@@ -42,6 +42,13 @@
"type": "llm_prompts",
"intents": ["llm_prompts"]
},
+ {
+ "path": "Application observability",
+ "category": "Monitoring",
+ "iconType": null,
+ "type": null,
+ "intents": ["tracing"]
+ },
{
"path": "Autoresearch",
"category": "Tools",
diff --git a/frontend/src/products.tsx b/frontend/src/products.tsx
index 937488473707..7323ce8fcebb 100644
--- a/frontend/src/products.tsx
+++ b/frontend/src/products.tsx
@@ -116,6 +116,7 @@ export const productRoutes: Record<string, [string, string]> = {
'/debug/precompute': ['PrecomputeDebug', 'precomputeDebug'],
'/data-management/annotations': ['Annotations', 'annotations'],
'/data-management/annotations/:id': ['Annotations', 'annotation'],
+ '/application-observability': ['ApplicationObservability', 'applicationObservability'],
'/autoresearch': ['Autoresearch', 'autoresearch'],
'/autoresearch/new': ['AutoresearchNew', 'autoresearchNew'],
'/autoresearch/:id': ['AutoresearchPipeline', 'autoresearchPipeline'],
@@ -744,6 +745,14 @@ export const productConfiguration: Record<string, any> = {
'Annotations allow you to mark when certain changes happened so you can easily see how they impacted your metrics.',
iconType: 'annotation',
},
+ ApplicationObservability: {
+ name: 'Application observability',
+ projectBased: true,
+ layout: 'app-container',
+ activityScope: 'Tracing',
+ description: 'Whether your application is OK, one row per service, from the signals you already send.',
+ iconType: 'tracing',
+ },
Autoresearch: {
name: 'Autoresearch',
projectBased: true,
@@ -1424,6 +1433,7 @@ export const productUrls = {
precomputeDebug: (): string => `/debug/precompute`,
annotations: (): string => '/data-management/annotations',
annotation: (id: AnnotationType['id'] | ':id'): string => `/data-management/annotations/${id}`,
+ applicationObservability: (): string => '/application-observability',
autoresearch: (): string => '/autoresearch',
autoresearchNew: (): string => '/autoresearch/new',
autoresearchPipeline: (id: string): string => `/autoresearch/${id}`,
@@ -2337,6 +2347,7 @@ export const getTreeItemsNew = (): FileSystemImport[] => [
/** This const is auto-generated, as is the whole file */
export type ProductTreePath =
+ | 'Application observability'
| 'Apps'
| 'Autoresearch'
| 'Broadcasts'
@@ -2389,6 +2400,17 @@ export type ProductTreePath =
/** This const is auto-generated, as is the whole file */
export const getTreeItemsProducts = (): FileSystemImport[] => [
+ {
+ path: 'Application observability',
+ intents: [ProductKey.TRACING],
+ category: ProductItemCategory.MONITORING,
+ iconType: 'tracing' as FileSystemIconType,
+ iconColor: ['var(--color-product-tracing-light)', 'var(--color-product-tracing-dark)'] as FileSystemIconColor,
+ href: '/application-observability',
+ flag: FEATURE_FLAGS.APPLICATION_OBSERVABILITY,
+ sceneKey: 'ApplicationObservability',
+ sceneKeys: ['ApplicationObservability'],
+ },
{
path: 'Apps',
intents: [ProductKey.STREAMLIT_APPS],
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index da82fd11a018..697c7316664a 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -2663,7 +2663,30 @@ importers:
specifier: 'catalog:'
version: 0.2.4([email protected](patch_hash=139b8d1f1304f9d9da452a9a1244c94ea679dbcb85687d8999563146879fb6f5)([email protected]))
- products/apm: {}
+ products/apm:
+ dependencies:
+ '@posthog/icons':
+ specifier: 'catalog:'
+ '@types/react':
+ specifier: 18.3.27
+ version: 18.3.27
+ kea:
+ specifier: 'catalog:'
+ version: 4.0.0-pre.6(patch_hash=139b8d1f1304f9d9da452a9a1244c94ea679dbcb85687d8999563146879fb6f5)([email protected])
+ kea-loaders:
+ specifier: 'catalog:'
+ version: 3.1.1([email protected](patch_hash=139b8d1f1304f9d9da452a9a1244c94ea679dbcb85687d8999563146879fb6f5)([email protected]))
+ kea-router:
+ specifier: 'catalog:'
+ version: 3.4.2([email protected](patch_hash=139b8d1f1304f9d9da452a9a1244c94ea679dbcb85687d8999563146879fb6f5)([email protected]))
+ react:
+ specifier: 18.3.1
+ version: 18.3.1
+ devDependencies:
+ kea-test-utils:
+ specifier: 'catalog:'
+ version: 0.2.4([email protected](patch_hash=139b8d1f1304f9d9da452a9a1244c94ea679dbcb85687d8999563146879fb6f5)([email protected]))
products/approvals: {}
diff --git a/posthog/test/repo_invariants/test_pagination_contract.py b/posthog/test/repo_invariants/test_pagination_contract.py
index f1d300ebe1a2..3cca89972906 100644
--- a/posthog/test/repo_invariants/test_pagination_contract.py
+++ b/posthog/test/repo_invariants/test_pagination_contract.py
@@ -28,6 +28,8 @@ LIST_VIEWSETS_WITHOUT_DIRECT_SHARED_PAGINATION = {
EXISTING_CUSTOM_LIST_VIEWSETS = {
"products.aeo.backend.presentation.views.AEOPromptViewSet",
+ # Returns one bounded object (capped at SERVICES_LIMIT services), not a page of rows.
+ "products.apm.backend.presentation.views.ServicesHealthViewSet",
"ee.api.billing.BillingViewset",
"ee.api.quota_limits.QuotaLimitsViewSet",
"products.subscriptions.backend.presentation.views.SubscriptionDeliveryViewSet",
diff --git a/products/apm/backend/facade/api.py b/products/apm/backend/facade/api.py
index 51bbd1210bfe..9b7effad2529 100644
--- a/products/apm/backend/facade/api.py
+++ b/products/apm/backend/facade/api.py
@@ -12,6 +12,8 @@ infra-free by contract: everything re-exported here is a pure function or a
frozen dataclass over counts.
"""
+from typing import TYPE_CHECKING
+
from products.apm.backend.feature_flags import is_apm_enabled
from products.apm.backend.logic.anomaly_detection.bands import NegativeBinomialBandModel
from products.apm.backend.logic.anomaly_detection.baseline import TimeGrid, candidate_slice_pad_buckets
@@ -42,8 +44,25 @@ from products.apm.backend.logic.anomaly_detection.types import (
TrafficTier,
VerdictType,
)
+from products.apm.backend.logic.health.contract import HealthRow, HealthStatus, ServiceHealth, rank_services, status_of
+from products.apm.backend.logic.health.sources import (
+ ServicesHealthResult,
+ list_services_health as _list_services_health,
+)
+
+if TYPE_CHECKING:
+ from datetime import datetime
+
+ from posthog.models import Team
__all__ = [
+ "HealthRow",
+ "HealthStatus",
+ "ServiceHealth",
+ "ServicesHealthResult",
+ "list_services_health",
+ "rank_services",
+ "status_of",
"BUCKET_MINUTES",
"BUCKETS_PER_DAY",
"BUCKETS_PER_WEEK",
@@ -72,3 +91,13 @@ __all__ = [
"required_consecutive",
"traffic_tier",
]
+
+
+def list_services_health(
+ *, team: "Team", date_from: "datetime", date_to: "datetime", environment: str
+) -> ServicesHealthResult:
+ """One health row per service in the environment and window, worst first.
+
+ Pure contracts out: the presentation layer serializes `ServicesHealthResult` without touching logic.
+ """
+ return _list_services_health(team=team, date_from=date_from, date_to=date_to, environment=environment)
diff --git a/products/apm/backend/logic/health/__init__.py b/products/apm/backend/logic/health/__init__.py
new file mode 100644
index 000000000000..e69de29bb2d1
diff --git a/products/apm/backend/logic/health/contract.py b/products/apm/backend/logic/health/contract.py
new file mode 100644
index 000000000000..240c11fb6960
--- /dev/null
+++ b/products/apm/backend/logic/health/contract.py
@@ -0,0 +1,58 @@
+"""The health contract: one row per service that every Application Observability surface renders.
+
+Status today comes from the error-rate band alone. The detector verdict, SLOs, and lag join this
+row in later slices and take precedence over the band when they are present; the thresholds here
+match the prototype so the two implementations stay in step.
+"""
+
+from dataclasses import dataclass, replace
+
+from posthog.enums import LabeledStrEnum
+
+WARNING_ERROR_RATE = 0.01
+SERIOUS_ERROR_RATE = 0.05
+
+_STATUS_RANK = {"critical": 0, "serious": 1, "warning": 2, "good": 3}
+
+
+class HealthStatus(LabeledStrEnum):
+ GOOD = "good"
+ WARNING = "warning"
+ SERIOUS = "serious"
+ CRITICAL = "critical"
+
+
+@dataclass(frozen=True)
+class HealthRow:
+ request_rate: float | None
+ error_rate: float | None
+ p95_ms: float | None
+ span_count: int
+ error_count: int
+
+
+@dataclass(frozen=True)
+class ServiceHealth:
+ service_name: str
+ environment: str
+ health: HealthRow
+ status: HealthStatus = HealthStatus.GOOD
+ sparkline: tuple[int, ...] = ()
+
+
+def status_of(health: HealthRow) -> HealthStatus:
+ rate = health.error_rate or 0.0
+ if rate >= SERIOUS_ERROR_RATE:
+ return HealthStatus.SERIOUS
+ if rate >= WARNING_ERROR_RATE:
+ return HealthStatus.WARNING
+ return HealthStatus.GOOD
+
+
+def rank_services(rows: list[ServiceHealth]) -> list[ServiceHealth]:
+ """Worst status first, then the higher error rate, then the name, with the status filled in."""
+ scored = [replace(row, status=status_of(row.health)) for row in rows]
+ return sorted(
+ scored,
+ key=lambda row: (_STATUS_RANK[row.status], -(row.health.error_rate or 0.0), row.service_name),
+ )
diff --git a/products/apm/backend/logic/health/sources.py b/products/apm/backend/logic/health/sources.py
new file mode 100644
index 000000000000..2e87366dcb25
--- /dev/null
+++ b/products/apm/backend/logic/health/sources.py
@@ -0,0 +1,178 @@
+"""Reads the health row for every service in a window from the spans table.
+
+A service's request rate comes from its server spans. A service that emits no server spans, which
+is every consumer and worker in practice, falls back to its root spans so it still gets a row.
+The environment is the first non-empty resource attribute in the resolution order below, with the
+cluster name as the last fallback and `default` when nothing is set.
+"""
+
+from dataclasses import dataclass
+from datetime import datetime
+
+from posthog.hogql import ast
+from posthog.hogql.constants import HogQLGlobalSettings
+from posthog.hogql.parser import parse_expr, parse_select
+from posthog.hogql.query import execute_hogql_query
+
+from posthog.clickhouse.client.connection import Workload
+from posthog.models import Team
+
+from products.apm.backend.logic.health.contract import HealthRow, ServiceHealth, rank_services
+
+SPARKLINE_POINTS = 24
+SERVICES_LIMIT = 500
+DEFAULT_ENVIRONMENT = "default"
+
+ENVIRONMENT_ATTRIBUTES = (
+ "deployment.environment.name",
+ "deployment.environment",
+ "env",
+ "k8s.cluster.name",
+)
+
+# Mirrors products/tracing/backend/logic.py's TIME_BUCKET_DATE_RANGE_WHERE: time_bucket is a
+# materialized, coarse truncation of timestamp and leads trace_spans' primary key, so a day-bound
+# predicate on it adds no rows but lets ClickHouse prune parts instead of scanning every part the
+# team has. Pinned to UTC so a non-UTC day boundary can't drop same-day rows.
+_TIME_BUCKET_DATE_RANGE_WHERE = (
+ "toStartOfDay(time_bucket, 'UTC') >= toStartOfDay({date_from}, 'UTC') "
+ "AND toStartOfDay(time_bucket, 'UTC') <= toStartOfDay({date_to}, 'UTC')"
+)
+
+
+@dataclass(frozen=True)
+class ServicesHealthResult:
+ services: list[ServiceHealth]
+ environments: list[str]
+
+
+def environment_expr() -> ast.Expr:
+ parts = ", ".join(f"nullIf(resource_attributes['{key}'], '')" for key in ENVIRONMENT_ATTRIBUTES)
+ return parse_expr(
+ f"coalesce({parts}, {{default}})", placeholders={"default": ast.Constant(value=DEFAULT_ENVIRONMENT)}
+ )
+
+
+def _window_where(date_from: datetime, date_to: datetime) -> ast.Expr:
+ return parse_expr(
+ f"timestamp >= {{date_from}} AND timestamp < {{date_to}} AND {_TIME_BUCKET_DATE_RANGE_WHERE}",
+ placeholders={"date_from": ast.Constant(value=date_from), "date_to": ast.Constant(value=date_to)},
+ )
+
+
+def _services_query(date_from: datetime, date_to: datetime, environment: str) -> ast.SelectQuery:
+ # Server spans are the request count. Root spans are the fallback for services with none, so a
+ # consumer's client spans count once each rather than once per downstream call.
+ #
+ # A team with more services than SERVICES_LIMIT needs the worst ones to survive the cutoff, so
+ # the ranking (error rate, then error count, then name — the same order rank_services applies)
+ # runs in SQL before LIMIT, not after. The HAVING also drops services with no counted spans,
+ # which would otherwise waste a LIMIT slot ahead of a service that actually has traffic.
+ query = parse_select(
+ """
+ SELECT
+ service_name,
+ countIf(kind = 2) AS server_spans,
+ if(countIf(kind = 2) > 0, countIf(kind = 2), countIf(is_root_span)) AS span_count,
+ if(countIf(kind = 2) > 0, countIf(kind = 2 AND status_code = 2), countIf(is_root_span AND status_code = 2)) AS error_count,
+ if(countIf(kind = 2) > 0,
+ quantileIf(0.95)(duration_nano, kind = 2),
+ quantileIf(0.95)(duration_nano, is_root_span)) / 1e6 AS p95_ms
+ FROM posthog.trace_spans
+ WHERE {where} AND {env_expr} = {environment}
+ GROUP BY service_name
+ HAVING span_count > 0
+ ORDER BY error_count / span_count DESC, error_count DESC, service_name
+ LIMIT {limit}
+ """,
+ placeholders={
+ "where": _window_where(date_from, date_to),
+ "env_expr": environment_expr(),
+ "environment": ast.Constant(value=environment),
+ "limit": ast.Constant(value=SERVICES_LIMIT),
+ },
+ )
+ assert isinstance(query, ast.SelectQuery)
+ return query
+
+
+def _sparkline_query(date_from: datetime, date_to: datetime, environment: str) -> ast.SelectQuery:
+ # One bucket per point across the window; the client draws the counts in order.
+ query = parse_select(
+ """
+ SELECT
+ service_name,
+ toInt(floor(dateDiff('second', {date_from}, timestamp) / {bucket_seconds})) AS bucket,
+ countIf(kind = 2) AS server_spans,
+ countIf(is_root_span) AS root_spans
+ FROM posthog.trace_spans
+ WHERE {where} AND {env_expr} = {environment}
+ GROUP BY service_name, bucket
+ ORDER BY service_name, bucket
+ LIMIT 100000
+ """,
+ placeholders={
+ "date_from": ast.Constant(value=date_from),
+ "bucket_seconds": ast.Constant(
+ value=max(1, int((date_to - date_from).total_seconds() // SPARKLINE_POINTS))
+ ),
+ "where": _window_where(date_from, date_to),
+ "env_expr": environment_expr(),
+ "environment": ast.Constant(value=environment),
+ },
+ )
+ assert isinstance(query, ast.SelectQuery)
+ return query
+
+
+def _environments_query(date_from: datetime, date_to: datetime) -> ast.SelectQuery:
+ query = parse_select(
+ "SELECT {env_expr} AS environment FROM posthog.trace_spans WHERE {where} GROUP BY environment ORDER BY environment LIMIT 50",
+ placeholders={"env_expr": environment_expr(), "where": _window_where(date_from, date_to)},
+ )
+ assert isinstance(query, ast.SelectQuery)
+ return query
+
+
+def _run(team: Team, query: ast.SelectQuery) -> list:
+ return execute_hogql_query(
+ query_type="ApmServicesHealthQuery",
+ query=query,
+ team=team,
+ workload=Workload.LOGS,
+ settings=HogQLGlobalSettings(max_execution_time=30),
+ ).results
+
+
+def list_services_health(
+ *, team: Team, date_from: datetime, date_to: datetime, environment: str
+) -> ServicesHealthResult:
+ seconds = max(1.0, (date_to - date_from).total_seconds())
+ rows = _run(team, _services_query(date_from, date_to, environment))
+ sparklines: dict[str, list[int]] = {}
+ has_server: dict[str, bool] = {row[0]: row[1] > 0 for row in rows} # row[1] is server_spans
+ for service_name, bucket, server_spans, root_spans in _run(team, _sparkline_query(date_from, date_to, environment)):
+ points = sparklines.setdefault(service_name, [0] * SPARKLINE_POINTS)
+ if 0 <= bucket < SPARKLINE_POINTS:
+ points[bucket] += server_spans if has_server.get(service_name) else root_spans
+ services = []
+ for service_name, _server_spans, span_count, error_count, p95_ms in rows:
+ if not span_count:
+ continue
+ health = HealthRow(
+ request_rate=span_count / seconds,
+ error_rate=error_count / span_count,
+ p95_ms=float(p95_ms) if p95_ms is not None else None,
+ span_count=int(span_count),
+ error_count=int(error_count),
+ )
+ services.append(
+ ServiceHealth(
+ service_name=service_name,
+ environment=environment,
+ health=health,
+ sparkline=tuple(sparklines.get(service_name, [0] * SPARKLINE_POINTS)),
+ )
+ )
+ environments = [row[0] for row in _run(team, _environments_query(date_from, date_to))]
+ return ServicesHealthResult(services=rank_services(services), environments=environments)
diff --git a/products/apm/backend/presentation/serializers.py b/products/apm/backend/presentation/serializers.py
index eca8a315ca54..a1a312537dec 100644
--- a/products/apm/backend/presentation/serializers.py
+++ b/products/apm/backend/presentation/serializers.py
@@ -1 +1,46 @@
"""DRF serializers for apm."""
+
+from drf_spectacular.utils import extend_schema_serializer
+from rest_framework import serializers
+
+from products.apm.backend.facade.api import HealthStatus
+
+
+class ServicesHealthRequestSerializer(serializers.Serializer):
+ date_from = serializers.DateTimeField(
+ required=False, help_text="Start of the window, ISO 8601. Defaults to one hour before date_to."
+ )
+ date_to = serializers.DateTimeField(required=False, help_text="End of the window, ISO 8601. Defaults to now.")
+ environment = serializers.CharField(
+ required=False,
+ allow_blank=False,
+ max_length=200,
+ help_text="Environment to list, as resolved from span resource attributes. Defaults to 'default'.",
+ )
+
+
+class HealthRowSerializer(serializers.Serializer):
+ request_rate = serializers.FloatField(allow_null=True, help_text="Requests per second over the window.")
+ error_rate = serializers.FloatField(allow_null=True, help_text="Share of requests with an error status, 0 to 1.")
+ p95_ms = serializers.FloatField(allow_null=True, help_text="95th percentile request duration in milliseconds.")
+ span_count = serializers.IntegerField(help_text="Requests counted in the window.")
+ error_count = serializers.IntegerField(help_text="Requests with an error status in the window.")
+
+
+class ServiceHealthSerializer(serializers.Serializer):
+ service_name = serializers.CharField(help_text="The service.name resource attribute.")
+ environment = serializers.CharField(help_text="The environment the row was computed for.")
+ status = serializers.ChoiceField(choices=HealthStatus.choices, help_text="Health band from the error rate.")
+ health = HealthRowSerializer(help_text="The health row every surface renders.")
+ sparkline = serializers.ListField(
+ child=serializers.IntegerField(), help_text="Request counts per bucket across the window, oldest first."
+ )
+
+
+@extend_schema_serializer(many=False) # drf-spectacular wraps a `list` action's response in an array by default
+class ServicesHealthResponseSerializer(serializers.Serializer):
+ results = ServiceHealthSerializer(many=True, help_text="One row per service, worst status first.")
+ environments = serializers.ListField(child=serializers.CharField(), help_text="Environments seen in the window.")
+ environment = serializers.CharField(help_text="The environment the rows were computed for.")
+ date_from = serializers.DateTimeField(help_text="Start of the window used.")
+ date_to = serializers.DateTimeField(help_text="End of the window used.")
diff --git a/products/apm/backend/presentation/views.py b/products/apm/backend/presentation/views.py
index 21a80e30fffb..9b09f8276bfa 100644
--- a/products/apm/backend/presentation/views.py
+++ b/products/apm/backend/presentation/views.py
@@ -4,3 +4,69 @@ DRF views for apm.
Validate JSON via serializers, call facade methods,
return serialized responses. No business logic here.
"""
+
+from dataclasses import asdict
+from datetime import timedelta
+
+from django.utils import timezone
+
+from drf_spectacular.utils import extend_schema
+from rest_framework import status, viewsets
+from rest_framework.exceptions import PermissionDenied
+from rest_framework.request import Request
+from rest_framework.response import Response
+
+from posthog.schema import ProductKey
+
+from posthog.api.routing import TeamAndOrgViewSetMixin
+from posthog.clickhouse.query_tagging import Feature, tag_queries
+
+from products.apm.backend.facade.api import is_apm_enabled, list_services_health
+from products.apm.backend.presentation.serializers import (
+ ServicesHealthRequestSerializer,
+ ServicesHealthResponseSerializer,
+)
+
+DEFAULT_WINDOW = timedelta(hours=1)
+MAX_WINDOW = timedelta(days=7)
+DEFAULT_ENVIRONMENT = "default"
+
+
+class ServicesHealthViewSet(TeamAndOrgViewSetMixin, viewsets.ViewSet):
+ """One health row per service in an environment and window, worst first.
+
+ Read-only, and dark for every team without the product flag: the flag gates the scene, the
+ nav entry, and this endpoint together.
+ """
+
+ scope_object = "tracing"
+
+ def _check_flag(self) -> None:
+ if not is_apm_enabled(self.team.pk):
+ raise PermissionDenied("Application observability is not enabled for this project.")
+
+ @extend_schema(parameters=[ServicesHealthRequestSerializer], responses={200: ServicesHealthResponseSerializer})
+ def list(self, request: Request, *args, **kwargs) -> Response:
+ self._check_flag()
+ tag_queries(product=ProductKey.TRACING, feature=Feature.QUERY)
+ params = ServicesHealthRequestSerializer(data=request.query_params)
+ params.is_valid(raise_exception=True)
+ date_to = params.validated_data.get("date_to") or timezone.now()
+ date_from = params.validated_data.get("date_from") or date_to - DEFAULT_WINDOW
+ if date_from >= date_to or date_to - date_from > MAX_WINDOW:
+ return Response(
+ {"detail": "date_from must precede date_to by at most 7 days."}, status=status.HTTP_400_BAD_REQUEST
+ )
+ environment = params.validated_data.get("environment") or DEFAULT_ENVIRONMENT
+
+ result = list_services_health(team=self.team, date_from=date_from, date_to=date_to, environment=environment)
+ payload = {
+ "results": [
+ {**asdict(row), "status": row.status.value, "sparkline": list(row.sparkline)} for row in result.services
+ ],
+ "environments": result.environments,
+ "environment": environment,
+ "date_from": date_from,
+ "date_to": date_to,
+ }
+ return Response(ServicesHealthResponseSerializer(payload).data, status=status.HTTP_200_OK)
diff --git a/products/apm/backend/routes.py b/products/apm/backend/routes.py
new file mode 100644
index 000000000000..72f8d698b34a
--- /dev/null
+++ b/products/apm/backend/routes.py
@@ -0,0 +1,7 @@
+from posthog.api.routing import RouterRegistry
+
+from products.apm.backend.presentation.views import ServicesHealthViewSet
+
+
+def register_routes(routers: RouterRegistry) -> None:
+ routers.projects.register(r"apm/services", ServicesHealthViewSet, "project_apm_services", ["team_id"])
diff --git a/products/apm/backend/tests/test_health_contract.py b/products/apm/backend/tests/test_health_contract.py
new file mode 100644
index 000000000000..8d9182956c1c
--- /dev/null
+++ b/products/apm/backend/tests/test_health_contract.py
@@ -0,0 +1,61 @@
+from django.test import SimpleTestCase
+
+from parameterized import parameterized
+
+from products.apm.backend.logic.health.contract import HealthRow, HealthStatus, ServiceHealth, rank_services, status_of
+
+
+def _row(
+ request_rate: float | None = 10.0,
+ error_rate: float | None = 0.0,
+ p95_ms: float | None = 100.0,
+ span_count: int = 600,
+ error_count: int = 0,
+) -> HealthRow:
+ return HealthRow(
+ request_rate=request_rate,
+ error_rate=error_rate,
+ p95_ms=p95_ms,
+ span_count=span_count,
+ error_count=error_count,
+ )
+
+
+class TestStatusOf(SimpleTestCase):
+ @parameterized.expand(
+ [
+ ("zero_errors", 0.0, HealthStatus.GOOD),
+ ("under_one_percent", 0.009, HealthStatus.GOOD),
+ ("one_percent", 0.01, HealthStatus.WARNING),
+ ("just_under_five", 0.049, HealthStatus.WARNING),
+ ("five_percent", 0.05, HealthStatus.SERIOUS),
+ ("most_fail", 0.6, HealthStatus.SERIOUS),
+ ]
+ )
+ def test_error_rate_bands(self, _name: str, error_rate: float, expected: HealthStatus) -> None:
+ self.assertEqual(status_of(_row(error_rate=error_rate)), expected)
+
+ def test_no_traffic_is_good(self) -> None:
+ self.assertEqual(status_of(_row(request_rate=0.0, error_rate=None, span_count=0)), HealthStatus.GOOD)
+
+
+class TestRankServices(SimpleTestCase):
+ def test_worst_status_first_then_error_rate_then_name(self) -> None:
+ rows = [
+ ServiceHealth(service_name="c", environment="prod", health=_row(error_rate=0.004)),
+ ServiceHealth(service_name="a", environment="prod", health=_row(error_rate=0.001)),
+ ServiceHealth(service_name="b", environment="prod", health=_row(error_rate=0.06)),
+ ServiceHealth(service_name="d", environment="prod", health=_row(error_rate=0.02)),
+ ]
+ self.assertEqual([r.service_name for r in rank_services(rows)], ["b", "d", "c", "a"])
+
+ def test_equal_rows_sort_by_name(self) -> None:
+ rows = [
+ ServiceHealth(service_name="web", environment="prod", health=_row()),
+ ServiceHealth(service_name="api", environment="prod", health=_row()),
+ ]
+ self.assertEqual([r.service_name for r in rank_services(rows)], ["api", "web"])
+
+ def test_status_is_attached_to_each_row(self) -> None:
+ ranked = rank_services([ServiceHealth(service_name="q", environment="prod", health=_row(error_rate=0.06))])
+ self.assertEqual(ranked[0].status, HealthStatus.SERIOUS)
diff --git a/products/apm/backend/tests/test_services_health_api.py b/products/apm/backend/tests/test_services_health_api.py
new file mode 100644
index 000000000000..0a2582525317
--- /dev/null
+++ b/products/apm/backend/tests/test_services_health_api.py
@@ -0,0 +1,215 @@
+import base64
+import datetime as dt
+
+from posthog.test.base import APIBaseTest, ClickhouseTestMixin
+from unittest.mock import patch
+
+from django.test import SimpleTestCase
+
+from drf_spectacular.generators import SchemaGenerator
+
+from posthog.clickhouse.client import sync_execute
+from posthog.clickhouse.traces.spans import TRACE_SPANS_DISTRIBUTED_TABLE_SQL, TRACE_SPANS_TABLE_SQL
+
+from products.apm.backend.logic.health.sources import SERVICES_LIMIT
+
+DATE_FROM = "2026-06-02T07:00:00Z"
+DATE_TO = "2026-06-02T09:00:00Z"
+FLAG_PATCH = "products.apm.backend.presentation.views.is_apm_enabled"
+
+
+def _b64(raw: bytes) -> str:
+ return base64.b64encode(raw).decode("ascii")
+
+
+class TestServicesHealthAPI(ClickhouseTestMixin, APIBaseTest):
+ """One row per service from server spans, worst first, behind the product flag."""
+
+ CLASS_DATA_LEVEL_SETUP = True
+
+ @classmethod
+ def _recreate_trace_spans_tables(cls) -> None:
+ # is_root_span ships via a separate logs-cluster migration, not the Python DDL.
+ sync_execute("DROP TABLE IF EXISTS trace_spans_distributed")
+ sync_execute("DROP TABLE IF EXISTS trace_spans")
+ sync_execute(TRACE_SPANS_TABLE_SQL())
+ sync_execute(
+ "ALTER TABLE trace_spans ADD COLUMN IF NOT EXISTS "
+ "is_root_span Bool MATERIALIZED (replaceAll(trimRight(parent_span_id, '='), 'A', '')) = ''"
+ )
+ sync_execute(TRACE_SPANS_DISTRIBUTED_TABLE_SQL())
+
+ @classmethod
+ def tearDownClass(cls):
+ sync_execute("DROP TABLE IF EXISTS trace_spans_distributed")
+ sync_execute("DROP TABLE IF EXISTS trace_spans")
+ sync_execute(TRACE_SPANS_TABLE_SQL())
+ sync_execute(TRACE_SPANS_DISTRIBUTED_TABLE_SQL())
+ super().tearDownClass()
+
+ @classmethod
+ def setUpTestData(cls):
+ super().setUpTestData()
+ cls._recreate_trace_spans_tables()
+ base = dt.datetime(2026, 6, 2, 8, 0, 0)
+ rows: list[str] = []
+ n = 0
+
+ def span(service: str, kind: int, status_code: int, ms: int, env: str = "", parent: str = "") -> None:
+ nonlocal n
+ n += 1
+ start = base + dt.timedelta(seconds=n)
+ attrs = f"map('deployment.environment.name', '{env}')" if env else "map()"
+ rows.append(
+ f"('019e8770-0000-0000-0000-{n:012d}', {cls.team.id}, '{_b64(n.to_bytes(16, 'big'))}', "
+ f"'{_b64(n.to_bytes(8, 'big'))}', '{parent}', 'op', {kind}, "
+ f"'{start.strftime('%Y-%m-%d %H:%M:%S.%f')}', "
+ f"'{(start + dt.timedelta(milliseconds=ms)).strftime('%Y-%m-%d %H:%M:%S.%f')}', "
+ f"'{start.strftime('%Y-%m-%d %H:%M:%S.%f')}', {status_code}, '{service}', {attrs})"
+ )
+
+ # web: 10 server spans, 1 error -> 10%, serious. Client spans must not count as requests.
+ for i in range(10):
+ span("web", 2, 2 if i == 0 else 0, 50 + i, env="prod")
+ span("web", 3, 2, 5, env="prod")
+ # api: 20 server spans, no errors -> good
+ for i in range(20):
+ span("api", 2, 0, 20 + i, env="prod")
+ # worker: no server spans; its root client spans carry the rate instead. 4 root spans, 1 error -> 25%
+ for i in range(4):
+ span("worker", 3, 2 if i == 0 else 0, 10, env="prod")
+ # a service in another environment must not appear for prod
+ for _ in range(3):
+ span("eu-only", 2, 0, 30, env="staging")
+
+ sync_execute(
+ "INSERT INTO trace_spans (uuid, team_id, trace_id, span_id, parent_span_id, name, kind, "
+ "timestamp, end_time, observed_timestamp, status_code, service_name, resource_attributes) VALUES "
+ + ",".join(rows)
+ )
+
+ def _list(self, **params) -> dict:
+ query = {"date_from": DATE_FROM, "date_to": DATE_TO, "environment": "prod", **params}
+ with patch(FLAG_PATCH, return_value=True):
+ response = self.client.get(f"/api/projects/{self.team.id}/apm/services/", query)
+ self.assertEqual(response.status_code, 200, response.content)
+ return response.json()
+
+ def test_one_row_per_service_worst_first(self) -> None:
+ data = self._list()
+ names = [r["service_name"] for r in data["results"]]
+ self.assertEqual(names, ["worker", "web", "api"])
+ web = data["results"][1]
+ self.assertEqual(web["status"], "serious")
+ self.assertEqual(web["health"]["span_count"], 10)
+ self.assertEqual(web["health"]["error_count"], 1)
+ self.assertAlmostEqual(web["health"]["error_rate"], 0.1)
+ self.assertAlmostEqual(web["health"]["request_rate"], 10 / 7200, places=6)
+ self.assertGreaterEqual(web["health"]["p95_ms"], 50)
+ self.assertEqual(data["results"][2]["status"], "good")
+
+ def test_root_client_spans_count_when_a_service_has_no_server_spans(self) -> None:
+ worker = next(r for r in self._list()["results"] if r["service_name"] == "worker")
+ self.assertEqual(worker["health"]["span_count"], 4)
+ self.assertAlmostEqual(worker["health"]["error_rate"], 0.25)
+ self.assertEqual(worker["status"], "serious")
+
+ def test_environment_filters_and_is_listed(self) -> None:
+ data = self._list()
+ self.assertNotIn("eu-only", [r["service_name"] for r in data["results"]])
+ self.assertEqual(sorted(data["environments"]), ["prod", "staging"])
+ staging = self._list(environment="staging")
+ self.assertEqual([r["service_name"] for r in staging["results"]], ["eu-only"])
+
+ def test_each_row_carries_a_sparkline(self) -> None:
+ for row in self._list()["results"]:
+ self.assertEqual(len(row["sparkline"]), 24)
+ self.assertEqual(sum(row["sparkline"]), row["health"]["span_count"])
+
+ def test_limit_does_not_drop_a_failing_service_behind_healthy_ones_alphabetically(self) -> None:
+ # The SERVICES_LIMIT cutoff used to apply after an alphabetical ORDER BY, so a failing
+ # service sorting late in the alphabet could be cut before ranking ever saw it. Uses its
+ # own date window and environment so it doesn't perturb the other tests' exact-match
+ # assertions on `results`/`environments`.
+ date_from, date_to = "2026-06-03T07:00:00Z", "2026-06-03T09:00:00Z"
+ base = dt.datetime(2026, 6, 3, 8, 0, 0)
+ rows: list[str] = []
+ n = 0
+
+ def span(service: str, status_code: int) -> None:
+ nonlocal n
+ n += 1
+ start = base + dt.timedelta(microseconds=n)
+ ts = start.strftime("%Y-%m-%d %H:%M:%S.%f")
+ rows.append(
+ f"('019e8771-0000-0000-0000-{n:012d}', {self.team.id}, '{_b64(n.to_bytes(16, 'big'))}', "
+ f"'{_b64(n.to_bytes(8, 'big'))}', '', 'op', 2, '{ts}', '{ts}', '{ts}', {status_code}, "
+ f"'{service}', map('deployment.environment.name', 'ranked'))"
+ )
+
+ for i in range(SERVICES_LIMIT):
+ span(f"svc-{i:04d}", 0)
+ for _ in range(5):
+ span("zzz-failing", 2)
+
+ sync_execute(
+ "INSERT INTO trace_spans (uuid, team_id, trace_id, span_id, parent_span_id, name, kind, "
+ "timestamp, end_time, observed_timestamp, status_code, service_name, resource_attributes) VALUES "
+ + ",".join(rows)
+ )
+
+ data = self._list(date_from=date_from, date_to=date_to, environment="ranked")
+ names = [r["service_name"] for r in data["results"]]
+ self.assertIn("zzz-failing", names)
+
+ def test_defaults_to_the_last_hour_when_no_range_is_given(self) -> None:
+ with patch(FLAG_PATCH, return_value=True):
+ response = self.client.get(f"/api/projects/{self.team.id}/apm/services/")
+ self.assertEqual(response.status_code, 200, response.content)
+ self.assertEqual(response.json()["results"], [])
+
+ def test_403_when_the_flag_is_off(self) -> None:
+ with patch(FLAG_PATCH, return_value=False):
+ response = self.client.get(f"/api/projects/{self.team.id}/apm/services/")
+ self.assertEqual(response.status_code, 403)
+
+ def test_unauthenticated_is_rejected(self) -> None:
+ self.client.logout()
+ response = self.client.get(f"/api/projects/{self.team.id}/apm/services/")
+ self.assertEqual(response.status_code, 401)
+
+ def test_other_team_sees_nothing(self) -> None:
+ other = self.create_team_with_organization(organization=self.organization)
+ with patch(FLAG_PATCH, return_value=True):
+ response = self.client.get(
+ f"/api/projects/{other.id}/apm/services/",
+ {"date_from": DATE_FROM, "date_to": DATE_TO, "environment": "prod"},
+ )
+ self.assertEqual(response.status_code, 200, response.content)
+ self.assertEqual(response.json()["results"], [])
+
+ def test_queries_are_tagged_for_the_request_path(self) -> None:
+ # The test base pre-tags the connection, so only an explicit check catches a request path that
+ # forgets to tag and fails with UntaggedQueryError in a real server.
+ with (
+ patch(FLAG_PATCH, return_value=True),
+ patch("products.apm.backend.presentation.views.tag_queries") as tag,
+ ):
+ self.client.get(f"/api/projects/{self.team.id}/apm/services/")
+ tag.assert_called_once()
+ self.assertTrue(tag.call_args.kwargs.get("product"))
+ self.assertTrue(tag.call_args.kwargs.get("feature"))
+
+
+class TestServicesHealthOpenApiSchema(SimpleTestCase):
+ """The `list` action returns one object; drf-spectacular defaults a `list` action to an array response."""
+
+ def test_list_response_schema_is_a_single_object_not_an_array(self) -> None:
+ schema = SchemaGenerator().get_schema(request=None, public=True)
+ operation = schema["paths"]["/api/projects/{project_id}/apm/services/"]["get"]
+ response_schema = operation["responses"]["200"]["content"]["application/json"]["schema"]
+ self.assertNotEqual(
+ response_schema.get("type"),
+ "array",
+ f"GET .../apm/services/ must document a single object response. Got: {response_schema}",
+ )
diff --git a/products/apm/frontend/ApplicationObservabilityScene.tsx b/products/apm/frontend/ApplicationObservabilityScene.tsx
new file mode 100644
index 000000000000..2c9420249d87
--- /dev/null
+++ b/products/apm/frontend/ApplicationObservabilityScene.tsx
@@ -0,0 +1,206 @@
+import { useActions, useValues } from 'kea'
+
+import { LemonBanner, LemonSelect, LemonTable, LemonTableColumns, LemonTag, Link } from '@posthog/lemon-ui'
+
+import { SceneExport } from 'scenes/sceneTypes'
+import { urls } from 'scenes/urls'
+
+import { SceneContent } from '~/layout/scenes/components/SceneContent'
+import { SceneTitleSection } from '~/layout/scenes/components/SceneTitleSection'
+
+import {
+ TIME_RANGE_LABELS,
+ TimeRange,
+ applicationObservabilityLogic,
+ drillDownParams,
+} from './applicationObservabilityLogic'
+import type { HealthStatusEnumApi, ServiceHealthApi } from './generated/api.schemas'
+
+export const scene: SceneExport = {
+ component: ApplicationObservabilityScene,
+ logic: applicationObservabilityLogic,
+}
+
+const STATUS_LABEL: Record<HealthStatusEnumApi, string> = {
+ good: 'Healthy',
+ warning: 'Watch',
+ serious: 'Failing',
+ critical: 'Confirmed',
+}
+
+const STATUS_TAG: Record<HealthStatusEnumApi, 'success' | 'warning' | 'danger'> = {
+ good: 'success',
+ warning: 'warning',
+ serious: 'danger',
+ critical: 'danger',
+}
+
+export function formatRate(perSecond: number | null): string {
+ if (perSecond === null) {
+ return '—'
+ }
+ if (perSecond >= 1000) {
+ return `${(perSecond / 1000).toFixed(1)}k/s`
+ }
+ if (perSecond >= 10) {
+ return `${Math.round(perSecond)}/s`
+ }
+ if (perSecond >= 0.1) {
+ return `${perSecond.toFixed(1)}/s`
+ }
+ return `${(perSecond * 60).toFixed(1)}/min`
+}
+
+export function formatPercent(fraction: number | null): string {
+ if (fraction === null) {
+ return '—'
+ }
+ const pct = fraction * 100
+ return `${pct.toFixed(pct >= 10 ? 0 : pct >= 1 ? 1 : 2)}%`
+}
+
+export function formatMs(ms: number | null): string {
+ if (ms === null) {
+ return '—'
+ }
+ return ms >= 1000 ? `${(ms / 1000).toFixed(1)}s` : `${Math.round(ms)}ms`
+}
+
+function Sparkline({ values }: { values: number[] }): JSX.Element {
+ const width = 72
+ const height = 18
+ const max = Math.max(1, ...values)
+ const points = values
+ .map((value, index) => {
+ const x = (index / Math.max(1, values.length - 1)) * (width - 2) + 1
+ const y = height - 1 - (value / max) * (height - 2)
+ return `${x.toFixed(1)},${y.toFixed(1)}`
+ })
+ .join(' ')
+ return (
+ <svg width={width} height={height} viewBox={`0 0 ${width} ${height}`} aria-hidden="true" className="block">
+ <polyline points={points} fill="none" stroke="currentColor" strokeWidth={1.5} className="text-muted" />
+ </svg>
+ )
+}
+
+export function ApplicationObservabilityScene(): JSX.Element {
+ const {
+ services,
+ servicesHealthLoading,
+ hasLoadError,
+ environments,
+ resolvedEnvironment,
+ timeRange,
+ attentionCount,
+ } = useValues(applicationObservabilityLogic)
+ const { setEnvironment, setTimeRange } = useActions(applicationObservabilityLogic)
+
+ const columns: LemonTableColumns<ServiceHealthApi> = [
+ {
+ title: 'Service',
+ key: 'service_name',
+ render: (_, row) => <span className="font-semibold">{row.service_name}</span>,
+ },
+ {
+ title: 'Status',
+ key: 'status',
+ render: (_, row) => <LemonTag type={STATUS_TAG[row.status]}>{STATUS_LABEL[row.status]}</LemonTag>,
+ },
+ {
+ title: 'Requests',
+ key: 'request_rate',
+ align: 'right',
+ render: (_, row) => <span className="font-mono">{formatRate(row.health.request_rate)}</span>,
+ },
+ {
+ title: 'Errors',
+ key: 'error_rate',
+ align: 'right',
+ render: (_, row) => <span className="font-mono">{formatPercent(row.health.error_rate)}</span>,
+ },
+ {
+ title: 'p95',
+ key: 'p95_ms',
+ align: 'right',
+ render: (_, row) => <span className="font-mono">{formatMs(row.health.p95_ms)}</span>,
+ },
+ {
+ title: 'Trend',
+ key: 'sparkline',
+ render: (_, row) => <Sparkline values={row.sparkline} />,
+ },
+ {
+ title: 'Open in',
+ key: 'links',
+ render: (_, row) => (
+ <span className="flex gap-2">
+ <Link to={`${urls.tracing()}?${drillDownParams(row.service_name, timeRange)}`}>Traces</Link>
+ <Link to={`${urls.logs()}?${drillDownParams(row.service_name, timeRange)}`}>Logs</Link>
+ </span>
+ ),
+ },
+ ]
+
+ const attentionMessage =
+ attentionCount > 0
+ ? `${attentionCount} ${attentionCount === 1 ? 'service needs' : 'services need'} attention in ${resolvedEnvironment}`
+ : `All quiet in ${resolvedEnvironment}`
+
+ return (
+ <SceneContent>
+ <SceneTitleSection
+ name="Application observability"
+ description="One row per service, worst first, from the spans you already send."
+ resourceType={{ type: 'tracing' }}
+ />
+ <div className="flex flex-wrap items-center gap-2">
+ <LemonSelect
+ size="small"
+ value={resolvedEnvironment}
+ onChange={(value) => setEnvironment(value)}
+ options={(environments.length ? environments : [resolvedEnvironment]).map((env) => ({
+ value: env,
+ label: env,
+ }))}
+ data-attr="apm-environment"
+ />
+ <LemonSelect
+ size="small"
+ value={timeRange}
+ onChange={(value) => setTimeRange(value as TimeRange)}
+ options={(Object.keys(TIME_RANGE_LABELS) as TimeRange[]).map((value) => ({
+ value,
+ label: TIME_RANGE_LABELS[value],
+ }))}
+ data-attr="apm-time-range"
+ />
+ <span className="text-muted text-xs">Refreshes every 5 minutes</span>
+ </div>
+ {hasLoadError ? (
+ <LemonBanner type="error">
+ {services.length > 0
+ ? `Couldn't refresh service health for ${resolvedEnvironment}. Showing the last successful results.`
+ : `Couldn't load service health for ${resolvedEnvironment}. Try again shortly.`}
+ </LemonBanner>
+ ) : (
+ !servicesHealthLoading &&
+ services.length > 0 && (
+ <LemonBanner type={attentionCount > 0 ? 'warning' : 'success'}>{attentionMessage}</LemonBanner>
+ )
+ )}
+ <LemonTable
+ columns={columns}
+ dataSource={services}
+ rowKey="service_name"
+ loading={servicesHealthLoading}
+ emptyState={
+ hasLoadError
+ ? "Couldn't load service health. Check your connection and try again."
+ : 'No spans in this environment and time range. Send traces to see services here.'
+ }
+ data-attr="apm-services-table"
+ />
+ </SceneContent>
+ )
+}
diff --git a/products/apm/frontend/applicationObservabilityLogic.test.ts b/products/apm/frontend/applicationObservabilityLogic.test.ts
new file mode 100644
index 000000000000..b159e6bf729a
--- /dev/null
+++ b/products/apm/frontend/applicationObservabilityLogic.test.ts
@@ -0,0 +1,127 @@
+import { router } from 'kea-router'
+import { expectLogic } from 'kea-test-utils'
+
+import { parseTagsFilter } from 'lib/utils/url'
+
+import { useMocks } from '~/mocks/jest'
+import { initKeaTests } from '~/test/init'
+
+import {
+ APPLICATION_OBSERVABILITY_PATH,
+ applicationObservabilityLogic,
+ drillDownParams,
+} from './applicationObservabilityLogic'
+import type { ServicesHealthResponseApi } from './generated/api.schemas'
+
+const row = (service_name: string, status: 'good' | 'warning' | 'serious' | 'critical'): any => ({
+ service_name,
+ environment: 'prod',
+ status,
+ health: { request_rate: 1, error_rate: 0, p95_ms: 10, span_count: 1, error_count: 0 },
+ sparkline: [1],
+})
+
+const RESPONSE: ServicesHealthResponseApi = {
+ results: [row('queue', 'serious'), row('web', 'warning'), row('api', 'good')],
+ environments: ['prod', 'staging'],
+ environment: 'prod',
+ date_from: '2026-06-02T07:00:00Z',
+ date_to: '2026-06-02T08:00:00Z',
+}
+
+describe('applicationObservabilityLogic', () => {
+ let logic: ReturnType<typeof applicationObservabilityLogic.build>
+ let requests: string[]
+
+ beforeEach(async () => {
+ requests = []
+ useMocks({
+ get: {
+ '/api/projects/:team_id/apm/services/': ({ request }) => {
+ requests.push(new URL(request.url).search)
+ return [200, RESPONSE]
+ },
+ },
+ })
+ initKeaTests()
+ logic = applicationObservabilityLogic()
+ logic.mount()
+ await expectLogic(logic).toFinishAllListeners()
+ })
+
+ afterEach(() => {
+ logic.unmount()
+ })
+
+ it('counts the services that need attention from the loaded rows', async () => {
+ await expectLogic(logic).toDispatchActions(['loadServicesHealthSuccess'])
+ expect(logic.values.attentionCount).toBe(1)
+ expect(logic.values.environments).toEqual(['prod', 'staging'])
+ expect(logic.values.resolvedEnvironment).toBe('prod')
+ // Mounting with no URL params must load exactly once: a prior bug fired both the
+ // urlToAction initial sync and afterMount's own load.
+ expect(requests.length).toBe(1)
+ })
+
+ it('round-trips environment and range through the URL and reloads once per change', async () => {
+ await expectLogic(logic).toDispatchActions(['loadServicesHealthSuccess'])
+ const before = requests.length
+
+ router.actions.push(APPLICATION_OBSERVABILITY_PATH, { environment: 'staging', range: '-24h' })
+ await expectLogic(logic).toDispatchActions(['setEnvironment', 'setTimeRange', 'loadServicesHealthSuccess'])
+ expect(logic.values.environment).toBe('staging')
+ expect(logic.values.timeRange).toBe('-24h')
+ expect(requests.length).toBe(before + 1)
+ expect(requests[requests.length - 1]).toContain('environment=staging')
+
+ logic.actions.setTimeRange('-6h')
+ expect(router.values.searchParams).toMatchObject({ environment: 'staging', range: '-6h' })
+ })
+
+ it('reloads when a picker action fires directly, not only via a URL round-trip', async () => {
+ // Dispatching setEnvironment directly (as the scene's LemonSelect onChange does) used to
+ // skip the reload: by the time urlToAction re-read the URL it had already written, the
+ // values already matched and the `changed` guard stayed false.
+ await expectLogic(logic).toDispatchActions(['loadServicesHealthSuccess'])
+ const before = requests.length
+
+ logic.actions.setEnvironment('direct-pick')
+ await expectLogic(logic).toDispatchActions(['loadServicesHealthSuccess'])
+
+ expect(requests.length).toBe(before + 1)
+ })
+
+ it('tracks a refresh failure separately from the loaded data, so stale data is not reported as healthy', async () => {
+ await expectLogic(logic).toDispatchActions(['loadServicesHealthSuccess'])
+ expect(logic.values.hasLoadError).toBe(false)
+ expect(logic.values.services).toHaveLength(3)
+
+ useMocks({ get: { '/api/projects/:team_id/apm/services/': () => [500, { detail: 'boom' }] } })
+ logic.actions.loadServicesHealth()
+ await expectLogic(logic).toDispatchActions(['loadServicesHealthFailure'])
+
+ expect(logic.values.hasLoadError).toBe(true)
+ // The previous successful rows stay in `services` so the scene can show them as stale
+ // instead of losing them, which is what let a failed refresh render as "All quiet".
+ expect(logic.values.services).toHaveLength(3)
+ })
+
+ it('ignores an unknown range in the URL and keeps the default', async () => {
+ router.actions.push(APPLICATION_OBSERVABILITY_PATH, { range: 'yesterday' })
+ await expectLogic(logic).toFinishAllListeners()
+ expect(logic.values.timeRange).toBe('-1h')
+ })
+
+ it('ignores an inherited-property range value in the URL', async () => {
+ // `in` matches inherited Object.prototype keys like `toString`, so a naive `value in
+ // TIME_RANGE_LABELS` check would accept this and break TIME_RANGE_MS lookups.
+ router.actions.push(APPLICATION_OBSERVABILITY_PATH, { range: 'toString' })
+ await expectLogic(logic).toFinishAllListeners()
+ expect(logic.values.timeRange).toBe('-1h')
+ })
+
+ it('keeps a service name with a comma as one service in drill-down links', () => {
+ const params = new URLSearchParams(drillDownParams('checkout,v2', '-1h'))
+ expect(parseTagsFilter(params.get('serviceNames'))).toEqual(['checkout,v2'])
+ })
+})
diff --git a/products/apm/frontend/applicationObservabilityLogic.ts b/products/apm/frontend/applicationObservabilityLogic.ts
new file mode 100644
index 000000000000..bb94cb1ec9b1
--- /dev/null
+++ b/products/apm/frontend/applicationObservabilityLogic.ts
@@ -0,0 +1,219 @@
+import { MakeLogicType, actions, afterMount, connect, kea, listeners, path, reducers, selectors } from 'kea'
+import { loaders } from 'kea-loaders'
+import { actionToUrl, urlToAction } from 'kea-router'
+
+import { teamLogic } from 'scenes/teamLogic'
+
+import { apmServicesList } from './generated/api'
+import type { ServiceHealthApi, ServicesHealthResponseApi } from './generated/api.schemas'
+
+export const APPLICATION_OBSERVABILITY_PATH = '/application-observability'
+
+export type TimeRange = '-1h' | '-6h' | '-24h' | '-7d'
+
+export const TIME_RANGE_LABELS: Record<TimeRange, string> = {
+ '-1h': 'Last hour',
+ '-6h': 'Last 6 hours',
+ '-24h': 'Last 24 hours',
+ '-7d': 'Last 7 days',
+}
+
+const TIME_RANGE_MS: Record<TimeRange, number> = {
+ '-1h': 60 * 60 * 1000,
+ '-6h': 6 * 60 * 60 * 1000,
+ '-24h': 24 * 60 * 60 * 1000,
+ '-7d': 7 * 24 * 60 * 60 * 1000,
+}
+
+// One 5-minute bucket, the grain the backend computes health at.
+const POLL_INTERVAL_MS = 5 * 60 * 1000
+
+// Matches the Traces and Logs URL readers: `serviceNames` goes through parseTagsFilter, which splits a
+// plain string on commas, so it is a JSON array; `dateRange` is a JSON `{date_from, date_to}` object.
+export function drillDownParams(serviceName: string, timeRange: TimeRange): string {
+ const serviceNames = JSON.stringify([serviceName])
+ const dateRange = JSON.stringify({ date_from: timeRange, date_to: null })
+ return `serviceNames=${encodeURIComponent(serviceNames)}&dateRange=${encodeURIComponent(dateRange)}`
+}
+
+function isTimeRange(value: unknown): value is TimeRange {
+ // `in` also matches inherited keys like `toString`, so a `?range=toString` URL would pass.
+ return typeof value === 'string' && Object.hasOwn(TIME_RANGE_LABELS, value)
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface applicationObservabilityLogicValues {
+ currentTeamId: number | null // teamLogic
+ attentionCount: number
+ environment: string | null
+ environments: string[]
+ hasLoadError: boolean
+ resolvedEnvironment: string
+ services: ServiceHealthApi[]
+ servicesHealth: ServicesHealthResponseApi | null
+ servicesHealthLoading: boolean
+ timeRange: TimeRange
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface applicationObservabilityLogicActions {
+ loadServicesHealth: (_: void) => void
+ loadServicesHealthFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadServicesHealthSuccess: (
+ servicesHealth: ServicesHealthResponseApi,
+ payload?: void
+ ) => {
+ servicesHealth: ServicesHealthResponseApi
+ payload?: void
+ }
+ requestReload: () => {
+ value: true
+ }
+ setEnvironment: (environment: string | null) => {
+ environment: string | null
+ }
+ setTimeRange: (timeRange: TimeRange) => {
+ timeRange: TimeRange
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface applicationObservabilityLogicMeta {
+ __keaTypeGenInternalSelectorTypes: {
+ services: (servicesHealth: ServicesHealthResponseApi | null) => ServiceHealthApi[]
+ environments: (servicesHealth: ServicesHealthResponseApi | null) => string[]
+ resolvedEnvironment: (environment: string | null, servicesHealth: ServicesHealthResponseApi | null) => string
+ attentionCount: (services: ServiceHealthApi[]) => number
+ }
+}
+
+export type applicationObservabilityLogicType = MakeLogicType<
+ applicationObservabilityLogicValues,
+ applicationObservabilityLogicActions,
+ Record<string, any>,
+ applicationObservabilityLogicMeta
+>
+
+export const applicationObservabilityLogic = kea<applicationObservabilityLogicType>([
+ path(['products', 'apm', 'frontend', 'applicationObservabilityLogic']),
+ connect(() => ({ values: [teamLogic, ['currentTeamId']] })),
+
+ actions({
+ setEnvironment: (environment: string | null) => ({ environment }),
+ setTimeRange: (timeRange: TimeRange) => ({ timeRange }),
+ // Internal: coalesces the picker actions and the initial URL sync into a single reload.
+ requestReload: true,
+ }),
+
+ reducers({
+ environment: [null as string | null, { setEnvironment: (_, { environment }) => environment }],
+ timeRange: ['-1h' as TimeRange, { setTimeRange: (_, { timeRange }) => timeRange }],
+ // Tracks the *last* load's outcome so a refresh failure can be told apart from a
+ // genuinely empty result, and from a healthy result that's gone stale.
+ hasLoadError: [
+ false,
+ {
+ loadServicesHealthSuccess: () => false,
+ loadServicesHealthFailure: () => true,
+ },
+ ],
+ }),
+
+ loaders(({ values }) => ({
+ servicesHealth: [
+ null as ServicesHealthResponseApi | null,
+ {
+ loadServicesHealth: async (_: void, breakpoint): Promise<ServicesHealthResponseApi> => {
+ const dateTo = new Date()
+ const dateFrom = new Date(dateTo.getTime() - TIME_RANGE_MS[values.timeRange])
+ const response = await apmServicesList(String(values.currentTeamId), {
+ date_from: dateFrom.toISOString(),
+ date_to: dateTo.toISOString(),
+ ...(values.environment ? { environment: values.environment } : {}),
+ })
+ // A superseded call (environment/range changed again mid-flight) throws here
+ // instead of overwriting state with a stale response.
+ breakpoint()
+ return response
+ },
+ },
+ ],
+ })),
+
+ selectors({
+ services: [
+ (s) => [s.servicesHealth],
+ (servicesHealth: ServicesHealthResponseApi | null): ServiceHealthApi[] => servicesHealth?.results ?? [],
+ ],
+ environments: [
+ (s) => [s.servicesHealth],
+ (servicesHealth: ServicesHealthResponseApi | null): string[] => servicesHealth?.environments ?? [],
+ ],
+ resolvedEnvironment: [
+ (s) => [s.environment, s.servicesHealth],
+ (environment: string | null, servicesHealth: ServicesHealthResponseApi | null): string =>
+ environment ?? servicesHealth?.environment ?? 'default',
+ ],
+ attentionCount: [
+ (s) => [s.services],
+ (services: ServiceHealthApi[]): number =>
+ services.filter((row: ServiceHealthApi) => row.status === 'serious' || row.status === 'critical')
+ .length,
+ ],
+ }),
+
+ actionToUrl(({ values }) => {
+ const toUrl = (): [string, Record<string, string>] => [
+ APPLICATION_OBSERVABILITY_PATH,
+ {
+ ...(values.environment ? { environment: values.environment } : {}),
+ ...(values.timeRange !== '-1h' ? { range: values.timeRange } : {}),
+ },
+ ]
+ return { setEnvironment: toUrl, setTimeRange: toUrl }
+ }),
+
+ urlToAction(({ actions, values }) => ({
+ // Only forwards URL state into the picker reducers. The reload itself comes from
+ // `requestReload`'s listeners below, so a picker-driven change and a URL-driven change
+ // reload exactly once either way (see the `listeners` block).
+ [APPLICATION_OBSERVABILITY_PATH]: (_, searchParams) => {
+ const environment = typeof searchParams.environment === 'string' ? searchParams.environment : null
+ const range = isTimeRange(searchParams.range) ? searchParams.range : '-1h'
+ if (environment !== values.environment) {
+ actions.setEnvironment(environment)
+ }
+ if (range !== values.timeRange) {
+ actions.setTimeRange(range)
+ }
+ },
+ })),
+
+ listeners(({ actions, cache }) => ({
+ setEnvironment: () => actions.requestReload(),
+ setTimeRange: () => actions.requestReload(),
+ // Debounced with a replaceable timer: several `requestReload` calls in the same tick
+ // (e.g. the initial URL sync setting both the environment and the range at once, or that
+ // sync landing in the same tick as the mount-time load) collapse into a single request.
+ requestReload: () => {
+ cache.disposables.add(() => {
+ const timerId = setTimeout(() => actions.loadServicesHealth(), 0)
+ return () => clearTimeout(timerId)
+ }, 'reloadTimer')
+ },
+ })),
+
+ afterMount(({ actions, cache }) => {
+ actions.requestReload()
+ cache.disposables.add(() => {
+ const handle = setInterval(() => actions.loadServicesHealth(), POLL_INTERVAL_MS)
+ return () => clearInterval(handle)
+ }, 'poll')
+ }),
+])
diff --git a/products/apm/frontend/generated/api.schemas.ts b/products/apm/frontend/generated/api.schemas.ts
new file mode 100644
index 000000000000..fedde3e6b7a1
--- /dev/null
+++ b/products/apm/frontend/generated/api.schemas.ts
@@ -0,0 +1,93 @@
+/**
+ * Auto-generated from the Django backend OpenAPI schema.
+ * To modify these types, update the Django serializers or views, then run:
+ * hogli build:openapi
+ * Questions or issues? #team-devex on Slack
+ *
+ * PostHog API - generated
+ * OpenAPI spec version: 1.0.0
+ */
+/**
+ * * `good` - Good
+ * * `warning` - Warning
+ * * `serious` - Serious
+ * * `critical` - Critical
+ */
+export type HealthStatusEnumApi = (typeof HealthStatusEnumApi)[keyof typeof HealthStatusEnumApi]
+
+export const HealthStatusEnumApi = {
+ Good: 'good',
+ Warning: 'warning',
+ Serious: 'serious',
+ Critical: 'critical',
+} as const
+
+export interface HealthRowApi {
+ /**
+ * Requests per second over the window.
+ * @nullable
+ */
+ request_rate: number | null
+ /**
+ * Share of requests with an error status, 0 to 1.
+ * @nullable
+ */
+ error_rate: number | null
+ /**
+ * 95th percentile request duration in milliseconds.
+ * @nullable
+ */
+ p95_ms: number | null
+ /** Requests counted in the window. */
+ span_count: number
+ /** Requests with an error status in the window. */
+ error_count: number
+}
+
+export interface ServiceHealthApi {
+ /** The service.name resource attribute. */
+ service_name: string
+ /** The environment the row was computed for. */
+ environment: string
+ /** Health band from the error rate.
+ *
+ * * `good` - Good
+ * * `warning` - Warning
+ * * `serious` - Serious
+ * * `critical` - Critical */
+ status: HealthStatusEnumApi
+ /** The health row every surface renders. */
+ health: HealthRowApi
+ /** Request counts per bucket across the window, oldest first. */
+ sparkline: number[]
+}
+
+export interface ServicesHealthResponseApi {
+ /** One row per service, worst status first. */
+ results: ServiceHealthApi[]
+ /** Environments seen in the window. */
+ environments: string[]
+ /** The environment the rows were computed for. */
+ environment: string
+ /** Start of the window used. */
+ date_from: string
+ /** End of the window used. */
+ date_to: string
+}
+
+export type ApmServicesListParams = {
+ /**
+ * Start of the window, ISO 8601. Defaults to one hour before date_to.
+ */
+ date_from?: string
+ /**
+ * End of the window, ISO 8601. Defaults to now.
+ */
+ date_to?: string
+ /**
+ * Environment to list, as resolved from span resource attributes. Defaults to 'default'.
+ * @minLength 1
+ * @maxLength 200
+ */
+ environment?: string
+}
diff --git a/products/apm/frontend/generated/api.ts b/products/apm/frontend/generated/api.ts
new file mode 100644
index 000000000000..ad2ff9edb028
--- /dev/null
+++ b/products/apm/frontend/generated/api.ts
@@ -0,0 +1,44 @@
+import { apiMutator } from '../../../../frontend/src/lib/api-orval-mutator'
+/**
+ * Auto-generated from the Django backend OpenAPI schema.
+ * To modify these types, update the Django serializers or views, then run:
+ * hogli build:openapi
+ * Questions or issues? #team-devex on Slack
+ *
+ * PostHog API - generated
+ * OpenAPI spec version: 1.0.0
+ */
+import type { ApmServicesListParams, ServicesHealthResponseApi } from './api.schemas'
+
+export const getApmServicesListUrl = (projectId: string, params?: ApmServicesListParams) => {
+ const normalizedParams = new URLSearchParams()
+
+ Object.entries(params || {}).forEach(([key, value]) => {
+ if (value !== undefined) {
+ normalizedParams.append(key, value === null ? 'null' : String(value))
+ }
+ })
+
+ const stringifiedParams = normalizedParams.toString()
+
+ return stringifiedParams.length > 0
+ ? `/api/projects/${projectId}/apm/services/?${stringifiedParams}`
+ : `/api/projects/${projectId}/apm/services/`
+}
+
+/**
+ * One health row per service in an environment and window, worst first.
+ *
+ * Read-only, and dark for every team without the product flag: the flag gates the scene, the
+ * nav entry, and this endpoint together.
+ */
+export const apmServicesList = async (
+ projectId: string,
+ params?: ApmServicesListParams,
+ options?: RequestInit
+): Promise<ServicesHealthResponseApi> => {
+ return apiMutator<ServicesHealthResponseApi>(getApmServicesListUrl(projectId, params), {
+ ...options,
+ method: 'GET',
+ })
+}
diff --git a/products/apm/frontend/generated/api.zod.schemas.ts b/products/apm/frontend/generated/api.zod.schemas.ts
new file mode 100644
index 000000000000..2f5f16b752df
--- /dev/null
+++ b/products/apm/frontend/generated/api.zod.schemas.ts
@@ -0,0 +1,90 @@
+/**
+ * Auto-generated Zod validation schemas from the Django backend OpenAPI schema.
+ * To modify these schemas, update the Django serializers or views, then run:
+ * hogli build:openapi
+ * Questions or issues? #team-devex on Slack
+ *
+ * PostHog API - generated
+ * OpenAPI spec version: 1.0.0
+ */
+import { z as zod } from 'zod'
+
+export const HealthStatusEnumApi = zod
+ .enum(['good', 'warning', 'serious', 'critical'])
+ .describe('\* `good` - Good\n\* `warning` - Warning\n\* `serious` - Serious\n\* `critical` - Critical')
+
+export type HealthStatusEnumApi = zod.input<typeof HealthStatusEnumApi>
+export type HealthStatusEnumApiOutput = zod.output<typeof HealthStatusEnumApi>
+
+export const HealthRowApi = zod.object({
+ request_rate: zod.number().nullable().describe('Requests per second over the window.'),
+ error_rate: zod.number().nullable().describe('Share of requests with an error status, 0 to 1.'),
+ p95_ms: zod.number().nullable().describe('95th percentile request duration in milliseconds.'),
+ span_count: zod.number().describe('Requests counted in the window.'),
+ error_count: zod.number().describe('Requests with an error status in the window.'),
+})
+
+export type HealthRowApi = zod.input<typeof HealthRowApi>
+export type HealthRowApiOutput = zod.output<typeof HealthRowApi>
+
+export const ServiceHealthApi = zod.object({
+ service_name: zod.string().describe('The service.name resource attribute.'),
+ environment: zod.string().describe('The environment the row was computed for.'),
+ status: zod
+ .enum(['good', 'warning', 'serious', 'critical'])
+ .describe('\* `good` - Good\n\* `warning` - Warning\n\* `serious` - Serious\n\* `critical` - Critical')
+ .describe(
+ 'Health band from the error rate.\n\n\* `good` - Good\n\* `warning` - Warning\n\* `serious` - Serious\n\* `critical` - Critical'
+ ),
+ health: zod
+ .object({
+ request_rate: zod.number().nullable().describe('Requests per second over the window.'),
+ error_rate: zod.number().nullable().describe('Share of requests with an error status, 0 to 1.'),
+ p95_ms: zod.number().nullable().describe('95th percentile request duration in milliseconds.'),
+ span_count: zod.number().describe('Requests counted in the window.'),
+ error_count: zod.number().describe('Requests with an error status in the window.'),
+ })
+ .describe('The health row every surface renders.'),
+ sparkline: zod.array(zod.number()).describe('Request counts per bucket across the window, oldest first.'),
+})
+
+export type ServiceHealthApi = zod.input<typeof ServiceHealthApi>
+export type ServiceHealthApiOutput = zod.output<typeof ServiceHealthApi>
+
+export const ServicesHealthResponseApi = zod.object({
+ results: zod
+ .array(
+ zod.object({
+ service_name: zod.string().describe('The service.name resource attribute.'),
+ environment: zod.string().describe('The environment the row was computed for.'),
+ status: zod
+ .enum(['good', 'warning', 'serious', 'critical'])
+ .describe(
+ '\* `good` - Good\n\* `warning` - Warning\n\* `serious` - Serious\n\* `critical` - Critical'
+ )
+ .describe(
+ 'Health band from the error rate.\n\n\* `good` - Good\n\* `warning` - Warning\n\* `serious` - Serious\n\* `critical` - Critical'
+ ),
+ health: zod
+ .object({
+ request_rate: zod.number().nullable().describe('Requests per second over the window.'),
+ error_rate: zod.number().nullable().describe('Share of requests with an error status, 0 to 1.'),
+ p95_ms: zod.number().nullable().describe('95th percentile request duration in milliseconds.'),
+ span_count: zod.number().describe('Requests counted in the window.'),
+ error_count: zod.number().describe('Requests with an error status in the window.'),
+ })
+ .describe('The health row every surface renders.'),
+ sparkline: zod
+ .array(zod.number())
+ .describe('Request counts per bucket across the window, oldest first.'),
+ })
+ )
+ .describe('One row per service, worst status first.'),
+ environments: zod.array(zod.string()).describe('Environments seen in the window.'),
+ environment: zod.string().describe('The environment the rows were computed for.'),
+ date_from: zod.iso.datetime({ offset: true }).describe('Start of the window used.'),
+ date_to: zod.iso.datetime({ offset: true }).describe('End of the window used.'),
+})
+
+export type ServicesHealthResponseApi = zod.input<typeof ServicesHealthResponseApi>
+export type ServicesHealthResponseApiOutput = zod.output<typeof ServicesHealthResponseApi>
diff --git a/products/apm/frontend/generated/api.zod.ts b/products/apm/frontend/generated/api.zod.ts
new file mode 100644
index 000000000000..e8a15d4e1b52
--- /dev/null
+++ b/products/apm/frontend/generated/api.zod.ts
@@ -0,0 +1,9 @@
+/**
+ * Auto-generated Zod validation schemas from the Django backend OpenAPI schema.
+ * To modify these schemas, update the Django serializers or views, then run:
+ * hogli build:openapi
+ * Questions or issues? #team-devex on Slack
+ *
+ * PostHog API - generated
+ * OpenAPI spec version: 1.0.0
+ */
diff --git a/products/apm/manifest.tsx b/products/apm/manifest.tsx
index d99a1b093820..889c50864288 100644
--- a/products/apm/manifest.tsx
+++ b/products/apm/manifest.tsx
@@ -1,20 +1,50 @@
/**
* Product manifest for APM.
*
- * No scenes or nav entries yet. APM's first deliverable is a backend detector
- * that the logs, tracing, and metrics products consume, so today its only
- * surfaces are theirs. An empty manifest is valid in the meantime; see
- * products/notifications for the same shape.
+ * The first surface is the Application observability services list, behind the product flag.
+ * The anomaly detector in the backend stays a dependency of the logs, tracing, and metrics
+ * products and has no surface of its own here yet.
*/
-import { ProductManifest } from '../../frontend/src/types'
+import { FEATURE_FLAGS } from 'lib/constants'
+
+import { FileSystemIconType, ProductItemCategory, ProductKey } from '~/queries/schema/schema-general'
+import { FileSystemIconColor, ProductManifest } from '~/types'
export const manifest: ProductManifest = {
name: 'APM',
- scenes: {},
- routes: {},
+ scenes: {
+ ApplicationObservability: {
+ name: 'Application observability',
+ import: () => import('./frontend/ApplicationObservabilityScene'),
+ projectBased: true,
+ layout: 'app-container',
+ activityScope: 'Tracing',
+ description: 'Whether your application is OK, one row per service, from the signals you already send.',
+ iconType: 'tracing',
+ },
+ },
+ routes: {
+ '/application-observability': ['ApplicationObservability', 'applicationObservability'],
+ },
redirects: {},
- urls: {},
+ urls: {
+ applicationObservability: (): string => '/application-observability',
+ },
fileSystemTypes: {},
treeItemsNew: [],
- treeItemsProducts: [],
+ treeItemsProducts: [
+ {
+ path: 'Application observability',
+ intents: [ProductKey.TRACING],
+ category: ProductItemCategory.MONITORING,
+ iconType: 'tracing' as FileSystemIconType,
+ iconColor: [
+ 'var(--color-product-tracing-light)',
+ 'var(--color-product-tracing-dark)',
+ ] as FileSystemIconColor,
+ href: '/application-observability',
+ flag: FEATURE_FLAGS.APPLICATION_OBSERVABILITY,
+ sceneKey: 'ApplicationObservability',
+ },
+ ],
}
diff --git a/products/apm/package.json b/products/apm/package.json
index c4fa98752f67..f4b1d38750a8 100644
--- a/products/apm/package.json
+++ b/products/apm/package.json
@@ -2,5 +2,18 @@
"name": "@posthog/products-apm",
"scripts": {
"backend:test": "pytest -c ../../pytest.ini --rootdir ../.. backend/tests -v --tb=short"
+ },
+ "dependencies": {
+ "kea": "catalog:",
+ "kea-loaders": "catalog:",
+ "kea-router": "catalog:"
+ },
+ "devDependencies": {
+ "kea-test-utils": "catalog:"
+ },
+ "peerDependencies": {
+ "@posthog/icons": "catalog:",
+ "@types/react": "*",
+ "react": "*"
}
}
diff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.ts
index 204b9bfe4229..011d2f67ca46 100644
--- a/services/mcp/src/api/generated.ts
+++ b/services/mcp/src/api/generated.ts
@@ -57657,6 +57657,44 @@ export namespace Schemas {
snoozed: HealthIssueCounts;
}
+ export interface HealthRow {
+ /**
+ * Requests per second over the window.
+ * @nullable
+ */
+ request_rate: number | null;
+ /**
+ * Share of requests with an error status, 0 to 1.
+ * @nullable
+ */
+ error_rate: number | null;
+ /**
+ * 95th percentile request duration in milliseconds.
+ * @nullable
+ */
+ p95_ms: number | null;
+ /** Requests counted in the window. */
+ span_count: number;
+ /** Requests with an error status in the window. */
+ error_count: number;
+ }
+
+ /**
+ * * `good` - Good
+ * * `warning` - Warning
+ * * `serious` - Serious
+ * * `critical` - Critical
+ */
+ export type HealthStatusEnum = typeof HealthStatusEnum[keyof typeof HealthStatusEnum];
+
+
+ export const HealthStatusEnum = {
+ Good: 'good',
+ Warning: 'warning',
+ Serious: 'serious',
+ Critical: 'critical',
+ } as const;
+
export interface HeatmapCapturePage {
/** A page URL that currently sends heatmap data. */
url: string;
@@ -108041,6 +108079,24 @@ export namespace Schemas {
policies?: ToolPolicyEntry[];
}
+ export interface ServiceHealth {
+ /** The service.name resource attribute. */
+ service_name: string;
+ /** The environment the row was computed for. */
+ environment: string;
+ /** Health band from the error rate.
+ *
+ * * `good` - Good
+ * * `warning` - Warning
+ * * `serious` - Serious
+ * * `critical` - Critical */
+ status: HealthStatusEnum;
+ /** The health row every surface renders. */
+ health: HealthRow;
+ /** Request counts per bucket across the window, oldest first. */
+ sparkline: number[];
+ }
+
/**
* * `none` - None
* * `previous_period` - Previous Period
@@ -108299,6 +108355,19 @@ export namespace Schemas {
notes: string[];
}
+ export interface ServicesHealthResponse {
+ /** One row per service, worst status first. */
+ results: ServiceHealth[];
+ /** Environments seen in the window. */
+ environments: string[];
+ /** The environment the rows were computed for. */
+ environment: string;
+ /** Start of the window used. */
+ date_from: string;
+ /** End of the window used. */
+ date_to: string;
+ }
+
export interface SessionRecordingBulkDeleteRequest {
/**
* Session IDs of the recordings to delete (max 100 per call).
@@ -128127,6 +128196,23 @@ export namespace Schemas {
offset?: number;
};
+ export type ApmServicesListParams = {
+ /**
+ * Start of the window, ISO 8601. Defaults to one hour before date_to.
+ */
+ date_from?: string;
+ /**
+ * End of the window, ISO 8601. Defaults to now.
+ */
+ date_to?: string;
+ /**
+ * Environment to list, as resolved from span resource attributes. Defaults to 'default'.
+ * @minLength 1
+ * @maxLength 200
+ */
+ environment?: string;
+ };
+
export type ApprovalPoliciesListParams = {
/**
* Number of results to return per page.
diff --git a/services/mcp/src/tools/links/app-url-manifest.json b/services/mcp/src/tools/links/app-url-manifest.json
index aba2bc4c4061..72676674ad22 100644
--- a/services/mcp/src/tools/links/app-url-manifest.json
+++ b/services/mcp/src/tools/links/app-url-manifest.json
@@ -249,6 +249,11 @@
"params": [],
"scope": "project"
},
+ "applicationObservability": {
+ "template": "/application-observability",
+ "params": [],
+ "scope": "project"
+ },
"approval": {
"template": "/approvals/{id}",
"params": ["id"],
diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/generate-app-url.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/generate-app-url.json
index d6d3fd626d45..755575cb7307 100644
--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/generate-app-url.json
+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/generate-app-url.json
@@ -13,7 +13,7 @@
"type": "object"
},
"url": {
- "description": "A path template copied verbatim from the catalog below (e.g. `/persons/{uuid}`). Its `{placeholders}` are filled from `params`. These slugs come from PostHog's canonical route table, so they are always correct — never pass a path that is not in this list.\n\n/account-connected/{kind}\n/account/credential-review\n/account/social-connected\n/activity-logs\n/activity/{tab}\n/agentic/account-mismatch\n/agentic/authorize\n/ai\n/ai-enrichment\n/ai-evals/evaluations\n/ai-evals/evaluations/offline/datasets/{id}\n/ai-evals/evaluations/offline/experiments\n/ai-evals/evaluations/offline/experiments/{experimentId}\n/ai-evals/evaluations/offline/experiments?tab=datasets\n/ai-evals/evaluations/scorers\n/ai-evals/evaluations/scorers/{scorerId}\n/ai-evals/evaluations/scorers/{scorerId}/offline\n/ai-evals/evaluations/templates\n/ai-evals/evaluations/{id}\n/ai-evals/taggers\n/ai-evals/taggers/{id}\n/ai-observability/clusters\n/ai-observability/clusters/{runId}/{clusterId}\n/ai-observability/dashboard\n/ai-observability/errors\n/ai-observability/generations\n/ai-observability/playground\n/ai-observability/reviews\n/ai-observability/self-driving\n/ai-observability/sentiment\n/ai-observability/sessions\n/ai-observability/sessions/{id}\n/ai-observability/tools\n/ai-observability/traces\n/ai-observability/traces/{id}\n/ai-observability/users\n/ai/history\n/alerts\n/analytics\n/analytics/all\n/analytics/mine\n/analytics/product-analytics\n/analytics/spaces\n/approvals/{id}\n/autoresearch\n/autoresearch/new\n/autoresearch/{id}\n/bi\n/bi/new\n/bi/{insightShortId}\n/billing/authorization_status\n/broadcasts\n/broadcasts/new\n/broadcasts/{id}\n/business-knowledge\n/business-knowledge/playground\n/business-knowledge/settings\n/business-knowledge/{id}\n/canvas\n/canvases\n/canvases/new\n/canvases/{id}\n/cli/authorize\n/cli/live\n/code-review\n/code/canvas/{channelId}/{dashboardId}\n/code/channel/{channelId}\n/code/loop/{loopId}\n/code/task/{taskId}\n/cohorts\n/cohorts/{id}\n/cohorts/{id}/calculation-history\n/connect/vercel/link\n/coupons/{campaign}\n/create-organization\n/cross-project-dashboards\n/cross-project-dashboards/{id}\n/customer_analytics\n/customer_analytics/accounts\n/customer_analytics/accounts/by-external-id/{externalId}\n/customer_analytics/accounts/{accountId}\n/customer_analytics/announcements\n/customer_analytics/configuration\n/customer_analytics/dashboard\n/customer_analytics/feature-requests\n/customer_analytics/feed\n/customer_analytics/journeys\n/customer_analytics/journeys/new\n/customer_analytics/journeys/templates\n/customer_analytics/journeys/{id}/edit\n/customer_analytics/notes\n/customer_analytics/tasks\n/dashboard\n/dashboard/templates/{templateId}/copy-to-project\n/dashboard/{id}\n/dashboard/{id}/sharing\n/dashboard/{id}/subscriptions\n/dashboard/{id}/subscriptions/{subscriptionId}\n/dashboard/{id}/tiles/{tileId}\n/data-catalog\n/data-catalog/metrics/{name}\n/data-catalog/new-metric\n/data-management/actions\n/data-management/actions/new\n/data-management/actions/new/\n/data-management/actions/{id}\n/data-management/annotations\n/data-management/annotations/{id}\n/data-management/core-events\n/data-management/database\n/data-management/destinations\n/data-management/event-filtering\n/data-management/events\n/data-management/events/{id}\n/data-management/events/{id}/edit\n/data-management/history\n/data-management/ingestion-warnings\n/data-management/ingestion-warnings-v2\n/data-management/managed-viewsets\n/data-management/materialized-columns\n/data-management/properties\n/data-management/properties/{id}\n/data-management/properties/{id}/edit\n/data-management/revenue\n/data-management/schema\n/data-management/sources\n/data-management/sources/{id}/schemas\n/data-management/sources/{sourceId}/schemas/{schemaId}\n/data-management/transformations\n/data-management/variables\n/data-management/variables/{id}\n/data-management/variables/{id}/edit\n/data-management/warehouse-destinations\n/data-management/warehouse-properties\n/data-ops\n/data-warehouse/connect\n/data-warehouse/new-source\n/debug\n/debug/hog\n/debug/precompute\n/early_access_features\n/early_access_features/{id}\n/embedded/{token}\n/endpoints\n/endpoints/{name}\n/engineering-analytics/authors\n/engineering-analytics/authors/{handle}\n/engineering-analytics/deploys\n/engineering-analytics/overview\n/engineering-analytics/pull-requests\n/engineering-analytics/repos/{repoOwner}/{repoName}/actions/runs/{runId}\n/engineering-analytics/repos/{repoOwner}/{repoName}/actions/workflows/{workflowName}\n/engineering-analytics/repos/{repoOwner}/{repoName}/pull-requests/{number}\n/engineering-analytics/repos/{repoOwner}/{repoName}/pull-requests/{number}/ci-explorer\n/engineering-analytics/teams\n/engineering-analytics/teams/{ownerTeam}\n/engineering-analytics/tests\n/engineering-analytics/workflows\n/error-tracking\n/error-tracking/alerts/new/{templateId}\n/error-tracking/alerts/{id}\n/error-tracking/fingerprint/{fingerprint}\n/error-tracking/{id}\n/etl\n/events/{id}/{timestamp}\n/experiments\n/experiments/shared-metrics\n/experiments/shared-metrics/{id}\n/experiments/staff\n/experiments/{id}\n/exports\n/feature-flags\n/feature-flags/new\n/feature-flags/staff\n/feature-flags/staff/cohorts\n/feature-flags/templates\n/feature-flags/{id}\n/files\n/functions/new/{templateId}\n/functions/{id}\n/games/368hedgehogs\n/games/flappyhog\n/games/shipit\n/groups/{groupTypeIndex}\n/groups/{groupTypeIndex}/new\n/groups/{groupTypeIndex}/{groupKey}\n/health\n/health/alerts\n/health/pipeline-status\n/health/sdk-health\n/health/{category}\n/heatmaps\n/heatmaps/new\n/heatmaps/recording\n/heatmaps/{id}\n/home\n/identity-matching\n/inbox\n/inbox/reports/triage\n/inbox/scout-trials\n/inbox/scouts/findings\n/inbox/scouts/runs\n/inbox/scouts/scratchpad\n/inbox/scouts/{skillName}\n/inbox/{tab}/{reportId}\n/insights\n/insights/new\n/insights/quick-start\n/insights/{id}\n/insights/{id}/edit\n/insights/{id}/sharing\n/insights/{id}/subscriptions\n/insights/{id}/subscriptions/{subscriptionId}\n/insights/{insightShortId}/alerts\n/instance/async_migrations\n/instance/async_migrations/future\n/instance/async_migrations/settings\n/instance/dead_letter_queue\n/instance/kafka_inspector\n/instance/metrics\n/instance/settings\n/instance/staff_users\n/instance/status\n/integrations/stripe/confirm-install\n/integrations/vercel/link-error\n/integrations/{kind}/callback\n/integrations/{slug}\n/legal\n/legal/new/{type}\n/login\n/login/2fa\n/login/2fa_setup\n/logs\n/logs/alerts/{alertId}/notifications/{hogFunctionId}\n/logs/alerts/{id}\n/logs/drop-rules/new\n/logs/drop-rules/{id}\n/logs/retention-rules/new\n/logs/retention-rules/{id}\n/managed_migrations\n/managed_migrations/new\n/marketing\n/mcp-analytics\n/mcp-analytics/activity\n/mcp-analytics/dashboard\n/mcp-analytics/intent-clustering\n/mcp-analytics/missing-capabilities\n/mcp-analytics/notifications\n/mcp-analytics/sessions\n/mcp-analytics/tool-quality\n/mcp-analytics/tool-quality/{toolName}\n/mcp-registry\n/mcp-servers\n/mcp-servers/agent/{id}\n/mcp-servers/member/{id}\n/mcp-servers/server/{id}\n/mcp-servers/{tab}\n/metrics\n/metrics/dashboard-review\n/models\n/models/{id}\n/move-to-cloud\n/my-tickets\n/notebooks\n/notebooks/widgets/{widgetId}\n/notebooks/{shortId}\n/oauth/authorize\n/onboarding\n/onboarding/simple\n/organization-deactivated\n/organization-pending-deletion\n/organization/billing\n/organization/billing/overview\n/organization/billing/real-time-usage\n/organization/confirm-creation\n/organization/create-project\n/organization/legal\n/organization/startups\n/person/{id}\n/persons\n/persons/{uuid}\n/pipeline/batch-exports/new/{service}\n/pipeline/batch-exports/{id}\n/pipeline/new/\n/pipeline/plugins/{id}\n/platform-alerts\n/platform-alerts/{id}\n/preflight\n/product_tours\n/product_tours/{id}\n/project-pending-deletion\n/prompt-management/prompts\n/prompt-management/prompts/{name}\n/pulse\n/replay-vision\n/replay-vision/new/goal\n/replay-vision/observations/{observationId}\n/replay-vision/{id}/budget\n/replay-vision/{id}/configure\n/replay-vision/{id}/details\n/replay-vision/{id}/goal\n/replay-vision/{id}/overview\n/replay-vision/{id}/triggers\n/replay/file-playback\n/replay/home\n/replay/kiosk\n/replay/playlists/{id}\n/replay/settings\n/replay/{id}\n/reset\n/reset/{userUuid}/{token}\n/reset_2fa/{userUuid}/{token}\n/resource-transfer/{resourceKind}/{resourceId}\n/sessions/{id}\n/settings/environment-approvals\n/settings/organization-authentication/{feature}/{configId}\n/settings/project\n/settings/user-feature-previews\n/shared/{token}\n/shared_dashboard/{shareToken}\n/signup\n/signup/{id}\n/site/{url}\n/skills\n/skills/community\n/skills/{categoryTab}\n/skills/{name}\n/slack-task-context\n/spaces\n/spaces/new\n/spaces/{id}\n/spaces/{id}/canvases\n/spaces/{id}/new\n/spaces/{id}/settings\n/sql\n/stamphog\n/stamphog/digests\n/stamphog/install/callback\n/stamphog/runs\n/startups\n/streamlit-apps\n/streamlit-apps/new\n/streamlit-apps/{id}\n/streamlit-apps/{id}/edit\n/subscriptions\n/subscriptions/new\n/subscriptions/{id}\n/subscriptions/{id}/edit\n/support\n/support/settings\n/support/tickets\n/support/tickets/{ticketId}\n/surveys\n/surveys/form/new\n/surveys/guided/new\n/surveys/{id}\n/tasks\n/tasks/new\n/tasks/{taskId}\n/terminal\n/themes/custom-css\n/toolbar\n/tools\n/tracing\n/tracing/retention-rules/new\n/tracing/retention-rules/{id}\n/unsubscribe\n/uptime-monitoring\n/verify_email\n/visual-review\n/visual-review/repos/{repoOwner}/{repoName}/flakiness\n/visual-review/repos/{repoOwner}/{repoName}/runs\n/visual-review/repos/{repoOwner}/{repoName}/runs/{runId}\n/visual-review/repos/{repoOwner}/{repoName}/snapshots\n/visual-review/repos/{repoOwner}/{repoName}/{runType}/snapshots/{identifier}\n/visual-review/runs/{runId}\n/visual-review/settings\n/web\n/web-scripts\n/web-scripts/new\n/web/agents\n/web/bots\n/web/content-autopilot\n/web/health\n/web/live\n/web/marketing\n/web/page-performance\n/web/page-reports\n/web/recap\n/web/session-attribution-explorer\n/web/web-vitals\n/welcome\n/wizard/runs\n/workflows\n/workflows/channels/email/{id}\n/workflows/library/messages/{id}\n/workflows/library/templates/new\n/workflows/library/templates/{id}\n/workflows/new/workflow\n/workflows/{id}/{tab}",
+ "description": "A path template copied verbatim from the catalog below (e.g. `/persons/{uuid}`). Its `{placeholders}` are filled from `params`. These slugs come from PostHog's canonical route table, so they are always correct — never pass a path that is not in this list.\n\n/account-connected/{kind}\n/account/credential-review\n/account/social-connected\n/activity-logs\n/activity/{tab}\n/agentic/account-mismatch\n/agentic/authorize\n/ai\n/ai-enrichment\n/ai-evals/evaluations\n/ai-evals/evaluations/offline/datasets/{id}\n/ai-evals/evaluations/offline/experiments\n/ai-evals/evaluations/offline/experiments/{experimentId}\n/ai-evals/evaluations/offline/experiments?tab=datasets\n/ai-evals/evaluations/scorers\n/ai-evals/evaluations/scorers/{scorerId}\n/ai-evals/evaluations/scorers/{scorerId}/offline\n/ai-evals/evaluations/templates\n/ai-evals/evaluations/{id}\n/ai-evals/taggers\n/ai-evals/taggers/{id}\n/ai-observability/clusters\n/ai-observability/clusters/{runId}/{clusterId}\n/ai-observability/dashboard\n/ai-observability/errors\n/ai-observability/generations\n/ai-observability/playground\n/ai-observability/reviews\n/ai-observability/self-driving\n/ai-observability/sentiment\n/ai-observability/sessions\n/ai-observability/sessions/{id}\n/ai-observability/tools\n/ai-observability/traces\n/ai-observability/traces/{id}\n/ai-observability/users\n/ai/history\n/alerts\n/analytics\n/analytics/all\n/analytics/mine\n/analytics/product-analytics\n/analytics/spaces\n/application-observability\n/approvals/{id}\n/autoresearch\n/autoresearch/new\n/autoresearch/{id}\n/bi\n/bi/new\n/bi/{insightShortId}\n/billing/authorization_status\n/broadcasts\n/broadcasts/new\n/broadcasts/{id}\n/business-knowledge\n/business-knowledge/playground\n/business-knowledge/settings\n/business-knowledge/{id}\n/canvas\n/canvases\n/canvases/new\n/canvases/{id}\n/cli/authorize\n/cli/live\n/code-review\n/code/canvas/{channelId}/{dashboardId}\n/code/channel/{channelId}\n/code/loop/{loopId}\n/code/task/{taskId}\n/cohorts\n/cohorts/{id}\n/cohorts/{id}/calculation-history\n/connect/vercel/link\n/coupons/{campaign}\n/create-organization\n/cross-project-dashboards\n/cross-project-dashboards/{id}\n/customer_analytics\n/customer_analytics/accounts\n/customer_analytics/accounts/by-external-id/{externalId}\n/customer_analytics/accounts/{accountId}\n/customer_analytics/announcements\n/customer_analytics/configuration\n/customer_analytics/dashboard\n/customer_analytics/feature-requests\n/customer_analytics/feed\n/customer_analytics/journeys\n/customer_analytics/journeys/new\n/customer_analytics/journeys/templates\n/customer_analytics/journeys/{id}/edit\n/customer_analytics/notes\n/customer_analytics/tasks\n/dashboard\n/dashboard/templates/{templateId}/copy-to-project\n/dashboard/{id}\n/dashboard/{id}/sharing\n/dashboard/{id}/subscriptions\n/dashboard/{id}/subscriptions/{subscriptionId}\n/dashboard/{id}/tiles/{tileId}\n/data-catalog\n/data-catalog/metrics/{name}\n/data-catalog/new-metric\n/data-management/actions\n/data-management/actions/new\n/data-management/actions/new/\n/data-management/actions/{id}\n/data-management/annotations\n/data-management/annotations/{id}\n/data-management/core-events\n/data-management/database\n/data-management/destinations\n/data-management/event-filtering\n/data-management/events\n/data-management/events/{id}\n/data-management/events/{id}/edit\n/data-management/history\n/data-management/ingestion-warnings\n/data-management/ingestion-warnings-v2\n/data-management/managed-viewsets\n/data-management/materialized-columns\n/data-management/properties\n/data-management/properties/{id}\n/data-management/properties/{id}/edit\n/data-management/revenue\n/data-management/schema\n/data-management/sources\n/data-management/sources/{id}/schemas\n/data-management/sources/{sourceId}/schemas/{schemaId}\n/data-management/transformations\n/data-management/variables\n/data-management/variables/{id}\n/data-management/variables/{id}/edit\n/data-management/warehouse-destinations\n/data-management/warehouse-properties\n/data-ops\n/data-warehouse/connect\n/data-warehouse/new-source\n/debug\n/debug/hog\n/debug/precompute\n/early_access_features\n/early_access_features/{id}\n/embedded/{token}\n/endpoints\n/endpoints/{name}\n/engineering-analytics/authors\n/engineering-analytics/authors/{handle}\n/engineering-analytics/deploys\n/engineering-analytics/overview\n/engineering-analytics/pull-requests\n/engineering-analytics/repos/{repoOwner}/{repoName}/actions/runs/{runId}\n/engineering-analytics/repos/{repoOwner}/{repoName}/actions/workflows/{workflowName}\n/engineering-analytics/repos/{repoOwner}/{repoName}/pull-requests/{number}\n/engineering-analytics/repos/{repoOwner}/{repoName}/pull-requests/{number}/ci-explorer\n/engineering-analytics/teams\n/engineering-analytics/teams/{ownerTeam}\n/engineering-analytics/tests\n/engineering-analytics/workflows\n/error-tracking\n/error-tracking/alerts/new/{templateId}\n/error-tracking/alerts/{id}\n/error-tracking/fingerprint/{fingerprint}\n/error-tracking/{id}\n/etl\n/events/{id}/{timestamp}\n/experiments\n/experiments/shared-metrics\n/experiments/shared-metrics/{id}\n/experiments/staff\n/experiments/{id}\n/exports\n/feature-flags\n/feature-flags/new\n/feature-flags/staff\n/feature-flags/staff/cohorts\n/feature-flags/templates\n/feature-flags/{id}\n/files\n/functions/new/{templateId}\n/functions/{id}\n/games/368hedgehogs\n/games/flappyhog\n/games/shipit\n/groups/{groupTypeIndex}\n/groups/{groupTypeIndex}/new\n/groups/{groupTypeIndex}/{groupKey}\n/health\n/health/alerts\n/health/pipeline-status\n/health/sdk-health\n/health/{category}\n/heatmaps\n/heatmaps/new\n/heatmaps/recording\n/heatmaps/{id}\n/home\n/identity-matching\n/inbox\n/inbox/reports/triage\n/inbox/scout-trials\n/inbox/scouts/findings\n/inbox/scouts/runs\n/inbox/scouts/scratchpad\n/inbox/scouts/{skillName}\n/inbox/{tab}/{reportId}\n/insights\n/insights/new\n/insights/quick-start\n/insights/{id}\n/insights/{id}/edit\n/insights/{id}/sharing\n/insights/{id}/subscriptions\n/insights/{id}/subscriptions/{subscriptionId}\n/insights/{insightShortId}/alerts\n/instance/async_migrations\n/instance/async_migrations/future\n/instance/async_migrations/settings\n/instance/dead_letter_queue\n/instance/kafka_inspector\n/instance/metrics\n/instance/settings\n/instance/staff_users\n/instance/status\n/integrations/stripe/confirm-install\n/integrations/vercel/link-error\n/integrations/{kind}/callback\n/integrations/{slug}\n/legal\n/legal/new/{type}\n/login\n/login/2fa\n/login/2fa_setup\n/logs\n/logs/alerts/{alertId}/notifications/{hogFunctionId}\n/logs/alerts/{id}\n/logs/drop-rules/new\n/logs/drop-rules/{id}\n/logs/retention-rules/new\n/logs/retention-rules/{id}\n/managed_migrations\n/managed_migrations/new\n/marketing\n/mcp-analytics\n/mcp-analytics/activity\n/mcp-analytics/dashboard\n/mcp-analytics/intent-clustering\n/mcp-analytics/missing-capabilities\n/mcp-analytics/notifications\n/mcp-analytics/sessions\n/mcp-analytics/tool-quality\n/mcp-analytics/tool-quality/{toolName}\n/mcp-registry\n/mcp-servers\n/mcp-servers/agent/{id}\n/mcp-servers/member/{id}\n/mcp-servers/server/{id}\n/mcp-servers/{tab}\n/metrics\n/metrics/dashboard-review\n/models\n/models/{id}\n/move-to-cloud\n/my-tickets\n/notebooks\n/notebooks/widgets/{widgetId}\n/notebooks/{shortId}\n/oauth/authorize\n/onboarding\n/onboarding/simple\n/organization-deactivated\n/organization-pending-deletion\n/organization/billing\n/organization/billing/overview\n/organization/billing/real-time-usage\n/organization/confirm-creation\n/organization/create-project\n/organization/legal\n/organization/startups\n/person/{id}\n/persons\n/persons/{uuid}\n/pipeline/batch-exports/new/{service}\n/pipeline/batch-exports/{id}\n/pipeline/new/\n/pipeline/plugins/{id}\n/platform-alerts\n/platform-alerts/{id}\n/preflight\n/product_tours\n/product_tours/{id}\n/project-pending-deletion\n/prompt-management/prompts\n/prompt-management/prompts/{name}\n/pulse\n/replay-vision\n/replay-vision/new/goal\n/replay-vision/observations/{observationId}\n/replay-vision/{id}/budget\n/replay-vision/{id}/configure\n/replay-vision/{id}/details\n/replay-vision/{id}/goal\n/replay-vision/{id}/overview\n/replay-vision/{id}/triggers\n/replay/file-playback\n/replay/home\n/replay/kiosk\n/replay/playlists/{id}\n/replay/settings\n/replay/{id}\n/reset\n/reset/{userUuid}/{token}\n/reset_2fa/{userUuid}/{token}\n/resource-transfer/{resourceKind}/{resourceId}\n/sessions/{id}\n/settings/environment-approvals\n/settings/organization-authentication/{feature}/{configId}\n/settings/project\n/settings/user-feature-previews\n/shared/{token}\n/shared_dashboard/{shareToken}\n/signup\n/signup/{id}\n/site/{url}\n/skills\n/skills/community\n/skills/{categoryTab}\n/skills/{name}\n/slack-task-context\n/spaces\n/spaces/new\n/spaces/{id}\n/spaces/{id}/canvases\n/spaces/{id}/new\n/spaces/{id}/settings\n/sql\n/stamphog\n/stamphog/digests\n/stamphog/install/callback\n/stamphog/runs\n/startups\n/streamlit-apps\n/streamlit-apps/new\n/streamlit-apps/{id}\n/streamlit-apps/{id}/edit\n/subscriptions\n/subscriptions/new\n/subscriptions/{id}\n/subscriptions/{id}/edit\n/support\n/support/settings\n/support/tickets\n/support/tickets/{ticketId}\n/surveys\n/surveys/form/new\n/surveys/guided/new\n/surveys/{id}\n/tasks\n/tasks/new\n/tasks/{taskId}\n/terminal\n/themes/custom-css\n/toolbar\n/tools\n/tracing\n/tracing/retention-rules/new\n/tracing/retention-rules/{id}\n/unsubscribe\n/uptime-monitoring\n/verify_email\n/visual-review\n/visual-review/repos/{repoOwner}/{repoName}/flakiness\n/visual-review/repos/{repoOwner}/{repoName}/runs\n/visual-review/repos/{repoOwner}/{repoName}/runs/{runId}\n/visual-review/repos/{repoOwner}/{repoName}/snapshots\n/visual-review/repos/{repoOwner}/{repoName}/{runType}/snapshots/{identifier}\n/visual-review/runs/{runId}\n/visual-review/settings\n/web\n/web-scripts\n/web-scripts/new\n/web/agents\n/web/bots\n/web/content-autopilot\n/web/health\n/web/live\n/web/marketing\n/web/page-performance\n/web/page-reports\n/web/recap\n/web/session-attribution-explorer\n/web/web-vitals\n/welcome\n/wizard/runs\n/workflows\n/workflows/channels/email/{id}\n/workflows/library/messages/{id}\n/workflows/library/templates/new\n/workflows/library/templates/{id}\n/workflows/new/workflow\n/workflows/{id}/{tab}",
"type": "string"
}
},