@gravitee/gamma-lib-observability 1.29.0 → 1.30.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 +45 -55
- package/QUERYING.md +5 -5
- package/USAGE_GUIDE.md +178 -231
- package/dist/build-observability-base-url.d.ts +12 -12
- package/dist/build-observability-base-url.d.ts.map +1 -1
- package/dist/build-traces-base-url.d.ts +9 -18
- package/dist/build-traces-base-url.d.ts.map +1 -1
- package/dist/data-sources/http-data-source.d.ts.map +1 -1
- package/dist/data-sources/http-filter-source.d.ts.map +1 -1
- package/dist/data-sources/http-logs-source.d.ts +1 -13
- package/dist/data-sources/http-logs-source.d.ts.map +1 -1
- package/dist/data-sources/logs-data-source.d.ts +1 -1
- package/dist/data-sources/logs-data-source.d.ts.map +1 -1
- package/dist/filters/filter-provider.d.ts +6 -0
- package/dist/filters/filter-provider.d.ts.map +1 -1
- package/dist/hooks/query-keys.d.ts +1 -1
- package/dist/hooks/query-keys.d.ts.map +1 -1
- package/dist/hooks/use-log-detail-query.d.ts +1 -0
- package/dist/hooks/use-log-detail-query.d.ts.map +1 -1
- package/dist/hooks/use-logs-histogram-query.d.ts +0 -7
- package/dist/hooks/use-logs-histogram-query.d.ts.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1460 -1498
- package/dist/logs/LogsExplorerPage.d.ts +1 -7
- package/dist/logs/LogsExplorerPage.d.ts.map +1 -1
- package/dist/logs/detail/components/LogDetailContent.d.ts.map +1 -1
- package/dist/logs/detail/components/LogDetailContextChart.d.ts +1 -3
- package/dist/logs/detail/components/LogDetailContextChart.d.ts.map +1 -1
- package/dist/logs/detail/components/LogDetailDrawer.d.ts +2 -1
- package/dist/logs/detail/components/LogDetailDrawer.d.ts.map +1 -1
- package/dist/logs/detail/components/LogDetailPage.d.ts.map +1 -1
- package/dist/logs/detail/types.d.ts +0 -7
- package/dist/logs/detail/types.d.ts.map +1 -1
- package/dist/logs/index.d.ts +0 -2
- package/dist/logs/index.d.ts.map +1 -1
- package/dist/routing/LogsRouteElement.d.ts +3 -3
- package/dist/routing/LogsRouteElement.d.ts.map +1 -1
- package/dist/routing/ObservabilityRoutes.d.ts +2 -1
- package/dist/routing/ObservabilityRoutes.d.ts.map +1 -1
- package/dist/routing/types.d.ts +47 -16
- package/dist/routing/types.d.ts.map +1 -1
- package/dist/styles/observability.css +1 -1
- package/package.json +5 -5
- package/dist/logs/analytics-filter-mapping.d.ts +0 -35
- package/dist/logs/analytics-filter-mapping.d.ts.map +0 -1
package/INTEGRATION.md
CHANGED
|
@@ -35,8 +35,8 @@ Your module must provide these packages. They are **not** bundled by the library
|
|
|
35
35
|
| `react-dom` | ^19.0.0 | |
|
|
36
36
|
| `react-router-dom` | ^7.0.0 | |
|
|
37
37
|
| `@tanstack/react-query` | ^5.0.0 | Must be a **shared singleton** if using Module Federation |
|
|
38
|
-
| `@gravitee/graphene-core` | ^2.
|
|
39
|
-
| `@gravitee/graphene-charts` | ^2.
|
|
38
|
+
| `@gravitee/graphene-core` | ^2.49.0 | Design system primitives (buttons, popovers, tables, icons) |
|
|
39
|
+
| `@gravitee/graphene-charts` | ^2.49.0 | Chart components (dashboard widgets, trace waterfall & lineage). Sub-paths `/dashboard-grid` and `/lineage` are used. |
|
|
40
40
|
| `react-grid-layout` | ^2.0.0 | Required by `@gravitee/graphene-charts/dashboard-grid`. The lib does **not** bundle it. |
|
|
41
41
|
| `@xyflow/react` | ^12.0.0 | **Optional.** Only required to render the trace **Lineage** view; lazy-loaded, so apps that never open it can omit it. See [Tracing — Lineage view](#tracing--lineage-view). |
|
|
42
42
|
| `tailwindcss` | ^4.0.0 | Optional — only if you compile Tailwind yourself |
|
|
@@ -115,8 +115,8 @@ shared: {
|
|
|
115
115
|
'react-dom': { singleton: true, requiredVersion: '^19.0.0' },
|
|
116
116
|
'react-router-dom': { singleton: true, requiredVersion: '^7.0.0' },
|
|
117
117
|
'@tanstack/react-query': { singleton: true, requiredVersion: '^5.0.0' },
|
|
118
|
-
'@gravitee/graphene-core': { singleton: true, requiredVersion: '^2.
|
|
119
|
-
'@gravitee/graphene-charts': { singleton: true, requiredVersion: '^2.
|
|
118
|
+
'@gravitee/graphene-core': { singleton: true, requiredVersion: '^2.49.0' },
|
|
119
|
+
'@gravitee/graphene-charts': { singleton: true, requiredVersion: '^2.49.0' },
|
|
120
120
|
'react-grid-layout': { singleton: true, requiredVersion: '^2.0.0' },
|
|
121
121
|
}
|
|
122
122
|
```
|
|
@@ -320,7 +320,7 @@ time bucket.
|
|
|
320
320
|
}
|
|
321
321
|
```
|
|
322
322
|
|
|
323
|
-
- `axisId`: `'left'` (default) or `'right'` — requires `@gravitee/graphene-charts` ≥ 2.
|
|
323
|
+
- `axisId`: `'left'` (default) or `'right'` — requires `@gravitee/graphene-charts` ≥ 2.49 with dual-axis support.
|
|
324
324
|
- `unit`: optional suffix for tooltips (`1,234 req`, `250 ms`).
|
|
325
325
|
- Omit `axisId` on every series to keep the previous single-axis behaviour.
|
|
326
326
|
|
|
@@ -347,15 +347,11 @@ Context filters are always-on filters silently merged into every data query. Use
|
|
|
347
347
|
dashboards: {
|
|
348
348
|
enabled: true,
|
|
349
349
|
templates: [apiOverviewTemplate],
|
|
350
|
-
|
|
351
|
-
{ field: 'API_TYPE', label: 'API Type', operator: 'in', value: ['MCP', 'LLM'] },
|
|
352
|
-
],
|
|
353
|
-
scopeFilterField: 'API_TYPE',
|
|
350
|
+
scopeApiTypes: ['MCP', 'LLM'],
|
|
354
351
|
}
|
|
355
352
|
```
|
|
356
353
|
|
|
357
|
-
|
|
358
|
-
- `scopeFilterField` — restricts which filter providers appear in the FilterBar (only those whose `scopes` include the active values)
|
|
354
|
+
`scopeApiTypes` generates `API_TYPE` context filters (merged into every analytics query) and sets `scopeFilterField` to restrict which filter providers appear in the FilterBar. For non-API_TYPE scoping, use `contextFilters` + `scopeFilterField` directly.
|
|
359
355
|
|
|
360
356
|
### Cross-section links (Dashboards → Logs)
|
|
361
357
|
|
|
@@ -425,8 +421,7 @@ export const observability = defineObservabilityFeatures({
|
|
|
425
421
|
dashboards: { enabled: true, templates: myTemplates },
|
|
426
422
|
logs: {
|
|
427
423
|
enabled: true,
|
|
428
|
-
|
|
429
|
-
scopeFilterField: 'ENTRYPOINT',
|
|
424
|
+
scopeApiTypes: ['HTTP_PROXY'],
|
|
430
425
|
pageSize: 25,
|
|
431
426
|
columnVisibilityStorageKey: 'apim-logs-columns',
|
|
432
427
|
},
|
|
@@ -521,15 +516,15 @@ const columns: LogColumnDefinition<ConnectionLog>[] = [
|
|
|
521
516
|
|
|
522
517
|
Column variants: `text` (default), `badge`, `status-code`, `duration`, `datetime`, `http-method`.
|
|
523
518
|
|
|
524
|
-
### Scope filtering via
|
|
519
|
+
### Scope filtering via API_TYPE
|
|
525
520
|
|
|
526
|
-
|
|
521
|
+
Logs scope by `API_TYPE`, the same unified vocabulary used by dashboards:
|
|
527
522
|
|
|
528
|
-
| API type |
|
|
529
|
-
| -------- |
|
|
530
|
-
| MCP | `['
|
|
531
|
-
| LLM | `['
|
|
532
|
-
| HTTP | `['
|
|
523
|
+
| API type | Filter values |
|
|
524
|
+
| -------- | ---------------- |
|
|
525
|
+
| MCP | `['MCP']` |
|
|
526
|
+
| LLM | `['LLM']` |
|
|
527
|
+
| HTTP | `['HTTP_PROXY']` |
|
|
533
528
|
|
|
534
529
|
### Custom logs page (escape hatch)
|
|
535
530
|
|
|
@@ -622,7 +617,7 @@ For full data type reference, see [`USAGE_GUIDE.md` — Widget Integration Level
|
|
|
622
617
|
|
|
623
618
|
## Feature: Traces
|
|
624
619
|
|
|
625
|
-
Trace support ships a full UI route (`observe/tracing`) with search, filters, and detail views. Tracing endpoints live under the
|
|
620
|
+
Trace support ships a full UI route (`observe/tracing`) with search, filters, and detail views. Tracing endpoints live under the same Gamma API surface as all other observability endpoints:
|
|
626
621
|
|
|
627
622
|
```ts
|
|
628
623
|
import type {
|
|
@@ -664,18 +659,19 @@ The capability key `observability.traces.read` is already wired.
|
|
|
664
659
|
|
|
665
660
|
### tracesBaseUrl
|
|
666
661
|
|
|
667
|
-
|
|
662
|
+
Since `baseUrl` is now Gamma-scoped, `tracesBaseUrl` is redundant — it falls back to `baseUrl` when omitted. It is kept for backward compatibility:
|
|
668
663
|
|
|
669
664
|
```tsx
|
|
670
|
-
import { buildObservabilityBaseUrl
|
|
665
|
+
import { buildObservabilityBaseUrl } from '@gravitee/gamma-lib-observability';
|
|
671
666
|
|
|
672
|
-
const baseUrl = buildObservabilityBaseUrl(
|
|
673
|
-
const tracesBaseUrl = buildTracesBaseUrl(gammaBaseURL, organizationId, environmentId);
|
|
667
|
+
const baseUrl = buildObservabilityBaseUrl(gammaBaseURL, organizationId, environmentId);
|
|
674
668
|
|
|
675
|
-
<observability.Routes baseUrl={baseUrl}
|
|
669
|
+
<observability.Routes baseUrl={baseUrl} http={httpConfig} />;
|
|
676
670
|
```
|
|
677
671
|
|
|
678
|
-
`buildTracesBaseUrl`
|
|
672
|
+
Both `buildObservabilityBaseUrl` and `buildTracesBaseUrl` now produce identical Gamma-scoped URLs. `tracesBaseUrl` is optional and falls back to `baseUrl`.
|
|
673
|
+
|
|
674
|
+
`buildTracesBaseUrl` is kept as a backward-compatible alias:
|
|
679
675
|
|
|
680
676
|
```ts
|
|
681
677
|
import { buildTracesBaseUrl } from '@gravitee/gamma-lib-observability';
|
|
@@ -698,7 +694,7 @@ const tracesBaseUrl = buildTracesBaseUrl(bootstrapConfig.gammaBaseURL, organizat
|
|
|
698
694
|
// → '/gamma/organizations/DEFAULT/environments/DEFAULT'
|
|
699
695
|
```
|
|
700
696
|
|
|
701
|
-
When `tracesBaseUrl` is omitted, the lib falls back to `baseUrl
|
|
697
|
+
When `tracesBaseUrl` is omitted, the lib falls back to `baseUrl`. Both now produce identical Gamma-scoped URLs, so the prop is only needed for backward compatibility.
|
|
702
698
|
|
|
703
699
|
---
|
|
704
700
|
|
|
@@ -861,10 +857,10 @@ Guard the mount on the SDK environment being ready, with a fallback for standalo
|
|
|
861
857
|
|
|
862
858
|
```tsx
|
|
863
859
|
import { useModuleEnvironment } from '@gravitee/gamma-modules-sdk';
|
|
864
|
-
import { buildObservabilityBaseUrl
|
|
860
|
+
import { buildObservabilityBaseUrl } from '@gravitee/gamma-lib-observability';
|
|
865
861
|
|
|
866
862
|
function ObservabilitySection() {
|
|
867
|
-
const { environmentId, organizationId,
|
|
863
|
+
const { environmentId, organizationId, gammaBaseURL, isReady } = useModuleEnvironment();
|
|
868
864
|
|
|
869
865
|
// Standalone dev has no host env to wait for — mount immediately.
|
|
870
866
|
const awaitingHostEnv = import.meta.env.PROD && !isReady;
|
|
@@ -872,9 +868,8 @@ function ObservabilitySection() {
|
|
|
872
868
|
return null; // or a lightweight skeleton
|
|
873
869
|
}
|
|
874
870
|
|
|
875
|
-
const baseUrl = buildObservabilityBaseUrl(
|
|
876
|
-
|
|
877
|
-
return <observability.Routes baseUrl={baseUrl} tracesBaseUrl={tracesBaseUrl} http={httpConfig} /* … */ />;
|
|
871
|
+
const baseUrl = buildObservabilityBaseUrl(gammaBaseURL, organizationId, environmentId);
|
|
872
|
+
return <observability.Routes baseUrl={baseUrl} http={httpConfig} /* … */ />;
|
|
878
873
|
}
|
|
879
874
|
```
|
|
880
875
|
|
|
@@ -891,28 +886,31 @@ Build the observability `baseUrl` from your module's bootstrap config using the
|
|
|
891
886
|
```ts
|
|
892
887
|
import { buildObservabilityBaseUrl } from '@gravitee/gamma-lib-observability';
|
|
893
888
|
|
|
894
|
-
// Production —
|
|
889
|
+
// Production — gammaBaseURL is an absolute URL from bootstrap
|
|
895
890
|
const baseUrl = buildObservabilityBaseUrl(
|
|
896
|
-
bootstrapConfig.
|
|
891
|
+
bootstrapConfig.gammaBaseURL, // e.g. 'https://apim-master-api.cloud.gravitee.io/gamma'
|
|
892
|
+
organizationId, // e.g. 'DEFAULT'
|
|
897
893
|
environmentId, // e.g. 'DEFAULT'
|
|
898
894
|
);
|
|
899
|
-
// → 'https://apim-master-api.cloud.gravitee.io/
|
|
895
|
+
// → 'https://apim-master-api.cloud.gravitee.io/gamma/organizations/DEFAULT/environments/DEFAULT'
|
|
900
896
|
```
|
|
901
897
|
|
|
902
|
-
When a local dev proxy forwards `/
|
|
898
|
+
When a local dev proxy forwards `/gamma/*` requests to the real API, pass `{ useDevProxy: true }` to strip the origin:
|
|
903
899
|
|
|
904
900
|
```ts
|
|
905
|
-
const baseUrl = buildObservabilityBaseUrl(bootstrapConfig.
|
|
906
|
-
|
|
901
|
+
const baseUrl = buildObservabilityBaseUrl(bootstrapConfig.gammaBaseURL, organizationId, environmentId, {
|
|
902
|
+
useDevProxy: true,
|
|
903
|
+
});
|
|
904
|
+
// → '/gamma/organizations/DEFAULT/environments/DEFAULT' (origin stripped, browser hits the proxy)
|
|
907
905
|
```
|
|
908
906
|
|
|
909
|
-
The `useDevProxy` option extracts the pathname from an absolute `
|
|
907
|
+
The `useDevProxy` option extracts the pathname from an absolute `gammaBaseURL` so the browser fetches through the local dev proxy instead of directly hitting the remote API origin. When `gammaBaseURL` is already a relative path (e.g. `/gamma`), the option is a no-op.
|
|
910
908
|
|
|
911
|
-
The library uses `baseUrl` to construct its built-in HTTP adapters: `createHttpDataSource(baseUrl)` for metrics, `createHttpFilterSource(baseUrl)` for filters, and `createHttpLogsSource(baseUrl)` for logs.
|
|
909
|
+
The library uses `baseUrl` to construct its built-in HTTP adapters: `createHttpDataSource(baseUrl)` for metrics, `createHttpFilterSource(baseUrl)` for filters, and `createHttpLogsSource(baseUrl)` for logs. All adapters target the unified `/observability/*` surface. If you pass custom overrides (`dataSource`, `filterProviders`, `logsDataSource`, `tracesDataSource`), these URLs are still required for any remaining internal HTTP calls.
|
|
912
910
|
|
|
913
911
|
### Authenticated backends (`createHttpDataSource` options)
|
|
914
912
|
|
|
915
|
-
The built-in `createHttpDataSource(baseUrl, options?)` adapter speaks the Gravitee
|
|
913
|
+
The built-in `createHttpDataSource(baseUrl, options?)` adapter speaks the Gravitee unified observability analytics contract (`/observability/analytics/measures`, `/observability/analytics/facets`, `/observability/analytics/time-series`). It accepts an `options` argument for hosts that need to plug their auth flow:
|
|
916
914
|
|
|
917
915
|
```ts
|
|
918
916
|
import { createHttpDataSource } from '@gravitee/gamma-lib-observability';
|
|
@@ -943,7 +941,7 @@ const dataSource = createHttpDataSource(baseUrl, {
|
|
|
943
941
|
|
|
944
942
|
### Built-in logs adapter (`createHttpLogsSource`)
|
|
945
943
|
|
|
946
|
-
The built-in `createHttpLogsSource(baseUrl, options?)` adapter speaks the
|
|
944
|
+
The built-in `createHttpLogsSource(baseUrl, options?)` adapter speaks the unified Gamma logs contract (`POST /observability/logs/search`). It is automatically used by `ObservabilityRoutes` when `config.features.logs.enabled` is true and no explicit `logsDataSource` prop is provided.
|
|
947
945
|
|
|
948
946
|
```ts
|
|
949
947
|
import { createHttpLogsSource } from '@gravitee/gamma-lib-observability';
|
|
@@ -951,8 +949,6 @@ import { createHttpLogsSource } from '@gravitee/gamma-lib-observability';
|
|
|
951
949
|
const logsSource = createHttpLogsSource(baseUrl, {
|
|
952
950
|
credentials: 'include',
|
|
953
951
|
headers: () => ({ 'X-Xsrf-Token': readXsrfTokenFromCookie() }),
|
|
954
|
-
// Override the search endpoint path (default: '/logs/search')
|
|
955
|
-
searchPath: '/observability/logs',
|
|
956
952
|
});
|
|
957
953
|
```
|
|
958
954
|
|
|
@@ -961,11 +957,11 @@ const logsSource = createHttpLogsSource(baseUrl, {
|
|
|
961
957
|
| `fetch` | Custom fetch implementation — useful when the host already has an authenticated client |
|
|
962
958
|
| `headers` | Static `HeadersInit` or a factory called per-request (re-evaluated for every call) |
|
|
963
959
|
| `credentials` | Forwarded to `fetch` — `'include'` when the host relies on cookies |
|
|
964
|
-
| `searchPath` | Path appended to `baseUrl` for log search. Defaults to `'/logs/search'`
|
|
960
|
+
| `searchPath` | Path appended to `baseUrl` for log search. Defaults to `'/observability/logs/search'` |
|
|
965
961
|
|
|
966
962
|
**Wire format**: pagination (`page`, `perPage`) is sent as query params. The POST body contains `{ timeRange: { from, to }, filters: [...] }` where filters use the same wire format as the metrics adapter.
|
|
967
963
|
|
|
968
|
-
**`getById`**: fetches a single log via
|
|
964
|
+
**`getById`**: fetches a single log via `GET /observability/logs/{requestId}?apiId={apiId}`. The `apiId` is extracted from the log row at click time via the `logsGetApiId` prop. Returns `null` on 404.
|
|
969
965
|
|
|
970
966
|
### Custom data source
|
|
971
967
|
|
|
@@ -1165,17 +1161,11 @@ const trafficTemplate = defineDashboardTemplate({
|
|
|
1165
1161
|
|
|
1166
1162
|
export const observability = defineObservabilityFeatures({
|
|
1167
1163
|
basePath: 'observe',
|
|
1164
|
+
scopeApiTypes: ['HTTP_PROXY'],
|
|
1168
1165
|
features: {
|
|
1169
|
-
dashboards: {
|
|
1170
|
-
enabled: true,
|
|
1171
|
-
templates: [trafficTemplate],
|
|
1172
|
-
contextFilters: [{ field: 'API_TYPE', label: 'API Type', operator: 'in', value: ['HTTP'] }],
|
|
1173
|
-
scopeFilterField: 'API_TYPE',
|
|
1174
|
-
},
|
|
1166
|
+
dashboards: { enabled: true, templates: [trafficTemplate] },
|
|
1175
1167
|
logs: {
|
|
1176
1168
|
enabled: true,
|
|
1177
|
-
contextFilters: [{ field: 'ENTRYPOINT', label: 'Entrypoint', operator: 'in', value: ['http-proxy'] }],
|
|
1178
|
-
scopeFilterField: 'ENTRYPOINT',
|
|
1179
1169
|
pageSize: 25,
|
|
1180
1170
|
columnVisibilityStorageKey: 'my-module-logs-columns',
|
|
1181
1171
|
},
|
package/QUERYING.md
CHANGED
|
@@ -11,11 +11,11 @@ request field they expose, the defaults the library injects, and copy-pasteable
|
|
|
11
11
|
|
|
12
12
|
## 1. Endpoints
|
|
13
13
|
|
|
14
|
-
| Endpoint
|
|
15
|
-
|
|
|
16
|
-
| `POST /analytics/measures` | `metric`, `metric-group` | aggregated metric values (`MetricResult[]`) |
|
|
17
|
-
| `POST /analytics/facets` | `doughnut`, `bar` | grouped buckets (`FacetBucket[]`) |
|
|
18
|
-
| `POST /analytics/time-series` | `cartesian` | data points over time (`TimeSeriesGroup[]`) |
|
|
14
|
+
| Endpoint | Used by widgets | Returns |
|
|
15
|
+
| ------------------------------------------- | ------------------------ | ------------------------------------------- |
|
|
16
|
+
| `POST /observability/analytics/measures` | `metric`, `metric-group` | aggregated metric values (`MetricResult[]`) |
|
|
17
|
+
| `POST /observability/analytics/facets` | `doughnut`, `bar` | grouped buckets (`FacetBucket[]`) |
|
|
18
|
+
| `POST /observability/analytics/time-series` | `cartesian` | data points over time (`TimeSeriesGroup[]`) |
|
|
19
19
|
|
|
20
20
|
### Capability matrix
|
|
21
21
|
|