@gravitee/gamma-lib-observability 1.5.0 → 1.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/INTEGRATION.md CHANGED
@@ -11,6 +11,8 @@ This guide walks through integrating the observability library into a Gamma modu
11
11
  - [Prerequisites](#prerequisites)
12
12
  - [Installation](#installation)
13
13
  - [Quick Start](#quick-start)
14
+ - [Host Wiring Checklist](#host-wiring-checklist)
15
+ - [Authenticated HTTP (`http` prop)](#authenticated-http-http-prop)
14
16
  - [Feature: Dashboards](#feature-dashboards)
15
17
  - [Feature: Logs](#feature-logs)
16
18
  - [Feature: Widget Embedding](#feature-widget-embedding)
@@ -162,6 +164,59 @@ That's it — you now have a working dashboards section. The library handles dat
162
164
 
163
165
  ---
164
166
 
167
+ ## Host Wiring Checklist
168
+
169
+ The lib is a **contributor**: it ships routes, nav and route metadata; the host owns the shell. Use this as a quick reference of everything the host must wire — most of it is derivable from data the lib already exposes, so prefer the provided helpers over hand-rolled parsing.
170
+
171
+ - [ ] **CSS** — import `@gravitee/gamma-lib-observability/styles` in the exposed entry (see [CSS](#css)).
172
+ - [ ] **Query client** — wrap the app in a single `QueryClientProvider` (shared singleton under Module Federation).
173
+ - [ ] **Authenticated HTTP** — pass the `http` prop (or an `HttpProvider`) once so every internal source is authenticated (see [Authenticated HTTP](#authenticated-http-http-prop)).
174
+ - [ ] **Mount routes** — `<Route path="observe/*" element={<observability.Routes … />} />`.
175
+ - [ ] **Register navigation** — add `observability.navGroup` to your sidenav groups.
176
+ - [ ] **Active nav key** — resolve it with `observability.resolveRouteKey(pathname)` (see [Active nav key detection](#active-nav-key-detection)).
177
+ - [ ] **Breadcrumbs** — build them from `observability.breadcrumbSegments(activeNavKey)` (see [Breadcrumbs](#breadcrumbs)).
178
+ - [ ] **Merge route keys / routes** — spread `observability.routeKeys` / `observability.routes` into the module's own (see [Merging route keys and routes](#merging-route-keys-and-routes)).
179
+ - [ ] **Module Federation timing** — mount data-bound routes only after the SDK environment id has landed (see [Module Federation timing](#module-federation-timing)).
180
+ - [ ] **Capabilities (optional)** — wrap with `CapabilityProvider` for RBAC.
181
+
182
+ ---
183
+
184
+ ## Authenticated HTTP (`http` prop)
185
+
186
+ Every request the lib makes — metrics, filter definitions, filter values, filter label resolution, logs (and traces when shipped) — must be authenticated. Configure this **once** via the `http` prop on `<observability.Routes>` instead of patching each data source individually:
187
+
188
+ ```tsx
189
+ <observability.Routes
190
+ baseUrl={baseUrl}
191
+ http={{
192
+ // Send cookies (e.g. the Gravitee session) on every request.
193
+ credentials: 'include',
194
+ // Function form is re-evaluated per request, so short-lived tokens
195
+ // (rolling XSRF) stay fresh.
196
+ headers: () => ({
197
+ 'X-Requested-With': 'XMLHttpRequest',
198
+ 'X-Xsrf-Token': readXsrfTokenFromCookie(),
199
+ }),
200
+ }}
201
+ />
202
+ ```
203
+
204
+ | Option | Purpose |
205
+ | ------------- | ---------------------------------------------------------------------------------------------------------- |
206
+ | `fetch` | Custom fetch implementation — useful when the host already has an authenticated client |
207
+ | `headers` | Static `HeadersInit` or a factory called per-request (re-evaluated for every call, ideal for rolling XSRF) |
208
+ | `credentials` | Forwarded to `fetch` — `'include'` when the host relies on cookies |
209
+
210
+ The `http` config is applied to **every** internally-built source. Resolution order:
211
+
212
+ 1. `http` prop on `<observability.Routes>` (explicit, wins)
213
+ 2. Nearest `HttpProvider` ancestor
214
+ 3. Bare `fetch` (no auth) — only when neither of the above is provided
215
+
216
+ > Per-source option bags (`createHttpDataSource(baseUrl, options)`, `createHttpLogsSource(baseUrl, options)`) still exist for advanced overrides (see [Advanced Topics](#advanced-topics)), but the `http` prop is the recommended centralized pattern — supply it once and you are done.
217
+
218
+ ---
219
+
165
220
  ## Feature: Dashboards
166
221
 
167
222
  ### Dashboard templates
@@ -251,6 +306,42 @@ dashboards: {
251
306
  - `contextFilters` — merged into every `fetchTimeSeries`, `fetchFacets`, `fetchMeasures` call
252
307
  - `scopeFilterField` — restricts which filter providers appear in the FilterBar (only those whose `scopes` include the active values)
253
308
 
309
+ ### Cross-section links (Dashboards → Logs)
310
+
311
+ Dashboards can render **optional** toolbar links for cross-section navigation — typically a _"See associated logs"_ link that jumps to the Logs screen **carrying the active dashboard filters over**. Declare them via `externalLinks` on the dashboards feature, and build the target URL with the `buildLogsDeepLink` helper:
312
+
313
+ ```ts
314
+ import { buildLogsDeepLink } from '@gravitee/gamma-lib-observability';
315
+
316
+ dashboards: {
317
+ enabled: true,
318
+ templates: myTemplates,
319
+ externalLinks: [
320
+ {
321
+ label: 'See associated logs',
322
+ // `href` can be a static string or a function receiving the dashboard's
323
+ // current filters. Use `buildLogsDeepLink` to encode them into the logs URL.
324
+ href: (filters) =>
325
+ buildLogsDeepLink({
326
+ basePath: '/observe',
327
+ timeRange: { type: 'relative', period: '1h' },
328
+ filters,
329
+ }),
330
+ },
331
+ ],
332
+ }
333
+ ```
334
+
335
+ Each link renders in the dashboard toolbar as `Label →`. The `href` callback is re-evaluated on every render with the **live** filters, so the target URL always reflects the current filter state.
336
+
337
+ `buildLogsDeepLink({ basePath, timeRange, filters? })` returns a deep link to the logs screen:
338
+
339
+ - builds `<basePath>/logs` (trailing slashes on `basePath` are normalized);
340
+ - encodes `filters` + `timeRange` into the `q` / `v` URL-state params — the **same codec** the routes use — so the Logs screen opens pre-filtered;
341
+ - returns the bare path (no query) when the state matches defaults.
342
+
343
+ > The `href(filters)` callback receives the active **filters** but not the time range (links are declared statically in config). Pass a sensible default `timeRange` to `buildLogsDeepLink` (it is required); the Logs screen lets the user adjust it afterwards.
344
+
254
345
  ### Full `DashboardFeatureConfig`
255
346
 
256
347
  ```ts
@@ -259,6 +350,12 @@ interface DashboardFeatureConfig {
259
350
  templates: DashboardTemplate[];
260
351
  contextFilters?: FilterCondition[];
261
352
  scopeFilterField?: string;
353
+ externalLinks?: ExternalDashboardLink[];
354
+ }
355
+
356
+ interface ExternalDashboardLink {
357
+ label: string;
358
+ href: string | ((filters: readonly FilterCondition[]) => string);
262
359
  }
263
360
  ```
264
361
 
@@ -527,47 +624,89 @@ defineObservabilityFeatures({
527
624
 
528
625
  ### Active nav key detection
529
626
 
530
- Register observability route keys in your `getActiveNavKey` function so the sidebar highlights correctly:
627
+ The lib is the only place that knows how it structures its composite route keys (`observe/dashboards`, `observe/logs`), so let it reparse them. Call `observability.resolveRouteKey(pathname)` in your `getActiveNavKey` function instead of hand-writing the `observe/*` branch:
531
628
 
532
629
  ```ts
533
630
  import { observability } from './config/observability';
534
631
 
535
632
  function getActiveNavKey(pathname: string): string | undefined {
536
- for (const key of observability.routeKeys) {
537
- if (pathname.startsWith(`/${key}`)) return key;
538
- }
633
+ // Handles host-prefixed paths (e.g. /environments/:hrid/aim/observe/logs),
634
+ // falls back to the first enabled feature for a bare `observe` path, and
635
+ // returns null for non-observability paths.
636
+ const observabilityKey = observability.resolveRouteKey(pathname);
637
+ if (observabilityKey !== null) return observabilityKey;
638
+
539
639
  // ...other module routes...
540
640
  }
541
641
  ```
542
642
 
543
- `routeKeys` is an array like `['observe/dashboards', 'observe/logs']`.
643
+ `resolveRouteKey`:
644
+
645
+ - locates the `basePath` segment (`observe` by default) anywhere in the pathname, so host route prefixes are handled automatically;
646
+ - matches the next segment against the lib's own `routeKeys`;
647
+ - falls back to the first enabled feature (`routeKeys[0]`) for a bare base path or an unknown sub-segment — no `?? 'dashboards'` edge case to maintain;
648
+ - returns `null` when the pathname is not an observability path.
649
+
650
+ > **`basePath` must be a single URL segment** (e.g. `observe`, `monitoring`) — it is matched against one path segment. A multi-segment value like `obs/v2` will not resolve.
651
+
652
+ > `routeKeys` is still exposed (an array like `['observe/dashboards', 'observe/logs']`) for cases where you need the raw list — e.g. [merging route keys and routes](#merging-route-keys-and-routes).
544
653
 
545
654
  ### Breadcrumbs
546
655
 
547
- The library does **not** own the breadcrumb UI your module is responsible for rendering it. However, the routes follow a **3-level depth** convention that modules must implement:
656
+ The library does **not** render breadcrumbs — your module owns the breadcrumb UI (it composes `buildLinearBreadcrumbs` from graphene-core and `buildModuleNavPath` from gamma-modules-sdk). But the lib **does** know its own 2-level structure (group + feature), so it returns the breadcrumb **data** for you via `observability.breadcrumbSegments(activeNavKey)`. You map that data onto your renderer.
548
657
 
658
+ ```ts
659
+ type BreadcrumbSegment = { label: string; routeKey?: string };
549
660
  ```
550
- Module Name → Observability Feature → Page Title
661
+
662
+ ```tsx
663
+ import { observability } from './config/observability';
664
+
665
+ const activeNavKey = observability.resolveRouteKey(pathname);
666
+
667
+ // Lib-owned group + feature segments (data only, never JSX):
668
+ const segments = activeNavKey ? observability.breadcrumbSegments(activeNavKey) : null;
669
+
670
+ // Host maps segments onto its own breadcrumb primitives, then appends the
671
+ // 3rd level (dashboard name / log detail) from route params + template/data:
672
+ const breadcrumbs = buildLinearBreadcrumbs([
673
+ ...(segments ?? []).map((s) => ({
674
+ label: s.label,
675
+ href: s.routeKey ? buildModuleNavPath(s.routeKey) : undefined,
676
+ })),
677
+ ...(detailTitle ? [{ label: detailTitle }] : []),
678
+ ]);
551
679
  ```
552
680
 
553
- Examples:
681
+ `breadcrumbSegments`:
554
682
 
555
- | Path | Breadcrumb |
556
- | ---------------------------------- | --------------------------------- |
557
- | `/observe/dashboards` | `AIM Dashboards` |
558
- | `/observe/dashboards/api-overview` | `AIM → Dashboards → API Overview` |
559
- | `/observe/logs` | `AIM → Logs` |
560
- | `/observe/logs/abc-123` | `AIM → Logs → Log Detail` |
683
+ - returns `null` when `activeNavKey` is not an observability key (the host renders its default breadcrumbs);
684
+ - group segment uses `navGroup.label`, with `routeKey` pointing to the **first enabled feature** (the group entry point) — so it auto-adapts when features are added/removed instead of hardcoding `observe/dashboards`;
685
+ - feature segment uses `routes[key].label`.
561
686
 
562
- Use `observability.routes` to build breadcrumb labels dynamically:
687
+ Examples (group label = `Observability`, dashboards enabled first):
688
+
689
+ | Call | Result |
690
+ | ------------------------------------------ | --------------------------------------------------------------------------------------- |
691
+ | `breadcrumbSegments('observe/dashboards')` | `[{ label: 'Observability', routeKey: 'observe/dashboards' }, { label: 'Dashboards' }]` |
692
+ | `breadcrumbSegments('observe/logs')` | `[{ label: 'Observability', routeKey: 'observe/dashboards' }, { label: 'Logs' }]` |
693
+ | `breadcrumbSegments('llm-router')` | `null` |
694
+
695
+ The routes still follow a **3-level depth** convention — `Module Name → Observability Feature → Page Title`. The lib returns the first two levels; the host appends the third (dashboard name, log detail) from the route params and its template/data.
696
+
697
+ ### Merging route keys and routes
698
+
699
+ When your module maintains a single canonical list of route keys and a routes map, spread the lib's contributions into them instead of re-declaring `observe/*` entries by hand:
563
700
 
564
701
  ```ts
565
- const { routes } = observability;
566
- // routes['observe/dashboards'] { path: 'observe/dashboards', label: 'Dashboards' }
567
- // routes['observe/logs'] → { path: 'observe/logs', label: 'Logs' }
702
+ import { observability } from './config/observability';
703
+ import { moduleKeys, moduleRoutes } from './routing';
704
+
705
+ export const ROUTE_KEYS = [...moduleKeys, ...observability.routeKeys] as const;
706
+ export const ROUTES = { ...moduleRoutes, ...observability.routes };
568
707
  ```
569
708
 
570
- For the third level (dashboard name, log detail), read the page title from the route params and your template/data.
709
+ This keeps the lib as the single source of truth for its own keys/labels enabling or disabling a feature automatically updates both lists, with zero duplication in the host.
571
710
 
572
711
  ---
573
712
 
@@ -603,6 +742,35 @@ const capabilities: DashboardCapabilities = {
603
742
 
604
743
  ## Advanced Topics
605
744
 
745
+ ### Module Federation timing
746
+
747
+ When the module runs **federated** inside a host, the gamma-modules-sdk environment is populated **asynchronously** — the real environment id (and therefore the resolved `baseUrl`) is not available on the very first render. If you mount the data-bound observability routes before that id lands, the lib fires analytics queries against the wrong (placeholder) environment; those requests are then cancelled once the real id arrives, producing console noise and a flash of empty/incorrect data.
748
+
749
+ Guard the mount on the SDK environment being ready, with a fallback for standalone dev where there is no host to wait for:
750
+
751
+ ```tsx
752
+ import { useModuleEnvironment } from '@gravitee/gamma-modules-sdk';
753
+
754
+ function ObservabilitySection() {
755
+ const { environmentId, isReady } = useModuleEnvironment();
756
+
757
+ // Standalone dev has no host env to wait for — mount immediately.
758
+ const awaitingHostEnv = import.meta.env.PROD && !isReady;
759
+ if (awaitingHostEnv) {
760
+ return null; // or a lightweight skeleton
761
+ }
762
+
763
+ const baseUrl = buildObservabilityBaseUrl(environmentId);
764
+ return <observability.Routes baseUrl={baseUrl} http={httpConfig} /* … */ />;
765
+ }
766
+ ```
767
+
768
+ Key points:
769
+
770
+ - Wait for the SDK environment to be ready **before** mounting `<observability.Routes>` (or any data-bound route), so the first query uses the correct `baseUrl`.
771
+ - Keep a standalone-dev fallback (`import.meta.env.PROD` guard, or a config flag) so running the module on its own does not block on a host that will never appear.
772
+ - The exact hook/selector depends on your module SDK version — the pattern is "resolve env id → derive baseUrl → mount", not the specific API surface.
773
+
606
774
  ### baseUrl resolution
607
775
 
608
776
  Build the observability `baseUrl` from your module's bootstrap config:
@@ -887,6 +1055,25 @@ export const observability = defineObservabilityFeatures({
887
1055
  },
888
1056
  nav: { label: 'Observability' },
889
1057
  });
1058
+
1059
+ // Single source of truth for route keys/routes — spread the lib's contributions.
1060
+ export const ROUTE_KEYS = [...moduleKeys, ...observability.routeKeys] as const;
1061
+ export const ROUTES = { ...moduleRoutes, ...observability.routes };
1062
+ ```
1063
+
1064
+ ```ts
1065
+ // src/config/navigation.ts — active nav key + breadcrumbs via the lib helpers
1066
+ import { observability } from './config/observability';
1067
+
1068
+ export function getActiveNavKey(pathname: string): string | undefined {
1069
+ return observability.resolveRouteKey(pathname) ?? resolveModuleNavKey(pathname);
1070
+ }
1071
+
1072
+ export function getBreadcrumbSegments(pathname: string) {
1073
+ const activeNavKey = observability.resolveRouteKey(pathname);
1074
+ // Returns null for non-observability paths → host renders its defaults.
1075
+ return activeNavKey ? observability.breadcrumbSegments(activeNavKey) : null;
1076
+ }
890
1077
  ```
891
1078
 
892
1079
  ```tsx
@@ -898,6 +1085,8 @@ import { observability } from './config/observability';
898
1085
  import { connectionLogsDataSource, logColumns } from './config/logs';
899
1086
 
900
1087
  function AppRoutes() {
1088
+ // Resolve baseUrl from the SDK env; wait for it before mounting when federated
1089
+ // (see "Module Federation timing").
901
1090
  const baseUrl = useObservabilityBaseUrl();
902
1091
 
903
1092
  return (
@@ -911,6 +1100,14 @@ function AppRoutes() {
911
1100
  element={
912
1101
  <observability.Routes
913
1102
  baseUrl={baseUrl}
1103
+ // Centralized auth — applied to metrics, filters, and logs sources.
1104
+ http={{
1105
+ credentials: 'include',
1106
+ headers: () => ({
1107
+ 'X-Requested-With': 'XMLHttpRequest',
1108
+ 'X-Xsrf-Token': readXsrfTokenFromCookie(),
1109
+ }),
1110
+ }}
914
1111
  logsDataSource={connectionLogsDataSource}
915
1112
  logsColumns={logColumns}
916
1113
  logsOnRowClick={(entry) => navigate(`/observe/logs/${(entry as ConnectionLog).requestId}`)}
package/USAGE_GUIDE.md CHANGED
@@ -624,12 +624,64 @@ const observability = defineObservabilityFeatures({
624
624
  });
625
625
 
626
626
  // Returns:
627
- // observability.Routes — React component to mount under your module's routes
628
- // observability.navGroup — Navigation group descriptor for your sidenav
629
- // observability.routeKeys — Array of route keys for breadcrumb integration
630
- // observability.routes — Record of { path, label } for each enabled feature
627
+ // observability.Routes — React component to mount under your module's routes
628
+ // observability.navGroup — Navigation group descriptor for your sidenav
629
+ // observability.routeKeys — Array of route keys for breadcrumb integration
630
+ // observability.routes — Record of { path, label } for each enabled feature
631
+ // observability.resolveRouteKey — (pathname) => composite route key | null
632
+ // observability.breadcrumbSegments — (activeNavKey) => BreadcrumbSegment[] | null
631
633
  ```
632
634
 
635
+ ### `ObservabilityFeatures` API reference
636
+
637
+ | Member | Type | Description |
638
+ | -------------------- | ------------------------------------------------------- | --------------------------------------------------------------------------------------- |
639
+ | `Routes` | `(props: ObservabilityRoutesProps) => ReactNode` | Route tree to mount under `observe/*`. |
640
+ | `navGroup` | `NavGroup` | `{ label, items }` descriptor for the sidenav. Only enabled features appear in `items`. |
641
+ | `routeKeys` | `readonly string[]` | Composite keys for enabled features, e.g. `['observe/dashboards', 'observe/logs']`. |
642
+ | `routes` | `Record<string, { path; label }>` | Per-feature `{ path, label }` keyed by composite route key. |
643
+ | `resolveRouteKey` | `(pathname: string) => string \| null` | Reparses a host pathname into the matching composite route key. See below. |
644
+ | `breadcrumbSegments` | `(activeNavKey: string) => BreadcrumbSegment[] \| null` | Builds group + feature breadcrumb data for an active key. See below. |
645
+
646
+ #### `resolveRouteKey(pathname)`
647
+
648
+ Resolves a (possibly host-prefixed) pathname to the matching composite route key.
649
+
650
+ ```ts
651
+ observability.resolveRouteKey('/observe/dashboards'); // → 'observe/dashboards'
652
+ observability.resolveRouteKey('/environments/DEFAULT/aim/observe/logs'); // → 'observe/logs'
653
+ observability.resolveRouteKey('/observe'); // → 'observe/dashboards' (first enabled feature)
654
+ observability.resolveRouteKey('/llm-router'); // → null
655
+ ```
656
+
657
+ - Locates the `basePath` segment (`observe` by default) anywhere in the pathname, so host route prefixes are handled automatically.
658
+ - Matches the following segment against the lib's own `routeKeys`.
659
+ - Falls back to the first enabled feature (`routeKeys[0]`) for a bare base path or an unknown sub-segment.
660
+ - Returns `null` when the pathname is not an observability path (or no features are enabled).
661
+
662
+ > `basePath` must be a single URL segment (e.g. `observe`, `monitoring`); a multi-segment value such as `obs/v2` will not resolve.
663
+
664
+ #### `breadcrumbSegments(activeNavKey)`
665
+
666
+ Returns breadcrumb **data** (the lib never returns JSX) for an active composite route key.
667
+
668
+ ```ts
669
+ type BreadcrumbSegment = { label: string; routeKey?: string };
670
+
671
+ observability.breadcrumbSegments('observe/dashboards');
672
+ // → [{ label: 'Observability', routeKey: 'observe/dashboards' }, { label: 'Dashboards' }]
673
+
674
+ observability.breadcrumbSegments('observe/logs');
675
+ // → [{ label: 'Observability', routeKey: 'observe/dashboards' }, { label: 'Logs' }]
676
+
677
+ observability.breadcrumbSegments('llm-router'); // → null
678
+ ```
679
+
680
+ - The group segment uses `navGroup.label` and points its `routeKey` at the **first enabled feature** (the entry point) — it auto-adapts when features are added/removed.
681
+ - The feature segment uses `routes[key].label`.
682
+ - Returns `null` when `activeNavKey` is not an observability key.
683
+ - The host maps the segments onto its own breadcrumb renderer (e.g. `buildLinearBreadcrumbs` + `buildModuleNavPath`) and appends any 3rd-level title (dashboard name, log detail) itself.
684
+
633
685
  ### Mounting Routes
634
686
 
635
687
  ```tsx
@@ -682,7 +734,7 @@ const { navGroup } = observability;
682
734
  // navGroup.items → [{ key: 'observe/dashboards', title: 'Dashboards', icon: LayoutDashboardIcon }]
683
735
  ```
684
736
 
685
- Breadcrumbs are handled by the calling module — the library does not own the layout shell.
737
+ Breadcrumbs are rendered by the calling module — the library does not own the layout shell — but the lib supplies the breadcrumb **data** (group + feature) via `observability.breadcrumbSegments(activeNavKey)`. See the [`ObservabilityFeatures` API reference](#observabilityfeatures-api-reference) above.
686
738
 
687
739
  ---
688
740
 
@@ -717,6 +769,33 @@ logs: {
717
769
  - `contextFilters` are automatically merged into every `fetchLogs` call by the query hooks.
718
770
  - `scopeFilterField` restricts which filter providers appear in the `FilterBar` (only those whose `scopes` overlap with the active context values).
719
771
 
772
+ ### Deep-linking to the logs screen (`buildLogsDeepLink`)
773
+
774
+ Use `buildLogsDeepLink` to build a URL that opens the Logs screen pre-filtered — typically from a dashboard's `externalLinks` cross-section link (see `DashboardFeatureConfig.externalLinks` in [`INTEGRATION.md`](./INTEGRATION.md#cross-section-links-dashboards--logs)).
775
+
776
+ ```tsx
777
+ import { buildLogsDeepLink, type BuildLogsDeepLinkParams } from '@gravitee/gamma-lib-observability';
778
+
779
+ const href = buildLogsDeepLink({
780
+ basePath: '/observe',
781
+ timeRange: { type: 'relative', period: '1h' },
782
+ filters: [{ field: 'STATUS', label: 'Status', operator: 'in', value: ['500'] }],
783
+ });
784
+ // → '/observe/logs?q=...&v=1'
785
+ ```
786
+
787
+ | Param | Type | Description |
788
+ | ----------- | ------------------------------ | -------------------------------------------------------------- |
789
+ | `basePath` | `string` | Mount base (e.g. `/observe`). Trailing slashes are normalized. |
790
+ | `timeRange` | `TimeRange` | Time range encoded into the URL state. |
791
+ | `filters` | `FilterCondition[]` (optional) | Filters encoded into the URL state. Defaults to `[]`. |
792
+
793
+ Behavior:
794
+
795
+ - targets `<basePath>/logs`;
796
+ - encodes `filters` + `timeRange` into the `q` / `v` params via the same codec as `encodeObservabilityState`, so the Logs screen restores them on load;
797
+ - returns the bare path (no query string) when the state matches defaults.
798
+
720
799
  ### Custom logs page (escape hatch)
721
800
 
722
801
  For full control over the logs page layout, pass a pre-composed `logsPage` ReactNode instead of `logsDataSource`/`logsColumns`. You must wrap your page with `LogsDataSourceProvider`:
package/dist/index.d.ts CHANGED
@@ -23,7 +23,7 @@ export { buildDefaultLogDetailConfig, connectionLogPreset, defineLogDetail, LogD
23
23
  export type { BuildDefaultLogDetailConfigOptions, ConnectionLogDetailData, ConnectionLogPresetOptions, DeliveryAttempt, DefineLogDetailInput, DefineLogDetailMultiInput, DefineLogDetailSingleInput, LogDetailCodeBlockProps, LogDetailConfig, LogDetailConfigMulti, LogDetailConfigSingle, LogDetailContextChartConfig, LogDetailContextChartProps, LogDetailDrawerProps, LogDetailDrawerShellProps, LogDetailEmptyFieldProps, LogDetailFieldDefinition, LogDetailHeaderComponentProps, LogDetailHeaderProps, LogDetailHeadersTableProps, LogDetailHelpers, LogDetailJsonTreeProps, LogDetailKeyValueGridProps, LogDetailMetricDefinition, LogDetailMetricsProps, LogDetailPageProps, LogDetailPresetResolution, LogDetailSectionDefinition, LogDetailSectionProps, LogDetailSectionsProps, LogDetailVariant, MessageEntry, MessageLogDetailData, MessageLogPresetOptions, WebhookLogDetailData, WebhookLogPresetOptions, } from './logs/detail';
24
24
  export { defineObservabilityFeatures } from './routing';
25
25
  export { ContextFiltersProvider, useContextFilters } from './routing';
26
- export type { ContextFiltersProviderProps, DashboardFeatureConfig, ExternalDashboardLink, FeatureKey, LogsFeatureConfig, NavGroup, NavItem, ObservabilityFeatures, ObservabilityFeaturesConfig, ObservabilityRoutesProps, } from './routing';
26
+ export type { BreadcrumbSegment, ContextFiltersProviderProps, DashboardFeatureConfig, ExternalDashboardLink, FeatureKey, LogsFeatureConfig, NavGroup, NavItem, ObservabilityFeatures, ObservabilityFeaturesConfig, ObservabilityRoutesProps, } from './routing';
27
27
  export { createHttpDataSource, type HttpDataSourceOptions } from './data-sources';
28
28
  export { createHttpFilterSource, type FilterSource } from './data-sources';
29
29
  export { createHttpLogsSource, type HttpLogsSourceOptions } from './data-sources';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,YAAY,EACV,iBAAiB,EACjB,cAAc,EACd,SAAS,EACT,eAAe,EACf,aAAa,EACb,SAAS,EACT,qBAAqB,EACrB,cAAc,EACd,eAAe,EACf,cAAc,EACd,yBAAyB,EACzB,iBAAiB,EACjB,oBAAoB,EACpB,YAAY,EACZ,cAAc,EACd,iBAAiB,EACjB,gBAAgB,EAChB,oBAAoB,EACpB,SAAS,EACT,MAAM,EACN,YAAY,EACZ,UAAU,GACX,MAAM,SAAS,CAAC;AAEjB,OAAO,EACL,oBAAoB,EACpB,eAAe,EACf,gBAAgB,EAChB,WAAW,EACX,iBAAiB,EACjB,gBAAgB,EAChB,mBAAmB,EACnB,cAAc,EACd,cAAc,GACf,MAAM,SAAS,CAAC;AAEjB,YAAY,EACV,cAAc,EACd,WAAW,EACX,OAAO,EACP,YAAY,EACZ,QAAQ,EACR,UAAU,EACV,eAAe,EACf,eAAe,EACf,SAAS,GACV,MAAM,SAAS,CAAC;AAEjB,YAAY,EACV,kBAAkB,EAClB,aAAa,EACb,SAAS,EACT,mBAAmB,EACnB,eAAe,EACf,aAAa,EACb,iBAAiB,EACjB,UAAU,GACX,MAAM,SAAS,CAAC;AAGjB,YAAY,EACV,oBAAoB,EACpB,oBAAoB,EACpB,cAAc,EACd,eAAe,EACf,iBAAiB,EACjB,gBAAgB,EAChB,iBAAiB,GAClB,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EACL,kBAAkB,EAClB,4BAA4B,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AAM,WAAW,CAAC;AAEtE,YAAY,EACV,2BAA2B,EAC3B,sBAAsB,EACtB,qBAAqB,EACrB,UAAU,EACV,iBAAiB,EACjB,QAAQ,EACR,OAAO,EACP,qBAAqB,EACrB,2BAA2B,EAC3B,wBAAwB,GACzB,MAAM,WAAW,CAAC;AAGnB,OAAO,EAAE,oBAAoB,EAAE,KAAK,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AAClF,OAAO,EAAE,sBAAsB,EAAE,KAAK,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC3E,OAAO,EAAE,oBAAoB,EAAE,KAAK,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AAGlF,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,YAAY,EACV,iBAAiB,EACjB,cAAc,EACd,SAAS,EACT,eAAe,EACf,aAAa,EACb,SAAS,EACT,qBAAqB,EACrB,cAAc,EACd,eAAe,EACf,cAAc,EACd,yBAAyB,EACzB,iBAAiB,EACjB,oBAAoB,EACpB,YAAY,EACZ,cAAc,EACd,iBAAiB,EACjB,gBAAgB,EAChB,oBAAoB,EACpB,SAAS,EACT,MAAM,EACN,YAAY,EACZ,UAAU,GACX,MAAM,SAAS,CAAC;AAEjB,OAAO,EACL,oBAAoB,EACpB,eAAe,EACf,gBAAgB,EAChB,WAAW,EACX,iBAAiB,EACjB,gBAAgB,EAChB,mBAAmB,EACnB,cAAc,EACd,cAAc,GACf,MAAM,SAAS,CAAC;AAEjB,YAAY,EACV,cAAc,EACd,WAAW,EACX,OAAO,EACP,YAAY,EACZ,QAAQ,EACR,UAAU,EACV,eAAe,EACf,eAAe,EACf,SAAS,GACV,MAAM,SAAS,CAAC;AAEjB,YAAY,EACV,kBAAkB,EAClB,aAAa,EACb,SAAS,EACT,mBAAmB,EACnB,eAAe,EACf,aAAa,EACb,iBAAiB,EACjB,UAAU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gB,EAChB,YAAY,EACZ,oBAAoB,EACpB,uBAAuB,EACvB,oBAAoB,EACpB,uBAAuB,GACxB,MAAM,eAAe,CAAC;AAGvB,OAAO,EAAE,2BAA2B,EAAE,MAAM,WAAW,CAAC;AACxD,OAAO,EAAE,sBAAsB,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAEtE,YAAY,EACV,iBAAiB,EACjB,2BAA2B,EAC3B,sBAAsB,EACtB,qBAAqB,EACrB,UAAU,EACV,iBAAiB,EACjB,QAAQ,EACR,OAAO,EACP,qBAAqB,EACrB,2BAA2B,EAC3B,wBAAwB,GACzB,MAAM,WAAW,CAAC;AAGnB,OAAO,EAAE,oBAAoB,EAAE,KAAK,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AAClF,OAAO,EAAE,sBAAsB,EAAE,KAAK,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC3E,OAAO,EAAE,oBAAoB,EAAE,KAAK,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AAGlF,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC"}
package/dist/index.js CHANGED
@@ -5176,11 +5176,28 @@ function Ss(e) {
5176
5176
  config: e
5177
5177
  });
5178
5178
  }
5179
+ function s(e) {
5180
+ let n = e.split("/").filter(Boolean), r = n.indexOf(t);
5181
+ if (r === -1) return null;
5182
+ let a = n[r + 1], o = a ? `${t}/${a}` : null;
5183
+ return o !== null && i.includes(o) ? o : i[0] ?? null;
5184
+ }
5185
+ function c(e) {
5186
+ let t = a[e];
5187
+ if (t === void 0) return null;
5188
+ let n = i[0];
5189
+ return [{
5190
+ label: r.label,
5191
+ routeKey: n
5192
+ }, { label: t.label }];
5193
+ }
5179
5194
  return {
5180
5195
  navGroup: r,
5181
5196
  routeKeys: i,
5182
5197
  routes: a,
5183
- Routes: o
5198
+ Routes: o,
5199
+ resolveRouteKey: s,
5200
+ breadcrumbSegments: c
5184
5201
  };
5185
5202
  }
5186
5203
  function Cs(e) {
@@ -1 +1 @@
1
- {"version":3,"file":"define-observability-features.d.ts","sourceRoot":"","sources":["../../src/routing/define-observability-features.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAIV,qBAAqB,EACrB,2BAA2B,EAE5B,MAAM,SAAS,CAAC;AAajB,wBAAgB,2BAA2B,CAAC,MAAM,EAAE,2BAA2B,GAAG,qBAAqB,CAatG"}
1
+ {"version":3,"file":"define-observability-features.d.ts","sourceRoot":"","sources":["../../src/routing/define-observability-features.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAKV,qBAAqB,EACrB,2BAA2B,EAE5B,MAAM,SAAS,CAAC;AAajB,wBAAgB,2BAA2B,CAAC,MAAM,EAAE,2BAA2B,GAAG,qBAAqB,CAwCtG"}
@@ -1,5 +1,5 @@
1
1
  export { defineObservabilityFeatures } from './define-observability-features';
2
2
  export { ContextFiltersProvider, useContextFilters } from './ContextFiltersProvider';
3
3
  export type { ContextFiltersProviderProps } from './ContextFiltersProvider';
4
- export type { DashboardFeatureConfig, ExternalDashboardLink, FeatureKey, LogsFeatureConfig, NavGroup, NavItem, ObservabilityFeatures, ObservabilityFeaturesConfig, ObservabilityRoutesProps, } from './types';
4
+ export type { BreadcrumbSegment, DashboardFeatureConfig, ExternalDashboardLink, FeatureKey, LogsFeatureConfig, NavGroup, NavItem, ObservabilityFeatures, ObservabilityFeaturesConfig, ObservabilityRoutesProps, } from './types';
5
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/routing/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,2BAA2B,EAAE,MAAM,iCAAiC,CAAC;AAC9E,OAAO,EAAE,sBAAsB,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AACrF,YAAY,EAAE,2BAA2B,EAAE,MAAM,0BAA0B,CAAC;AAC5E,YAAY,EACV,sBAAsB,EACtB,qBAAqB,EACrB,UAAU,EACV,iBAAiB,EACjB,QAAQ,EACR,OAAO,EACP,qBAAqB,EACrB,2BAA2B,EAC3B,wBAAwB,GACzB,MAAM,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/routing/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,2BAA2B,EAAE,MAAM,iCAAiC,CAAC;AAC9E,OAAO,EAAE,sBAAsB,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AACrF,YAAY,EAAE,2BAA2B,EAAE,MAAM,0BAA0B,CAAC;AAC5E,YAAY,EACV,iBAAiB,EACjB,sBAAsB,EACtB,qBAAqB,EACrB,UAAU,EACV,iBAAiB,EACjB,QAAQ,EACR,OAAO,EACP,qBAAqB,EACrB,2BAA2B,EAC3B,wBAAwB,GACzB,MAAM,SAAS,CAAC"}
@@ -97,6 +97,16 @@ export interface NavGroup {
97
97
  label: string;
98
98
  items: NavItem[];
99
99
  }
100
+ /**
101
+ * A single breadcrumb entry returned by {@link ObservabilityFeatures.breadcrumbSegments}.
102
+ * The lib returns data only — the host maps it onto its own breadcrumb renderer
103
+ * (e.g. `buildLinearBreadcrumbs` from graphene-core).
104
+ */
105
+ export interface BreadcrumbSegment {
106
+ label: string;
107
+ /** Composite route key to link to. Omitted for the (non-clickable) leaf segment. */
108
+ routeKey?: string;
109
+ }
100
110
  export interface ObservabilityFeatures {
101
111
  navGroup: NavGroup;
102
112
  routeKeys: readonly string[];
@@ -105,5 +115,19 @@ export interface ObservabilityFeatures {
105
115
  label: string;
106
116
  }>;
107
117
  Routes: (props: ObservabilityRoutesProps) => ReactNode;
118
+ /**
119
+ * Resolves a host pathname to the matching composite route key
120
+ * (e.g. `observe/dashboards`). Handles host-prefixed paths by locating the
121
+ * base path segment, falls back to the first enabled feature for a bare base
122
+ * path, and returns `null` when the pathname is not an observability path.
123
+ */
124
+ resolveRouteKey: (pathname: string) => string | null;
125
+ /**
126
+ * Builds breadcrumb data (group + feature) for an active composite route key.
127
+ * The group segment's entry point is derived from the first enabled feature,
128
+ * so it auto-adapts when features are added or removed. Returns `null` when
129
+ * `activeNavKey` is not an observability key.
130
+ */
131
+ breadcrumbSegments: (activeNavKey: string) => BreadcrumbSegment[] | null;
108
132
  }
109
133
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/routing/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACpD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AACjE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AACvE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AAC7E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAE/D,MAAM,MAAM,UAAU,GAAG,YAAY,GAAG,MAAM,CAAC;AAE/C,MAAM,WAAW,sBAAsB;IACrC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,SAAS,EAAE,SAAS,iBAAiB,EAAE,CAAC;IACxC,cAAc,CAAC,EAAE,eAAe,EAAE,CAAC;IACnC;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B;;;;OAIG;IACH,aAAa,CAAC,EAAE,SAAS,qBAAqB,EAAE,CAAC;CAClD;AAED,MAAM,WAAW,qBAAqB;IACpC,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,GAAG,CAAC,CAAC,OAAO,EAAE,SAAS,eAAe,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E,MAAM,KAAK,iBAAiB,EAAE,GAAG,IAAI,CAAC;CAC1E"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gravitee/gamma-lib-observability",
3
- "version": "1.5.0",
3
+ "version": "1.6.0",
4
4
  "description": "Shared observability library for Gamma modules — dashboards, logs, tracing UI components and integration with business rules.",
5
5
  "type": "module",
6
6
  "packageManager": "yarn@4.14.1",