Compare commits

..

12 Commits

Author SHA1 Message Date
Ashwin Bhatkal
aabe59103d fix(dashboard-v2): variable selection (default reset + multiselect commit-on-close) (#12254)
Some checks are pending
build-staging / staging (push) Blocked by required conditions
build-staging / prepare (push) Waiting to run
build-staging / js-build (push) Blocked by required conditions
build-staging / go-build (push) Blocked by required conditions
Release Drafter / update_release_draft (push) Waiting to run
* feat(NewSelect): make multi-select Only/All + Toggle real clickable pills

* fix(dashboard-v2): reset variable default only on real option-set changes

* fix(dashboard-v2): multiselect value selection — commit on close, skip unchanged cascade, allow clear

* fix(dashboard-v2): fix multiselect tag layout in the variable pill

* fix: format issue

* fix(dashboard-v2): clear invalid variable default and fix useVariableForm test OOM

Stabilize the useVariableForm test props so the reset-on-`initial` effect no
longer loops into a heap OOM (the hook relies on a stable `initial` reference,
which memoized callers already provide). With the suite now running, align the
QUERY/CUSTOM default-reset to clear an invalidated default to empty rather than
pinning the first option, matching the DYNAMIC path and letting resolution fall
back to the first option / ALL.

* refactor(NewSelect): extract option-row button handler out of JSX

Pull the repeated stopPropagation/preventDefault/select/reset logic on the
option row's checkbox, Only/All and Toggle buttons into a single
`selectFromButton(e, source)` helper so the JSX stays readable.
2026-07-23 20:08:56 +00:00
Ashwin Bhatkal
6c957d1e8b feat(dashboard-v2): ANTLR-composed apply-to-panels with an impact review dialog (#12181)
* fix(dashboard-v2): compose panel filter via ANTLR so apply/remove respect precedence

* feat(dashboard-v2): review apply-to-panels query changes in the impact dialog

* feat(dashboard-v2): surface non-builder panel queries in the apply-to-panels review

findApplyUsages now emits an editable row for every selected panel query that
does not yet reference the variable — PromQL/ClickHouse rows default to their
current text (never auto-injected) so the review dialog opens for them instead
of silently no-op'ing. Adds isVariableAppliedToAllPanels, a cheap boolean scan
(no ANTLR) for the 'apply to all' disabled state.

* feat(dashboard-v2): route apply-to-all through the review dialog

The list-row 'Apply to all' now opens the same VariableImpactDialog review (all
panels as target) instead of a plain confirm, and is disabled with an 'Already
applied to all panels' tooltip once every panel query references the variable.
Removes the now-redundant ApplyToAllDialog and the dead build*VariableToPanelsPatch
helpers.
2026-07-23 19:42:49 +00:00
Ashwin Bhatkal
de1e21a050 fix(dashboard-v2): variable, panel-layout, and dashboards-list bug-bash fixes (#12178)
* feat(dashboard-v2): compact panel layout before persisting drag and JSON edits

* feat(dashboard-v2): resolve and persist user-typed variable selection across refetch

* feat(dashboard-v2): expose image field and close-on-Escape in the JSON editor

* fix(dashboard-v2): keep a custom dashboard image selectable in the overview picker

* fix(dashboard-v2): variable form & bar fixes

* fix(dashboard-v2): unify section title modal, keep open on error

* refactor(dashboard-v2): dashboard-list tags (popover to tooltip, TagBadge, DashboardRowTags)

* fix(dashboard-v2): sync locked state to the detail cache after list-page toggle

* fix(dashboard-v2): stop the variable value control from showing scrollbars

* fix(dashboard-v2): hide the not-recommended pill below 1280px, not 1024px
2026-07-23 18:21:12 +00:00
Nikhil Soni
85abfd626e fix(tracedetail): correct EndTimestampMillis in flamegraph API response (#12251)
* fix(tracedetail): use span-derived bounds for flamegraph EndTimestampMillis

The trace_summary MV stores max(timestamp) as 'end', which is the maximum
span *start* time. For the final span of a trace, this misses the span's
duration entirely, making EndTimestampMillis shorter than the actual trace end.

FlamegraphTrace already computed the correct end via updateTimeRange
(end = max(span_start + duration)) but only used it internally for bucket
sampling. Add TimeRange() to expose these span-derived bounds and use them
in both getFullFlamegraph and getWindowedFlamegraph instead of summary.End.

The waterfall was unaffected — NewWaterfallTraceFromSpans already computes
endTime = max(span.TimeUnix + span.DurationNano) from actual spans.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GxTqz7CqqmoFEPHFqhJUCa

* chore: remove unnecessary comments

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-07-23 17:21:29 +00:00
Aditya Singh
66c7e2d157 feat(trace-details): download full trace from trace details page (#12115)
Some checks failed
build-staging / prepare (push) Has been cancelled
build-staging / js-build (push) Has been cancelled
build-staging / go-build (push) Has been cancelled
build-staging / staging (push) Has been cancelled
Release Drafter / update_release_draft (push) Has been cancelled
* feat: add blob-stitching and part-fetch primitives for chunked downloads

* feat: add bounded worker-pool runner for chunked downloads

* feat: add trace download store, query and progress panel

* feat: add download trace option to trace options menu

* feat: update tests
2026-07-23 12:39:27 +00:00
Vinicius Lourenço
3c5c2cdcd9 refactor(infrastructure-monitoring-v2): remove map between dot and underscore attributes (#12214)
* refactor(infrastructure-monitoring-v2): remove map between dot and underscore attributes

* test(entity-metrics): fix test
2026-07-23 11:34:38 +00:00
Gaurav Tewari
cd1861ff87 chore: bump package versions (#12213)
* chore: bump axios version

* chore: bump more packages

---------

Co-authored-by: Gaurav Tewari <tewarig@users.noreply.github.com>
2026-07-23 11:03:19 +00:00
Nikhil Mantri
f0a0b95ecd chore: removed code and tests (#12243)
Co-authored-by: Pandey <vibhupandey28@gmail.com>
2026-07-23 10:48:44 +00:00
Ashwin Bhatkal
38340b5027 fix(dashboards-v2): dedicated "all" dynamic-variable signal + required non-nullable links (#12201)
* fix(dashboards-v2): make panel/dashboard links required and non-nullable

* fix: validate links on read from db as well

* fix: allow all as value for signal

* fix: dont allow empty string for signal

* fix(dashboards-v2): dedicated `all` dynamic-variable signal (frontend + client)

* test: add empty links to new payloads in integration tests

---------

Co-authored-by: Naman Verma <naman.verma@signoz.io>
2026-07-23 10:34:18 +00:00
Abhi kumar
fba56e9a64 fix(dashboard): filter-quote escaping, panel export encoding, right-legend width, number-panel query warning (#12246)
* fix(qb): stop doubling escaped quotes on filter round-trip

formatSingleValue escapes ' -> \' when quoting a filter value, but its inverse
(unquote, in formatSingleValueForFilter) stripped the quotes without unescaping.
Each expression <-> filters round-trip therefore added a backslash. "Create
alert from panel" re-reads the query through the URL twice, so a filter like
name = 'it\'s a ribbon' arrived at the alert page as name = 'it\\'s a ribbon'
and failed the filter parser. Unescape \' -> ' so the round-trip is lossless.

* fix(dashboard): double-encode compositeQuery in panel export link

useGetCompositeQueryParam decodes the compositeQuery param twice, so a single
encode left a bare %/+ from a filter expression (e.g. ILIKE 'Inf%') that made
the reader's second decode throw and drop the whole query. Encode twice in
buildExportPanelLink so the query survives the round-trip.

* fix(dashboard): size right legend column to the longest label

A right-positioned legend is a single vertical column, so give it its own width
budget and size it to fit the longest series label, clamped to
[150px, min(320, 40% of container width)], instead of the shared bottom-legend
cap. Long service names no longer ellipsize in the pie/donut legend.

* feat(dashboard): warn when a number panel has more than one query enabled

A Number panel renders only the first query's value, so leaving extra
queries enabled (e.g. a formula plus its inputs) silently shows the wrong
value with no feedback. Surface a warning in the panel editor and on the
rendered panel when a Number panel has more than one enabled query.

Refs #9512
2026-07-23 08:47:25 +00:00
Tushar Vats
cbc8b5424b feat(qb): parse search() in the filter grammar (not yet implemented) (#12129)
Some checks failed
build-staging / prepare (push) Has been cancelled
build-staging / js-build (push) Has been cancelled
build-staging / go-build (push) Has been cancelled
build-staging / staging (push) Has been cancelled
Release Drafter / update_release_draft (push) Has been cancelled
Add a search('needle') function to the filter grammar, recognized but not
yet executed - using it returns "search is not yet supported" instead of a
syntax error. Alert links, dashboard variables, and the contradiction check
pass it through untouched. `search` is now reserved, like has/hasAny.
2026-07-22 17:03:30 +00:00
Aditya Singh
7ac6df6fb0 feat(query-builder): fieldContext prefixed key suggestions (#12200)
* feat(query-builder): fieldContext-prefixed key suggestions and type-aware operator filtering

* test(query-builder): extract shared CodeMirror DOM mocks for jsdom specs

* test(query-builder): add CodeMirror+MSW behavior specs for suggestion flows
2026-07-22 13:55:01 +00:00
213 changed files with 5864 additions and 5110 deletions

View File

@@ -2748,7 +2748,6 @@ components:
links:
items:
$ref: '#/components/schemas/DashboardtypesLink'
nullable: true
type: array
panels:
additionalProperties:
@@ -2765,6 +2764,7 @@ components:
- variables
- panels
- layouts
- links
type: object
DashboardtypesDashboardView:
properties:
@@ -2843,14 +2843,22 @@ components:
required:
- name
type: object
DashboardtypesDynamicVariableSignal:
enum:
- traces
- logs
- metrics
- all
type: string
DashboardtypesDynamicVariableSpec:
properties:
name:
type: string
signal:
$ref: '#/components/schemas/TelemetrytypesSignal'
$ref: '#/components/schemas/DashboardtypesDynamicVariableSignal'
required:
- name
- signal
type: object
DashboardtypesFillMode:
enum:
@@ -3393,7 +3401,6 @@ components:
links:
items:
$ref: '#/components/schemas/DashboardtypesLink'
nullable: true
type: array
plugin:
$ref: '#/components/schemas/DashboardtypesPanelPlugin'
@@ -3405,6 +3412,7 @@ components:
- display
- plugin
- queries
- links
type: object
DashboardtypesPatchOp:
enum:
@@ -4299,8 +4307,6 @@ components:
type: object
nodeCountsByReadiness:
$ref: '#/components/schemas/InframonitoringtypesNodeCountsByReadiness'
podCountsByPhase:
$ref: '#/components/schemas/InframonitoringtypesPodCountsByPhase'
podCountsByStatus:
$ref: '#/components/schemas/InframonitoringtypesPodCountsByStatus'
required:
@@ -4310,7 +4316,6 @@ components:
- clusterMemory
- clusterMemoryAllocatable
- nodeCountsByReadiness
- podCountsByPhase
- podCountsByStatus
- counts
- meta
@@ -4520,8 +4525,6 @@ components:
type: object
misscheduledNodes:
type: integer
podCountsByPhase:
$ref: '#/components/schemas/InframonitoringtypesPodCountsByPhase'
podCountsByStatus:
$ref: '#/components/schemas/InframonitoringtypesPodCountsByStatus'
readyNodes:
@@ -4538,7 +4541,6 @@ components:
- currentNodes
- readyNodes
- misscheduledNodes
- podCountsByPhase
- podCountsByStatus
- meta
type: object
@@ -4593,8 +4595,6 @@ components:
type: string
nullable: true
type: object
podCountsByPhase:
$ref: '#/components/schemas/InframonitoringtypesPodCountsByPhase'
podCountsByStatus:
$ref: '#/components/schemas/InframonitoringtypesPodCountsByStatus'
required:
@@ -4607,7 +4607,6 @@ components:
- deploymentMemoryLimit
- desiredPods
- availablePods
- podCountsByPhase
- podCountsByStatus
- meta
type: object
@@ -4739,8 +4738,6 @@ components:
type: string
nullable: true
type: object
podCountsByPhase:
$ref: '#/components/schemas/InframonitoringtypesPodCountsByPhase'
podCountsByStatus:
$ref: '#/components/schemas/InframonitoringtypesPodCountsByStatus'
successfulPods:
@@ -4757,7 +4754,6 @@ components:
- activePods
- failedPods
- successfulPods
- podCountsByPhase
- podCountsByStatus
- meta
type: object
@@ -4867,15 +4863,12 @@ components:
type: number
namespaceName:
type: string
podCountsByPhase:
$ref: '#/components/schemas/InframonitoringtypesPodCountsByPhase'
podCountsByStatus:
$ref: '#/components/schemas/InframonitoringtypesPodCountsByStatus'
required:
- namespaceName
- namespaceCPU
- namespaceMemory
- podCountsByPhase
- podCountsByStatus
- counts
- meta
@@ -4941,15 +4934,12 @@ components:
type: number
nodeName:
type: string
podCountsByPhase:
$ref: '#/components/schemas/InframonitoringtypesPodCountsByPhase'
podCountsByStatus:
$ref: '#/components/schemas/InframonitoringtypesPodCountsByStatus'
required:
- nodeName
- condition
- nodeCountsByReadiness
- podCountsByPhase
- podCountsByStatus
- nodeCPU
- nodeCPUAllocatable
@@ -4977,25 +4967,6 @@ components:
- total
- endTimeBeforeRetention
type: object
InframonitoringtypesPodCountsByPhase:
properties:
failed:
type: integer
pending:
type: integer
running:
type: integer
succeeded:
type: integer
unknown:
type: integer
required:
- pending
- running
- succeeded
- failed
- unknown
type: object
InframonitoringtypesPodCountsByStatus:
properties:
completed:
@@ -5054,15 +5025,6 @@ components:
- shutdown
- unexpectedAdmissionError
type: object
InframonitoringtypesPodPhase:
enum:
- pending
- running
- succeeded
- failed
- unknown
- no_data
type: string
InframonitoringtypesPodRecord:
properties:
meta:
@@ -5082,8 +5044,6 @@ components:
podCPURequest:
format: double
type: number
podCountsByPhase:
$ref: '#/components/schemas/InframonitoringtypesPodCountsByPhase'
podCountsByStatus:
$ref: '#/components/schemas/InframonitoringtypesPodCountsByStatus'
podMemory:
@@ -5095,8 +5055,6 @@ components:
podMemoryRequest:
format: double
type: number
podPhase:
$ref: '#/components/schemas/InframonitoringtypesPodPhase'
podRestarts:
format: int64
type: integer
@@ -5112,8 +5070,6 @@ components:
- podMemory
- podMemoryRequest
- podMemoryLimit
- podPhase
- podCountsByPhase
- podStatus
- podCountsByStatus
- podRestarts
@@ -5464,8 +5420,6 @@ components:
type: string
nullable: true
type: object
podCountsByPhase:
$ref: '#/components/schemas/InframonitoringtypesPodCountsByPhase'
podCountsByStatus:
$ref: '#/components/schemas/InframonitoringtypesPodCountsByStatus'
statefulSetCPU:
@@ -5498,7 +5452,6 @@ components:
- statefulSetMemoryLimit
- desiredPods
- currentPods
- podCountsByPhase
- podCountsByStatus
- meta
type: object
@@ -16152,17 +16105,19 @@ paths:
metrics derived by summing per-node values within the group: CPU usage, CPU
allocatable, memory working set, memory allocatable. Each row also reports
per-group nodeCountsByReadiness ({ ready, notReady } from each node''s latest
k8s.node.condition_ready value) and per-group podCountsByPhase ({ pending,
running, succeeded, failed, unknown } from each pod''s latest k8s.pod.phase
value). Each cluster includes metadata attributes (k8s.cluster.name). The
response type is ''list'' for the default k8s.cluster.name grouping or ''grouped_list''
for custom groupBy keys; in both modes every row aggregates nodes and pods
in the group. Supports filtering via a filter expression, custom groupBy,
ordering by cpu / cpu_allocatable / memory / memory_allocatable, and pagination
via offset/limit. Also reports whether the requested time range falls before
the data retention boundary. Numeric metric fields (clusterCPU, clusterCPUAllocatable,
clusterMemory, clusterMemoryAllocatable) return -1 as a sentinel when no data
is available for that field.'
k8s.node.condition_ready value) and per-group podCountsByStatus ({ pending,
running, failed, unknown, crashLoopBackOff, imagePullBackOff, errImagePull,
createContainerConfigError, containerCreating, oomKilled, completed, error,
containerCannotRun, evicted, nodeAffinity, nodeLost, shutdown, unexpectedAdmissionError
} reflecting each pod''s latest kubectl-style display status). Each cluster
includes metadata attributes (k8s.cluster.name). The response type is ''list''
for the default k8s.cluster.name grouping or ''grouped_list'' for custom groupBy
keys; in both modes every row aggregates nodes and pods in the group. Supports
filtering via a filter expression, custom groupBy, ordering by cpu / cpu_allocatable
/ memory / memory_allocatable, and pagination via offset/limit. Also reports
whether the requested time range falls before the data retention boundary.
Numeric metric fields (clusterCPU, clusterCPUAllocatable, clusterMemory, clusterMemoryAllocatable)
return -1 as a sentinel when no data is available for that field.'
operationId: ListClusters
requestBody:
content:
@@ -16230,13 +16185,16 @@ paths:
the number of nodes running at least one ready daemon pod) and misscheduledNodes
(k8s.daemonset.misscheduled_nodes, the number of nodes running the daemon
pod but not supposed to) — note these are node counts, not pod counts. It
also reports per-group podCountsByPhase ({ pending, running, succeeded, failed,
unknown } from each pod''s latest k8s.pod.phase value). Each daemonset includes
metadata attributes (k8s.daemonset.name, k8s.namespace.name, k8s.cluster.name).
The response type is ''list'' for the default k8s.daemonset.name grouping
or ''grouped_list'' for custom groupBy keys; in both modes every row aggregates
pods owned by daemonsets in the group. Supports filtering via a filter expression,
custom groupBy, ordering by cpu / cpu_request / cpu_limit / memory / memory_request
also reports per-group podCountsByStatus ({ pending, running, failed, unknown,
crashLoopBackOff, imagePullBackOff, errImagePull, createContainerConfigError,
containerCreating, oomKilled, completed, error, containerCannotRun, evicted,
nodeAffinity, nodeLost, shutdown, unexpectedAdmissionError } reflecting each
pod''s latest kubectl-style display status). Each daemonset includes metadata
attributes (k8s.daemonset.name, k8s.namespace.name, k8s.cluster.name). The
response type is ''list'' for the default k8s.daemonset.name grouping or ''grouped_list''
for custom groupBy keys; in both modes every row aggregates pods owned by
daemonsets in the group. Supports filtering via a filter expression, custom
groupBy, ordering by cpu / cpu_request / cpu_limit / memory / memory_request
/ memory_limit / desired_nodes / current_nodes / ready_nodes / misscheduled_nodes,
and pagination via offset/limit. Also reports whether the requested time range
falls before the data retention boundary. Numeric metric fields (daemonSetCPU,
@@ -16304,17 +16262,19 @@ paths:
the deployment, plus average CPU/memory request and limit utilization (deploymentCPURequest,
deploymentCPULimit, deploymentMemoryRequest, deploymentMemoryLimit). Each
row also reports the latest known desiredPods (k8s.deployment.desired) and
availablePods (k8s.deployment.available) replica counts and per-group podCountsByPhase
({ pending, running, succeeded, failed, unknown } from each pod''s latest
k8s.pod.phase value). Each deployment includes metadata attributes (k8s.deployment.name,
k8s.namespace.name, k8s.cluster.name). The response type is ''list'' for the
default k8s.deployment.name grouping or ''grouped_list'' for custom groupBy
keys; in both modes every row aggregates pods owned by deployments in the
group. Supports filtering via a filter expression, custom groupBy, ordering
by cpu / cpu_request / cpu_limit / memory / memory_request / memory_limit
/ desired_pods / available_pods, and pagination via offset/limit. Also reports
whether the requested time range falls before the data retention boundary.
Numeric metric fields (deploymentCPU, deploymentCPURequest, deploymentCPULimit,
availablePods (k8s.deployment.available) replica counts and per-group podCountsByStatus
({ pending, running, failed, unknown, crashLoopBackOff, imagePullBackOff,
errImagePull, createContainerConfigError, containerCreating, oomKilled, completed,
error, containerCannotRun, evicted, nodeAffinity, nodeLost, shutdown, unexpectedAdmissionError
} reflecting each pod''s latest kubectl-style display status). Each deployment
includes metadata attributes (k8s.deployment.name, k8s.namespace.name, k8s.cluster.name).
The response type is ''list'' for the default k8s.deployment.name grouping
or ''grouped_list'' for custom groupBy keys; in both modes every row aggregates
pods owned by deployments in the group. Supports filtering via a filter expression,
custom groupBy, ordering by cpu / cpu_request / cpu_limit / memory / memory_request
/ memory_limit / desired_pods / available_pods, and pagination via offset/limit.
Also reports whether the requested time range falls before the data retention
boundary. Numeric metric fields (deploymentCPU, deploymentCPURequest, deploymentCPULimit,
deploymentMemory, deploymentMemoryRequest, deploymentMemoryLimit, desiredPods,
availablePods) return -1 as a sentinel when no data is available for that
field.'
@@ -16449,9 +16409,12 @@ paths:
(k8s.job.desired_successful_pods, the target completion count), activePods
(k8s.job.active_pods), failedPods (k8s.job.failed_pods, cumulative across
the lifetime of the job), and successfulPods (k8s.job.successful_pods, cumulative).
It also reports per-group podCountsByPhase ({ pending, running, succeeded,
failed, unknown } from each pod''s latest k8s.pod.phase value); note podCountsByPhase.failed
(current pod-phase) is distinct from failedPods (cumulative job kube-state-metric).
It also reports per-group podCountsByStatus ({ pending, running, failed, unknown,
crashLoopBackOff, imagePullBackOff, errImagePull, createContainerConfigError,
containerCreating, oomKilled, completed, error, containerCannotRun, evicted,
nodeAffinity, nodeLost, shutdown, unexpectedAdmissionError } reflecting each
pod''s latest kubectl-style display status); note podCountsByStatus.failed
(current pod status) is distinct from failedPods (cumulative job kube-state-metric).
Each job includes metadata attributes (k8s.job.name, k8s.namespace.name, k8s.cluster.name).
The response type is ''list'' for the default k8s.job.name grouping or ''grouped_list''
for custom groupBy keys; in both modes every row aggregates pods owned by
@@ -16601,16 +16564,18 @@ paths:
deprecated: false
description: 'Returns a paginated list of Kubernetes namespaces with key aggregated
pod metrics: CPU usage and memory working set (summed across pods in the group),
plus per-group podCountsByPhase ({ pending, running, succeeded, failed, unknown
} from each pod''s latest k8s.pod.phase value in the window). Each namespace
includes metadata attributes (k8s.namespace.name, k8s.cluster.name). The response
type is ''list'' for the default k8s.namespace.name grouping or ''grouped_list''
for custom groupBy keys; in both modes every row aggregates pods in the group.
Supports filtering via a filter expression, custom groupBy, ordering by cpu
/ memory, and pagination via offset/limit. Also reports whether the requested
time range falls before the data retention boundary. Numeric metric fields
(namespaceCPU, namespaceMemory) return -1 as a sentinel when no data is available
for that field.'
plus per-group podCountsByStatus ({ pending, running, failed, unknown, crashLoopBackOff,
imagePullBackOff, errImagePull, createContainerConfigError, containerCreating,
oomKilled, completed, error, containerCannotRun, evicted, nodeAffinity, nodeLost,
shutdown, unexpectedAdmissionError } reflecting each pod''s latest kubectl-style
display status in the window). Each namespace includes metadata attributes
(k8s.namespace.name, k8s.cluster.name). The response type is ''list'' for
the default k8s.namespace.name grouping or ''grouped_list'' for custom groupBy
keys; in both modes every row aggregates pods in the group. Supports filtering
via a filter expression, custom groupBy, ordering by cpu / memory, and pagination
via offset/limit. Also reports whether the requested time range falls before
the data retention boundary. Numeric metric fields (namespaceCPU, namespaceMemory)
return -1 as a sentinel when no data is available for that field.'
operationId: ListNamespaces
requestBody:
content:
@@ -16670,18 +16635,21 @@ paths:
description: 'Returns a paginated list of Kubernetes nodes with key metrics:
CPU usage, CPU allocatable, memory working set, memory allocatable, per-group
nodeCountsByReadiness ({ ready, notReady } from each node''s latest k8s.node.condition_ready
in the window) and per-group podCountsByPhase ({ pending, running, succeeded,
failed, unknown } for pods scheduled on the listed nodes). Each node includes
metadata attributes (k8s.node.uid, k8s.cluster.name). The response type is
''list'' for the default k8s.node.name grouping (each row is one node with
its current condition string: ready / not_ready / no_data) or ''grouped_list''
for custom groupBy keys (each row aggregates nodes in the group; condition
stays no_data). Supports filtering via a filter expression, custom groupBy,
ordering by cpu / cpu_allocatable / memory / memory_allocatable, and pagination
via offset/limit. Also reports whether the requested time range falls before
the data retention boundary. Numeric metric fields (nodeCPU, nodeCPUAllocatable,
nodeMemory, nodeMemoryAllocatable) return -1 as a sentinel when no data is
available for that field.'
in the window) and per-group podCountsByStatus ({ pending, running, failed,
unknown, crashLoopBackOff, imagePullBackOff, errImagePull, createContainerConfigError,
containerCreating, oomKilled, completed, error, containerCannotRun, evicted,
nodeAffinity, nodeLost, shutdown, unexpectedAdmissionError } for pods scheduled
on the listed nodes, reflecting each pod''s latest kubectl-style display status).
Each node includes metadata attributes (k8s.node.uid, k8s.cluster.name). The
response type is ''list'' for the default k8s.node.name grouping (each row
is one node with its current condition string: ready / not_ready / no_data)
or ''grouped_list'' for custom groupBy keys (each row aggregates nodes in
the group; condition stays no_data). Supports filtering via a filter expression,
custom groupBy, ordering by cpu / cpu_allocatable / memory / memory_allocatable,
and pagination via offset/limit. Also reports whether the requested time range
falls before the data retention boundary. Numeric metric fields (nodeCPU,
nodeCPUAllocatable, nodeMemory, nodeMemoryAllocatable) return -1 as a sentinel
when no data is available for that field.'
operationId: ListNodes
requestBody:
content:
@@ -16740,20 +16708,23 @@ paths:
deprecated: false
description: 'Returns a paginated list of Kubernetes pods with key metrics:
CPU usage, CPU request/limit utilization, memory working set, memory request/limit
utilization, current pod phase (pending/running/succeeded/failed/unknown/no_data),
and pod age (ms since start time). Each pod includes metadata attributes (namespace,
node, workload owner such as deployment/statefulset/daemonset/job/cronjob,
utilization, current pod status (kubectl-style display status such as Running/Pending/CrashLoopBackOff,
or no_data), and pod age (ms since start time). Each pod includes metadata
attributes (namespace, node, workload owner such as deployment/statefulset/daemonset/job/cronjob,
cluster). Supports filtering via a filter expression, custom groupBy to aggregate
pods by any attribute, ordering by any of the six metrics (cpu, cpu_request,
cpu_limit, memory, memory_request, memory_limit), and pagination via offset/limit.
The response type is ''list'' for the default k8s.pod.uid grouping (each row
is one pod with its current phase) or ''grouped_list'' for custom groupBy
keys (each row aggregates pods in the group with per-phase counts under podCountsByPhase:
{ pending, running, succeeded, failed, unknown } derived from each pod''s
latest phase in the window). Also reports whether the requested time range
falls before the data retention boundary. Numeric metric fields (podCPU, podCPURequest,
podCPULimit, podMemory, podMemoryRequest, podMemoryLimit, podAge) return -1
as a sentinel when no data is available for that field.'
is one pod with its current status) or ''grouped_list'' for custom groupBy
keys (each row aggregates pods in the group with per-status counts under podCountsByStatus:
{ pending, running, failed, unknown, crashLoopBackOff, imagePullBackOff, errImagePull,
createContainerConfigError, containerCreating, oomKilled, completed, error,
containerCannotRun, evicted, nodeAffinity, nodeLost, shutdown, unexpectedAdmissionError
} derived from each pod''s latest kubectl-style display status in the window).
Also reports whether the requested time range falls before the data retention
boundary. Numeric metric fields (podCPU, podCPURequest, podCPULimit, podMemory,
podMemoryRequest, podMemoryLimit, podAge) return -1 as a sentinel when no
data is available for that field.'
operationId: ListPods
requestBody:
content:
@@ -16886,16 +16857,19 @@ paths:
statefulSetCPULimit, statefulSetMemoryRequest, statefulSetMemoryLimit). Each
row also reports the latest known desiredPods (k8s.statefulset.desired_pods)
and currentPods (k8s.statefulset.current_pods) replica counts and per-group
podCountsByPhase ({ pending, running, succeeded, failed, unknown } from each
pod''s latest k8s.pod.phase value). Each statefulset includes metadata attributes
(k8s.statefulset.name, k8s.namespace.name, k8s.cluster.name). The response
type is ''list'' for the default k8s.statefulset.name grouping or ''grouped_list''
for custom groupBy keys; in both modes every row aggregates pods owned by
statefulsets in the group. Supports filtering via a filter expression, custom
groupBy, ordering by cpu / cpu_request / cpu_limit / memory / memory_request
/ memory_limit / desired_pods / current_pods, and pagination via offset/limit.
Also reports whether the requested time range falls before the data retention
boundary. Numeric metric fields (statefulSetCPU, statefulSetCPURequest, statefulSetCPULimit,
podCountsByStatus ({ pending, running, failed, unknown, crashLoopBackOff,
imagePullBackOff, errImagePull, createContainerConfigError, containerCreating,
oomKilled, completed, error, containerCannotRun, evicted, nodeAffinity, nodeLost,
shutdown, unexpectedAdmissionError } reflecting each pod''s latest kubectl-style
display status). Each statefulset includes metadata attributes (k8s.statefulset.name,
k8s.namespace.name, k8s.cluster.name). The response type is ''list'' for the
default k8s.statefulset.name grouping or ''grouped_list'' for custom groupBy
keys; in both modes every row aggregates pods owned by statefulsets in the
group. Supports filtering via a filter expression, custom groupBy, ordering
by cpu / cpu_request / cpu_limit / memory / memory_request / memory_limit
/ desired_pods / current_pods, and pagination via offset/limit. Also reports
whether the requested time range falls before the data retention boundary.
Numeric metric fields (statefulSetCPU, statefulSetCPURequest, statefulSetCPULimit,
statefulSetMemory, statefulSetMemoryRequest, statefulSetMemoryLimit, desiredPods,
currentPods) return -1 as a sentinel when no data is available for that field.'
operationId: ListStatefulSets

View File

@@ -64,7 +64,7 @@
"antd": "5.11.0",
"antd-table-saveas-excel": "2.2.1",
"antlr4": "4.13.2",
"axios": "1.16.0",
"axios": "1.18.0",
"babel-jest": "^29.6.4",
"chart.js": "3.9.1",
"chartjs-adapter-date-fns": "^2.0.0",
@@ -74,7 +74,7 @@
"crypto-js": "4.2.0",
"d3-hierarchy": "3.1.2",
"dayjs": "^1.10.7",
"dompurify": "3.4.11",
"dompurify": "3.4.12",
"event-source-polyfill": "1.0.31",
"eventemitter3": "5.0.1",
"history": "4.10.1",
@@ -199,9 +199,9 @@
"react-resizable": "3.0.4",
"redux-mock-store": "1.5.4",
"sass": "1.97.3",
"sharp": "0.34.5",
"sharp": "0.35.0",
"stylelint": "17.7.0",
"svgo": "4.0.1",
"svgo": "4.0.2",
"ts-jest": "29.4.9",
"typescript-plugin-css-modules": "5.2.0",
"use-sync-external-store": "1.6.0",

445
frontend/pnpm-lock.yaml generated
View File

@@ -112,8 +112,8 @@ importers:
specifier: 4.13.2
version: 4.13.2
axios:
specifier: 1.16.0
version: 1.16.0
specifier: 1.18.0
version: 1.18.0
babel-jest:
specifier: ^29.6.4
version: 29.6.4(@babel/core@7.29.7)
@@ -142,8 +142,8 @@ importers:
specifier: ^1.10.7
version: 1.11.20
dompurify:
specifier: 3.4.11
version: 3.4.11
specifier: 3.4.12
version: 3.4.12
event-source-polyfill:
specifier: 1.0.31
version: 1.0.31
@@ -476,14 +476,14 @@ importers:
specifier: 1.97.3
version: 1.97.3
sharp:
specifier: 0.34.5
version: 0.34.5
specifier: 0.35.0
version: 0.35.0
stylelint:
specifier: 17.7.0
version: 17.7.0(typescript@5.9.3)
svgo:
specifier: 4.0.1
version: 4.0.1
specifier: 4.0.2
version: 4.0.2
ts-jest:
specifier: 29.4.9
version: 29.4.9(@babel/core@7.29.7)(@jest/transform@30.4.1)(@jest/types@30.2.0)(babel-jest@29.6.4(@babel/core@7.29.7))(esbuild@0.28.1)(jest-util@30.4.1)(jest@30.2.0(@types/node@16.18.25)(babel-plugin-macros@3.1.0)(ts-node@10.9.1(@types/node@16.18.25)(typescript@5.9.3)))(typescript@5.9.3)
@@ -501,7 +501,7 @@ importers:
version: 0.5.1(rolldown-vite@7.3.1(@types/node@16.18.25)(esbuild@0.28.1)(jiti@2.6.1)(less@4.4.0)(sass@1.97.3)(stylus@0.62.0)(terser@5.46.2)(yaml@2.8.4))
vite-plugin-image-optimizer:
specifier: 2.0.3
version: 2.0.3(rolldown-vite@7.3.1(@types/node@16.18.25)(esbuild@0.28.1)(jiti@2.6.1)(less@4.4.0)(sass@1.97.3)(stylus@0.62.0)(terser@5.46.2)(yaml@2.8.4))(sharp@0.34.5)(svgo@4.0.1)
version: 2.0.3(rolldown-vite@7.3.1(@types/node@16.18.25)(esbuild@0.28.1)(jiti@2.6.1)(less@4.4.0)(sass@1.97.3)(stylus@0.62.0)(terser@5.46.2)(yaml@2.8.4))(sharp@0.35.0)(svgo@4.0.2)
vite-tsconfig-paths:
specifier: 6.1.1
version: 6.1.1(rolldown-vite@7.3.1(@types/node@16.18.25)(esbuild@0.28.1)(jiti@2.6.1)(less@4.4.0)(sass@1.97.3)(stylus@0.62.0)(terser@5.46.2)(yaml@2.8.4))(typescript@5.9.3)
@@ -1460,6 +1460,9 @@ packages:
'@emnapi/core@1.8.1':
resolution: {integrity: sha512-AvT9QFpxK0Zd8J0jopedNm+w/2fIzvtPKPjqyw9jwvBaReTTqPBk9Hixaz7KbjimP+QNz605/XnjFcDAL2pqBg==}
'@emnapi/runtime@1.11.2':
resolution: {integrity: sha512-kyOl3X0DuTiT1h2ft8r2fYO8JYtU9a9Xis/zBSiGArNaagCOWx90N1k2wxp18czFDH+OgcWGb5ZP/XMt3dcyPA==}
'@emnapi/runtime@1.8.1':
resolution: {integrity: sha512-mehfKSMWjjNol8659Z8KxEMrdSJDDot5SXMq00dM8BN4o+CLNXQ0xH2V7EchNHV4RmbZLmmPdEaXZc5H2FXmDg==}
@@ -1714,156 +1717,165 @@ packages:
resolution: {integrity: sha512-bV0Tgo9K4hfPCek+aMAn81RppFKv2ySDQeMoSZuvTASywNTnVJCArCZE2FWqpvIatKu7VMRLWlR1EazvVhDyhQ==}
engines: {node: '>=18.18'}
'@img/colour@1.0.0':
resolution: {integrity: sha512-A5P/LfWGFSl6nsckYtjw9da+19jB8hkJ6ACTGcDfEJ0aE+l2n2El7dsVM7UVHZQ9s2lmYMWlrS21YLy2IR1LUw==}
'@img/colour@1.1.0':
resolution: {integrity: sha512-Td76q7j57o/tLVdgS746cYARfSyxk8iEfRxewL9h4OMzYhbW4TAcppl0mT4eyqXddh6L/jwoM75mo7ixa/pCeQ==}
engines: {node: '>=18'}
'@img/sharp-darwin-arm64@0.34.5':
resolution: {integrity: sha512-imtQ3WMJXbMY4fxb/Ndp6HBTNVtWCUI0WdobyheGf5+ad6xX8VIDO8u2xE4qc/fr08CKG/7dDseFtn6M6g/r3w==}
engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0}
'@img/sharp-darwin-arm64@0.35.0':
resolution: {integrity: sha512-ZgaYEwaj+lx/5n4W8GmZ2IYz0PQHjN5eqRcfijWGB+2Aq7ZInZGa0qJyAn6DEtyLuWHRSrmWOqT9q3qqTBvmUQ==}
engines: {node: '>=20.9.0'}
cpu: [arm64]
os: [darwin]
'@img/sharp-darwin-x64@0.34.5':
resolution: {integrity: sha512-YNEFAF/4KQ/PeW0N+r+aVVsoIY0/qxxikF2SWdp+NRkmMB7y9LBZAVqQ4yhGCm/H3H270OSykqmQMKLBhBJDEw==}
engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0}
'@img/sharp-darwin-x64@0.35.0':
resolution: {integrity: sha512-c1z9LFpKB0slQW3RchwBE8iSVzGp70TNjUUO9k4BZwwW4HH7JBGHeIy4b+kk4n/kcBASb9evKCE3/7Slmslgiw==}
engines: {node: '>=20.9.0'}
cpu: [x64]
os: [darwin]
'@img/sharp-libvips-darwin-arm64@1.2.4':
resolution: {integrity: sha512-zqjjo7RatFfFoP0MkQ51jfuFZBnVE2pRiaydKJ1G/rHZvnsrHAOcQALIi9sA5co5xenQdTugCvtb1cuf78Vf4g==}
'@img/sharp-freebsd-wasm32@0.35.0':
resolution: {integrity: sha512-Li2KTev0H90kEtnJHkI9xQojXt1AqWmFBMXiPw5kqd1jQgP7gi5HVK/qC5Rmh/59NuAwUuPzzPITmX22NomYYQ==}
engines: {node: '>=20.9.0'}
os: [freebsd]
'@img/sharp-libvips-darwin-arm64@1.3.0':
resolution: {integrity: sha512-EKbmBKtyTH+GPFDRw2TgK2oV6hyxxlJVIar4hoTYSNmIwipgMFdxPQqR392GmfdsPGWga0mCFN1cCKjRb9cljw==}
cpu: [arm64]
os: [darwin]
'@img/sharp-libvips-darwin-x64@1.2.4':
resolution: {integrity: sha512-1IOd5xfVhlGwX+zXv2N93k0yMONvUlANylbJw1eTah8K/Jtpi15KC+WSiaX/nBmbm2HxRM1gZ0nSdjSsrZbGKg==}
'@img/sharp-libvips-darwin-x64@1.3.0':
resolution: {integrity: sha512-Pl2OmOvrJ42adUllESxBsG54PfXLo1OYg9i3c5/5Ln/qJ0gZuTM9YMhQJPIbXqwidLRc/c2zuHt4RsrymmNv7A==}
cpu: [x64]
os: [darwin]
'@img/sharp-libvips-linux-arm64@1.2.4':
resolution: {integrity: sha512-excjX8DfsIcJ10x1Kzr4RcWe1edC9PquDRRPx3YVCvQv+U5p7Yin2s32ftzikXojb1PIFc/9Mt28/y+iRklkrw==}
'@img/sharp-libvips-linux-arm64@1.3.0':
resolution: {integrity: sha512-C0SqjoFKnszqa44EQ7xoaT48nnO0lOyXEULfXMWi8krrjOPGYkeK30Okzla6ATbBYsyZ0ySinK0FVkpv3DwzfQ==}
cpu: [arm64]
os: [linux]
libc: [glibc]
'@img/sharp-libvips-linux-arm@1.2.4':
resolution: {integrity: sha512-bFI7xcKFELdiNCVov8e44Ia4u2byA+l3XtsAj+Q8tfCwO6BQ8iDojYdvoPMqsKDkuoOo+X6HZA0s0q11ANMQ8A==}
'@img/sharp-libvips-linux-arm@1.3.0':
resolution: {integrity: sha512-A8UpHoUDW4DwnXoV6+q3C1s7QLRAHtPDEjWuNZjwHMyoCNZnm0GeNN8ls9f/bsEYTRQRW96C/n34XJQHJ2fT7A==}
cpu: [arm]
os: [linux]
libc: [glibc]
'@img/sharp-libvips-linux-ppc64@1.2.4':
resolution: {integrity: sha512-FMuvGijLDYG6lW+b/UvyilUWu5Ayu+3r2d1S8notiGCIyYU/76eig1UfMmkZ7vwgOrzKzlQbFSuQfgm7GYUPpA==}
'@img/sharp-libvips-linux-ppc64@1.3.0':
resolution: {integrity: sha512-WOpkVxAjFd369iaIzEgNRreFD+gWdUMIGD5zplhNKNeqS6mm5dac3q2AFyCBmzYoAdouzZvRBgxy4z8QHZb4/A==}
cpu: [ppc64]
os: [linux]
libc: [glibc]
'@img/sharp-libvips-linux-riscv64@1.2.4':
resolution: {integrity: sha512-oVDbcR4zUC0ce82teubSm+x6ETixtKZBh/qbREIOcI3cULzDyb18Sr/Wcyx7NRQeQzOiHTNbZFF1UwPS2scyGA==}
'@img/sharp-libvips-linux-riscv64@1.3.0':
resolution: {integrity: sha512-DRWw0mOHusrCCuw2rqP87oLg6PGlkomVDFqw2hIwsSfwWpu4k3XLcBPaKKl6ct/GtL/cwNkgwjV/tc0Mqht3VA==}
cpu: [riscv64]
os: [linux]
libc: [glibc]
'@img/sharp-libvips-linux-s390x@1.2.4':
resolution: {integrity: sha512-qmp9VrzgPgMoGZyPvrQHqk02uyjA0/QrTO26Tqk6l4ZV0MPWIW6LTkqOIov+J1yEu7MbFQaDpwdwJKhbJvuRxQ==}
'@img/sharp-libvips-linux-s390x@1.3.0':
resolution: {integrity: sha512-9APy+nFWhHS+kzLgWZfLcyrUd7YqnAQVa4BPOo4xkoHpdoktOAPG4cEr9+Jpl0TtqfVmcMJimNL5qNTyyOHZNA==}
cpu: [s390x]
os: [linux]
libc: [glibc]
'@img/sharp-libvips-linux-x64@1.2.4':
resolution: {integrity: sha512-tJxiiLsmHc9Ax1bz3oaOYBURTXGIRDODBqhveVHonrHJ9/+k89qbLl0bcJns+e4t4rvaNBxaEZsFtSfAdquPrw==}
'@img/sharp-libvips-linux-x64@1.3.0':
resolution: {integrity: sha512-y9RNUYDe2A1UAdhLyfeOodGRszQdaEoe4nfOpp/sNVPl2CWIcUyFaDoCh4vPLPxu19803j2naLqZup2WxDXCLA==}
cpu: [x64]
os: [linux]
libc: [glibc]
'@img/sharp-libvips-linuxmusl-arm64@1.2.4':
resolution: {integrity: sha512-FVQHuwx1IIuNow9QAbYUzJ+En8KcVm9Lk5+uGUQJHaZmMECZmOlix9HnH7n1TRkXMS0pGxIJokIVB9SuqZGGXw==}
'@img/sharp-libvips-linuxmusl-arm64@1.3.0':
resolution: {integrity: sha512-cC1wkC0Mlucd0KSiGrLkJnB/ZqPvZCntc/Lk7ZnYO5ZSbF2euNek4Xvxafojq+wN1q/W0eprdpUIjUr/EV2PBg==}
cpu: [arm64]
os: [linux]
libc: [musl]
'@img/sharp-libvips-linuxmusl-x64@1.2.4':
resolution: {integrity: sha512-+LpyBk7L44ZIXwz/VYfglaX/okxezESc6UxDSoyo2Ks6Jxc4Y7sGjpgU9s4PMgqgjj1gZCylTieNamqA1MF7Dg==}
'@img/sharp-libvips-linuxmusl-x64@1.3.0':
resolution: {integrity: sha512-LiYMhUZicB1QG//+RvmYZpXJO8fYRENfp+MZUCnG9aw+AKvGAy9gPaCnuwsPcBFs8EV66M0NNxj9VHcNklE8zw==}
cpu: [x64]
os: [linux]
libc: [musl]
'@img/sharp-linux-arm64@0.34.5':
resolution: {integrity: sha512-bKQzaJRY/bkPOXyKx5EVup7qkaojECG6NLYswgktOZjaXecSAeCWiZwwiFf3/Y+O1HrauiE3FVsGxFg8c24rZg==}
engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0}
'@img/sharp-linux-arm64@0.35.0':
resolution: {integrity: sha512-4+4XHLNT5wDT0roYlHTEmH9lDKt0acf9Tv+3hM3iceOirkxrR404/3WjAYZ9F9CkHrxeRcGLJXbi4vluMZ9O+A==}
engines: {node: '>=20.9.0'}
cpu: [arm64]
os: [linux]
libc: [glibc]
'@img/sharp-linux-arm@0.34.5':
resolution: {integrity: sha512-9dLqsvwtg1uuXBGZKsxem9595+ujv0sJ6Vi8wcTANSFpwV/GONat5eCkzQo/1O6zRIkh0m/8+5BjrRr7jDUSZw==}
engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0}
'@img/sharp-linux-arm@0.35.0':
resolution: {integrity: sha512-VVlpEWwizEFIOom0zdoeKuO5nuTswzVE5uHcBNvHzmeHUpNFajY3HFfbQ+zIH4E2kVaZ/yVxmsShW56TtEy4uA==}
engines: {node: '>=20.9.0'}
cpu: [arm]
os: [linux]
libc: [glibc]
'@img/sharp-linux-ppc64@0.34.5':
resolution: {integrity: sha512-7zznwNaqW6YtsfrGGDA6BRkISKAAE1Jo0QdpNYXNMHu2+0dTrPflTLNkpc8l7MUP5M16ZJcUvysVWWrMefZquA==}
engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0}
'@img/sharp-linux-ppc64@0.35.0':
resolution: {integrity: sha512-N3hzbEpUTJC8pWpPVJvgzGxM+so/MAXc8O2s/53B0LL9ZGpfXpME7Wizkc5d/8fRBlBtkDjzoZGDCqqNDHqLEw==}
engines: {node: '>=20.9.0'}
cpu: [ppc64]
os: [linux]
libc: [glibc]
'@img/sharp-linux-riscv64@0.34.5':
resolution: {integrity: sha512-51gJuLPTKa7piYPaVs8GmByo7/U7/7TZOq+cnXJIHZKavIRHAP77e3N2HEl3dgiqdD/w0yUfiJnII77PuDDFdw==}
engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0}
'@img/sharp-linux-riscv64@0.35.0':
resolution: {integrity: sha512-l6vmKVPnbS0RhVMbyxP5meAARsbhCnBN4fy31qz0+3a6Rv4jEqfzDrT89y6ZPkCi0AJGnwp2En528yXo401Hpw==}
engines: {node: '>=20.9.0'}
cpu: [riscv64]
os: [linux]
libc: [glibc]
'@img/sharp-linux-s390x@0.34.5':
resolution: {integrity: sha512-nQtCk0PdKfho3eC5MrbQoigJ2gd1CgddUMkabUj+rBevs8tZ2cULOx46E7oyX+04WGfABgIwmMC0VqieTiR4jg==}
engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0}
'@img/sharp-linux-s390x@0.35.0':
resolution: {integrity: sha512-MYlMiPFiv/EKPAHnp3yNZ9AAWFsxga9c5Bkc6wkar6bqzHLlkGVJHRm0u1ei+VXnZxp3Mz9MG9ZIsI8vSOf3sQ==}
engines: {node: '>=20.9.0'}
cpu: [s390x]
os: [linux]
libc: [glibc]
'@img/sharp-linux-x64@0.34.5':
resolution: {integrity: sha512-MEzd8HPKxVxVenwAa+JRPwEC7QFjoPWuS5NZnBt6B3pu7EG2Ge0id1oLHZpPJdn3OQK+BQDiw9zStiHBTJQQQQ==}
engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0}
'@img/sharp-linux-x64@0.35.0':
resolution: {integrity: sha512-TYaItB5oj1ioXjhyn2xrR208vf+YuIIcHptQWRRaBmFhvIvL9D72DXN8w75xup0KXA8UdEAhQ9Qb2S49FD/9Cw==}
engines: {node: '>=20.9.0'}
cpu: [x64]
os: [linux]
libc: [glibc]
'@img/sharp-linuxmusl-arm64@0.34.5':
resolution: {integrity: sha512-fprJR6GtRsMt6Kyfq44IsChVZeGN97gTD331weR1ex1c1rypDEABN6Tm2xa1wE6lYb5DdEnk03NZPqA7Id21yg==}
engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0}
'@img/sharp-linuxmusl-arm64@0.35.0':
resolution: {integrity: sha512-DSTb6ijQzqe6DdAaOBVqJ/SYf1vO8EW5bK6X6LRXufEBebf2722VCdvBUtZ3rtV0x2ApfPNDy/p7LrrjaWjiyQ==}
engines: {node: '>=20.9.0'}
cpu: [arm64]
os: [linux]
libc: [musl]
'@img/sharp-linuxmusl-x64@0.34.5':
resolution: {integrity: sha512-Jg8wNT1MUzIvhBFxViqrEhWDGzqymo3sV7z7ZsaWbZNDLXRJZoRGrjulp60YYtV4wfY8VIKcWidjojlLcWrd8Q==}
engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0}
'@img/sharp-linuxmusl-x64@0.35.0':
resolution: {integrity: sha512-K7ykQ+26Rt6+4BTU80AuGgTPIYX86UxiAKT4rcXX/WNTo7k1ZxpKz+TguHnwVpCqQK3B5PK0vZ0ZBe6nz/ib1w==}
engines: {node: '>=20.9.0'}
cpu: [x64]
os: [linux]
libc: [musl]
'@img/sharp-wasm32@0.34.5':
resolution: {integrity: sha512-OdWTEiVkY2PHwqkbBI8frFxQQFekHaSSkUIJkwzclWZe64O1X4UlUjqqqLaPbUpMOQk6FBu/HtlGXNblIs0huw==}
engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0}
'@img/sharp-wasm32@0.35.0':
resolution: {integrity: sha512-9woLIFORERCr+6cWu87dQ22J34EExkhc73U1kZW0c+RclQqWetoodByp4dWZ/hN8/KVmTRAx2HOnUwib8AwZdA==}
engines: {node: '>=20.9.0'}
'@img/sharp-webcontainers-wasm32@0.35.0':
resolution: {integrity: sha512-t+kie1TOyaDM6Dho+f+y0VqIUNhYQaKCUahuZVi0E0frgdiaOaPsDxDW3wfKacUdaNBCnK/ZDBMg33ydvHj8uA==}
engines: {node: '>=20.9.0'}
cpu: [wasm32]
'@img/sharp-win32-arm64@0.34.5':
resolution: {integrity: sha512-WQ3AgWCWYSb2yt+IG8mnC6Jdk9Whs7O0gxphblsLvdhSpSTtmu69ZG1Gkb6NuvxsNACwiPV6cNSZNzt0KPsw7g==}
engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0}
'@img/sharp-win32-arm64@0.35.0':
resolution: {integrity: sha512-M5eKxug0dabbaWgFKvPa3odNs2OpaP+81NASfGKkt4GcYXpNhSu7CaeYxWkLNV6vHmUp4hnCxnxrUyhUJhXbKA==}
engines: {node: '>=20.9.0'}
cpu: [arm64]
os: [win32]
'@img/sharp-win32-ia32@0.34.5':
resolution: {integrity: sha512-FV9m/7NmeCmSHDD5j4+4pNI8Cp3aW+JvLoXcTUo0IqyjSfAZJ8dIUmijx1qaJsIiU+Hosw6xM5KijAWRJCSgNg==}
engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0}
'@img/sharp-win32-ia32@0.35.0':
resolution: {integrity: sha512-z0+pZ03QCDvdVN0Ez9IX/yjWC19ikMlXrmdYMwYNLTh2BLPx3hXWPvyqWfquZ0BTO9O6GVOjIVoTcyyacMnWlQ==}
engines: {node: ^20.9.0}
cpu: [ia32]
os: [win32]
'@img/sharp-win32-x64@0.34.5':
resolution: {integrity: sha512-+29YMsqY2/9eFEiW93eqWnuLcWcufowXewwSNIT6UwZdUUCrM3oFjMWH/Z6/TMmb4hlFenmfAVbpWeup2jryCw==}
engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0}
'@img/sharp-win32-x64@0.35.0':
resolution: {integrity: sha512-feNnlz5ZHKr0MY1LPHvZQyJeBkbo4ctsn0D8FvA53VTw5TC63rfEL2UrWbkSBR19htSE7Mw78xYVwdJqoMWVHw==}
engines: {node: '>=20.9.0'}
cpu: [x64]
os: [win32]
@@ -4075,8 +4087,8 @@ packages:
resolution: {integrity: sha512-wvUjBtSGN7+7SjNpq/9M2Tg350UZD3q62IFZLbRAR1bSMlCo1ZaeW+BJ+D090e4hIIZLBcTDWe4Mh4jvUDajzQ==}
engines: {node: '>= 0.4'}
axios@1.16.0:
resolution: {integrity: sha512-6hp5CwvTPlN2A31g5dxnwAX0orzM7pmCRDLnZSX772mv8WDqICwFjowHuPs04Mc8deIld1+ejhtaMn5vp6b+1w==}
axios@1.18.0:
resolution: {integrity: sha512-E32NzpYKp++W7XRe52rHiXV2ehxmh3wbdgO7MHeFM+vqxLBYHzt0ElkiImtOBxtOmyp0yoC8C6uESVV84Y2/hw==}
babel-jest@29.6.4:
resolution: {integrity: sha512-meLj23UlSLddj6PC+YTOFRgDAtjnZom8w/ACsrx0gtPtv5cJZk0A5Unk5bV4wixD7XaPCN1fQvpww8czkZURmw==}
@@ -4881,8 +4893,8 @@ packages:
resolution: {integrity: sha512-cgwlv/1iFQiFnU96XXgROh8xTeetsnJiDsTc7TYCLFd9+/WNkIqPTxiM/8pSd8VIrhXGTf1Ny1q1hquVqDJB5w==}
engines: {node: '>= 4'}
dompurify@3.4.11:
resolution: {integrity: sha512-zhlUV12GsaRzMsf9q5M254YhA4+VuF0fG+QFqu6aYpoGlKtz+w8//jBcGVYBgQkR5GHjUomejY84AV+/uPbWdw==}
dompurify@3.4.12:
resolution: {integrity: sha512-zQvGet8Z2sWbQhCmfFz/T5QWH2oBmjnqK3qvOjaqaNLrLEF912WamU+ohnTp0TCep/MFVHpdJuCZEdFOdTnEFg==}
domutils@2.8.0:
resolution: {integrity: sha512-w96Cjofp72M5IIhpjgobBimYEfoPjx1Vx0BSX9P30WBdZW2WIKU0T1Bd0kz2eNZ9ikjKgHbEyKx8BB6H1L3h3A==}
@@ -5448,10 +5460,6 @@ packages:
resolution: {integrity: sha512-iZyKG96/JwPz1N55vj2Ie2vXbhu440zfUfJvSwEqEbeLluk7NnapfGqa7LH0mOsnDxTF85Mx8/dyR6HfqcbmbQ==}
engines: {node: '>=20'}
hasown@2.0.2:
resolution: {integrity: sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==}
engines: {node: '>= 0.4'}
hasown@2.0.4:
resolution: {integrity: sha512-T2UbfbBEF32wiepXIsMlTW9+dDYC6wMh/t/vYA4tuOMKqWz/n3vr1NFSxQiyP+zk2mXsoMA/i/7qV6LKut1t1A==}
engines: {node: '>= 0.4'}
@@ -8062,10 +8070,6 @@ packages:
sax@1.3.0:
resolution: {integrity: sha512-0s+oAmw9zLl1V1cS9BtZN7JAd0cW5e0QH4W3LWEK6a4LaLEA2OTpGYWDY+6XasBLtz6wkm3u1xRw95mRuJ59WA==}
sax@1.4.4:
resolution: {integrity: sha512-1n3r/tGXO6b6VXMdFT54SHzT9ytu9yr7TaELowdYpMqY/Ao7EnlQGmAQ1+RatX7Tkkdm6hONI2owqNx2aZj5Sw==}
engines: {node: '>=11.0.0'}
sax@1.6.0:
resolution: {integrity: sha512-6R3J5M4AcbtLUdZmRv2SygeVaM7IhrLXu9BmnOGmmACak8fiUtOsYNWUS4uK7upbmHIBbLBeFeI//477BKLBzA==}
engines: {node: '>=11.0.0'}
@@ -8122,9 +8126,9 @@ packages:
shallowequal@1.1.0:
resolution: {integrity: sha512-y0m1JoUZSlPAjXVtPPW70aZWfIL/dSP7AFkRnniLCrK/8MDKog3TySTBmckD+RObVxH0v4Tox67+F14PdED2oQ==}
sharp@0.34.5:
resolution: {integrity: sha512-Ou9I5Ft9WNcCbXrU9cMgPBcCK8LiwLqcbywW3t4oDV37n1pzpuNLsYiAV8eODnjbtQlSDwZ2cUEeQz4E54Hltg==}
engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0}
sharp@0.35.0:
resolution: {integrity: sha512-BqvG5XbwPZ4NV0DK90d86leEECMsoa8bO0nqnKWlBDYxri4GJ7c4EDInaF6q20lTh/mATmnDIKWJFfXnoVfH5g==}
engines: {node: '>=20.9.0'}
shebang-command@2.0.0:
resolution: {integrity: sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==}
@@ -8376,8 +8380,8 @@ packages:
svg-tags@1.0.0:
resolution: {integrity: sha512-ovssysQTa+luh7A5Weu3Rta6FJlFBBbInjOh722LIt6klpU2/HtdUbszju/G4devcvk8PGt7FCLv5wftu3THUA==}
svgo@4.0.1:
resolution: {integrity: sha512-XDpWUOPC6FEibaLzjfe0ucaV0YrOjYotGJO1WpF0Zd+n6ZGEQUsSugaoLq9QkEZtAfQIxT42UChcssDVPP3+/w==}
svgo@4.0.2:
resolution: {integrity: sha512-ekx94z1rRc5LDi6oSUaeRnYhd0UOJxdtQCL2rF8xpWxD3TPAsISWOrxezqGovqS38GRZOdpDfvQe3ts6F7nsng==}
engines: {node: '>=16'}
hasBin: true
@@ -10281,6 +10285,11 @@ snapshots:
tslib: 2.8.1
optional: true
'@emnapi/runtime@1.11.2':
dependencies:
tslib: 2.8.1
optional: true
'@emnapi/runtime@1.8.1':
dependencies:
tslib: 2.8.1
@@ -10444,7 +10453,7 @@ snapshots:
'@types/string-hash': 1.1.3
d3-interpolate: 3.0.1
date-fns: 4.1.0
dompurify: 3.4.11
dompurify: 3.4.12
eventemitter3: 5.0.1
fast_array_intersect: 1.1.0
history: 4.10.1
@@ -10485,100 +10494,110 @@ snapshots:
'@humanwhocodes/retry@0.4.3': {}
'@img/colour@1.0.0': {}
'@img/colour@1.1.0': {}
'@img/sharp-darwin-arm64@0.34.5':
'@img/sharp-darwin-arm64@0.35.0':
optionalDependencies:
'@img/sharp-libvips-darwin-arm64': 1.2.4
'@img/sharp-libvips-darwin-arm64': 1.3.0
optional: true
'@img/sharp-darwin-x64@0.34.5':
'@img/sharp-darwin-x64@0.35.0':
optionalDependencies:
'@img/sharp-libvips-darwin-x64': 1.2.4
'@img/sharp-libvips-darwin-x64': 1.3.0
optional: true
'@img/sharp-libvips-darwin-arm64@1.2.4':
optional: true
'@img/sharp-libvips-darwin-x64@1.2.4':
optional: true
'@img/sharp-libvips-linux-arm64@1.2.4':
optional: true
'@img/sharp-libvips-linux-arm@1.2.4':
optional: true
'@img/sharp-libvips-linux-ppc64@1.2.4':
optional: true
'@img/sharp-libvips-linux-riscv64@1.2.4':
optional: true
'@img/sharp-libvips-linux-s390x@1.2.4':
optional: true
'@img/sharp-libvips-linux-x64@1.2.4':
optional: true
'@img/sharp-libvips-linuxmusl-arm64@1.2.4':
optional: true
'@img/sharp-libvips-linuxmusl-x64@1.2.4':
optional: true
'@img/sharp-linux-arm64@0.34.5':
optionalDependencies:
'@img/sharp-libvips-linux-arm64': 1.2.4
optional: true
'@img/sharp-linux-arm@0.34.5':
optionalDependencies:
'@img/sharp-libvips-linux-arm': 1.2.4
optional: true
'@img/sharp-linux-ppc64@0.34.5':
optionalDependencies:
'@img/sharp-libvips-linux-ppc64': 1.2.4
optional: true
'@img/sharp-linux-riscv64@0.34.5':
optionalDependencies:
'@img/sharp-libvips-linux-riscv64': 1.2.4
optional: true
'@img/sharp-linux-s390x@0.34.5':
optionalDependencies:
'@img/sharp-libvips-linux-s390x': 1.2.4
optional: true
'@img/sharp-linux-x64@0.34.5':
optionalDependencies:
'@img/sharp-libvips-linux-x64': 1.2.4
optional: true
'@img/sharp-linuxmusl-arm64@0.34.5':
optionalDependencies:
'@img/sharp-libvips-linuxmusl-arm64': 1.2.4
optional: true
'@img/sharp-linuxmusl-x64@0.34.5':
optionalDependencies:
'@img/sharp-libvips-linuxmusl-x64': 1.2.4
optional: true
'@img/sharp-wasm32@0.34.5':
'@img/sharp-freebsd-wasm32@0.35.0':
dependencies:
'@emnapi/runtime': 1.8.1
'@img/sharp-wasm32': 0.35.0
optional: true
'@img/sharp-win32-arm64@0.34.5':
'@img/sharp-libvips-darwin-arm64@1.3.0':
optional: true
'@img/sharp-win32-ia32@0.34.5':
'@img/sharp-libvips-darwin-x64@1.3.0':
optional: true
'@img/sharp-win32-x64@0.34.5':
'@img/sharp-libvips-linux-arm64@1.3.0':
optional: true
'@img/sharp-libvips-linux-arm@1.3.0':
optional: true
'@img/sharp-libvips-linux-ppc64@1.3.0':
optional: true
'@img/sharp-libvips-linux-riscv64@1.3.0':
optional: true
'@img/sharp-libvips-linux-s390x@1.3.0':
optional: true
'@img/sharp-libvips-linux-x64@1.3.0':
optional: true
'@img/sharp-libvips-linuxmusl-arm64@1.3.0':
optional: true
'@img/sharp-libvips-linuxmusl-x64@1.3.0':
optional: true
'@img/sharp-linux-arm64@0.35.0':
optionalDependencies:
'@img/sharp-libvips-linux-arm64': 1.3.0
optional: true
'@img/sharp-linux-arm@0.35.0':
optionalDependencies:
'@img/sharp-libvips-linux-arm': 1.3.0
optional: true
'@img/sharp-linux-ppc64@0.35.0':
optionalDependencies:
'@img/sharp-libvips-linux-ppc64': 1.3.0
optional: true
'@img/sharp-linux-riscv64@0.35.0':
optionalDependencies:
'@img/sharp-libvips-linux-riscv64': 1.3.0
optional: true
'@img/sharp-linux-s390x@0.35.0':
optionalDependencies:
'@img/sharp-libvips-linux-s390x': 1.3.0
optional: true
'@img/sharp-linux-x64@0.35.0':
optionalDependencies:
'@img/sharp-libvips-linux-x64': 1.3.0
optional: true
'@img/sharp-linuxmusl-arm64@0.35.0':
optionalDependencies:
'@img/sharp-libvips-linuxmusl-arm64': 1.3.0
optional: true
'@img/sharp-linuxmusl-x64@0.35.0':
optionalDependencies:
'@img/sharp-libvips-linuxmusl-x64': 1.3.0
optional: true
'@img/sharp-wasm32@0.35.0':
dependencies:
'@emnapi/runtime': 1.11.2
optional: true
'@img/sharp-webcontainers-wasm32@0.35.0':
dependencies:
'@img/sharp-wasm32': 0.35.0
optional: true
'@img/sharp-win32-arm64@0.35.0':
optional: true
'@img/sharp-win32-ia32@0.35.0':
optional: true
'@img/sharp-win32-x64@0.35.0':
optional: true
'@isaacs/cliui@8.0.2':
@@ -12983,13 +13002,15 @@ snapshots:
dependencies:
possible-typed-array-names: 1.1.0
axios@1.16.0:
axios@1.18.0:
dependencies:
follow-redirects: 1.16.0
form-data: 4.0.6
https-proxy-agent: 5.0.1
proxy-from-env: 2.1.0
transitivePeerDependencies:
- debug
- supports-color
babel-jest@29.6.4(@babel/core@7.29.7):
dependencies:
@@ -13843,7 +13864,7 @@ snapshots:
dependencies:
domelementtype: 2.3.0
dompurify@3.4.11:
dompurify@3.4.12:
optionalDependencies:
'@types/trusted-types': 2.0.7
@@ -14498,10 +14519,6 @@ snapshots:
dependencies:
hookified: 1.15.1
hasown@2.0.2:
dependencies:
function-bind: 1.1.2
hasown@2.0.4:
dependencies:
function-bind: 1.1.2
@@ -14738,7 +14755,7 @@ snapshots:
internal-slot@1.1.0:
dependencies:
es-errors: 1.3.0
hasown: 2.0.2
hasown: 2.0.4
side-channel: 1.1.0
internmap@2.0.3: {}
@@ -14792,7 +14809,7 @@ snapshots:
is-core-module@2.16.1:
dependencies:
hasown: 2.0.2
hasown: 2.0.4
is-date-object@1.1.0:
dependencies:
@@ -14861,7 +14878,7 @@ snapshots:
call-bound: 1.0.4
gopd: 1.2.0
has-tostringtag: 1.0.2
hasown: 2.0.2
hasown: 2.0.4
is-set@2.0.3: {}
@@ -16177,7 +16194,7 @@ snapshots:
monaco-editor@0.55.1:
dependencies:
dompurify: 3.4.11
dompurify: 3.4.12
marked: 14.0.0
motion-dom@11.18.1:
@@ -16272,7 +16289,7 @@ snapshots:
dependencies:
debug: 3.2.7
iconv-lite: 0.6.3
sax: 1.4.4
sax: 1.6.0
transitivePeerDependencies:
- supports-color
optional: true
@@ -17741,9 +17758,6 @@ snapshots:
sax@1.3.0:
optional: true
sax@1.4.4:
optional: true
sax@1.6.0: {}
saxes@6.0.0:
@@ -17797,36 +17811,37 @@ snapshots:
shallowequal@1.1.0: {}
sharp@0.34.5:
sharp@0.35.0:
dependencies:
'@img/colour': 1.0.0
'@img/colour': 1.1.0
detect-libc: 2.1.2
semver: 7.8.5
optionalDependencies:
'@img/sharp-darwin-arm64': 0.34.5
'@img/sharp-darwin-x64': 0.34.5
'@img/sharp-libvips-darwin-arm64': 1.2.4
'@img/sharp-libvips-darwin-x64': 1.2.4
'@img/sharp-libvips-linux-arm': 1.2.4
'@img/sharp-libvips-linux-arm64': 1.2.4
'@img/sharp-libvips-linux-ppc64': 1.2.4
'@img/sharp-libvips-linux-riscv64': 1.2.4
'@img/sharp-libvips-linux-s390x': 1.2.4
'@img/sharp-libvips-linux-x64': 1.2.4
'@img/sharp-libvips-linuxmusl-arm64': 1.2.4
'@img/sharp-libvips-linuxmusl-x64': 1.2.4
'@img/sharp-linux-arm': 0.34.5
'@img/sharp-linux-arm64': 0.34.5
'@img/sharp-linux-ppc64': 0.34.5
'@img/sharp-linux-riscv64': 0.34.5
'@img/sharp-linux-s390x': 0.34.5
'@img/sharp-linux-x64': 0.34.5
'@img/sharp-linuxmusl-arm64': 0.34.5
'@img/sharp-linuxmusl-x64': 0.34.5
'@img/sharp-wasm32': 0.34.5
'@img/sharp-win32-arm64': 0.34.5
'@img/sharp-win32-ia32': 0.34.5
'@img/sharp-win32-x64': 0.34.5
'@img/sharp-darwin-arm64': 0.35.0
'@img/sharp-darwin-x64': 0.35.0
'@img/sharp-freebsd-wasm32': 0.35.0
'@img/sharp-libvips-darwin-arm64': 1.3.0
'@img/sharp-libvips-darwin-x64': 1.3.0
'@img/sharp-libvips-linux-arm': 1.3.0
'@img/sharp-libvips-linux-arm64': 1.3.0
'@img/sharp-libvips-linux-ppc64': 1.3.0
'@img/sharp-libvips-linux-riscv64': 1.3.0
'@img/sharp-libvips-linux-s390x': 1.3.0
'@img/sharp-libvips-linux-x64': 1.3.0
'@img/sharp-libvips-linuxmusl-arm64': 1.3.0
'@img/sharp-libvips-linuxmusl-x64': 1.3.0
'@img/sharp-linux-arm': 0.35.0
'@img/sharp-linux-arm64': 0.35.0
'@img/sharp-linux-ppc64': 0.35.0
'@img/sharp-linux-riscv64': 0.35.0
'@img/sharp-linux-s390x': 0.35.0
'@img/sharp-linux-x64': 0.35.0
'@img/sharp-linuxmusl-arm64': 0.35.0
'@img/sharp-linuxmusl-x64': 0.35.0
'@img/sharp-webcontainers-wasm32': 0.35.0
'@img/sharp-win32-arm64': 0.35.0
'@img/sharp-win32-ia32': 0.35.0
'@img/sharp-win32-x64': 0.35.0
shebang-command@2.0.0:
dependencies:
@@ -18124,7 +18139,7 @@ snapshots:
svg-tags@1.0.0: {}
svgo@4.0.1:
svgo@4.0.2:
dependencies:
commander: 11.1.0
css-select: 5.2.2
@@ -18591,14 +18606,14 @@ snapshots:
pathe: 0.2.0
vite: rolldown-vite@7.3.1(@types/node@16.18.25)(esbuild@0.28.1)(jiti@2.6.1)(less@4.4.0)(sass@1.97.3)(stylus@0.62.0)(terser@5.46.2)(yaml@2.8.4)
vite-plugin-image-optimizer@2.0.3(rolldown-vite@7.3.1(@types/node@16.18.25)(esbuild@0.28.1)(jiti@2.6.1)(less@4.4.0)(sass@1.97.3)(stylus@0.62.0)(terser@5.46.2)(yaml@2.8.4))(sharp@0.34.5)(svgo@4.0.1):
vite-plugin-image-optimizer@2.0.3(rolldown-vite@7.3.1(@types/node@16.18.25)(esbuild@0.28.1)(jiti@2.6.1)(less@4.4.0)(sass@1.97.3)(stylus@0.62.0)(terser@5.46.2)(yaml@2.8.4))(sharp@0.35.0)(svgo@4.0.2):
dependencies:
ansi-colors: 4.1.3
pathe: 2.0.3
vite: rolldown-vite@7.3.1(@types/node@16.18.25)(esbuild@0.28.1)(jiti@2.6.1)(less@4.4.0)(sass@1.97.3)(stylus@0.62.0)(terser@5.46.2)(yaml@2.8.4)
optionalDependencies:
sharp: 0.34.5
svgo: 4.0.1
sharp: 0.35.0
svgo: 4.0.2
vite-tsconfig-paths@6.1.1(rolldown-vite@7.3.1(@types/node@16.18.25)(esbuild@0.28.1)(jiti@2.6.1)(less@4.4.0)(sass@1.97.3)(stylus@0.62.0)(terser@5.46.2)(yaml@2.8.4))(typescript@5.9.3):
dependencies:

View File

@@ -136,7 +136,7 @@ export const invalidateGetChecks = async (
};
/**
* Returns a paginated list of Kubernetes clusters with key aggregated metrics derived by summing per-node values within the group: CPU usage, CPU allocatable, memory working set, memory allocatable. Each row also reports per-group nodeCountsByReadiness ({ ready, notReady } from each node's latest k8s.node.condition_ready value) and per-group podCountsByPhase ({ pending, running, succeeded, failed, unknown } from each pod's latest k8s.pod.phase value). Each cluster includes metadata attributes (k8s.cluster.name). The response type is 'list' for the default k8s.cluster.name grouping or 'grouped_list' for custom groupBy keys; in both modes every row aggregates nodes and pods in the group. Supports filtering via a filter expression, custom groupBy, ordering by cpu / cpu_allocatable / memory / memory_allocatable, and pagination via offset/limit. Also reports whether the requested time range falls before the data retention boundary. Numeric metric fields (clusterCPU, clusterCPUAllocatable, clusterMemory, clusterMemoryAllocatable) return -1 as a sentinel when no data is available for that field.
* Returns a paginated list of Kubernetes clusters with key aggregated metrics derived by summing per-node values within the group: CPU usage, CPU allocatable, memory working set, memory allocatable. Each row also reports per-group nodeCountsByReadiness ({ ready, notReady } from each node's latest k8s.node.condition_ready value) and per-group podCountsByStatus ({ pending, running, failed, unknown, crashLoopBackOff, imagePullBackOff, errImagePull, createContainerConfigError, containerCreating, oomKilled, completed, error, containerCannotRun, evicted, nodeAffinity, nodeLost, shutdown, unexpectedAdmissionError } reflecting each pod's latest kubectl-style display status). Each cluster includes metadata attributes (k8s.cluster.name). The response type is 'list' for the default k8s.cluster.name grouping or 'grouped_list' for custom groupBy keys; in both modes every row aggregates nodes and pods in the group. Supports filtering via a filter expression, custom groupBy, ordering by cpu / cpu_allocatable / memory / memory_allocatable, and pagination via offset/limit. Also reports whether the requested time range falls before the data retention boundary. Numeric metric fields (clusterCPU, clusterCPUAllocatable, clusterMemory, clusterMemoryAllocatable) return -1 as a sentinel when no data is available for that field.
* @summary List Clusters for Infra Monitoring
*/
export const listClusters = (
@@ -219,7 +219,7 @@ export const useListClusters = <
return useMutation(getListClustersMutationOptions(options));
};
/**
* Returns a paginated list of Kubernetes DaemonSets with key aggregated pod metrics: CPU usage and memory working set summed across pods owned by the daemonset, plus average CPU/memory request and limit utilization (daemonSetCPURequest, daemonSetCPULimit, daemonSetMemoryRequest, daemonSetMemoryLimit). Each row also reports the latest known node-level counters from kube-state-metrics: desiredNodes (k8s.daemonset.desired_scheduled_nodes, the number of nodes the daemonset wants to run on), currentNodes (k8s.daemonset.current_scheduled_nodes, the number of nodes the daemonset currently runs on), readyNodes (k8s.daemonset.ready_nodes, the number of nodes running at least one ready daemon pod) and misscheduledNodes (k8s.daemonset.misscheduled_nodes, the number of nodes running the daemon pod but not supposed to) — note these are node counts, not pod counts. It also reports per-group podCountsByPhase ({ pending, running, succeeded, failed, unknown } from each pod's latest k8s.pod.phase value). Each daemonset includes metadata attributes (k8s.daemonset.name, k8s.namespace.name, k8s.cluster.name). The response type is 'list' for the default k8s.daemonset.name grouping or 'grouped_list' for custom groupBy keys; in both modes every row aggregates pods owned by daemonsets in the group. Supports filtering via a filter expression, custom groupBy, ordering by cpu / cpu_request / cpu_limit / memory / memory_request / memory_limit / desired_nodes / current_nodes / ready_nodes / misscheduled_nodes, and pagination via offset/limit. Also reports whether the requested time range falls before the data retention boundary. Numeric metric fields (daemonSetCPU, daemonSetCPURequest, daemonSetCPULimit, daemonSetMemory, daemonSetMemoryRequest, daemonSetMemoryLimit, desiredNodes, currentNodes, readyNodes, misscheduledNodes) return -1 as a sentinel when no data is available for that field.
* Returns a paginated list of Kubernetes DaemonSets with key aggregated pod metrics: CPU usage and memory working set summed across pods owned by the daemonset, plus average CPU/memory request and limit utilization (daemonSetCPURequest, daemonSetCPULimit, daemonSetMemoryRequest, daemonSetMemoryLimit). Each row also reports the latest known node-level counters from kube-state-metrics: desiredNodes (k8s.daemonset.desired_scheduled_nodes, the number of nodes the daemonset wants to run on), currentNodes (k8s.daemonset.current_scheduled_nodes, the number of nodes the daemonset currently runs on), readyNodes (k8s.daemonset.ready_nodes, the number of nodes running at least one ready daemon pod) and misscheduledNodes (k8s.daemonset.misscheduled_nodes, the number of nodes running the daemon pod but not supposed to) — note these are node counts, not pod counts. It also reports per-group podCountsByStatus ({ pending, running, failed, unknown, crashLoopBackOff, imagePullBackOff, errImagePull, createContainerConfigError, containerCreating, oomKilled, completed, error, containerCannotRun, evicted, nodeAffinity, nodeLost, shutdown, unexpectedAdmissionError } reflecting each pod's latest kubectl-style display status). Each daemonset includes metadata attributes (k8s.daemonset.name, k8s.namespace.name, k8s.cluster.name). The response type is 'list' for the default k8s.daemonset.name grouping or 'grouped_list' for custom groupBy keys; in both modes every row aggregates pods owned by daemonsets in the group. Supports filtering via a filter expression, custom groupBy, ordering by cpu / cpu_request / cpu_limit / memory / memory_request / memory_limit / desired_nodes / current_nodes / ready_nodes / misscheduled_nodes, and pagination via offset/limit. Also reports whether the requested time range falls before the data retention boundary. Numeric metric fields (daemonSetCPU, daemonSetCPURequest, daemonSetCPULimit, daemonSetMemory, daemonSetMemoryRequest, daemonSetMemoryLimit, desiredNodes, currentNodes, readyNodes, misscheduledNodes) return -1 as a sentinel when no data is available for that field.
* @summary List DaemonSets for Infra Monitoring
*/
export const listDaemonSets = (
@@ -302,7 +302,7 @@ export const useListDaemonSets = <
return useMutation(getListDaemonSetsMutationOptions(options));
};
/**
* Returns a paginated list of Kubernetes Deployments with key aggregated pod metrics: CPU usage and memory working set summed across pods owned by the deployment, plus average CPU/memory request and limit utilization (deploymentCPURequest, deploymentCPULimit, deploymentMemoryRequest, deploymentMemoryLimit). Each row also reports the latest known desiredPods (k8s.deployment.desired) and availablePods (k8s.deployment.available) replica counts and per-group podCountsByPhase ({ pending, running, succeeded, failed, unknown } from each pod's latest k8s.pod.phase value). Each deployment includes metadata attributes (k8s.deployment.name, k8s.namespace.name, k8s.cluster.name). The response type is 'list' for the default k8s.deployment.name grouping or 'grouped_list' for custom groupBy keys; in both modes every row aggregates pods owned by deployments in the group. Supports filtering via a filter expression, custom groupBy, ordering by cpu / cpu_request / cpu_limit / memory / memory_request / memory_limit / desired_pods / available_pods, and pagination via offset/limit. Also reports whether the requested time range falls before the data retention boundary. Numeric metric fields (deploymentCPU, deploymentCPURequest, deploymentCPULimit, deploymentMemory, deploymentMemoryRequest, deploymentMemoryLimit, desiredPods, availablePods) return -1 as a sentinel when no data is available for that field.
* Returns a paginated list of Kubernetes Deployments with key aggregated pod metrics: CPU usage and memory working set summed across pods owned by the deployment, plus average CPU/memory request and limit utilization (deploymentCPURequest, deploymentCPULimit, deploymentMemoryRequest, deploymentMemoryLimit). Each row also reports the latest known desiredPods (k8s.deployment.desired) and availablePods (k8s.deployment.available) replica counts and per-group podCountsByStatus ({ pending, running, failed, unknown, crashLoopBackOff, imagePullBackOff, errImagePull, createContainerConfigError, containerCreating, oomKilled, completed, error, containerCannotRun, evicted, nodeAffinity, nodeLost, shutdown, unexpectedAdmissionError } reflecting each pod's latest kubectl-style display status). Each deployment includes metadata attributes (k8s.deployment.name, k8s.namespace.name, k8s.cluster.name). The response type is 'list' for the default k8s.deployment.name grouping or 'grouped_list' for custom groupBy keys; in both modes every row aggregates pods owned by deployments in the group. Supports filtering via a filter expression, custom groupBy, ordering by cpu / cpu_request / cpu_limit / memory / memory_request / memory_limit / desired_pods / available_pods, and pagination via offset/limit. Also reports whether the requested time range falls before the data retention boundary. Numeric metric fields (deploymentCPU, deploymentCPURequest, deploymentCPULimit, deploymentMemory, deploymentMemoryRequest, deploymentMemoryLimit, desiredPods, availablePods) return -1 as a sentinel when no data is available for that field.
* @summary List Deployments for Infra Monitoring
*/
export const listDeployments = (
@@ -468,7 +468,7 @@ export const useListHosts = <
return useMutation(getListHostsMutationOptions(options));
};
/**
* Returns a paginated list of Kubernetes Jobs with key aggregated pod metrics: CPU usage and memory working set summed across pods owned by the job, plus average CPU/memory request and limit utilization (jobCPURequest, jobCPULimit, jobMemoryRequest, jobMemoryLimit). Each row also reports the latest known job-level counters from kube-state-metrics: desiredSuccessfulPods (k8s.job.desired_successful_pods, the target completion count), activePods (k8s.job.active_pods), failedPods (k8s.job.failed_pods, cumulative across the lifetime of the job), and successfulPods (k8s.job.successful_pods, cumulative). It also reports per-group podCountsByPhase ({ pending, running, succeeded, failed, unknown } from each pod's latest k8s.pod.phase value); note podCountsByPhase.failed (current pod-phase) is distinct from failedPods (cumulative job kube-state-metric). Each job includes metadata attributes (k8s.job.name, k8s.namespace.name, k8s.cluster.name). The response type is 'list' for the default k8s.job.name grouping or 'grouped_list' for custom groupBy keys; in both modes every row aggregates pods owned by jobs in the group. Supports filtering via a filter expression, custom groupBy, ordering by cpu / cpu_request / cpu_limit / memory / memory_request / memory_limit / desired_successful_pods / active_pods / failed_pods / successful_pods, and pagination via offset/limit. Also reports whether the requested time range falls before the data retention boundary. Numeric metric fields (jobCPU, jobCPURequest, jobCPULimit, jobMemory, jobMemoryRequest, jobMemoryLimit, desiredSuccessfulPods, activePods, failedPods, successfulPods) return -1 as a sentinel when no data is available for that field.
* Returns a paginated list of Kubernetes Jobs with key aggregated pod metrics: CPU usage and memory working set summed across pods owned by the job, plus average CPU/memory request and limit utilization (jobCPURequest, jobCPULimit, jobMemoryRequest, jobMemoryLimit). Each row also reports the latest known job-level counters from kube-state-metrics: desiredSuccessfulPods (k8s.job.desired_successful_pods, the target completion count), activePods (k8s.job.active_pods), failedPods (k8s.job.failed_pods, cumulative across the lifetime of the job), and successfulPods (k8s.job.successful_pods, cumulative). It also reports per-group podCountsByStatus ({ pending, running, failed, unknown, crashLoopBackOff, imagePullBackOff, errImagePull, createContainerConfigError, containerCreating, oomKilled, completed, error, containerCannotRun, evicted, nodeAffinity, nodeLost, shutdown, unexpectedAdmissionError } reflecting each pod's latest kubectl-style display status); note podCountsByStatus.failed (current pod status) is distinct from failedPods (cumulative job kube-state-metric). Each job includes metadata attributes (k8s.job.name, k8s.namespace.name, k8s.cluster.name). The response type is 'list' for the default k8s.job.name grouping or 'grouped_list' for custom groupBy keys; in both modes every row aggregates pods owned by jobs in the group. Supports filtering via a filter expression, custom groupBy, ordering by cpu / cpu_request / cpu_limit / memory / memory_request / memory_limit / desired_successful_pods / active_pods / failed_pods / successful_pods, and pagination via offset/limit. Also reports whether the requested time range falls before the data retention boundary. Numeric metric fields (jobCPU, jobCPURequest, jobCPULimit, jobMemory, jobMemoryRequest, jobMemoryLimit, desiredSuccessfulPods, activePods, failedPods, successfulPods) return -1 as a sentinel when no data is available for that field.
* @summary List Jobs for Infra Monitoring
*/
export const listJobs = (
@@ -634,7 +634,7 @@ export const useListContainers = <
return useMutation(getListContainersMutationOptions(options));
};
/**
* Returns a paginated list of Kubernetes namespaces with key aggregated pod metrics: CPU usage and memory working set (summed across pods in the group), plus per-group podCountsByPhase ({ pending, running, succeeded, failed, unknown } from each pod's latest k8s.pod.phase value in the window). Each namespace includes metadata attributes (k8s.namespace.name, k8s.cluster.name). The response type is 'list' for the default k8s.namespace.name grouping or 'grouped_list' for custom groupBy keys; in both modes every row aggregates pods in the group. Supports filtering via a filter expression, custom groupBy, ordering by cpu / memory, and pagination via offset/limit. Also reports whether the requested time range falls before the data retention boundary. Numeric metric fields (namespaceCPU, namespaceMemory) return -1 as a sentinel when no data is available for that field.
* Returns a paginated list of Kubernetes namespaces with key aggregated pod metrics: CPU usage and memory working set (summed across pods in the group), plus per-group podCountsByStatus ({ pending, running, failed, unknown, crashLoopBackOff, imagePullBackOff, errImagePull, createContainerConfigError, containerCreating, oomKilled, completed, error, containerCannotRun, evicted, nodeAffinity, nodeLost, shutdown, unexpectedAdmissionError } reflecting each pod's latest kubectl-style display status in the window). Each namespace includes metadata attributes (k8s.namespace.name, k8s.cluster.name). The response type is 'list' for the default k8s.namespace.name grouping or 'grouped_list' for custom groupBy keys; in both modes every row aggregates pods in the group. Supports filtering via a filter expression, custom groupBy, ordering by cpu / memory, and pagination via offset/limit. Also reports whether the requested time range falls before the data retention boundary. Numeric metric fields (namespaceCPU, namespaceMemory) return -1 as a sentinel when no data is available for that field.
* @summary List Namespaces for Infra Monitoring
*/
export const listNamespaces = (
@@ -717,7 +717,7 @@ export const useListNamespaces = <
return useMutation(getListNamespacesMutationOptions(options));
};
/**
* Returns a paginated list of Kubernetes nodes with key metrics: CPU usage, CPU allocatable, memory working set, memory allocatable, per-group nodeCountsByReadiness ({ ready, notReady } from each node's latest k8s.node.condition_ready in the window) and per-group podCountsByPhase ({ pending, running, succeeded, failed, unknown } for pods scheduled on the listed nodes). Each node includes metadata attributes (k8s.node.uid, k8s.cluster.name). The response type is 'list' for the default k8s.node.name grouping (each row is one node with its current condition string: ready / not_ready / no_data) or 'grouped_list' for custom groupBy keys (each row aggregates nodes in the group; condition stays no_data). Supports filtering via a filter expression, custom groupBy, ordering by cpu / cpu_allocatable / memory / memory_allocatable, and pagination via offset/limit. Also reports whether the requested time range falls before the data retention boundary. Numeric metric fields (nodeCPU, nodeCPUAllocatable, nodeMemory, nodeMemoryAllocatable) return -1 as a sentinel when no data is available for that field.
* Returns a paginated list of Kubernetes nodes with key metrics: CPU usage, CPU allocatable, memory working set, memory allocatable, per-group nodeCountsByReadiness ({ ready, notReady } from each node's latest k8s.node.condition_ready in the window) and per-group podCountsByStatus ({ pending, running, failed, unknown, crashLoopBackOff, imagePullBackOff, errImagePull, createContainerConfigError, containerCreating, oomKilled, completed, error, containerCannotRun, evicted, nodeAffinity, nodeLost, shutdown, unexpectedAdmissionError } for pods scheduled on the listed nodes, reflecting each pod's latest kubectl-style display status). Each node includes metadata attributes (k8s.node.uid, k8s.cluster.name). The response type is 'list' for the default k8s.node.name grouping (each row is one node with its current condition string: ready / not_ready / no_data) or 'grouped_list' for custom groupBy keys (each row aggregates nodes in the group; condition stays no_data). Supports filtering via a filter expression, custom groupBy, ordering by cpu / cpu_allocatable / memory / memory_allocatable, and pagination via offset/limit. Also reports whether the requested time range falls before the data retention boundary. Numeric metric fields (nodeCPU, nodeCPUAllocatable, nodeMemory, nodeMemoryAllocatable) return -1 as a sentinel when no data is available for that field.
* @summary List Nodes for Infra Monitoring
*/
export const listNodes = (
@@ -800,7 +800,7 @@ export const useListNodes = <
return useMutation(getListNodesMutationOptions(options));
};
/**
* Returns a paginated list of Kubernetes pods with key metrics: CPU usage, CPU request/limit utilization, memory working set, memory request/limit utilization, current pod phase (pending/running/succeeded/failed/unknown/no_data), and pod age (ms since start time). Each pod includes metadata attributes (namespace, node, workload owner such as deployment/statefulset/daemonset/job/cronjob, cluster). Supports filtering via a filter expression, custom groupBy to aggregate pods by any attribute, ordering by any of the six metrics (cpu, cpu_request, cpu_limit, memory, memory_request, memory_limit), and pagination via offset/limit. The response type is 'list' for the default k8s.pod.uid grouping (each row is one pod with its current phase) or 'grouped_list' for custom groupBy keys (each row aggregates pods in the group with per-phase counts under podCountsByPhase: { pending, running, succeeded, failed, unknown } derived from each pod's latest phase in the window). Also reports whether the requested time range falls before the data retention boundary. Numeric metric fields (podCPU, podCPURequest, podCPULimit, podMemory, podMemoryRequest, podMemoryLimit, podAge) return -1 as a sentinel when no data is available for that field.
* Returns a paginated list of Kubernetes pods with key metrics: CPU usage, CPU request/limit utilization, memory working set, memory request/limit utilization, current pod status (kubectl-style display status such as Running/Pending/CrashLoopBackOff, or no_data), and pod age (ms since start time). Each pod includes metadata attributes (namespace, node, workload owner such as deployment/statefulset/daemonset/job/cronjob, cluster). Supports filtering via a filter expression, custom groupBy to aggregate pods by any attribute, ordering by any of the six metrics (cpu, cpu_request, cpu_limit, memory, memory_request, memory_limit), and pagination via offset/limit. The response type is 'list' for the default k8s.pod.uid grouping (each row is one pod with its current status) or 'grouped_list' for custom groupBy keys (each row aggregates pods in the group with per-status counts under podCountsByStatus: { pending, running, failed, unknown, crashLoopBackOff, imagePullBackOff, errImagePull, createContainerConfigError, containerCreating, oomKilled, completed, error, containerCannotRun, evicted, nodeAffinity, nodeLost, shutdown, unexpectedAdmissionError } derived from each pod's latest kubectl-style display status in the window). Also reports whether the requested time range falls before the data retention boundary. Numeric metric fields (podCPU, podCPURequest, podCPULimit, podMemory, podMemoryRequest, podMemoryLimit, podAge) return -1 as a sentinel when no data is available for that field.
* @summary List Pods for Infra Monitoring
*/
export const listPods = (
@@ -966,7 +966,7 @@ export const useListVolumes = <
return useMutation(getListVolumesMutationOptions(options));
};
/**
* Returns a paginated list of Kubernetes StatefulSets with key aggregated pod metrics: CPU usage and memory working set summed across pods owned by the statefulset, plus average CPU/memory request and limit utilization (statefulSetCPURequest, statefulSetCPULimit, statefulSetMemoryRequest, statefulSetMemoryLimit). Each row also reports the latest known desiredPods (k8s.statefulset.desired_pods) and currentPods (k8s.statefulset.current_pods) replica counts and per-group podCountsByPhase ({ pending, running, succeeded, failed, unknown } from each pod's latest k8s.pod.phase value). Each statefulset includes metadata attributes (k8s.statefulset.name, k8s.namespace.name, k8s.cluster.name). The response type is 'list' for the default k8s.statefulset.name grouping or 'grouped_list' for custom groupBy keys; in both modes every row aggregates pods owned by statefulsets in the group. Supports filtering via a filter expression, custom groupBy, ordering by cpu / cpu_request / cpu_limit / memory / memory_request / memory_limit / desired_pods / current_pods, and pagination via offset/limit. Also reports whether the requested time range falls before the data retention boundary. Numeric metric fields (statefulSetCPU, statefulSetCPURequest, statefulSetCPULimit, statefulSetMemory, statefulSetMemoryRequest, statefulSetMemoryLimit, desiredPods, currentPods) return -1 as a sentinel when no data is available for that field.
* Returns a paginated list of Kubernetes StatefulSets with key aggregated pod metrics: CPU usage and memory working set summed across pods owned by the statefulset, plus average CPU/memory request and limit utilization (statefulSetCPURequest, statefulSetCPULimit, statefulSetMemoryRequest, statefulSetMemoryLimit). Each row also reports the latest known desiredPods (k8s.statefulset.desired_pods) and currentPods (k8s.statefulset.current_pods) replica counts and per-group podCountsByStatus ({ pending, running, failed, unknown, crashLoopBackOff, imagePullBackOff, errImagePull, createContainerConfigError, containerCreating, oomKilled, completed, error, containerCannotRun, evicted, nodeAffinity, nodeLost, shutdown, unexpectedAdmissionError } reflecting each pod's latest kubectl-style display status). Each statefulset includes metadata attributes (k8s.statefulset.name, k8s.namespace.name, k8s.cluster.name). The response type is 'list' for the default k8s.statefulset.name grouping or 'grouped_list' for custom groupBy keys; in both modes every row aggregates pods owned by statefulsets in the group. Supports filtering via a filter expression, custom groupBy, ordering by cpu / cpu_request / cpu_limit / memory / memory_request / memory_limit / desired_pods / current_pods, and pagination via offset/limit. Also reports whether the requested time range falls before the data retention boundary. Numeric metric fields (statefulSetCPU, statefulSetCPURequest, statefulSetCPULimit, statefulSetMemory, statefulSetMemoryRequest, statefulSetMemoryLimit, desiredPods, currentPods) return -1 as a sentinel when no data is available for that field.
* @summary List StatefulSets for Infra Monitoring
*/
export const listStatefulSets = (

View File

@@ -4626,9 +4626,9 @@ export interface DashboardtypesQueryDTO {
export interface DashboardtypesPanelSpecDTO {
display: DashboardtypesDisplayDTO;
/**
* @type array,null
* @type array
*/
links?: DashboardtypesLinkDTO[] | null;
links: DashboardtypesLinkDTO[];
plugin: DashboardtypesPanelPluginDTO;
/**
* @type array
@@ -4668,12 +4668,18 @@ export type DashboardtypesVariableDefaultValueDTO = string | string[];
export enum DashboardtypesVariablePluginVariantGithubComSigNozSignozPkgTypesDashboardtypesDynamicVariableSpecDTOKind {
'signoz/DynamicVariable' = 'signoz/DynamicVariable',
}
export enum DashboardtypesDynamicVariableSignalDTO {
traces = 'traces',
logs = 'logs',
metrics = 'metrics',
all = 'all',
}
export interface DashboardtypesDynamicVariableSpecDTO {
/**
* @type string
*/
name: string;
signal?: TelemetrytypesSignalDTO;
signal: DashboardtypesDynamicVariableSignalDTO;
}
export interface DashboardtypesVariablePluginVariantGithubComSigNozSignozPkgTypesDashboardtypesDynamicVariableSpecDTO {
@@ -4815,9 +4821,9 @@ export interface DashboardtypesDashboardSpecDTO {
*/
layouts: DashboardtypesLayoutDTO[];
/**
* @type array,null
* @type array
*/
links?: DashboardtypesLinkDTO[] | null;
links: DashboardtypesLinkDTO[];
/**
* @type object
*/
@@ -5736,29 +5742,6 @@ export interface InframonitoringtypesNodeCountsByReadinessDTO {
ready: number;
}
export interface InframonitoringtypesPodCountsByPhaseDTO {
/**
* @type integer
*/
failed: number;
/**
* @type integer
*/
pending: number;
/**
* @type integer
*/
running: number;
/**
* @type integer
*/
succeeded: number;
/**
* @type integer
*/
unknown: number;
}
export interface InframonitoringtypesPodCountsByStatusDTO {
/**
* @type integer
@@ -5868,7 +5851,6 @@ export interface InframonitoringtypesClusterRecordDTO {
*/
meta: InframonitoringtypesClusterRecordDTOMeta;
nodeCountsByReadiness: InframonitoringtypesNodeCountsByReadinessDTO;
podCountsByPhase: InframonitoringtypesPodCountsByPhaseDTO;
podCountsByStatus: InframonitoringtypesPodCountsByStatusDTO;
}
@@ -6144,7 +6126,6 @@ export interface InframonitoringtypesDaemonSetRecordDTO {
* @type integer
*/
misscheduledNodes: number;
podCountsByPhase: InframonitoringtypesPodCountsByPhaseDTO;
podCountsByStatus: InframonitoringtypesPodCountsByStatusDTO;
/**
* @type integer
@@ -6226,7 +6207,6 @@ export interface InframonitoringtypesDeploymentRecordDTO {
* @type object,null
*/
meta: InframonitoringtypesDeploymentRecordDTOMeta;
podCountsByPhase: InframonitoringtypesPodCountsByPhaseDTO;
podCountsByStatus: InframonitoringtypesPodCountsByStatusDTO;
}
@@ -6393,7 +6373,6 @@ export interface InframonitoringtypesJobRecordDTO {
* @type object,null
*/
meta: InframonitoringtypesJobRecordDTOMeta;
podCountsByPhase: InframonitoringtypesPodCountsByPhaseDTO;
podCountsByStatus: InframonitoringtypesPodCountsByStatusDTO;
/**
* @type integer
@@ -6474,7 +6453,6 @@ export interface InframonitoringtypesNamespaceRecordDTO {
* @type string
*/
namespaceName: string;
podCountsByPhase: InframonitoringtypesPodCountsByPhaseDTO;
podCountsByStatus: InframonitoringtypesPodCountsByStatusDTO;
}
@@ -6541,7 +6519,6 @@ export interface InframonitoringtypesNodeRecordDTO {
* @type string
*/
nodeName: string;
podCountsByPhase: InframonitoringtypesPodCountsByPhaseDTO;
podCountsByStatus: InframonitoringtypesPodCountsByStatusDTO;
}
@@ -6562,14 +6539,6 @@ export interface InframonitoringtypesNodesDTO {
warning?: Querybuildertypesv5QueryWarnDataDTO;
}
export enum InframonitoringtypesPodPhaseDTO {
pending = 'pending',
running = 'running',
succeeded = 'succeeded',
failed = 'failed',
unknown = 'unknown',
no_data = 'no_data',
}
export type InframonitoringtypesPodRecordDTOMetaAnyOf = {
[key: string]: string;
};
@@ -6626,7 +6595,6 @@ export interface InframonitoringtypesPodRecordDTO {
* @format double
*/
podCPURequest: number;
podCountsByPhase: InframonitoringtypesPodCountsByPhaseDTO;
podCountsByStatus: InframonitoringtypesPodCountsByStatusDTO;
/**
* @type number
@@ -6643,7 +6611,6 @@ export interface InframonitoringtypesPodRecordDTO {
* @format double
*/
podMemoryRequest: number;
podPhase: InframonitoringtypesPodPhaseDTO;
/**
* @type integer
* @format int64
@@ -6993,7 +6960,6 @@ export interface InframonitoringtypesStatefulSetRecordDTO {
* @type object,null
*/
meta: InframonitoringtypesStatefulSetRecordDTOMeta;
podCountsByPhase: InframonitoringtypesPodCountsByPhaseDTO;
podCountsByStatus: InframonitoringtypesPodCountsByStatusDTO;
/**
* @type number

View File

@@ -1,26 +1,50 @@
import axios from 'api';
import { ErrorResponseHandlerV2 } from 'api/ErrorResponseHandlerV2';
import { AxiosError } from 'axios';
import { AxiosError, AxiosResponse } from 'axios';
import { ErrorV2Resp } from 'types/api';
import { ExportRawDataProps } from 'types/api/exportRawData/getExportRawData';
export interface FetchExportDataProps extends ExportRawDataProps {
signal?: AbortSignal;
}
async function postExportRawData({
format,
body,
signal,
}: FetchExportDataProps): Promise<AxiosResponse<Blob>> {
return axios.post<Blob>(
`export_raw_data?format=${encodeURIComponent(format)}`,
body,
{
responseType: 'blob',
decompress: true,
headers: {
Accept: 'application/octet-stream',
'Content-Type': 'application/json',
},
timeout: 0,
signal,
},
);
}
/**
* Fetches a single export_raw_data page and returns it as a Blob.
* Callers own retry/cancel/error UX.
*/
export async function fetchExportData(
props: FetchExportDataProps,
): Promise<Blob> {
const response = await postExportRawData(props);
return response.data;
}
export const downloadExportData = async (
props: ExportRawDataProps,
): Promise<void> => {
try {
const response = await axios.post<Blob>(
`export_raw_data?format=${encodeURIComponent(props.format)}`,
props.body,
{
responseType: 'blob',
decompress: true,
headers: {
Accept: 'application/octet-stream',
'Content-Type': 'application/json',
},
timeout: 0,
},
);
const response = await postExportRawData(props);
if (response.status !== 200) {
throw new Error(

View File

@@ -713,6 +713,19 @@ const CustomMultiSelect: React.FC<CustomMultiSelectProps> = ({
}
};
// Row buttons select without letting the wrapping checkbox also toggle:
// stop propagation, run the selection, then drop the active/chip focus.
const selectFromButton = (
e: React.MouseEvent,
source: 'option' | 'checkbox',
): void => {
e.stopPropagation();
e.preventDefault();
handleItemSelection(source);
setActiveChipIndex(-1);
setActiveIndex(-1);
};
return (
<div
key={option.value || `option-${index}`}
@@ -726,13 +739,6 @@ const CustomMultiSelect: React.FC<CustomMultiSelectProps> = ({
selected: isSelected,
active: isActive,
})}
onClick={(e): void => {
e.stopPropagation();
e.preventDefault();
handleItemSelection('option');
setActiveChipIndex(-1);
setActiveIndex(-1);
}}
onKeyDown={(e): void => {
if ((e.key === 'Enter' || e.key === SPACEKEY) && isActive) {
e.stopPropagation();
@@ -752,13 +758,7 @@ const CustomMultiSelect: React.FC<CustomMultiSelectProps> = ({
<Checkbox
value={isSelected}
className="option-checkbox"
onClick={(e): void => {
e.stopPropagation();
e.preventDefault();
handleItemSelection('checkbox');
setActiveChipIndex(-1);
setActiveIndex(-1);
}}
onClick={(e): void => selectFromButton(e, 'checkbox')}
>
<div className="option-content">
<Typography.Text truncate={1} className="option-label-text">
@@ -768,11 +768,19 @@ const CustomMultiSelect: React.FC<CustomMultiSelectProps> = ({
<div className="option-badge">{capitalize(option.type)}</div>
)}
{option.value && ensureValidOption(option.value) && (
<Button type="text" className="only-btn">
<Button
type="text"
className="only-btn"
onClick={(e): void => selectFromButton(e, 'option')}
>
{currentToggleTagValue({ option: option.value })}
</Button>
)}
<Button type="text" className="toggle-btn">
<Button
type="text"
className="toggle-btn"
onClick={(e): void => selectFromButton(e, 'checkbox')}
>
Toggle
</Button>
</div>

View File

@@ -656,6 +656,28 @@ describe('CustomMultiSelect - Comprehensive Tests', () => {
});
});
it('UI-03b: clicking "Only" selects just that value', async () => {
renderWithVirtuoso(
<CustomMultiSelect
options={mockOptions}
onChange={mockOnChange}
value={['frontend']}
/>,
);
const combobox = screen.getByRole('combobox');
await user.click(combobox);
// "Only" renders for each non-selected row (hidden until hover via CSS,
// which jsdom doesn't apply, so it's clickable here).
const onlyButtons = await screen.findAllByText('Only');
mockOnChange.mockClear();
await user.click(onlyButtons[0]);
expect(mockOnChange).toHaveBeenCalledTimes(1);
expect(mockOnChange.mock.calls[0][0]).toStrictEqual(['backend']);
});
it('UI-04: Should display values with loading info at bottom', async () => {
renderWithVirtuoso(
<CustomMultiSelect options={mockOptions} onChange={mockOnChange} loading />,
@@ -1449,7 +1471,7 @@ describe('CustomMultiSelect - Comprehensive Tests', () => {
expect(mockOnChange).toHaveBeenCalledWith(
['custom-value'],
[{ label: 'custom-value', value: 'custom-value' }],
[{ label: 'custom-value', value: 'custom-value', type: 'custom' }],
);
});
});

View File

@@ -0,0 +1,21 @@
import { prioritizeOrAddOptionForMultiSelect } from '../utils';
describe('prioritizeOrAddOptionForMultiSelect ordering', () => {
it('hoists selected then preserves the given (sorted) order in each group', () => {
const sorted = ['apple', 'banana', 'cherry', 'date', 'elderberry'].map(
(v) => ({ label: v, value: v }),
);
// selection given in a non-sorted order on purpose
const result = prioritizeOrAddOptionForMultiSelect(sorted, [
'date',
'banana',
]);
expect(result.map((o) => o.value)).toStrictEqual([
'banana',
'date',
'apple',
'cherry',
'elderberry',
]);
});
});

View File

@@ -458,7 +458,9 @@ $custom-border-color: #2c3044;
.option-item {
padding: 8px 12px;
cursor: pointer;
// Not the whole row — only the checkbox and the action buttons get the
// pointer (set below), so inert areas don't look clickable.
cursor: default;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
@@ -494,6 +496,13 @@ $custom-border-color: #2c3044;
.option-checkbox {
width: 100%;
cursor: default;
// The checkbox button is the only pointer target on the left; the label
// still toggles on click but keeps a default cursor.
> button {
cursor: pointer;
}
// @signozhq/ui Checkbox renders children inside a <label> that is
// content-sized by default. Make it fill the row (min-width: 0 lets it
@@ -535,9 +544,9 @@ $custom-border-color: #2c3044;
}
}
// Size the buttons to the row's resting content height (20px) and fully
// override antd's default 32px Button box, so revealing them on hover
// never changes the row height.
// "Only"/"All" is the primary action — a filled pill that reads as a
// button; "Toggle" is a secondary hint in plain text. Sized to the row's
// resting height so revealing them on hover never shifts it.
.only-btn,
.toggle-btn {
display: none;
@@ -545,14 +554,39 @@ $custom-border-color: #2c3044;
justify-content: center;
height: 18px;
min-height: 0;
padding: 0 6px;
font-size: 12px;
line-height: 1;
border: none;
box-shadow: none;
}
&:hover {
background-color: unset;
.only-btn {
padding: 4px 8px;
// Black interior + a visible border so the pill stands out clearly
// against the near-black row when revealed on hover.
border: 1px solid var(--l3-border);
border-radius: 3px;
background-color: var(--bg-ink-500, #0b0c0e);
color: var(--l1-foreground);
cursor: pointer;
}
.toggle-btn {
padding: 0 6px;
border: none;
background-color: transparent;
color: var(--l2-foreground);
cursor: pointer;
}
// Toggle appears over the checkbox area; "Only/All" takes over the row
// content and hides Toggle there (higher specificity wins).
&:hover {
.toggle-btn {
display: flex;
}
.option-badge {
display: none;
}
}
@@ -560,6 +594,7 @@ $custom-border-color: #2c3044;
.only-btn {
display: flex;
}
.toggle-btn {
display: none;
}
@@ -569,15 +604,6 @@ $custom-border-color: #2c3044;
}
}
}
.option-checkbox:hover {
.toggle-btn {
display: flex;
}
.option-badge {
display: none;
}
}
}
.loading-container {

View File

@@ -52,6 +52,8 @@ import type { SignalType } from 'types/api/v5/queryRange';
import { queryExamples, SUGGESTIONS_SECTION } from './constants';
import {
combineInitialAndUserExpression,
dedupeOptionsByLabel,
getFieldContextPrefix,
getRecentOptions,
renderRecentDeleteButton,
} from './utils';
@@ -222,6 +224,12 @@ function QuerySearch({
QueryKeyDataSuggestionsProps[] | null
>(null);
// dedupe keySuggestions by label/name
const dedupedKeySuggestions = useMemo(
() => dedupeOptionsByLabel(keySuggestions || []),
[keySuggestions],
);
const [showExamples] = useState(false);
const [cursorPos, setCursorPos] = useState({ line: 0, ch: 0 });
@@ -246,9 +254,11 @@ function QuerySearch({
[key: string]: QueryKeyDataSuggestionsProps[];
}): any[] =>
Object.values(keys).flatMap((items: QueryKeyDataSuggestionsProps[]) =>
items.map(({ name, fieldDataType }) => ({
items.map(({ name, fieldDataType, fieldContext }) => ({
label: name,
type: fieldDataType === 'string' ? 'keyword' : fieldDataType,
fieldContext,
fieldDataType,
info: '',
details: '',
})),
@@ -307,13 +317,17 @@ function QuerySearch({
if (response.data.data) {
const { keys } = response.data.data;
const options = generateOptions(keys);
// Use a Map to deduplicate by label and preserve order: new options take precedence
// Deduplicate by full variant identity (name + context + data type), NOT by
// label. deduping by label removes varient which is not expected. If we need
// to dedupe by label use dedupedKeySuggestions not dedupe the source itself
const variantId = (opt: QueryKeyDataSuggestionsProps): string =>
`${opt.label}|${opt.fieldContext ?? ''}|${opt.fieldDataType ?? ''}`;
const merged = new Map<string, QueryKeyDataSuggestionsProps>();
options.forEach((opt) => merged.set(opt.label, opt));
options.forEach((opt) => merged.set(variantId(opt), opt));
if (searchText && lastKeyRef.current !== searchText) {
(keySuggestions || []).forEach((opt) => {
if (!merged.has(opt.label)) {
merged.set(opt.label, opt);
if (!merged.has(variantId(opt))) {
merged.set(variantId(opt), opt);
}
});
}
@@ -919,8 +933,55 @@ function QuerySearch({
if (queryContext.isInKey) {
const searchText = word?.text.toLowerCase().trim() ?? '';
const fieldContextMatch = getFieldContextPrefix(searchText);
options = (keySuggestions || []).filter((option) =>
if (fieldContextMatch) {
const { context: fieldContext, remainder } = fieldContextMatch;
// Fetch the context's page when the prefix is typed exactly eg.("attribute.")
if (remainder === '' && lastFetchedKeyRef.current !== searchText) {
debouncedFetchKeySuggestions(searchText);
}
//suggestions that actually do start with <fieldContext>.
const nameMatches = (keySuggestions || [])
.filter((option) => option.label.toLowerCase().includes(searchText))
.map((option) => ({ ...option, boost: 100 }));
//suggestions which do not start with the prefix but qualifies for suggestion
const contextQualified = (keySuggestions || [])
.filter(
(option) =>
option.fieldContext === fieldContext &&
option.label.toLowerCase().includes(remainder),
)
.map((option) => ({
...option,
label: `${fieldContext}.${option.label}`,
boost: 0,
}));
const contextOptions = dedupeOptionsByLabel([
...nameMatches,
...contextQualified,
]);
// If contextOptions is empty fetch again.
if (
contextOptions.length === 0 &&
lastFetchedKeyRef.current !== searchText
) {
debouncedFetchKeySuggestions(searchText);
}
return {
from: word?.from ?? 0,
to: word?.to ?? cursorPos.ch,
options: addSpaceToOptions(contextOptions),
};
}
options = dedupedKeySuggestions.filter((option) =>
option.label.toLowerCase().includes(searchText),
);
@@ -969,9 +1030,26 @@ function QuerySearch({
// If we have a key context, add that info to the operator suggestions
if (keyName) {
// Find the key details from suggestions
const keyDetails = (keySuggestions || []).find((k) => k.label === keyName);
const keyType = keyDetails?.type || '';
const keyContextMatch = getFieldContextPrefix(keyName);
// key-suggestion can contain multiple variants of a single key
// In variants we capture ones that match the label to typed keyName exactly or,
// if it has a prefix fieldContext remove it and then match.
const variants = (keySuggestions || []).filter(
(k) =>
k.label === keyName ||
(keyContextMatch !== null &&
k.fieldContext === keyContextMatch.context &&
k.label === keyContextMatch.remainder),
);
const variantTypes = new Set(
variants
.map((k) =>
k.type === 'keyword' ? QUERY_BUILDER_KEY_TYPES.STRING : k.type,
)
.filter(Boolean),
);
//if there are multi-variant, show all suggestions else just the one
const keyType = variantTypes.size === 1 ? [...variantTypes][0] : '';
// Filter operators based on key type
if (keyType) {
@@ -1214,7 +1292,7 @@ function QuerySearch({
if (curChar === '(') {
// In expression context, suggest keys, functions, or nested parentheses
options = [
...(keySuggestions || []),
...dedupedKeySuggestions,
{ label: '(', type: 'parenthesis', info: 'Open nested group' },
{ label: 'NOT', type: 'operator', info: 'Negate expression' },
...options.filter((opt) => opt.type === 'function'),

View File

@@ -0,0 +1,120 @@
import {
combineInitialAndUserExpression,
dedupeOptionsByLabel,
getFieldContextPrefix,
getUserExpressionFromCombined,
} from '../utils';
describe('entityLogsExpression', () => {
describe('combineInitialAndUserExpression', () => {
it('returns user when initial is empty', () => {
expect(combineInitialAndUserExpression('', 'body contains error')).toBe(
'body contains error',
);
});
it('returns initial when user is empty', () => {
expect(combineInitialAndUserExpression('k8s.pod.name = "x"', '')).toBe(
'k8s.pod.name = "x"',
);
});
it('wraps user in parentheses with AND', () => {
expect(
combineInitialAndUserExpression('k8s.pod.name = "x"', 'body = "a"'),
).toBe('k8s.pod.name = "x" AND (body = "a")');
});
});
describe('getUserExpressionFromCombined', () => {
it('returns empty when combined equals initial', () => {
expect(
getUserExpressionFromCombined('k8s.pod.name = "x"', 'k8s.pod.name = "x"'),
).toBe('');
});
it('extracts user from wrapped form', () => {
expect(
getUserExpressionFromCombined(
'k8s.pod.name = "x"',
'k8s.pod.name = "x" AND (body = "a")',
),
).toBe('body = "a"');
});
it('extracts user from legacy AND without parens', () => {
expect(
getUserExpressionFromCombined(
'k8s.pod.name = "x"',
'k8s.pod.name = "x" AND body = "a"',
),
).toBe('body = "a"');
});
it('returns full combined when initial is empty', () => {
expect(getUserExpressionFromCombined('', 'service.name = "a"')).toBe(
'service.name = "a"',
);
});
});
});
describe('getFieldContextPrefix', () => {
it('matches a complete context prefix with a remainder', () => {
expect(getFieldContextPrefix('attribute.status')).toStrictEqual({
context: 'attribute',
remainder: 'status',
});
});
it('matches a bare context prefix with empty remainder', () => {
expect(getFieldContextPrefix('resource.')).toStrictEqual({
context: 'resource',
remainder: '',
});
});
it('matches every backend field context', () => {
['attribute', 'resource', 'span', 'body', 'log', 'metric'].forEach((ctx) => {
expect(getFieldContextPrefix(`${ctx}.x`)).toStrictEqual({
context: ctx,
remainder: 'x',
});
});
});
it('does not match a partial context name', () => {
expect(getFieldContextPrefix('attr')).toBeNull();
expect(getFieldContextPrefix('attribute')).toBeNull();
});
it('does not match a non-context key with dots', () => {
expect(getFieldContextPrefix('status.code')).toBeNull();
});
it('matches context case-insensitively but keeps remainder casing', () => {
expect(getFieldContextPrefix('Attribute.Status')).toStrictEqual({
context: 'attribute',
remainder: 'Status',
});
});
});
describe('dedupeOptionsByLabel', () => {
it('keeps the first occurrence per label, preserving order', () => {
expect(
dedupeOptionsByLabel([
{ label: 'status.code', type: 'keyword' },
{ label: 'status.code', type: 'number' },
{ label: 'duration', type: 'number' },
]),
).toStrictEqual([
{ label: 'status.code', type: 'keyword' },
{ label: 'duration', type: 'number' },
]);
});
it('returns an empty array for empty input', () => {
expect(dedupeOptionsByLabel([])).toStrictEqual([]);
});
});

View File

@@ -1,58 +0,0 @@
import {
combineInitialAndUserExpression,
getUserExpressionFromCombined,
} from '../utils';
describe('entityLogsExpression', () => {
describe('combineInitialAndUserExpression', () => {
it('returns user when initial is empty', () => {
expect(combineInitialAndUserExpression('', 'body contains error')).toBe(
'body contains error',
);
});
it('returns initial when user is empty', () => {
expect(combineInitialAndUserExpression('k8s.pod.name = "x"', '')).toBe(
'k8s.pod.name = "x"',
);
});
it('wraps user in parentheses with AND', () => {
expect(
combineInitialAndUserExpression('k8s.pod.name = "x"', 'body = "a"'),
).toBe('k8s.pod.name = "x" AND (body = "a")');
});
});
describe('getUserExpressionFromCombined', () => {
it('returns empty when combined equals initial', () => {
expect(
getUserExpressionFromCombined('k8s.pod.name = "x"', 'k8s.pod.name = "x"'),
).toBe('');
});
it('extracts user from wrapped form', () => {
expect(
getUserExpressionFromCombined(
'k8s.pod.name = "x"',
'k8s.pod.name = "x" AND (body = "a")',
),
).toBe('body = "a"');
});
it('extracts user from legacy AND without parens', () => {
expect(
getUserExpressionFromCombined(
'k8s.pod.name = "x"',
'k8s.pod.name = "x" AND body = "a"',
),
).toBe('body = "a"');
});
it('returns full combined when initial is empty', () => {
expect(getUserExpressionFromCombined('', 'service.name = "a"')).toBe(
'service.name = "a"',
);
});
});
});

View File

@@ -1,6 +1,16 @@
export const RECENTS_SECTION = { name: 'Recent searches', rank: 1 } as const;
export const SUGGESTIONS_SECTION = { name: 'Suggestions', rank: 2 } as const;
// TODO: move to using TelemetrytypesFieldContextDTO when we migrate getKeySuggestions API (Part of https://github.com/SigNoz/engineering-pod/issues/5289)
export const FIELD_CONTEXTS = [
'attribute',
'resource',
'span',
'body',
'log',
'metric',
] as const;
// Custom CodeMirror Completion.type for recent-query entries. Used to discriminate
// recents from regular autocomplete completions in renderers and event handlers.
export const RECENT_COMPLETION_TYPE = 'recent';

View File

@@ -9,11 +9,45 @@ import type { SignalType } from 'types/api/v5/queryRange';
import 'utils/timeUtils';
import {
FIELD_CONTEXTS,
RECENT_COMPLETION_TYPE,
RECENTS_DISPLAY_CAP,
RECENTS_SECTION,
} from './constants';
export interface FieldContextPrefixMatch {
context: string;
remainder: string;
}
// This function checks if the text(query key) starts with a fieldContext
// This util strictly checks that and returns context and remainder back.
// This helps differentiate if the typed key was prefixed with a context or
// was it an actual queryKey like (attribute.abc)
export function getFieldContextPrefix(
text: string,
): FieldContextPrefixMatch | null {
const lower = text.toLowerCase();
const context = FIELD_CONTEXTS.find((ctx) => lower.startsWith(`${ctx}.`));
return context ? { context, remainder: text.slice(context.length + 1) } : null;
}
// Keeps the first occurrence per label, preserving order. Key suggestions hold
// one entry per (name, fieldContext, fieldDataType) variant; This means query builder
// could show multiple labels and this avoids that.
export function dedupeOptionsByLabel<T extends { label: string }>(
options: T[],
): T[] {
const seen = new Set<string>();
return options.filter((option) => {
if (seen.has(option.label)) {
return false;
}
seen.add(option.label);
return true;
});
}
export function combineInitialAndUserExpression(
initial: string,
user: string,

View File

@@ -0,0 +1,217 @@
import { initialQueriesMap } from 'constants/queryBuilder';
import { rest, server } from 'mocks-server/server';
import { render, userEvent, waitFor } from 'tests/test-utils';
import { DataSource } from 'types/common/queryBuilder';
import QuerySearch from '../QuerySearch/QuerySearch';
import { mockCodeMirrorDomApis } from './codemirrorDomMocks';
const CM_EDITOR_SELECTOR = '.cm-editor .cm-content';
const CM_OPTION_SELECTOR = '.cm-tooltip-autocomplete .cm-completionLabel';
beforeAll(() => {
mockCodeMirrorDomApis();
});
jest.mock('hooks/useDarkMode', () => ({
useIsDarkMode: (): boolean => false,
}));
jest.mock('providers/Dashboard/store/useDashboardStore', () => ({
useDashboardStore: (): { dashboardData: undefined } => ({
dashboardData: undefined,
}),
}));
jest.mock('hooks/queryBuilder/useQueryBuilder', () => {
const handleRunQuery = jest.fn();
return {
__esModule: true,
useQueryBuilder: (): { handleRunQuery: () => void } => ({ handleRunQuery }),
handleRunQuery,
};
});
// Keys fixture: status.code exists as 3 variants (attribute string/number +
// resource string); attribute.a.b.c is a key literally named with the prefix.
const KEYS_FIXTURE = {
'status.code': [
{
name: 'status.code',
fieldContext: 'attribute',
fieldDataType: 'string',
signal: 'logs',
},
{
name: 'status.code',
fieldContext: 'attribute',
fieldDataType: 'number',
signal: 'logs',
},
{
name: 'status.code',
fieldContext: 'resource',
fieldDataType: 'string',
signal: 'logs',
},
],
'attribute.a.b.c': [
{
name: 'attribute.a.b.c',
fieldContext: 'attribute',
fieldDataType: 'string',
signal: 'logs',
},
],
'duration.nano': [
{
name: 'duration.nano',
fieldContext: 'span',
fieldDataType: 'number',
signal: 'logs',
},
],
};
const fetchedSearchTexts: string[] = [];
beforeEach(() => {
fetchedSearchTexts.length = 0;
server.use(
rest.get('http://localhost/api/v1/fields/keys', (req, res, ctx) => {
fetchedSearchTexts.push(req.url.searchParams.get('searchText') ?? '');
return res(
ctx.status(200),
ctx.json({
status: 'success',
data: { complete: true, keys: KEYS_FIXTURE },
}),
);
}),
rest.get('http://localhost/api/v1/fields/values', (_req, res, ctx) =>
res(
ctx.status(200),
ctx.json({
status: 'success',
data: { values: { stringValues: [], numberValues: [] } },
}),
),
),
);
});
async function renderAndType(text: string): Promise<HTMLElement> {
render(
<QuerySearch
onChange={jest.fn() as jest.MockedFunction<(v: string) => void>}
queryData={initialQueriesMap.logs.builder.queryData[0]}
dataSource={DataSource.LOGS}
/>,
);
await waitFor(() => {
expect(document.querySelector(CM_EDITOR_SELECTOR)).toBeInTheDocument();
});
const editor = document.querySelector(CM_EDITOR_SELECTOR) as HTMLElement;
await userEvent.click(editor);
await userEvent.type(editor, text);
return editor;
}
// Types a key, waits for its suggestion to render (proving the debounced key
// fetch resolved into state), then types a space to enter operator context.
async function typeKeyThenEnterOperatorContext(
key: string,
expectedKeyLabel: string,
): Promise<void> {
const editor = await renderAndType(key);
await waitFor(() => {
expect(visibleOptionLabels()).toContain(expectedKeyLabel);
});
// skipClick: a click would reset the caret to position 0 under the mocked
// DOM rects; we need the space appended at the end of the typed key.
await userEvent.type(editor, ' ', { skipClick: true });
await waitFor(() => {
expect(visibleOptionLabels()).toContain('=');
});
}
function visibleOptionLabels(): string[] {
return Array.from(document.querySelectorAll(CM_OPTION_SELECTOR)).map(
(el) => el.textContent ?? '',
);
}
describe('QuerySearch context-prefixed key suggestions', () => {
it('shows one deduped suggestion per key name in normal mode', async () => {
await renderAndType('statu');
await waitFor(() => {
expect(visibleOptionLabels()).toContain('status.code');
});
const statusOptions = visibleOptionLabels().filter(
(label) => label === 'status.code',
);
expect(statusOptions).toHaveLength(1);
});
it('shows context-scoped suggestions for a complete context prefix', async () => {
await renderAndType('attribute.');
await waitFor(() => {
expect(visibleOptionLabels()).toContain('attribute.status.code');
});
const labels = visibleOptionLabels();
// Literal key name match ranks first
expect(labels[0]).toBe('attribute.a.b.c');
// Context-qualified form of the literal key is also present
expect(labels).toContain('attribute.attribute.a.b.c');
// span-only key is not suggested under attribute.
expect(labels).not.toContain('attribute.duration.nano');
});
it('fetches the context page when the prefix is typed exactly', async () => {
await renderAndType('attribute.');
await waitFor(() => {
expect(fetchedSearchTexts).toContain('attribute.');
});
});
});
describe('QuerySearch operator suggestions by key type', () => {
it('shows all operators for a key with ambiguous types', async () => {
// status.code is string + number across variants → no type filtering
await typeKeyThenEnterOperatorContext('status.code', 'status.code');
const labels = visibleOptionLabels();
expect(labels).toContain('>');
expect(labels).toContain('LIKE');
});
it('shows numeric operators for a single-type number key', async () => {
await typeKeyThenEnterOperatorContext('duration.nano', 'duration.nano');
const labels = visibleOptionLabels();
expect(labels).toContain('>');
expect(labels).not.toContain('LIKE');
});
it('narrows operators when a context prefix disambiguates the type', async () => {
// status.code is ambiguous globally, but resource.status.code is string-only
await typeKeyThenEnterOperatorContext(
'resource.status.code',
'resource.status.code',
);
const labels = visibleOptionLabels();
expect(labels).toContain('LIKE');
expect(labels).not.toContain('>');
});
});

View File

@@ -8,78 +8,13 @@ import type { QueryKeyDataSuggestionsProps } from 'types/api/querySuggestions/ty
import { DataSource } from 'types/common/queryBuilder';
import QuerySearch from '../QuerySearch/QuerySearch';
import { mockCodeMirrorDomApis } from './codemirrorDomMocks';
const CM_EDITOR_SELECTOR = '.cm-editor .cm-content';
// Mock DOM APIs that CodeMirror needs
beforeAll(() => {
// Mock getClientRects and getBoundingClientRect for Range objects
const mockRect: DOMRect = {
width: 100,
height: 20,
top: 0,
left: 0,
right: 100,
bottom: 20,
x: 0,
y: 0,
toJSON: (): DOMRect => mockRect,
} as DOMRect;
// Create a minimal Range mock with only what CodeMirror actually uses
const createMockRange = (): Range => {
let startContainer: Node = document.createTextNode('');
let endContainer: Node = document.createTextNode('');
let startOffset = 0;
let endOffset = 0;
const mockRange = {
// CodeMirror uses these for text measurement
getClientRects: (): DOMRectList =>
({
length: 1,
item: (index: number): DOMRect | null => (index === 0 ? mockRect : null),
0: mockRect,
*[Symbol.iterator](): Generator<DOMRect> {
yield mockRect;
},
}) as unknown as DOMRectList,
getBoundingClientRect: (): DOMRect => mockRect,
// CodeMirror calls these to set up text ranges
setStart: (node: Node, offset: number): void => {
startContainer = node;
startOffset = offset;
},
setEnd: (node: Node, offset: number): void => {
endContainer = node;
endOffset = offset;
},
// Minimal Range properties (TypeScript requires these)
get startContainer(): Node {
return startContainer;
},
get endContainer(): Node {
return endContainer;
},
get startOffset(): number {
return startOffset;
},
get endOffset(): number {
return endOffset;
},
get collapsed(): boolean {
return startContainer === endContainer && startOffset === endOffset;
},
commonAncestorContainer: document.body,
};
return mockRange as unknown as Range;
};
// Mock document.createRange to return a new Range instance each time
document.createRange = (): Range => createMockRange();
// Mock getBoundingClientRect for elements
Element.prototype.getBoundingClientRect = (): DOMRect => mockRect;
mockCodeMirrorDomApis();
});
jest.mock('hooks/useDarkMode', () => ({

View File

@@ -0,0 +1,71 @@
// Mocks the DOM measurement APIs CodeMirror needs to render in jsdom
// (Range client rects + element bounding rects). Call from a beforeAll in
// specs that render the real CodeMirror editor.
export function mockCodeMirrorDomApis(): void {
const mockRect: DOMRect = {
width: 100,
height: 20,
top: 0,
left: 0,
right: 100,
bottom: 20,
x: 0,
y: 0,
toJSON: (): DOMRect => mockRect,
} as DOMRect;
// Create a minimal Range mock with only what CodeMirror actually uses
const createMockRange = (): Range => {
let startContainer: Node = document.createTextNode('');
let endContainer: Node = document.createTextNode('');
let startOffset = 0;
let endOffset = 0;
const mockRange = {
// CodeMirror uses these for text measurement
getClientRects: (): DOMRectList =>
({
length: 1,
item: (index: number): DOMRect | null => (index === 0 ? mockRect : null),
0: mockRect,
*[Symbol.iterator](): Generator<DOMRect> {
yield mockRect;
},
}) as unknown as DOMRectList,
getBoundingClientRect: (): DOMRect => mockRect,
// CodeMirror calls these to set up text ranges
setStart: (node: Node, offset: number): void => {
startContainer = node;
startOffset = offset;
},
setEnd: (node: Node, offset: number): void => {
endContainer = node;
endOffset = offset;
},
// Minimal Range properties (TypeScript requires these)
get startContainer(): Node {
return startContainer;
},
get endContainer(): Node {
return endContainer;
},
get startOffset(): number {
return startOffset;
},
get endOffset(): number {
return endOffset;
},
get collapsed(): boolean {
return startContainer === endContainer && startOffset === endOffset;
},
commonAncestorContainer: document.body,
};
return mockRange as unknown as Range;
};
// Mock document.createRange to return a new Range instance each time
document.createRange = (): Range => createMockRange();
// Mock getBoundingClientRect for elements
Element.prototype.getBoundingClientRect = (): DOMRect => mockRect;
}

View File

@@ -9,6 +9,7 @@ import { extractQueryPairs } from 'utils/queryContextUtils';
import {
convertAggregationToExpression,
convertExpressionToFilters,
convertFiltersToExpression,
convertFiltersToExpressionWithExistingQuery,
formatValueForExpression,
@@ -1598,4 +1599,36 @@ describe('formatValueForExpression', () => {
expect(formatValueForExpression([123] as any)).toBe('[123]');
});
});
// Regression: an escaped single quote must not gain a backslash on each
// expression <-> filters round-trip (broke Create Alert from a panel).
describe('escaped quote round-trip', () => {
const EXPR = "name = 'it\\'s a ribbon'"; // name = 'it\'s a ribbon' (single backslash)
it('stores the unescaped value in the filter item', () => {
const items = convertExpressionToFilters(EXPR);
expect(items).toHaveLength(1);
expect(items[0].value).toBe("it's a ribbon");
});
it('is lossless: expression -> filters -> expression', () => {
const items = convertExpressionToFilters(EXPR);
expect(convertFiltersToExpression({ items, op: 'AND' }).expression).toBe(
EXPR,
);
});
it('is idempotent across repeated existing-query conversions', () => {
const pass1 = convertFiltersToExpressionWithExistingQuery(
{ items: [], op: 'AND' },
EXPR,
);
expect(pass1.filter.expression).toBe(EXPR);
const pass2 = convertFiltersToExpressionWithExistingQuery(
pass1.filters,
pass1.filter.expression,
);
expect(pass2.filter.expression).toBe(EXPR);
});
});
});

View File

@@ -176,7 +176,9 @@ function formatSingleValueForFilter(
}
if (isQuoted(value)) {
return unquote(value);
// Unescape `\'` → `'` (inverse of formatSingleValue) so the round-trip doesn't
// double the backslash each pass.
return unquote(value).replace(/\\'/g, "'");
}
}
@@ -768,6 +770,34 @@ export const removeVariableFromExpression = (
return removeKeysFromExpression(expression, keysToRemove, `$${variableName}`);
};
// Appends `clause` as a top-level AND term, parenthesising the base only when it
// has a top-level OR (AND binds tighter, so `a OR b AND c` would misbind).
export const appendAndClause = (
expression: string | undefined,
clause: string,
): string => {
const base = expression?.trim();
if (!base) {
return clause;
}
const chars = CharStreams.fromString(base);
const lexer = new FilterQueryLexer(chars);
lexer.removeErrorListeners();
const tokenStream = new CommonTokenStream(lexer);
const parser = new FilterQueryParser(tokenStream);
parser.removeErrorListeners();
const tree = parser.query();
if (parser.syntaxErrorsCount > 0) {
return `(${base}) AND ${clause}`;
}
const hasTopLevelOr =
tree.expression().orExpression().andExpression_list().length > 1;
return hasTopLevelOr ? `(${base}) AND ${clause}` : `${base} AND ${clause}`;
};
/**
* Convert old having format to new having format
* @param having - Array of old having objects with columnName, op, and value

View File

@@ -0,0 +1,11 @@
.static {
// Tag chips are not interactive, but the @signozhq Badge darkens outline
// variants on hover — which reads as clickable. Pin the hover background to the
// resting background so hovering a plain tag produces no change.
--badge-outline-hover-background-color: var(
--badge-outline-background-color,
color-mix(in oklab, var(--badge-background) 10%, transparent)
);
cursor: default;
}

View File

@@ -1,5 +1,8 @@
import { type MouseEvent, type ReactNode } from 'react';
import { Badge } from '@signozhq/ui/badge';
import cx from 'classnames';
import styles from './TagBadge.module.scss';
interface TagBadgeProps {
children: ReactNode;
@@ -22,7 +25,7 @@ function TagBadge({
<Badge
color="sienna"
variant="outline"
className={className}
className={cx(styles.static, className)}
closable={closable}
onClose={onClose}
>

View File

@@ -65,4 +65,5 @@
min-width: 0;
padding-left: 12px;
padding-bottom: 12px;
padding-top: 8px;
}

View File

@@ -25,20 +25,52 @@ describe('calculateChartDimensions', () => {
});
});
it('RIGHT: reserves a side column capped at 30% of the width and keeps full height', () => {
it('RIGHT: reserves a side column capped at 320px / 40% of the width and keeps full height', () => {
const dims = calculateChartDimensions({
containerWidth: 1000,
containerHeight: 400,
legendConfig: { position: LegendPosition.RIGHT },
seriesLabels: labels(10, 40),
});
// 40-char labels approximate to 336px, capped at min(240, 30% of 1000).
expect(dims.legendWidth).toBe(240);
expect(dims.width).toBe(760);
expect(dims.legendWidth).toBe(320);
expect(dims.width).toBe(680);
expect(dims.height).toBe(400);
expect(dims.legendHeight).toBe(400);
});
it('RIGHT: sizes the column to the longest label when it fits under the cap', () => {
const dims = calculateChartDimensions({
containerWidth: 1000,
containerHeight: 400,
legendConfig: { position: LegendPosition.RIGHT },
seriesLabels: labels(5, 20),
});
expect(dims.legendWidth).toBe(216);
expect(dims.width).toBe(784);
});
it('RIGHT: never shrinks the column below the 150px floor', () => {
const dims = calculateChartDimensions({
containerWidth: 1000,
containerHeight: 400,
legendConfig: { position: LegendPosition.RIGHT },
seriesLabels: labels(3, 3),
});
expect(dims.legendWidth).toBe(150);
expect(dims.width).toBe(850);
});
it('RIGHT: on a narrow container the legend never takes more than 40% of the width', () => {
const dims = calculateChartDimensions({
containerWidth: 300,
containerHeight: 400,
legendConfig: { position: LegendPosition.RIGHT },
seriesLabels: labels(10, 40),
});
expect(dims.legendWidth).toBe(120);
expect(dims.width).toBe(180);
});
it('BOTTOM: a single row of items reserves one legend row', () => {
const dims = calculateChartDimensions({
containerWidth: 1000,

View File

@@ -15,6 +15,12 @@ const BASE_LEGEND_WIDTH = 16;
const LEGEND_PADDING = 12;
const LEGEND_LINE_HEIGHT = 28;
// RIGHT legend is a vertical column with its own width budget (cap protects the donut).
const MAX_RIGHT_LEGEND_WIDTH = 320;
const RIGHT_LEGEND_WIDTH_RATIO = 0.4;
// Column padding + copy button, not covered by the text-length estimate.
const RIGHT_LEGEND_RESERVED_WIDTH = 40;
/**
* Calculates the average width of the legend items based on the labels of the series.
* @param legends - The labels of the series.
@@ -42,7 +48,7 @@ export function calculateAverageLegendWidth(legends: string[]): number {
* Implementation details (high level):
* - Approximates legend item width from label text length, using a fixed average char width.
* - RIGHT legend:
* - `legendWidth` is clamped between 150px and min(MAX_LEGEND_WIDTH, 30% of container width).
* - `legendWidth` fits the longest label, clamped to [150px, min(MAX_RIGHT_LEGEND_WIDTH, 40% width)].
* - Chart width is `containerWidth - legendWidth`.
* - BOTTOM legend:
* - Computes how many items fit per row, then uses at most 2 rows.
@@ -80,9 +86,22 @@ export function calculateChartDimensions({
const legendItemCount = seriesLabels.length;
if (legendConfig.position === LegendPosition.RIGHT) {
const maxRightLegendWidth = Math.min(MAX_LEGEND_WIDTH, containerWidth * 0.3);
// Size the column to the longest name (up to the cap) so it doesn't ellipsize.
const longestLabelLength = seriesLabels.reduce(
(max, label) => Math.max(max, label.length),
0,
);
const desiredLegendWidth =
BASE_LEGEND_WIDTH +
longestLabelLength * AVG_CHAR_WIDTH +
RIGHT_LEGEND_RESERVED_WIDTH;
const maxRightLegendWidth = Math.min(
MAX_RIGHT_LEGEND_WIDTH,
containerWidth * RIGHT_LEGEND_WIDTH_RATIO,
);
const rightLegendWidth = Math.min(
Math.max(150, approxLegendItemWidth),
Math.max(150, desiredLegendWidth),
maxRightLegendWidth,
);

View File

@@ -15,6 +15,10 @@
&--legend-right {
flex-direction: row;
.chart-layout__legend-wrapper {
padding-top: 8px;
}
}
&__legend-wrapper {

View File

@@ -15,7 +15,6 @@ import APIError from 'types/api/error';
import QuickFilters from 'components/QuickFilters/QuickFilters';
import { QuickFiltersSource } from 'components/QuickFilters/types';
import { InfraMonitoringEvents } from 'constants/events';
import { FeatureKeys } from 'constants/features';
import { initialQueriesMap } from 'constants/queryBuilder';
import K8sBaseDetails, {
K8sDetailsFilters,
@@ -29,7 +28,6 @@ import {
} from 'container/InfraMonitoringK8sV2/constants';
import { useGetCompositeQueryParam } from 'hooks/queryBuilder/useGetCompositeQueryParam';
import { useQueryBuilder } from 'hooks/queryBuilder/useQueryBuilder';
import { useAppContext } from 'providers/App/App';
import { DataSource } from 'types/common/queryBuilder';
import {
@@ -93,11 +91,6 @@ function Hosts(): JSX.Element {
}
}, [compositeQuery, redirectWithQueryBuilderData]);
const { featureFlags } = useAppContext();
const dotMetricsEnabled =
featureFlags?.find((flag) => flag.name === FeatureKeys.DOT_METRICS_ENABLED)
?.active || false;
const handleFilterVisibilityChange = (): void => {
setShowFilters(!showFilters);
};
@@ -190,8 +183,8 @@ function Hosts(): JSX.Element {
const getInitialLogTracesExpression = useCallback(
(host: InframonitoringtypesHostRecordDTO) =>
hostInitialLogTracesExpression(host, dotMetricsEnabled),
[dotMetricsEnabled],
hostInitialLogTracesExpression(host),
[],
);
const controlListPrefix = !showFilters ? (
<div className={styles.quickFiltersToggleContainer}>
@@ -226,7 +219,7 @@ function Hosts(): JSX.Element {
</div>
<QuickFilters
source={QuickFiltersSource.INFRA_MONITORING}
config={getHostsQuickFiltersConfig(dotMetricsEnabled)}
config={getHostsQuickFiltersConfig()}
handleFilterVisibilityChange={handleFilterVisibilityChange}
useFieldApis={{
metricNamespace:

View File

@@ -8,8 +8,8 @@ import {
InframonitoringtypesHostStatusDTO,
} from 'api/generated/services/sigNoz.schemas';
import { K8sDetailsMetadataConfig } from 'container/InfraMonitoringK8sV2/Base/K8sBaseDetails';
import { formatValueForExpression } from 'components/QueryBuilderV2/utils';
import { INFRA_MONITORING_ATTR_KEYS } from 'container/InfraMonitoringK8sV2/constants';
import { formatValueForExpression } from 'components/QueryBuilderV2/utils';
import { SelectedItemParams } from 'container/InfraMonitoringK8sV2/hooks';
import {
getHostQueryPayload,
@@ -63,7 +63,7 @@ export const hostDetailsMetadataConfig: HostDetailMetadataConfigType[] = [
},
{
label: 'OPERATING SYSTEM',
getValue: (h): string => h.meta?.['os.type'] || '-',
getValue: (h): string => h.meta?.[INFRA_MONITORING_ATTR_KEYS.OS_TYPE] || '-',
render: (value): React.ReactNode =>
value !== '-' ? (
<Badge variant="outline" className={infraHostsStyles.infraMonitoringTags}>
@@ -101,9 +101,8 @@ export function getHostMetricsQueryPayload(
host: InframonitoringtypesHostRecordDTO,
start: number,
end: number,
dotMetricsEnabled: boolean,
): ReturnType<typeof getHostQueryPayload> {
return getHostQueryPayload(host.hostName, start, end, dotMetricsEnabled);
return getHostQueryPayload(host.hostName, start, end, true);
}
export { hostWidgetInfo };
@@ -111,17 +110,13 @@ export { hostWidgetInfo };
export const hostGetSelectedItemExpression = (
params: SelectedItemParams,
): string =>
`host.name = ${formatValueForExpression(params.selectedItem ?? '')}`;
`${INFRA_MONITORING_ATTR_KEYS.HOST_NAME} = ${formatValueForExpression(params.selectedItem ?? '')}`;
export function hostInitialLogTracesExpression(
host: InframonitoringtypesHostRecordDTO,
dotMetricsEnabled: boolean,
): string {
const hostKey = dotMetricsEnabled
? INFRA_MONITORING_ATTR_KEYS.HOST_NAME
: 'host_name';
const hostName = formatValueForExpression(host.hostName || '');
return `${hostKey} = ${hostName}`;
return `${INFRA_MONITORING_ATTR_KEYS.HOST_NAME} = ${hostName}`;
}
export function hostInitialEventsExpression(

View File

@@ -7,8 +7,8 @@ import {
IQuickFiltersConfig,
} from 'components/QuickFilters/types';
import { TriangleAlert } from '@signozhq/icons';
import { INFRA_MONITORING_ATTR_KEYS } from 'container/InfraMonitoringK8sV2/constants';
import { CellValueTooltip } from 'container/InfraMonitoringK8sV2/components';
import { INFRA_MONITORING_ATTR_KEYS } from 'container/InfraMonitoringK8sV2/constants';
import { DataTypes } from 'types/api/queryBuilder/queryAutocompleteResponse';
import { DataSource } from 'types/common/queryBuilder';
const HOSTNAME_DOCS_URL =
@@ -62,32 +62,18 @@ export function HostnameCell({
);
}
export function getHostsQuickFiltersConfig(
dotMetricsEnabled: boolean,
): IQuickFiltersConfig[] {
const hostNameKey = dotMetricsEnabled
? INFRA_MONITORING_ATTR_KEYS.HOST_NAME
: 'host_name';
const osTypeKey = dotMetricsEnabled ? 'os.type' : 'os_type';
const metricName = dotMetricsEnabled
? 'system.cpu.load_average.15m'
: 'system_cpu_load_average_15m';
const environmentKey = dotMetricsEnabled
? 'deployment.environment'
: 'deployment_environment';
export function getHostsQuickFiltersConfig(): IQuickFiltersConfig[] {
return [
{
type: FiltersType.CHECKBOX,
title: 'Host Name',
attributeKey: {
key: hostNameKey,
key: INFRA_MONITORING_ATTR_KEYS.HOST_NAME,
dataType: DataTypes.String,
type: 'resource',
},
aggregateOperator: 'noop',
aggregateAttribute: metricName,
aggregateAttribute: INFRA_MONITORING_ATTR_KEYS.SYSTEM_CPU_LOAD_AVERAGE_15M,
dataSource: DataSource.METRICS,
defaultOpen: true,
},
@@ -95,12 +81,12 @@ export function getHostsQuickFiltersConfig(
type: FiltersType.CHECKBOX,
title: 'OS Type',
attributeKey: {
key: osTypeKey,
key: INFRA_MONITORING_ATTR_KEYS.OS_TYPE,
dataType: DataTypes.String,
type: 'resource',
},
aggregateOperator: 'noop',
aggregateAttribute: metricName,
aggregateAttribute: INFRA_MONITORING_ATTR_KEYS.SYSTEM_CPU_LOAD_AVERAGE_15M,
dataSource: DataSource.METRICS,
defaultOpen: true,
},
@@ -108,7 +94,7 @@ export function getHostsQuickFiltersConfig(
type: FiltersType.CHECKBOX,
title: 'Environment',
attributeKey: {
key: environmentKey,
key: INFRA_MONITORING_ATTR_KEYS.DEPLOYMENT_ENVIRONMENT,
dataType: DataTypes.String,
type: 'resource',
},

View File

@@ -70,7 +70,6 @@ export type GetEntityQueryPayload<T> = (
entity: T,
start: number,
end: number,
dotMetricsEnabled: boolean,
) => GetQueryResultsProps[];
export interface K8sDetailsTabsConfig {

View File

@@ -9,33 +9,14 @@ import {
import { SelectedItemParams } from 'container/InfraMonitoringK8sV2/hooks';
import { INFRA_MONITORING_ATTR_KEYS } from 'container/InfraMonitoringK8sV2/constants';
const dotToUnder: Record<string, string> = {
'os.type': 'os_type',
'host.name': 'host_name',
'deployment.environment': 'deployment_environment',
'k8s.node.name': 'k8s_node_name',
'k8s.cluster.name': 'k8s_cluster_name',
'k8s.node.uid': 'k8s_node_uid',
'k8s.cronjob.name': 'k8s_cronjob_name',
'k8s.daemonset.name': 'k8s_daemonset_name',
'k8s.deployment.name': 'k8s_deployment_name',
'k8s.job.name': 'k8s_job_name',
'k8s.namespace.name': 'k8s_namespace_name',
'k8s.pod.name': 'k8s_pod_name',
'k8s.pod.uid': 'k8s_pod_uid',
'k8s.statefulset.name': 'k8s_statefulset_name',
'k8s.persistentvolumeclaim.name': 'k8s_persistentvolumeclaim_name',
};
export function getGroupedByMeta<
T extends { meta?: Record<string, string> | null },
>(itemData: T, groupBy: string[]): Record<string, string> {
const result: Record<string, string> = {};
const meta = itemData.meta ?? {};
groupBy.forEach((rawKey) => {
const metaKey = (dotToUnder[rawKey] ?? rawKey) as keyof typeof meta;
result[rawKey] = (meta[metaKey] || meta[rawKey]) ?? '';
groupBy.forEach((key) => {
result[key] = meta[key] ?? '';
});
return result;
@@ -47,9 +28,8 @@ export function getGroupByEl<
const groupByValues: string[] = [];
const meta = itemData.meta ?? {};
groupBy.forEach((rawKey) => {
const metaKey = (dotToUnder[rawKey] ?? rawKey) as keyof typeof meta;
const value = meta[metaKey] || meta[rawKey] || '<no-value>';
groupBy.forEach((key) => {
const value = meta[key] || '<no-value>';
groupByValues.push(value);
});

View File

@@ -24,7 +24,7 @@ import {
export const k8sClusterGetSelectedItemExpression = (
params: SelectedItemParams,
): string =>
`k8s.cluster.name = ${formatValueForExpression(params.selectedItem ?? '')}`;
`${INFRA_MONITORING_ATTR_KEYS.K8S_CLUSTER_NAME} = ${formatValueForExpression(params.selectedItem ?? '')}`;
export const k8sClusterDetailsMetadataConfig: K8sDetailsMetadataConfig<InframonitoringtypesClusterRecordDTO>[] =
[{ label: 'Cluster Name', getValue: (p): string => p.clusterName || '' }];
@@ -86,7 +86,7 @@ export const k8sClusterGetEntityName = (
export const k8sClusterGetCountsFilterExpression = (
item: InframonitoringtypesClusterRecordDTO,
): string =>
`k8s.cluster.name = ${formatValueForExpression(item.clusterName ?? '')}`;
`${INFRA_MONITORING_ATTR_KEYS.K8S_CLUSTER_NAME} = ${formatValueForExpression(item.clusterName ?? '')}`;
export const clusterWidgetInfo = [
{
@@ -138,96 +138,7 @@ export const getClusterMetricsQueryPayload = (
cluster: InframonitoringtypesClusterRecordDTO,
start: number,
end: number,
dotMetricsEnabled: boolean,
): GetQueryResultsProps[] => {
const getKey = (dotKey: string, underscoreKey: string): string =>
dotMetricsEnabled ? dotKey : underscoreKey;
const k8sPodCpuUtilizationKey = getKey(
'k8s.pod.cpu.usage',
'k8s_pod_cpu_usage',
);
const k8sNodeAllocatableCpuKey = getKey(
'k8s.node.allocatable_cpu',
'k8s_node_allocatable_cpu',
);
const k8sPodMemoryUsageKey = getKey(
'k8s.pod.memory.usage',
'k8s_pod_memory_usage',
);
const k8sNodeAllocatableMemoryKey = getKey(
'k8s.node.allocatable_memory',
'k8s_node_allocatable_memory',
);
const k8sNodeConditionReadyKey = getKey(
'k8s.node.condition_ready',
'k8s_node_condition_ready',
);
const k8sDeploymentAvailableKey = getKey(
'k8s.deployment.available',
'k8s_deployment_available',
);
const k8sDeploymentDesiredKey = getKey(
'k8s.deployment.desired',
'k8s_deployment_desired',
);
const k8sStatefulsetCurrentPodsKey = getKey(
'k8s.statefulset.current_pods',
'k8s_statefulset_current_pods',
);
const k8sStatefulsetDesiredPodsKey = getKey(
'k8s.statefulset.desired_pods',
'k8s_statefulset_desired_pods',
);
const k8sStatefulsetReadyPodsKey = getKey(
'k8s.statefulset.ready_pods',
'k8s_statefulset_ready_pods',
);
const k8sStatefulsetUpdatedPodsKey = getKey(
'k8s.statefulset.updated_pods',
'k8s_statefulset_updated_pods',
);
const k8sDaemonsetCurrentScheduledNodesKey = getKey(
'k8s.daemonset.current_scheduled_nodes',
'k8s_daemonset_current_scheduled_nodes',
);
const k8sDaemonsetDesiredScheduledNodesKey = getKey(
'k8s.daemonset.desired_scheduled_nodes',
'k8s_daemonset_desired_scheduled_nodes',
);
const k8sDaemonsetReadyNodesKey = getKey(
'k8s.daemonset.ready_nodes',
'k8s_daemonset_ready_nodes',
);
const k8sJobActivePodsKey = getKey(
'k8s.job.active_pods',
'k8s_job_active_pods',
);
const k8sJobSuccessfulPodsKey = getKey(
'k8s.job.successful_pods',
'k8s_job_successful_pods',
);
const k8sJobFailedPodsKey = getKey(
'k8s.job.failed_pods',
'k8s_job_failed_pods',
);
const k8sJobDesiredSuccessfulPodsKey = getKey(
'k8s.job.desired_successful_pods',
'k8s_job_desired_successful_pods',
);
const k8sClusterNameKey = getKey('k8s.cluster.name', 'k8s_cluster_name');
const k8sNodeNameKey = getKey('k8s.node.name', 'k8s_node_name');
const k8sDeploymentNameKey = getKey(
'k8s.deployment.name',
'k8s_deployment_name',
);
const k8sNamespaceNameKey = getKey('k8s.namespace.name', 'k8s_namespace_name');
const k8sStatefulsetNameKey = getKey(
'k8s.statefulset.name',
'k8s_statefulset_name',
);
const k8sDaemonsetNameKey = getKey('k8s.daemonset.name', 'k8s_daemonset_name');
const k8sJobNameKey = getKey('k8s.job.name', 'k8s_job_name');
return [
{
selectedTime: 'GLOBAL_TIME',
@@ -239,7 +150,7 @@ export const getClusterMetricsQueryPayload = (
aggregateAttribute: {
dataType: DataTypes.Float64,
id: 'k8s_pod_cpu_usage--float64--Gauge--true',
key: k8sPodCpuUtilizationKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_POD_CPU_USAGE,
type: 'Gauge',
},
aggregateOperator: 'avg',
@@ -253,7 +164,7 @@ export const getClusterMetricsQueryPayload = (
key: {
dataType: DataTypes.String,
id: 'k8s_cluster_name--string--tag--false',
key: k8sClusterNameKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_CLUSTER_NAME,
type: 'tag',
},
op: '=',
@@ -278,7 +189,7 @@ export const getClusterMetricsQueryPayload = (
aggregateAttribute: {
dataType: DataTypes.Float64,
id: 'k8s_pod_cpu_usage--float64--Gauge--true',
key: k8sPodCpuUtilizationKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_POD_CPU_USAGE,
type: 'Gauge',
},
aggregateOperator: 'min',
@@ -292,7 +203,7 @@ export const getClusterMetricsQueryPayload = (
key: {
dataType: DataTypes.String,
id: 'k8s_cluster_name--string--tag--false',
key: k8sClusterNameKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_CLUSTER_NAME,
type: 'tag',
},
op: '=',
@@ -317,7 +228,7 @@ export const getClusterMetricsQueryPayload = (
aggregateAttribute: {
dataType: DataTypes.Float64,
id: 'k8s_pod_cpu_usage--float64--Gauge--true',
key: k8sPodCpuUtilizationKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_POD_CPU_USAGE,
type: 'Gauge',
},
aggregateOperator: 'max',
@@ -331,7 +242,7 @@ export const getClusterMetricsQueryPayload = (
key: {
dataType: DataTypes.String,
id: 'k8s_cluster_name--string--tag--false',
key: k8sClusterNameKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_CLUSTER_NAME,
type: 'tag',
},
op: '=',
@@ -356,7 +267,7 @@ export const getClusterMetricsQueryPayload = (
aggregateAttribute: {
dataType: DataTypes.Float64,
id: 'k8s_node_allocatable_cpu--float64--Gauge--true',
key: k8sNodeAllocatableCpuKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_NODE_ALLOCATABLE_CPU,
type: 'Gauge',
},
aggregateOperator: 'avg',
@@ -370,7 +281,7 @@ export const getClusterMetricsQueryPayload = (
key: {
dataType: DataTypes.String,
id: 'k8s_cluster_name--string--tag--false',
key: k8sClusterNameKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_CLUSTER_NAME,
type: 'tag',
},
op: '=',
@@ -429,7 +340,7 @@ export const getClusterMetricsQueryPayload = (
aggregateAttribute: {
dataType: DataTypes.Float64,
id: 'k8s_pod_memory_usage--float64--Gauge--true',
key: k8sPodMemoryUsageKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_POD_MEMORY_USAGE,
type: 'Gauge',
},
aggregateOperator: 'avg',
@@ -443,7 +354,7 @@ export const getClusterMetricsQueryPayload = (
key: {
dataType: DataTypes.String,
id: 'k8s_cluster_name--string--tag--false',
key: k8sClusterNameKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_CLUSTER_NAME,
type: 'tag',
},
op: '=',
@@ -468,7 +379,7 @@ export const getClusterMetricsQueryPayload = (
aggregateAttribute: {
dataType: DataTypes.Float64,
id: 'k8s_pod_memory_usage--float64--Gauge--true',
key: k8sPodMemoryUsageKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_POD_MEMORY_USAGE,
type: 'Gauge',
},
aggregateOperator: 'min',
@@ -482,7 +393,7 @@ export const getClusterMetricsQueryPayload = (
key: {
dataType: DataTypes.String,
id: 'k8s_cluster_name--string--tag--false',
key: k8sClusterNameKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_CLUSTER_NAME,
type: 'tag',
},
op: '=',
@@ -507,7 +418,7 @@ export const getClusterMetricsQueryPayload = (
aggregateAttribute: {
dataType: DataTypes.Float64,
id: 'k8s_pod_memory_usage--float64--Gauge--true',
key: k8sPodMemoryUsageKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_POD_MEMORY_USAGE,
type: 'Gauge',
},
aggregateOperator: 'max',
@@ -521,7 +432,7 @@ export const getClusterMetricsQueryPayload = (
key: {
dataType: DataTypes.String,
id: 'k8s_cluster_name--string--tag--false',
key: k8sClusterNameKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_CLUSTER_NAME,
type: 'tag',
},
op: '=',
@@ -546,7 +457,7 @@ export const getClusterMetricsQueryPayload = (
aggregateAttribute: {
dataType: DataTypes.Float64,
id: 'k8s_node_allocatable_memory--float64--Gauge--true',
key: k8sNodeAllocatableMemoryKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_NODE_ALLOCATABLE_MEMORY,
type: 'Gauge',
},
aggregateOperator: 'avg',
@@ -560,7 +471,7 @@ export const getClusterMetricsQueryPayload = (
key: {
dataType: DataTypes.String,
id: 'k8s_cluster_name--string--tag--false',
key: k8sClusterNameKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_CLUSTER_NAME,
type: 'tag',
},
op: '=',
@@ -619,7 +530,7 @@ export const getClusterMetricsQueryPayload = (
aggregateAttribute: {
dataType: DataTypes.Float64,
id: 'k8s_node_condition_ready--float64--Gauge--true',
key: k8sNodeConditionReadyKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_NODE_CONDITION_READY,
type: 'Gauge',
},
aggregateOperator: 'latest',
@@ -633,7 +544,7 @@ export const getClusterMetricsQueryPayload = (
key: {
dataType: DataTypes.String,
id: 'k8s_cluster_name--string--tag--false',
key: k8sClusterNameKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_CLUSTER_NAME,
type: 'tag',
},
op: '=',
@@ -647,18 +558,18 @@ export const getClusterMetricsQueryPayload = (
{
dataType: DataTypes.String,
id: 'k8s_node_name--string--tag--false',
key: k8sNodeNameKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_NODE_NAME,
type: 'tag',
},
],
having: [
{
columnName: `MAX(${k8sNodeConditionReadyKey})`,
columnName: `MAX(${INFRA_MONITORING_ATTR_KEYS.K8S_NODE_CONDITION_READY})`,
op: '=',
value: 1,
},
],
legend: `{{${k8sNodeNameKey}}}`,
legend: `{{${INFRA_MONITORING_ATTR_KEYS.K8S_NODE_NAME}}}`,
limit: null,
orderBy: [],
queryName: 'A',
@@ -705,7 +616,7 @@ export const getClusterMetricsQueryPayload = (
aggregateAttribute: {
dataType: DataTypes.Float64,
id: 'k8s_node_condition_ready--float64--Gauge--true',
key: k8sNodeConditionReadyKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_NODE_CONDITION_READY,
type: 'Gauge',
},
aggregateOperator: 'latest',
@@ -719,7 +630,7 @@ export const getClusterMetricsQueryPayload = (
key: {
dataType: DataTypes.String,
id: 'k8s_cluster_name--string--tag--false',
key: k8sClusterNameKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_CLUSTER_NAME,
type: 'tag',
},
op: '=',
@@ -733,18 +644,18 @@ export const getClusterMetricsQueryPayload = (
{
dataType: DataTypes.String,
id: 'k8s_node_name--string--tag--false',
key: k8sNodeNameKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_NODE_NAME,
type: 'tag',
},
],
having: [
{
columnName: `MAX(${k8sNodeConditionReadyKey})`,
columnName: `MAX(${INFRA_MONITORING_ATTR_KEYS.K8S_NODE_CONDITION_READY})`,
op: '=',
value: 0,
},
],
legend: `{{${k8sNodeNameKey}}}`,
legend: `{{${INFRA_MONITORING_ATTR_KEYS.K8S_NODE_NAME}}}`,
limit: null,
orderBy: [],
queryName: 'A',
@@ -791,7 +702,7 @@ export const getClusterMetricsQueryPayload = (
aggregateAttribute: {
dataType: DataTypes.Float64,
id: 'k8s_deployment_available--float64--Gauge--true',
key: k8sDeploymentAvailableKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_DEPLOYMENT_AVAILABLE,
type: 'Gauge',
},
aggregateOperator: 'latest',
@@ -805,7 +716,7 @@ export const getClusterMetricsQueryPayload = (
key: {
dataType: DataTypes.String,
id: 'k8s_cluster_name--string--tag--false',
key: k8sClusterNameKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_CLUSTER_NAME,
type: 'tag',
},
op: '=',
@@ -819,13 +730,13 @@ export const getClusterMetricsQueryPayload = (
{
dataType: DataTypes.String,
id: 'k8s_deployment_name--string--tag--false',
key: k8sDeploymentNameKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_DEPLOYMENT_NAME,
type: 'tag',
},
{
dataType: DataTypes.String,
id: 'k8s_namespace_name--string--tag--false',
key: k8sNamespaceNameKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_NAMESPACE_NAME,
type: 'tag',
},
],
@@ -843,7 +754,7 @@ export const getClusterMetricsQueryPayload = (
aggregateAttribute: {
dataType: DataTypes.Float64,
id: 'k8s_deployment_desired--float64--Gauge--true',
key: k8sDeploymentDesiredKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_DEPLOYMENT_DESIRED,
type: 'Gauge',
},
aggregateOperator: 'latest',
@@ -857,7 +768,7 @@ export const getClusterMetricsQueryPayload = (
key: {
dataType: DataTypes.String,
id: 'k8s_cluster_name--string--tag--false',
key: k8sClusterNameKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_CLUSTER_NAME,
type: 'tag',
},
op: '=',
@@ -871,13 +782,13 @@ export const getClusterMetricsQueryPayload = (
{
dataType: DataTypes.String,
id: 'k8s_deployment_name--string--tag--false',
key: k8sDeploymentNameKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_DEPLOYMENT_NAME,
type: 'tag',
},
{
dataType: DataTypes.String,
id: 'k8s_namespace_name--string--tag--false',
key: k8sNamespaceNameKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_NAMESPACE_NAME,
type: 'tag',
},
],
@@ -941,7 +852,7 @@ export const getClusterMetricsQueryPayload = (
aggregateAttribute: {
dataType: DataTypes.Float64,
id: 'k8s_statefulset_current_pods--float64--Gauge--true',
key: k8sStatefulsetCurrentPodsKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_STATEFULSET_CURRENT_PODS,
type: 'Gauge',
},
aggregateOperator: 'max',
@@ -955,7 +866,7 @@ export const getClusterMetricsQueryPayload = (
key: {
dataType: DataTypes.String,
id: 'k8s_cluster_name--string--tag--false',
key: k8sClusterNameKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_CLUSTER_NAME,
type: 'tag',
},
op: '=',
@@ -969,13 +880,13 @@ export const getClusterMetricsQueryPayload = (
{
dataType: DataTypes.String,
id: 'k8s_statefulset_name--string--tag--false',
key: k8sStatefulsetNameKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_STATEFULSET_NAME,
type: 'tag',
},
{
dataType: DataTypes.String,
id: 'k8s_namespace_name--string--tag--false',
key: k8sNamespaceNameKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_NAMESPACE_NAME,
type: 'tag',
},
],
@@ -993,7 +904,7 @@ export const getClusterMetricsQueryPayload = (
aggregateAttribute: {
dataType: DataTypes.Float64,
id: 'k8s_statefulset_desired_pods--float64--Gauge--true',
key: k8sStatefulsetDesiredPodsKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_STATEFULSET_DESIRED_PODS,
type: 'Gauge',
},
aggregateOperator: 'max',
@@ -1007,7 +918,7 @@ export const getClusterMetricsQueryPayload = (
key: {
dataType: DataTypes.String,
id: 'k8s_cluster_name--string--tag--false',
key: k8sClusterNameKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_CLUSTER_NAME,
type: 'tag',
},
op: '=',
@@ -1021,13 +932,13 @@ export const getClusterMetricsQueryPayload = (
{
dataType: DataTypes.String,
id: 'k8s_statefulset_name--string--tag--false',
key: k8sStatefulsetNameKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_STATEFULSET_NAME,
type: 'tag',
},
{
dataType: DataTypes.String,
id: 'k8s_namespace_name--string--tag--false',
key: k8sNamespaceNameKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_NAMESPACE_NAME,
type: 'tag',
},
],
@@ -1045,7 +956,7 @@ export const getClusterMetricsQueryPayload = (
aggregateAttribute: {
dataType: DataTypes.Float64,
id: 'k8s_statefulset_ready_pods--float64--Gauge--true',
key: k8sStatefulsetReadyPodsKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_STATEFULSET_READY_PODS,
type: 'Gauge',
},
aggregateOperator: 'max',
@@ -1059,7 +970,7 @@ export const getClusterMetricsQueryPayload = (
key: {
dataType: DataTypes.String,
id: 'k8s_cluster_name--string--tag--false',
key: k8sClusterNameKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_CLUSTER_NAME,
type: 'tag',
},
op: '=',
@@ -1073,13 +984,13 @@ export const getClusterMetricsQueryPayload = (
{
dataType: DataTypes.String,
id: 'k8s_statefulset_name--string--tag--false',
key: k8sStatefulsetNameKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_STATEFULSET_NAME,
type: 'tag',
},
{
dataType: DataTypes.String,
id: 'k8s_namespace_name--string--tag--false',
key: k8sNamespaceNameKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_NAMESPACE_NAME,
type: 'tag',
},
],
@@ -1097,7 +1008,7 @@ export const getClusterMetricsQueryPayload = (
aggregateAttribute: {
dataType: DataTypes.Float64,
id: 'k8s_statefulset_updated_pods--float64--Gauge--true',
key: k8sStatefulsetUpdatedPodsKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_STATEFULSET_UPDATED_PODS,
type: 'Gauge',
},
aggregateOperator: 'max',
@@ -1111,7 +1022,7 @@ export const getClusterMetricsQueryPayload = (
key: {
dataType: DataTypes.String,
id: 'k8s_cluster_name--string--tag--false',
key: k8sClusterNameKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_CLUSTER_NAME,
type: 'tag',
},
op: '=',
@@ -1125,13 +1036,13 @@ export const getClusterMetricsQueryPayload = (
{
dataType: DataTypes.String,
id: 'k8s_statefulset_name--string--tag--false',
key: k8sStatefulsetNameKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_STATEFULSET_NAME,
type: 'tag',
},
{
dataType: DataTypes.String,
id: 'k8s_namespace_name--string--tag--false',
key: k8sNamespaceNameKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_NAMESPACE_NAME,
type: 'tag',
},
],
@@ -1219,7 +1130,7 @@ export const getClusterMetricsQueryPayload = (
aggregateAttribute: {
dataType: DataTypes.Float64,
id: 'k8s_daemonset_current_scheduled_nodes--float64--Gauge--true',
key: k8sDaemonsetCurrentScheduledNodesKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_DAEMONSET_CURRENT_SCHEDULED_NODES,
type: 'Gauge',
},
aggregateOperator: 'avg',
@@ -1233,7 +1144,7 @@ export const getClusterMetricsQueryPayload = (
key: {
dataType: DataTypes.String,
id: 'k8s_cluster_name--string--tag--false',
key: k8sClusterNameKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_CLUSTER_NAME,
type: 'tag',
},
op: '=',
@@ -1247,7 +1158,7 @@ export const getClusterMetricsQueryPayload = (
{
dataType: DataTypes.String,
id: 'k8s_daemonset_name--string--tag--false',
key: k8sDaemonsetNameKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_DAEMONSET_NAME,
type: 'tag',
},
],
@@ -1265,7 +1176,7 @@ export const getClusterMetricsQueryPayload = (
aggregateAttribute: {
dataType: DataTypes.Float64,
id: 'k8s_daemonset_desired_scheduled_nodes--float64--Gauge--true',
key: k8sDaemonsetDesiredScheduledNodesKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_DAEMONSET_DESIRED_SCHEDULED_NODES,
type: 'Gauge',
},
aggregateOperator: 'avg',
@@ -1279,7 +1190,7 @@ export const getClusterMetricsQueryPayload = (
key: {
dataType: DataTypes.String,
id: 'k8s_cluster_name--string--tag--false',
key: k8sClusterNameKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_CLUSTER_NAME,
type: 'tag',
},
op: '=',
@@ -1293,7 +1204,7 @@ export const getClusterMetricsQueryPayload = (
{
dataType: DataTypes.String,
id: 'k8s_daemonset_name--string--tag--false',
key: k8sDaemonsetNameKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_DAEMONSET_NAME,
type: 'tag',
},
],
@@ -1311,7 +1222,7 @@ export const getClusterMetricsQueryPayload = (
aggregateAttribute: {
dataType: DataTypes.Float64,
id: 'k8s_daemonset_ready_nodes--float64--Gauge--true',
key: k8sDaemonsetReadyNodesKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_DAEMONSET_READY_NODES,
type: 'Gauge',
},
aggregateOperator: 'avg',
@@ -1325,7 +1236,7 @@ export const getClusterMetricsQueryPayload = (
key: {
dataType: DataTypes.String,
id: 'k8s_cluster_name--string--tag--false',
key: k8sClusterNameKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_CLUSTER_NAME,
type: 'tag',
},
op: '=',
@@ -1339,7 +1250,7 @@ export const getClusterMetricsQueryPayload = (
{
dataType: DataTypes.String,
id: 'k8s_daemonset_name--string--tag--false',
key: k8sDaemonsetNameKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_DAEMONSET_NAME,
type: 'tag',
},
],
@@ -1415,7 +1326,7 @@ export const getClusterMetricsQueryPayload = (
aggregateAttribute: {
dataType: DataTypes.Float64,
id: 'k8s_job_active_pods--float64--Gauge--true',
key: k8sJobActivePodsKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_JOB_ACTIVE_PODS,
type: 'Gauge',
},
aggregateOperator: 'max',
@@ -1429,7 +1340,7 @@ export const getClusterMetricsQueryPayload = (
key: {
dataType: DataTypes.String,
id: 'k8s_cluster_name--string--tag--false',
key: k8sClusterNameKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_CLUSTER_NAME,
type: 'tag',
},
op: '=',
@@ -1443,13 +1354,13 @@ export const getClusterMetricsQueryPayload = (
{
dataType: DataTypes.String,
id: 'k8s_job_name--string--tag--false',
key: k8sJobNameKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_JOB_NAME,
type: 'tag',
},
{
dataType: DataTypes.String,
id: 'k8s_namespace_name--string--tag--false',
key: k8sNamespaceNameKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_NAMESPACE_NAME,
type: 'tag',
},
],
@@ -1467,7 +1378,7 @@ export const getClusterMetricsQueryPayload = (
aggregateAttribute: {
dataType: DataTypes.Float64,
id: 'k8s_job_successful_pods--float64--Gauge--true',
key: k8sJobSuccessfulPodsKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_JOB_SUCCESSFUL_PODS,
type: 'Gauge',
},
aggregateOperator: 'max',
@@ -1481,7 +1392,7 @@ export const getClusterMetricsQueryPayload = (
key: {
dataType: DataTypes.String,
id: 'k8s_cluster_name--string--tag--false',
key: k8sClusterNameKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_CLUSTER_NAME,
type: 'tag',
},
op: '=',
@@ -1495,13 +1406,13 @@ export const getClusterMetricsQueryPayload = (
{
dataType: DataTypes.String,
id: 'k8s_job_name--string--tag--false',
key: k8sJobNameKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_JOB_NAME,
type: 'tag',
},
{
dataType: DataTypes.String,
id: 'k8s_namespace_name--string--tag--false',
key: k8sNamespaceNameKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_NAMESPACE_NAME,
type: 'tag',
},
],
@@ -1519,7 +1430,7 @@ export const getClusterMetricsQueryPayload = (
aggregateAttribute: {
dataType: DataTypes.Float64,
id: 'k8s_job_failed_pods--float64--Gauge--true',
key: k8sJobFailedPodsKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_JOB_FAILED_PODS,
type: 'Gauge',
},
aggregateOperator: 'max',
@@ -1533,7 +1444,7 @@ export const getClusterMetricsQueryPayload = (
key: {
dataType: DataTypes.String,
id: 'k8s_cluster_name--string--tag--false',
key: k8sClusterNameKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_CLUSTER_NAME,
type: 'tag',
},
op: '=',
@@ -1547,13 +1458,13 @@ export const getClusterMetricsQueryPayload = (
{
dataType: DataTypes.String,
id: 'k8s_job_name--string--tag--false',
key: k8sJobNameKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_JOB_NAME,
type: 'tag',
},
{
dataType: DataTypes.String,
id: 'k8s_namespace_name--string--tag--false',
key: k8sNamespaceNameKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_NAMESPACE_NAME,
type: 'tag',
},
],
@@ -1571,7 +1482,7 @@ export const getClusterMetricsQueryPayload = (
aggregateAttribute: {
dataType: DataTypes.Float64,
id: 'k8s_job_desired_successful_pods--float64--Gauge--true',
key: k8sJobDesiredSuccessfulPodsKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_JOB_DESIRED_SUCCESSFUL_PODS,
type: 'Gauge',
},
aggregateOperator: 'max',
@@ -1585,7 +1496,7 @@ export const getClusterMetricsQueryPayload = (
key: {
dataType: DataTypes.String,
id: 'k8s_cluster_name--string--tag--false',
key: k8sClusterNameKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_CLUSTER_NAME,
type: 'tag',
},
op: '=',
@@ -1599,13 +1510,13 @@ export const getClusterMetricsQueryPayload = (
{
dataType: DataTypes.String,
id: 'k8s_job_name--string--tag--false',
key: k8sJobNameKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_JOB_NAME,
type: 'tag',
},
{
dataType: DataTypes.String,
id: 'k8s_namespace_name--string--tag--false',
key: k8sNamespaceNameKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_NAMESPACE_NAME,
type: 'tag',
},
],

View File

@@ -100,54 +100,7 @@ export const getDaemonSetMetricsQueryPayload = (
daemonSet: InframonitoringtypesDaemonSetRecordDTO,
start: number,
end: number,
dotMetricsEnabled: boolean,
): GetQueryResultsProps[] => {
const k8sPodCpuUtilizationKey = dotMetricsEnabled
? 'k8s.pod.cpu.usage'
: 'k8s_pod_cpu_usage';
const k8sContainerCpuRequestKey = dotMetricsEnabled
? 'k8s.container.cpu_request'
: 'k8s_container_cpu_request';
const k8sContainerCpuLimitKey = dotMetricsEnabled
? 'k8s.container.cpu_limit'
: 'k8s_container_cpu_limit';
const k8sPodMemoryUsageKey = dotMetricsEnabled
? 'k8s.pod.memory.usage'
: 'k8s_pod_memory_usage';
const k8sContainerMemoryRequestKey = dotMetricsEnabled
? 'k8s.container.memory_request'
: 'k8s_container_memory_request';
const k8sContainerMemoryLimitKey = dotMetricsEnabled
? 'k8s.container.memory_limit'
: 'k8s_container_memory_limit';
const k8sPodNetworkIoKey = dotMetricsEnabled
? 'k8s.pod.network.io'
: 'k8s_pod_network_io';
const k8sPodNetworkErrorsKey = dotMetricsEnabled
? 'k8s.pod.network.errors'
: 'k8s_pod_network_errors';
const k8sDaemonSetNameKey = dotMetricsEnabled
? 'k8s.daemonset.name'
: 'k8s_daemonset_name';
const k8sPodNameKey = dotMetricsEnabled ? 'k8s.pod.name' : 'k8s_pod_name';
const k8sNamespaceNameKey = dotMetricsEnabled
? 'k8s.namespace.name'
: 'k8s_namespace_name';
const k8sClusterNameKey = dotMetricsEnabled
? 'k8s.cluster.name'
: 'k8s_cluster_name';
const clusterName =
daemonSet.meta?.[INFRA_MONITORING_ATTR_KEYS.K8S_CLUSTER_NAME] ?? '';
const namespaceName =
@@ -159,7 +112,7 @@ export const getDaemonSetMetricsQueryPayload = (
key: {
dataType: DataTypes.String,
id: 'k8s_cluster_name--string--tag--false',
key: k8sClusterNameKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_CLUSTER_NAME,
type: 'tag',
},
op: '=',
@@ -170,7 +123,7 @@ export const getDaemonSetMetricsQueryPayload = (
key: {
dataType: DataTypes.String,
id: 'k8s_namespace_name--string--tag--false',
key: k8sNamespaceNameKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_NAMESPACE_NAME,
type: 'tag',
},
op: '=',
@@ -189,7 +142,7 @@ export const getDaemonSetMetricsQueryPayload = (
aggregateAttribute: {
dataType: DataTypes.Float64,
id: 'k8s_pod_cpu_usage--float64--Gauge--true',
key: k8sPodCpuUtilizationKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_POD_CPU_USAGE,
type: 'Gauge',
},
aggregateOperator: 'avg',
@@ -203,7 +156,7 @@ export const getDaemonSetMetricsQueryPayload = (
key: {
dataType: DataTypes.String,
id: 'k8s_daemonset_name--string--tag--false',
key: k8sDaemonSetNameKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_DAEMONSET_NAME,
type: 'tag',
},
op: '=',
@@ -231,7 +184,7 @@ export const getDaemonSetMetricsQueryPayload = (
aggregateAttribute: {
dataType: DataTypes.Float64,
id: 'k8s_container_cpu_request--float64--Gauge--true',
key: k8sContainerCpuRequestKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_CONTAINER_CPU_REQUEST,
type: 'Gauge',
},
aggregateOperator: 'avg',
@@ -245,7 +198,7 @@ export const getDaemonSetMetricsQueryPayload = (
key: {
dataType: DataTypes.String,
id: 'k8s_pod_name--string--tag--false',
key: k8sPodNameKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_POD_NAME,
type: 'tag',
},
op: 'contains',
@@ -273,7 +226,7 @@ export const getDaemonSetMetricsQueryPayload = (
aggregateAttribute: {
dataType: DataTypes.Float64,
id: 'k8s_container_cpu_limit--float64--Gauge--true',
key: k8sContainerCpuLimitKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_CONTAINER_CPU_LIMIT,
type: 'Gauge',
},
aggregateOperator: 'avg',
@@ -287,7 +240,7 @@ export const getDaemonSetMetricsQueryPayload = (
key: {
dataType: DataTypes.String,
id: 'k8s_pod_name--string--tag--false',
key: k8sPodNameKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_POD_NAME,
type: 'tag',
},
op: 'contains',
@@ -349,7 +302,7 @@ export const getDaemonSetMetricsQueryPayload = (
aggregateAttribute: {
dataType: DataTypes.Float64,
id: 'k8s_pod_memory_usage--float64--Gauge--true',
key: k8sPodMemoryUsageKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_POD_MEMORY_USAGE,
type: 'Gauge',
},
aggregateOperator: 'avg',
@@ -363,7 +316,7 @@ export const getDaemonSetMetricsQueryPayload = (
key: {
dataType: DataTypes.String,
id: 'k8s_daemonset_name--string--tag--false',
key: k8sDaemonSetNameKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_DAEMONSET_NAME,
type: 'tag',
},
op: '=',
@@ -391,7 +344,7 @@ export const getDaemonSetMetricsQueryPayload = (
aggregateAttribute: {
dataType: DataTypes.Float64,
id: 'k8s_container_memory_request--float64--Gauge--true',
key: k8sContainerMemoryRequestKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_CONTAINER_MEMORY_REQUEST,
type: 'Gauge',
},
aggregateOperator: 'avg',
@@ -405,7 +358,7 @@ export const getDaemonSetMetricsQueryPayload = (
key: {
dataType: DataTypes.String,
id: 'k8s_pod_name--string--tag--false',
key: k8sPodNameKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_POD_NAME,
type: 'tag',
},
op: 'contains',
@@ -433,7 +386,7 @@ export const getDaemonSetMetricsQueryPayload = (
aggregateAttribute: {
dataType: DataTypes.Float64,
id: 'k8s_container_memory_limit--float64--Gauge--true',
key: k8sContainerMemoryLimitKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_CONTAINER_MEMORY_LIMIT,
type: 'Gauge',
},
aggregateOperator: 'avg',
@@ -447,7 +400,7 @@ export const getDaemonSetMetricsQueryPayload = (
key: {
dataType: DataTypes.String,
id: 'k8s_pod_name--string--tag--false',
key: k8sPodNameKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_POD_NAME,
type: 'tag',
},
op: 'contains',
@@ -509,7 +462,7 @@ export const getDaemonSetMetricsQueryPayload = (
aggregateAttribute: {
dataType: DataTypes.Float64,
id: 'k8s_pod_network_io--float64--Sum--true',
key: k8sPodNetworkIoKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_POD_NETWORK_IO,
type: 'Sum',
},
aggregateOperator: 'rate',
@@ -523,7 +476,7 @@ export const getDaemonSetMetricsQueryPayload = (
key: {
dataType: DataTypes.String,
id: 'k8s_daemonset_name--string--tag--false',
key: k8sDaemonSetNameKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_DAEMONSET_NAME,
type: 'tag',
},
op: '=',
@@ -598,7 +551,7 @@ export const getDaemonSetMetricsQueryPayload = (
aggregateAttribute: {
dataType: DataTypes.Float64,
id: 'k8s_pod_network_errors--float64--Sum--true',
key: k8sPodNetworkErrorsKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_POD_NETWORK_ERRORS,
type: 'Sum',
},
aggregateOperator: 'increase',
@@ -612,7 +565,7 @@ export const getDaemonSetMetricsQueryPayload = (
key: {
dataType: DataTypes.String,
id: 'k8s_daemonset_name--string--tag--false',
key: k8sDaemonSetNameKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_DAEMONSET_NAME,
type: 'tag',
},
op: '=',
@@ -684,15 +637,10 @@ export const getDaemonSetPodMetricsQueryPayload = (
daemonSet: InframonitoringtypesDaemonSetRecordDTO,
start: number,
end: number,
dotMetricsEnabled: boolean,
): GetQueryResultsProps[] => {
const k8sDaemonSetNameKey = dotMetricsEnabled
? 'k8s.daemonset.name'
: 'k8s_daemonset_name';
return getPodUtilizationByPodQueryPayloads(
{
workloadNameKey: k8sDaemonSetNameKey,
workloadNameKey: INFRA_MONITORING_ATTR_KEYS.K8S_DAEMONSET_NAME,
workloadNameValue:
daemonSet.meta?.[INFRA_MONITORING_ATTR_KEYS.K8S_DAEMONSET_NAME] ?? '',
clusterName:
@@ -702,6 +650,5 @@ export const getDaemonSetPodMetricsQueryPayload = (
},
start,
end,
dotMetricsEnabled,
);
};

View File

@@ -100,52 +100,7 @@ export const getDeploymentMetricsQueryPayload = (
deployment: InframonitoringtypesDeploymentRecordDTO,
start: number,
end: number,
dotMetricsEnabled: boolean,
): GetQueryResultsProps[] => {
const k8sPodCpuUtilizationKey = dotMetricsEnabled
? 'k8s.pod.cpu.usage'
: 'k8s_pod_cpu_usage';
const k8sContainerCpuRequestKey = dotMetricsEnabled
? 'k8s.container.cpu_request'
: 'k8s_container_cpu_request';
const k8sContainerCpuLimitKey = dotMetricsEnabled
? 'k8s.container.cpu_limit'
: 'k8s_container_cpu_limit';
const k8sPodMemoryUsageKey = dotMetricsEnabled
? 'k8s.pod.memory.usage'
: 'k8s_pod_memory_usage';
const k8sContainerMemoryRequestKey = dotMetricsEnabled
? 'k8s.container.memory_request'
: 'k8s_container_memory_request';
const k8sContainerMemoryLimitKey = dotMetricsEnabled
? 'k8s.container.memory_limit'
: 'k8s_container_memory_limit';
const k8sPodNetworkIoKey = dotMetricsEnabled
? 'k8s.pod.network.io'
: 'k8s_pod_network_io';
const k8sPodNetworkErrorsKey = dotMetricsEnabled
? 'k8s.pod.network.errors'
: 'k8s_pod_network_errors';
const k8sDeploymentNameKey = dotMetricsEnabled
? 'k8s.deployment.name'
: 'k8s_deployment_name';
const k8sPodNameKey = dotMetricsEnabled ? 'k8s.pod.name' : 'k8s_pod_name';
const k8sClusterNameKey = dotMetricsEnabled
? 'k8s.cluster.name'
: 'k8s_cluster_name';
const k8sNamespaceNameKey = dotMetricsEnabled
? 'k8s.namespace.name'
: 'k8s_namespace_name';
const clusterName =
deployment.meta?.[INFRA_MONITORING_ATTR_KEYS.K8S_CLUSTER_NAME] ?? '';
@@ -158,7 +113,7 @@ export const getDeploymentMetricsQueryPayload = (
key: {
dataType: DataTypes.String,
id: 'k8s_cluster_name--string--tag--false',
key: k8sClusterNameKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_CLUSTER_NAME,
type: 'tag',
},
op: '=',
@@ -169,7 +124,7 @@ export const getDeploymentMetricsQueryPayload = (
key: {
dataType: DataTypes.String,
id: 'k8s_namespace_name--string--tag--false',
key: k8sNamespaceNameKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_NAMESPACE_NAME,
type: 'tag',
},
op: '=',
@@ -188,7 +143,7 @@ export const getDeploymentMetricsQueryPayload = (
aggregateAttribute: {
dataType: DataTypes.Float64,
id: 'k8s_pod_cpu_usage--float64--Gauge--true',
key: k8sPodCpuUtilizationKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_POD_CPU_USAGE,
type: 'Gauge',
},
aggregateOperator: 'avg',
@@ -202,7 +157,7 @@ export const getDeploymentMetricsQueryPayload = (
key: {
dataType: DataTypes.String,
id: 'k8s_deployment_name--string--tag--false',
key: k8sDeploymentNameKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_DEPLOYMENT_NAME,
type: 'tag',
},
op: '=',
@@ -230,7 +185,7 @@ export const getDeploymentMetricsQueryPayload = (
aggregateAttribute: {
dataType: DataTypes.Float64,
id: 'k8s_container_cpu_request--float64--Gauge--true',
key: k8sContainerCpuRequestKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_CONTAINER_CPU_REQUEST,
type: 'Gauge',
},
aggregateOperator: 'avg',
@@ -244,7 +199,7 @@ export const getDeploymentMetricsQueryPayload = (
key: {
dataType: DataTypes.String,
id: 'k8s_pod_name--string--tag--false',
key: k8sPodNameKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_POD_NAME,
type: 'tag',
},
op: 'contains',
@@ -272,7 +227,7 @@ export const getDeploymentMetricsQueryPayload = (
aggregateAttribute: {
dataType: DataTypes.Float64,
id: 'k8s_container_cpu_limit--float64--Gauge--true',
key: k8sContainerCpuLimitKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_CONTAINER_CPU_LIMIT,
type: 'Gauge',
},
aggregateOperator: 'avg',
@@ -286,7 +241,7 @@ export const getDeploymentMetricsQueryPayload = (
key: {
dataType: DataTypes.String,
id: 'k8s_pod_name--string--tag--false',
key: k8sPodNameKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_POD_NAME,
type: 'tag',
},
op: 'contains',
@@ -348,7 +303,7 @@ export const getDeploymentMetricsQueryPayload = (
aggregateAttribute: {
dataType: DataTypes.Float64,
id: 'k8s_pod_memory_usage--float64--Gauge--true',
key: k8sPodMemoryUsageKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_POD_MEMORY_USAGE,
type: 'Gauge',
},
aggregateOperator: 'avg',
@@ -362,7 +317,7 @@ export const getDeploymentMetricsQueryPayload = (
key: {
dataType: DataTypes.String,
id: 'k8s_deployment_name--string--tag--false',
key: k8sDeploymentNameKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_DEPLOYMENT_NAME,
type: 'tag',
},
op: '=',
@@ -390,7 +345,7 @@ export const getDeploymentMetricsQueryPayload = (
aggregateAttribute: {
dataType: DataTypes.Float64,
id: 'k8s_container_memory_request--float64--Gauge--true',
key: k8sContainerMemoryRequestKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_CONTAINER_MEMORY_REQUEST,
type: 'Gauge',
},
aggregateOperator: 'avg',
@@ -404,7 +359,7 @@ export const getDeploymentMetricsQueryPayload = (
key: {
dataType: DataTypes.String,
id: 'k8s_pod_name--string--tag--false',
key: k8sPodNameKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_POD_NAME,
type: 'tag',
},
op: 'contains',
@@ -432,7 +387,7 @@ export const getDeploymentMetricsQueryPayload = (
aggregateAttribute: {
dataType: DataTypes.Float64,
id: 'k8s_container_memory_limit--float64--Gauge--true',
key: k8sContainerMemoryLimitKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_CONTAINER_MEMORY_LIMIT,
type: 'Gauge',
},
aggregateOperator: 'avg',
@@ -446,7 +401,7 @@ export const getDeploymentMetricsQueryPayload = (
key: {
dataType: DataTypes.String,
id: 'k8s_pod_name--string--tag--false',
key: k8sPodNameKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_POD_NAME,
type: 'tag',
},
op: 'contains',
@@ -508,7 +463,7 @@ export const getDeploymentMetricsQueryPayload = (
aggregateAttribute: {
dataType: DataTypes.Float64,
id: 'k8s_pod_network_io--float64--Sum--true',
key: k8sPodNetworkIoKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_POD_NETWORK_IO,
type: 'Sum',
},
aggregateOperator: 'rate',
@@ -522,7 +477,7 @@ export const getDeploymentMetricsQueryPayload = (
key: {
dataType: DataTypes.String,
id: 'k8s_deployment_name--string--tag--false',
key: k8sDeploymentNameKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_DEPLOYMENT_NAME,
type: 'tag',
},
op: '=',
@@ -597,7 +552,7 @@ export const getDeploymentMetricsQueryPayload = (
aggregateAttribute: {
dataType: DataTypes.Float64,
id: 'k8s_pod_network_errors--float64--Sum--true',
key: k8sPodNetworkErrorsKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_POD_NETWORK_ERRORS,
type: 'Sum',
},
aggregateOperator: 'increase',
@@ -611,7 +566,7 @@ export const getDeploymentMetricsQueryPayload = (
key: {
dataType: DataTypes.String,
id: 'k8s_deployment_name--string--tag--false',
key: k8sDeploymentNameKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_DEPLOYMENT_NAME,
type: 'tag',
},
op: '=',
@@ -683,15 +638,10 @@ export const getDeploymentPodMetricsQueryPayload = (
deployment: InframonitoringtypesDeploymentRecordDTO,
start: number,
end: number,
dotMetricsEnabled: boolean,
): GetQueryResultsProps[] => {
const k8sDeploymentNameKey = dotMetricsEnabled
? 'k8s.deployment.name'
: 'k8s_deployment_name';
return getPodUtilizationByPodQueryPayloads(
): GetQueryResultsProps[] =>
getPodUtilizationByPodQueryPayloads(
{
workloadNameKey: k8sDeploymentNameKey,
workloadNameKey: INFRA_MONITORING_ATTR_KEYS.K8S_DEPLOYMENT_NAME,
workloadNameValue:
deployment.meta?.[INFRA_MONITORING_ATTR_KEYS.K8S_DEPLOYMENT_NAME] ?? '',
clusterName:
@@ -701,6 +651,4 @@ export const getDeploymentPodMetricsQueryPayload = (
},
start,
end,
dotMetricsEnabled,
);
};

View File

@@ -40,7 +40,6 @@ interface EntityMetricsProps<T> {
node: T,
start: number,
end: number,
dotMetricsEnabled: boolean,
) => GetQueryResultsProps[];
queryKey: string;
category: InfraMonitoringEntity;

View File

@@ -85,7 +85,6 @@ describe('EntityMetrics time range wiring', () => {
entity,
START_SECONDS,
END_SECONDS,
false,
);
expect(mockBuildChartConfig).toHaveBeenCalledWith(
expect.objectContaining({

View File

@@ -13,8 +13,6 @@ import { SuccessResponse } from 'types/api';
import { MetricRangePayloadProps } from 'types/api/metrics/getQueryRange';
import uPlot from 'uplot';
import { FeatureKeys } from 'constants/features';
import { useAppContext } from 'providers/App/App';
import { getMetricsTableData, MetricsTableData } from './utils';
export interface UseEntityMetricsParams<T> {
@@ -25,7 +23,6 @@ export interface UseEntityMetricsParams<T> {
entity: T,
start: number,
end: number,
dotMetricsEnabled: boolean,
) => GetQueryResultsProps[];
visibilities: boolean[];
category: InfraMonitoringEntity;
@@ -46,26 +43,9 @@ export function useEntityMetrics<T>({
visibilities,
category,
}: UseEntityMetricsParams<T>): UseEntityMetricsResult {
const { featureFlags } = useAppContext();
const dotMetricsEnabled =
featureFlags?.find((flag) => flag.name === FeatureKeys.DOT_METRICS_ENABLED)
?.active || false;
const queryPayloads = useMemo(
() =>
getEntityQueryPayload(
entity,
timeRange.startTime,
timeRange.endTime,
dotMetricsEnabled,
),
[
getEntityQueryPayload,
entity,
timeRange.startTime,
timeRange.endTime,
dotMetricsEnabled,
],
() => getEntityQueryPayload(entity, timeRange.startTime, timeRange.endTime),
[getEntityQueryPayload, entity, timeRange.startTime, timeRange.endTime],
);
const queries = useQueries(

View File

@@ -30,7 +30,6 @@ interface CreatePodMetricsTabParams<T> {
entity: T,
start: number,
end: number,
dotMetricsEnabled: boolean,
) => GetQueryResultsProps[];
queryKey: string;
category: InfraMonitoringEntity;

View File

@@ -26,8 +26,6 @@ import {
import ErrorBoundaryFallback from 'pages/ErrorBoundaryFallback/ErrorBoundaryFallback';
import { DataSource } from 'types/common/queryBuilder';
import { FeatureKeys } from '../../constants/features';
import { useAppContext } from '../../providers/App/App';
import { K8sDynamicList } from './Base/K8sDynamicList';
import {
GetClustersQuickFiltersConfig,
@@ -128,69 +126,64 @@ export default function InfraMonitoringK8s(): JSX.Element {
setShowFilters((show) => !show);
}, []);
const { featureFlags } = useAppContext();
const dotMetricsEnabled =
featureFlags?.find((flag) => flag.name === FeatureKeys.DOT_METRICS_ENABLED)
?.active || false;
const categories = useMemo(
() => [
{
key: K8sCategories.PODS,
label: 'Pods',
icon: <Container size={14} />,
config: GetPodsQuickFiltersConfig(dotMetricsEnabled),
config: GetPodsQuickFiltersConfig(),
},
{
key: K8sCategories.NODES,
label: 'Nodes',
icon: <Workflow size={14} />,
config: GetNodesQuickFiltersConfig(dotMetricsEnabled),
config: GetNodesQuickFiltersConfig(),
},
{
key: K8sCategories.NAMESPACES,
label: 'Namespaces',
icon: <FilePenLine size={14} />,
config: GetNamespaceQuickFiltersConfig(dotMetricsEnabled),
config: GetNamespaceQuickFiltersConfig(),
},
{
key: K8sCategories.CLUSTERS,
label: 'Clusters',
icon: <Boxes size={14} />,
config: GetClustersQuickFiltersConfig(dotMetricsEnabled),
config: GetClustersQuickFiltersConfig(),
},
{
key: K8sCategories.DEPLOYMENTS,
label: 'Deployments',
icon: <Computer size={14} />,
config: GetDeploymentsQuickFiltersConfig(dotMetricsEnabled),
config: GetDeploymentsQuickFiltersConfig(),
},
{
key: K8sCategories.JOBS,
label: 'Jobs',
icon: <Bolt size={14} />,
config: GetJobsQuickFiltersConfig(dotMetricsEnabled),
config: GetJobsQuickFiltersConfig(),
},
{
key: K8sCategories.DAEMONSETS,
label: 'DaemonSets',
icon: <Group size={14} />,
config: GetDaemonsetsQuickFiltersConfig(dotMetricsEnabled),
config: GetDaemonsetsQuickFiltersConfig(),
},
{
key: K8sCategories.STATEFULSETS,
label: 'StatefulSets',
icon: <ArrowUpDown size={14} />,
config: GetStatefulsetsQuickFiltersConfig(dotMetricsEnabled),
config: GetStatefulsetsQuickFiltersConfig(),
},
{
key: K8sCategories.VOLUMES,
label: 'Volumes',
icon: <HardDrive size={14} />,
config: GetVolumesQuickFiltersConfig(dotMetricsEnabled),
config: GetVolumesQuickFiltersConfig(),
},
],
[dotMetricsEnabled],
[],
);
const selectedCategoryConfig = useMemo(

View File

@@ -96,28 +96,7 @@ export const getJobMetricsQueryPayload = (
job: InframonitoringtypesJobRecordDTO,
start: number,
end: number,
dotMetricsEnabled: boolean,
): GetQueryResultsProps[] => {
const k8sPodCpuUtilizationKey = dotMetricsEnabled
? 'k8s.pod.cpu.usage'
: 'k8s_pod_cpu_usage';
const k8sPodMemoryUsageKey = dotMetricsEnabled
? 'k8s.pod.memory.usage'
: 'k8s_pod_memory_usage';
const k8sPodNetworkIoKey = dotMetricsEnabled
? 'k8s.pod.network.io'
: 'k8s_pod_network_io';
const k8sPodNetworkErrorsKey = dotMetricsEnabled
? 'k8s.pod.network.errors'
: 'k8s_pod_network_errors';
const k8sJobNameKey = dotMetricsEnabled ? 'k8s.job.name' : 'k8s_job_name';
const k8sClusterNameKey = dotMetricsEnabled
? 'k8s.cluster.name'
: 'k8s_cluster_name';
const k8sNamespaceNameKey = dotMetricsEnabled
? 'k8s.namespace.name'
: 'k8s_namespace_name';
const clusterName =
job.meta?.[INFRA_MONITORING_ATTR_KEYS.K8S_CLUSTER_NAME] ?? '';
const namespaceName =
@@ -129,7 +108,7 @@ export const getJobMetricsQueryPayload = (
key: {
dataType: DataTypes.String,
id: 'k8s_job_name--string--tag--false',
key: k8sJobNameKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_JOB_NAME,
type: 'tag',
},
op: '=',
@@ -140,7 +119,7 @@ export const getJobMetricsQueryPayload = (
key: {
dataType: DataTypes.String,
id: 'k8s_cluster_name--string--tag--false',
key: k8sClusterNameKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_CLUSTER_NAME,
type: 'tag',
},
op: '=',
@@ -151,7 +130,7 @@ export const getJobMetricsQueryPayload = (
key: {
dataType: DataTypes.String,
id: 'k8s_namespace_name--string--tag--false',
key: k8sNamespaceNameKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_NAMESPACE_NAME,
type: 'tag',
},
op: '=',
@@ -170,7 +149,7 @@ export const getJobMetricsQueryPayload = (
aggregateAttribute: {
dataType: DataTypes.Float64,
id: 'k8s_pod_cpu_usage--float64--Gauge--true',
key: k8sPodCpuUtilizationKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_POD_CPU_USAGE,
type: 'Gauge',
},
aggregateOperator: 'avg',
@@ -231,7 +210,7 @@ export const getJobMetricsQueryPayload = (
aggregateAttribute: {
dataType: DataTypes.Float64,
id: 'k8s_pod_memory_usage--float64--Gauge--true',
key: k8sPodMemoryUsageKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_POD_MEMORY_USAGE,
type: 'Gauge',
},
aggregateOperator: 'avg',
@@ -292,7 +271,7 @@ export const getJobMetricsQueryPayload = (
aggregateAttribute: {
dataType: DataTypes.Float64,
id: 'k8s_pod_network_io--float64--Sum--true',
key: k8sPodNetworkIoKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_POD_NETWORK_IO,
type: 'Sum',
},
aggregateOperator: 'rate',
@@ -366,7 +345,7 @@ export const getJobMetricsQueryPayload = (
aggregateAttribute: {
dataType: DataTypes.Float64,
id: 'k8s_pod_network_errors--float64--Sum--true',
key: k8sPodNetworkErrorsKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_POD_NETWORK_ERRORS,
type: 'Sum',
},
aggregateOperator: 'increase',
@@ -437,13 +416,10 @@ export const getJobPodMetricsQueryPayload = (
job: InframonitoringtypesJobRecordDTO,
start: number,
end: number,
dotMetricsEnabled: boolean,
): GetQueryResultsProps[] => {
const k8sJobNameKey = dotMetricsEnabled ? 'k8s.job.name' : 'k8s_job_name';
return getPodUtilizationByPodQueryPayloads(
): GetQueryResultsProps[] =>
getPodUtilizationByPodQueryPayloads(
{
workloadNameKey: k8sJobNameKey,
workloadNameKey: INFRA_MONITORING_ATTR_KEYS.K8S_JOB_NAME,
workloadNameValue: job.jobName ?? '',
clusterName: job.meta?.[INFRA_MONITORING_ATTR_KEYS.K8S_CLUSTER_NAME] ?? '',
namespaceName:
@@ -451,6 +427,4 @@ export const getJobPodMetricsQueryPayload = (
},
start,
end,
dotMetricsEnabled,
);
};

View File

@@ -166,97 +166,7 @@ export const getNamespaceMetricsQueryPayload = (
namespace: InframonitoringtypesNamespaceRecordDTO,
start: number,
end: number,
dotMetricsEnabled: boolean,
): GetQueryResultsProps[] => {
const getKey = (dotKey: string, underscoreKey: string): string =>
dotMetricsEnabled ? dotKey : underscoreKey;
const k8sPodCpuUtilizationKey = getKey(
'k8s.pod.cpu.usage',
'k8s_pod_cpu_usage',
);
const k8sContainerCpuRequestKey = getKey(
'k8s.container.cpu_request',
'k8s_container_cpu_request',
);
const k8sPodMemoryUsageKey = getKey(
'k8s.pod.memory.usage',
'k8s_pod_memory_usage',
);
const k8sContainerMemoryRequestKey = getKey(
'k8s.container.memory_request',
'k8s_container_memory_request',
);
const k8sPodMemoryWorkingSetKey = getKey(
'k8s.pod.memory.working_set',
'k8s_pod_memory_working_set',
);
const k8sPodMemoryRssKey = getKey('k8s.pod.memory.rss', 'k8s_pod_memory_rss');
const k8sPodNetworkIoKey = getKey('k8s.pod.network.io', 'k8s_pod_network_io');
const k8sPodNetworkErrorsKey = getKey(
'k8s.pod.network.errors',
'k8s_pod_network_errors',
);
const k8sStatefulsetCurrentPodsKey = getKey(
'k8s.statefulset.current_pods',
'k8s_statefulset_current_pods',
);
const k8sStatefulsetDesiredPodsKey = getKey(
'k8s.statefulset.desired_pods',
'k8s_statefulset_desired_pods',
);
const k8sStatefulsetUpdatedPodsKey = getKey(
'k8s.statefulset.updated_pods',
'k8s_statefulset_updated_pods',
);
const k8sReplicasetDesiredKey = getKey(
'k8s.replicaset.desired',
'k8s_replicaset_desired',
);
const k8sReplicasetAvailableKey = getKey(
'k8s.replicaset.available',
'k8s_replicaset_available',
);
const k8sDaemonsetDesiredScheduledNodesKey = getKey(
'k8s.daemonset.desired_scheduled_nodes',
'k8s_daemonset_desired_scheduled_nodes',
);
const k8sDaemonsetCurrentScheduledNodesKey = getKey(
'k8s.daemonset.current_scheduled_nodes',
'k8s_daemonset_current_scheduled_nodes',
);
const k8sDaemonsetReadyNodesKey = getKey(
'k8s.daemonset.ready_nodes',
'k8s_daemonset_ready_nodes',
);
const k8sDaemonsetMisscheduledNodesKey = getKey(
'k8s.daemonset.misscheduled_nodes',
'k8s_daemonset_misscheduled_nodes',
);
const k8sDeploymentDesiredKey = getKey(
'k8s.deployment.desired',
'k8s_deployment_desired',
);
const k8sDeploymentAvailableKey = getKey(
'k8s.deployment.available',
'k8s_deployment_available',
);
const k8sNamespaceNameKey = getKey('k8s.namespace.name', 'k8s_namespace_name');
const k8sPodNameKey = getKey('k8s.pod.name', 'k8s_pod_name');
const k8sStatefulsetNameKey = getKey(
'k8s.statefulset.name',
'k8s_statefulset_name',
);
const k8sReplicasetNameKey = getKey(
'k8s.replicaset.name',
'k8s_replicaset_name',
);
const k8sDaemonsetNameKey = getKey('k8s.daemonset.name', 'k8s_daemonset_name');
const k8sDeploymentNameKey = getKey(
'k8s.deployment.name',
'k8s_deployment_name',
);
const k8sClusterNameKey = getKey('k8s.cluster.name', 'k8s_cluster_name');
const clusterName =
namespace.meta?.[INFRA_MONITORING_ATTR_KEYS.K8S_CLUSTER_NAME] ?? '';
@@ -266,7 +176,7 @@ export const getNamespaceMetricsQueryPayload = (
key: {
dataType: DataTypes.String,
id: 'k8s_cluster_name--string--tag--false',
key: k8sClusterNameKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_CLUSTER_NAME,
type: 'tag',
},
op: '=',
@@ -284,8 +194,8 @@ export const getNamespaceMetricsQueryPayload = (
{
aggregateAttribute: {
dataType: DataTypes.Float64,
id: k8sPodCpuUtilizationKey,
key: k8sPodCpuUtilizationKey,
id: INFRA_MONITORING_ATTR_KEYS.K8S_POD_CPU_USAGE,
key: INFRA_MONITORING_ATTR_KEYS.K8S_POD_CPU_USAGE,
type: 'Gauge',
},
aggregateOperator: 'avg',
@@ -298,8 +208,8 @@ export const getNamespaceMetricsQueryPayload = (
id: '47b3adae',
key: {
dataType: DataTypes.String,
id: k8sNamespaceNameKey,
key: k8sNamespaceNameKey,
id: INFRA_MONITORING_ATTR_KEYS.K8S_NAMESPACE_NAME,
key: INFRA_MONITORING_ATTR_KEYS.K8S_NAMESPACE_NAME,
type: 'tag',
},
op: '=',
@@ -324,8 +234,8 @@ export const getNamespaceMetricsQueryPayload = (
{
aggregateAttribute: {
dataType: DataTypes.Float64,
id: k8sContainerCpuRequestKey,
key: k8sContainerCpuRequestKey,
id: INFRA_MONITORING_ATTR_KEYS.K8S_CONTAINER_CPU_REQUEST,
key: INFRA_MONITORING_ATTR_KEYS.K8S_CONTAINER_CPU_REQUEST,
type: 'Gauge',
},
aggregateOperator: 'latest',
@@ -338,8 +248,8 @@ export const getNamespaceMetricsQueryPayload = (
id: '93d2be5e',
key: {
dataType: DataTypes.String,
id: k8sNamespaceNameKey,
key: k8sNamespaceNameKey,
id: INFRA_MONITORING_ATTR_KEYS.K8S_NAMESPACE_NAME,
key: INFRA_MONITORING_ATTR_KEYS.K8S_NAMESPACE_NAME,
type: 'tag',
},
op: '=',
@@ -364,8 +274,8 @@ export const getNamespaceMetricsQueryPayload = (
{
aggregateAttribute: {
dataType: DataTypes.Float64,
id: k8sPodCpuUtilizationKey,
key: k8sPodCpuUtilizationKey,
id: INFRA_MONITORING_ATTR_KEYS.K8S_POD_CPU_USAGE,
key: INFRA_MONITORING_ATTR_KEYS.K8S_POD_CPU_USAGE,
type: 'Gauge',
},
aggregateOperator: 'min',
@@ -378,8 +288,8 @@ export const getNamespaceMetricsQueryPayload = (
id: '795eb679',
key: {
dataType: DataTypes.String,
id: k8sNamespaceNameKey,
key: k8sNamespaceNameKey,
id: INFRA_MONITORING_ATTR_KEYS.K8S_NAMESPACE_NAME,
key: INFRA_MONITORING_ATTR_KEYS.K8S_NAMESPACE_NAME,
type: 'tag',
},
op: '=',
@@ -404,8 +314,8 @@ export const getNamespaceMetricsQueryPayload = (
{
aggregateAttribute: {
dataType: DataTypes.Float64,
id: k8sPodCpuUtilizationKey,
key: k8sPodCpuUtilizationKey,
id: INFRA_MONITORING_ATTR_KEYS.K8S_POD_CPU_USAGE,
key: INFRA_MONITORING_ATTR_KEYS.K8S_POD_CPU_USAGE,
type: 'Gauge',
},
aggregateOperator: 'max',
@@ -418,8 +328,8 @@ export const getNamespaceMetricsQueryPayload = (
id: '6792adbe',
key: {
dataType: DataTypes.String,
id: k8sNamespaceNameKey,
key: k8sNamespaceNameKey,
id: INFRA_MONITORING_ATTR_KEYS.K8S_NAMESPACE_NAME,
key: INFRA_MONITORING_ATTR_KEYS.K8S_NAMESPACE_NAME,
type: 'tag',
},
op: '=',
@@ -478,8 +388,8 @@ export const getNamespaceMetricsQueryPayload = (
{
aggregateAttribute: {
dataType: DataTypes.Float64,
id: k8sPodMemoryUsageKey,
key: k8sPodMemoryUsageKey,
id: INFRA_MONITORING_ATTR_KEYS.K8S_POD_MEMORY_USAGE,
key: INFRA_MONITORING_ATTR_KEYS.K8S_POD_MEMORY_USAGE,
type: 'Gauge',
},
aggregateOperator: 'avg',
@@ -492,8 +402,8 @@ export const getNamespaceMetricsQueryPayload = (
id: '10011298',
key: {
dataType: DataTypes.String,
id: k8sNamespaceNameKey,
key: k8sNamespaceNameKey,
id: INFRA_MONITORING_ATTR_KEYS.K8S_NAMESPACE_NAME,
key: INFRA_MONITORING_ATTR_KEYS.K8S_NAMESPACE_NAME,
type: 'tag',
},
op: '=',
@@ -518,8 +428,8 @@ export const getNamespaceMetricsQueryPayload = (
{
aggregateAttribute: {
dataType: DataTypes.Float64,
id: k8sContainerMemoryRequestKey,
key: k8sContainerMemoryRequestKey,
id: INFRA_MONITORING_ATTR_KEYS.K8S_CONTAINER_MEMORY_REQUEST,
key: INFRA_MONITORING_ATTR_KEYS.K8S_CONTAINER_MEMORY_REQUEST,
type: 'Gauge',
},
aggregateOperator: 'latest',
@@ -532,8 +442,8 @@ export const getNamespaceMetricsQueryPayload = (
id: 'ea53b656',
key: {
dataType: DataTypes.String,
id: k8sNamespaceNameKey,
key: k8sNamespaceNameKey,
id: INFRA_MONITORING_ATTR_KEYS.K8S_NAMESPACE_NAME,
key: INFRA_MONITORING_ATTR_KEYS.K8S_NAMESPACE_NAME,
type: 'tag',
},
op: '=',
@@ -558,8 +468,8 @@ export const getNamespaceMetricsQueryPayload = (
{
aggregateAttribute: {
dataType: DataTypes.Float64,
id: k8sPodMemoryWorkingSetKey,
key: k8sPodMemoryWorkingSetKey,
id: INFRA_MONITORING_ATTR_KEYS.K8S_POD_MEMORY_WORKING_SET,
key: INFRA_MONITORING_ATTR_KEYS.K8S_POD_MEMORY_WORKING_SET,
type: 'Gauge',
},
aggregateOperator: 'avg',
@@ -572,8 +482,8 @@ export const getNamespaceMetricsQueryPayload = (
id: '674ace83',
key: {
dataType: DataTypes.String,
id: k8sNamespaceNameKey,
key: k8sNamespaceNameKey,
id: INFRA_MONITORING_ATTR_KEYS.K8S_NAMESPACE_NAME,
key: INFRA_MONITORING_ATTR_KEYS.K8S_NAMESPACE_NAME,
type: 'tag',
},
op: '=',
@@ -598,8 +508,8 @@ export const getNamespaceMetricsQueryPayload = (
{
aggregateAttribute: {
dataType: DataTypes.Float64,
id: k8sPodMemoryRssKey,
key: k8sPodMemoryRssKey,
id: INFRA_MONITORING_ATTR_KEYS.K8S_POD_MEMORY_RSS,
key: INFRA_MONITORING_ATTR_KEYS.K8S_POD_MEMORY_RSS,
type: 'Gauge',
},
aggregateOperator: 'avg',
@@ -612,8 +522,8 @@ export const getNamespaceMetricsQueryPayload = (
id: '187dbdb3',
key: {
dataType: DataTypes.String,
id: k8sNamespaceNameKey,
key: k8sNamespaceNameKey,
id: INFRA_MONITORING_ATTR_KEYS.K8S_NAMESPACE_NAME,
key: INFRA_MONITORING_ATTR_KEYS.K8S_NAMESPACE_NAME,
type: 'tag',
},
op: '=',
@@ -638,8 +548,8 @@ export const getNamespaceMetricsQueryPayload = (
{
aggregateAttribute: {
dataType: DataTypes.Float64,
id: k8sPodMemoryUsageKey,
key: k8sPodMemoryUsageKey,
id: INFRA_MONITORING_ATTR_KEYS.K8S_POD_MEMORY_USAGE,
key: INFRA_MONITORING_ATTR_KEYS.K8S_POD_MEMORY_USAGE,
type: 'Gauge',
},
aggregateOperator: 'min',
@@ -652,8 +562,8 @@ export const getNamespaceMetricsQueryPayload = (
id: 'a3dbf468',
key: {
dataType: DataTypes.String,
id: k8sNamespaceNameKey,
key: k8sNamespaceNameKey,
id: INFRA_MONITORING_ATTR_KEYS.K8S_NAMESPACE_NAME,
key: INFRA_MONITORING_ATTR_KEYS.K8S_NAMESPACE_NAME,
type: 'tag',
},
op: '=',
@@ -678,8 +588,8 @@ export const getNamespaceMetricsQueryPayload = (
{
aggregateAttribute: {
dataType: DataTypes.Float64,
id: k8sPodMemoryUsageKey,
key: k8sPodMemoryUsageKey,
id: INFRA_MONITORING_ATTR_KEYS.K8S_POD_MEMORY_USAGE,
key: INFRA_MONITORING_ATTR_KEYS.K8S_POD_MEMORY_USAGE,
type: 'Gauge',
},
aggregateOperator: 'max',
@@ -692,8 +602,8 @@ export const getNamespaceMetricsQueryPayload = (
id: '4b2406c2',
key: {
dataType: DataTypes.String,
id: k8sNamespaceNameKey,
key: k8sNamespaceNameKey,
id: INFRA_MONITORING_ATTR_KEYS.K8S_NAMESPACE_NAME,
key: INFRA_MONITORING_ATTR_KEYS.K8S_NAMESPACE_NAME,
type: 'tag',
},
op: '=',
@@ -752,8 +662,8 @@ export const getNamespaceMetricsQueryPayload = (
{
aggregateAttribute: {
dataType: DataTypes.Float64,
id: k8sPodCpuUtilizationKey,
key: k8sPodCpuUtilizationKey,
id: INFRA_MONITORING_ATTR_KEYS.K8S_POD_CPU_USAGE,
key: INFRA_MONITORING_ATTR_KEYS.K8S_POD_CPU_USAGE,
type: 'Gauge',
},
aggregateOperator: 'avg',
@@ -766,8 +676,8 @@ export const getNamespaceMetricsQueryPayload = (
id: 'c3a73f0a',
key: {
dataType: DataTypes.String,
id: k8sNamespaceNameKey,
key: k8sNamespaceNameKey,
id: INFRA_MONITORING_ATTR_KEYS.K8S_NAMESPACE_NAME,
key: INFRA_MONITORING_ATTR_KEYS.K8S_NAMESPACE_NAME,
type: 'tag',
},
op: '=',
@@ -781,13 +691,13 @@ export const getNamespaceMetricsQueryPayload = (
groupBy: [
{
dataType: DataTypes.String,
id: k8sPodNameKey,
key: k8sPodNameKey,
id: INFRA_MONITORING_ATTR_KEYS.K8S_POD_NAME,
key: INFRA_MONITORING_ATTR_KEYS.K8S_POD_NAME,
type: 'tag',
},
],
having: [],
legend: `{{${k8sPodNameKey}}}`,
legend: `{{${INFRA_MONITORING_ATTR_KEYS.K8S_POD_NAME}}}`,
limit: 10,
orderBy: [],
queryName: 'A',
@@ -833,8 +743,8 @@ export const getNamespaceMetricsQueryPayload = (
{
aggregateAttribute: {
dataType: DataTypes.Float64,
id: k8sPodMemoryUsageKey,
key: k8sPodMemoryUsageKey,
id: INFRA_MONITORING_ATTR_KEYS.K8S_POD_MEMORY_USAGE,
key: INFRA_MONITORING_ATTR_KEYS.K8S_POD_MEMORY_USAGE,
type: 'Gauge',
},
aggregateOperator: 'avg',
@@ -847,8 +757,8 @@ export const getNamespaceMetricsQueryPayload = (
id: '5cad3379',
key: {
dataType: DataTypes.String,
id: k8sNamespaceNameKey,
key: k8sNamespaceNameKey,
id: INFRA_MONITORING_ATTR_KEYS.K8S_NAMESPACE_NAME,
key: INFRA_MONITORING_ATTR_KEYS.K8S_NAMESPACE_NAME,
type: 'tag',
},
op: '=',
@@ -862,13 +772,13 @@ export const getNamespaceMetricsQueryPayload = (
groupBy: [
{
dataType: DataTypes.String,
id: k8sPodNameKey,
key: k8sPodNameKey,
id: INFRA_MONITORING_ATTR_KEYS.K8S_POD_NAME,
key: INFRA_MONITORING_ATTR_KEYS.K8S_POD_NAME,
type: 'tag',
},
],
having: [],
legend: `{{${k8sPodNameKey}}}`,
legend: `{{${INFRA_MONITORING_ATTR_KEYS.K8S_POD_NAME}}}`,
limit: 10,
orderBy: [],
queryName: 'A',
@@ -914,8 +824,8 @@ export const getNamespaceMetricsQueryPayload = (
{
aggregateAttribute: {
dataType: DataTypes.Float64,
id: k8sPodNetworkIoKey,
key: k8sPodNetworkIoKey,
id: INFRA_MONITORING_ATTR_KEYS.K8S_POD_NETWORK_IO,
key: INFRA_MONITORING_ATTR_KEYS.K8S_POD_NETWORK_IO,
type: 'Sum',
},
aggregateOperator: 'rate',
@@ -928,8 +838,8 @@ export const getNamespaceMetricsQueryPayload = (
id: '00f5c5e1',
key: {
dataType: DataTypes.String,
id: k8sNamespaceNameKey,
key: k8sNamespaceNameKey,
id: INFRA_MONITORING_ATTR_KEYS.K8S_NAMESPACE_NAME,
key: INFRA_MONITORING_ATTR_KEYS.K8S_NAMESPACE_NAME,
type: 'tag',
},
op: '=',
@@ -1001,8 +911,8 @@ export const getNamespaceMetricsQueryPayload = (
{
aggregateAttribute: {
dataType: DataTypes.String,
id: k8sPodNetworkErrorsKey,
key: k8sPodNetworkErrorsKey,
id: INFRA_MONITORING_ATTR_KEYS.K8S_POD_NETWORK_ERRORS,
key: INFRA_MONITORING_ATTR_KEYS.K8S_POD_NETWORK_ERRORS,
type: 'Sum',
},
aggregateOperator: 'increase',
@@ -1015,8 +925,8 @@ export const getNamespaceMetricsQueryPayload = (
id: '3aa8e064',
key: {
dataType: DataTypes.String,
id: k8sNamespaceNameKey,
key: k8sNamespaceNameKey,
id: INFRA_MONITORING_ATTR_KEYS.K8S_NAMESPACE_NAME,
key: INFRA_MONITORING_ATTR_KEYS.K8S_NAMESPACE_NAME,
type: 'tag',
},
op: '=',
@@ -1088,8 +998,8 @@ export const getNamespaceMetricsQueryPayload = (
{
aggregateAttribute: {
dataType: DataTypes.Float64,
id: k8sStatefulsetCurrentPodsKey,
key: k8sStatefulsetCurrentPodsKey,
id: INFRA_MONITORING_ATTR_KEYS.K8S_STATEFULSET_CURRENT_PODS,
key: INFRA_MONITORING_ATTR_KEYS.K8S_STATEFULSET_CURRENT_PODS,
type: 'Gauge',
},
aggregateOperator: 'latest',
@@ -1102,8 +1012,8 @@ export const getNamespaceMetricsQueryPayload = (
id: '5f2a55c5',
key: {
dataType: DataTypes.String,
id: k8sNamespaceNameKey,
key: k8sNamespaceNameKey,
id: INFRA_MONITORING_ATTR_KEYS.K8S_NAMESPACE_NAME,
key: INFRA_MONITORING_ATTR_KEYS.K8S_NAMESPACE_NAME,
type: 'tag',
},
op: '=',
@@ -1117,8 +1027,8 @@ export const getNamespaceMetricsQueryPayload = (
groupBy: [
{
dataType: DataTypes.String,
id: k8sStatefulsetNameKey,
key: k8sStatefulsetNameKey,
id: INFRA_MONITORING_ATTR_KEYS.K8S_STATEFULSET_NAME,
key: INFRA_MONITORING_ATTR_KEYS.K8S_STATEFULSET_NAME,
type: 'tag',
},
],
@@ -1135,8 +1045,8 @@ export const getNamespaceMetricsQueryPayload = (
{
aggregateAttribute: {
dataType: DataTypes.Float64,
id: k8sStatefulsetDesiredPodsKey,
key: k8sStatefulsetDesiredPodsKey,
id: INFRA_MONITORING_ATTR_KEYS.K8S_STATEFULSET_DESIRED_PODS,
key: INFRA_MONITORING_ATTR_KEYS.K8S_STATEFULSET_DESIRED_PODS,
type: 'Gauge',
},
aggregateOperator: 'latest',
@@ -1149,8 +1059,8 @@ export const getNamespaceMetricsQueryPayload = (
id: '13bd7a1d',
key: {
dataType: DataTypes.String,
id: k8sNamespaceNameKey,
key: k8sNamespaceNameKey,
id: INFRA_MONITORING_ATTR_KEYS.K8S_NAMESPACE_NAME,
key: INFRA_MONITORING_ATTR_KEYS.K8S_NAMESPACE_NAME,
type: 'tag',
},
op: '=',
@@ -1164,8 +1074,8 @@ export const getNamespaceMetricsQueryPayload = (
groupBy: [
{
dataType: DataTypes.String,
id: k8sStatefulsetNameKey,
key: k8sStatefulsetNameKey,
id: INFRA_MONITORING_ATTR_KEYS.K8S_STATEFULSET_NAME,
key: INFRA_MONITORING_ATTR_KEYS.K8S_STATEFULSET_NAME,
type: 'tag',
},
],
@@ -1182,8 +1092,8 @@ export const getNamespaceMetricsQueryPayload = (
{
aggregateAttribute: {
dataType: DataTypes.Float64,
id: k8sStatefulsetUpdatedPodsKey,
key: k8sStatefulsetUpdatedPodsKey,
id: INFRA_MONITORING_ATTR_KEYS.K8S_STATEFULSET_UPDATED_PODS,
key: INFRA_MONITORING_ATTR_KEYS.K8S_STATEFULSET_UPDATED_PODS,
type: 'Gauge',
},
aggregateOperator: 'latest',
@@ -1196,8 +1106,8 @@ export const getNamespaceMetricsQueryPayload = (
id: '9d287c73',
key: {
dataType: DataTypes.String,
id: k8sNamespaceNameKey,
key: k8sNamespaceNameKey,
id: INFRA_MONITORING_ATTR_KEYS.K8S_NAMESPACE_NAME,
key: INFRA_MONITORING_ATTR_KEYS.K8S_NAMESPACE_NAME,
type: 'tag',
},
op: '=',
@@ -1211,8 +1121,8 @@ export const getNamespaceMetricsQueryPayload = (
groupBy: [
{
dataType: DataTypes.String,
id: k8sStatefulsetNameKey,
key: k8sStatefulsetNameKey,
id: INFRA_MONITORING_ATTR_KEYS.K8S_STATEFULSET_NAME,
key: INFRA_MONITORING_ATTR_KEYS.K8S_STATEFULSET_NAME,
type: 'tag',
},
],
@@ -1263,8 +1173,8 @@ export const getNamespaceMetricsQueryPayload = (
{
aggregateAttribute: {
dataType: DataTypes.Float64,
id: k8sReplicasetDesiredKey,
key: k8sReplicasetDesiredKey,
id: INFRA_MONITORING_ATTR_KEYS.K8S_REPLICASET_DESIRED,
key: INFRA_MONITORING_ATTR_KEYS.K8S_REPLICASET_DESIRED,
type: 'Gauge',
},
aggregateOperator: 'latest',
@@ -1277,8 +1187,8 @@ export const getNamespaceMetricsQueryPayload = (
id: '0c1e655c',
key: {
dataType: DataTypes.String,
id: k8sNamespaceNameKey,
key: k8sNamespaceNameKey,
id: INFRA_MONITORING_ATTR_KEYS.K8S_NAMESPACE_NAME,
key: INFRA_MONITORING_ATTR_KEYS.K8S_NAMESPACE_NAME,
type: 'tag',
},
op: '=',
@@ -1292,14 +1202,14 @@ export const getNamespaceMetricsQueryPayload = (
groupBy: [
{
dataType: DataTypes.String,
id: k8sReplicasetNameKey,
key: k8sReplicasetNameKey,
id: INFRA_MONITORING_ATTR_KEYS.K8S_REPLICASET_NAME,
key: INFRA_MONITORING_ATTR_KEYS.K8S_REPLICASET_NAME,
type: 'tag',
},
],
having: [
{
columnName: `MAX(${k8sReplicasetDesiredKey})`,
columnName: `MAX(${INFRA_MONITORING_ATTR_KEYS.K8S_REPLICASET_DESIRED})`,
op: '>',
value: 0,
},
@@ -1316,8 +1226,8 @@ export const getNamespaceMetricsQueryPayload = (
{
aggregateAttribute: {
dataType: DataTypes.Float64,
id: k8sReplicasetAvailableKey,
key: k8sReplicasetAvailableKey,
id: INFRA_MONITORING_ATTR_KEYS.K8S_REPLICASET_AVAILABLE,
key: INFRA_MONITORING_ATTR_KEYS.K8S_REPLICASET_AVAILABLE,
type: 'Gauge',
},
aggregateOperator: 'latest',
@@ -1330,8 +1240,8 @@ export const getNamespaceMetricsQueryPayload = (
id: 'b2296bdb',
key: {
dataType: DataTypes.String,
id: k8sNamespaceNameKey,
key: k8sNamespaceNameKey,
id: INFRA_MONITORING_ATTR_KEYS.K8S_NAMESPACE_NAME,
key: INFRA_MONITORING_ATTR_KEYS.K8S_NAMESPACE_NAME,
type: 'tag',
},
op: '=',
@@ -1345,14 +1255,14 @@ export const getNamespaceMetricsQueryPayload = (
groupBy: [
{
dataType: DataTypes.String,
id: k8sReplicasetNameKey,
key: k8sReplicasetNameKey,
id: INFRA_MONITORING_ATTR_KEYS.K8S_REPLICASET_NAME,
key: INFRA_MONITORING_ATTR_KEYS.K8S_REPLICASET_NAME,
type: 'tag',
},
],
having: [
{
columnName: `MAX(${k8sReplicasetDesiredKey})`,
columnName: `MAX(${INFRA_MONITORING_ATTR_KEYS.K8S_REPLICASET_DESIRED})`,
op: '>',
value: 0,
},
@@ -1403,8 +1313,8 @@ export const getNamespaceMetricsQueryPayload = (
{
aggregateAttribute: {
dataType: DataTypes.Float64,
id: k8sDaemonsetDesiredScheduledNodesKey,
key: k8sDaemonsetDesiredScheduledNodesKey,
id: INFRA_MONITORING_ATTR_KEYS.K8S_DAEMONSET_DESIRED_SCHEDULED_NODES,
key: INFRA_MONITORING_ATTR_KEYS.K8S_DAEMONSET_DESIRED_SCHEDULED_NODES,
type: 'Gauge',
},
aggregateOperator: 'latest',
@@ -1417,8 +1327,8 @@ export const getNamespaceMetricsQueryPayload = (
id: '2964eb92',
key: {
dataType: DataTypes.String,
id: k8sNamespaceNameKey,
key: k8sNamespaceNameKey,
id: INFRA_MONITORING_ATTR_KEYS.K8S_NAMESPACE_NAME,
key: INFRA_MONITORING_ATTR_KEYS.K8S_NAMESPACE_NAME,
type: 'tag',
},
op: '=',
@@ -1432,8 +1342,8 @@ export const getNamespaceMetricsQueryPayload = (
groupBy: [
{
dataType: DataTypes.String,
id: k8sDaemonsetNameKey,
key: k8sDaemonsetNameKey,
id: INFRA_MONITORING_ATTR_KEYS.K8S_DAEMONSET_NAME,
key: INFRA_MONITORING_ATTR_KEYS.K8S_DAEMONSET_NAME,
type: 'tag',
},
],
@@ -1450,8 +1360,8 @@ export const getNamespaceMetricsQueryPayload = (
{
aggregateAttribute: {
dataType: DataTypes.Float64,
id: k8sDaemonsetCurrentScheduledNodesKey,
key: k8sDaemonsetCurrentScheduledNodesKey,
id: INFRA_MONITORING_ATTR_KEYS.K8S_DAEMONSET_CURRENT_SCHEDULED_NODES,
key: INFRA_MONITORING_ATTR_KEYS.K8S_DAEMONSET_CURRENT_SCHEDULED_NODES,
type: 'Gauge',
},
aggregateOperator: 'latest',
@@ -1464,8 +1374,8 @@ export const getNamespaceMetricsQueryPayload = (
id: 'cd324eff',
key: {
dataType: DataTypes.String,
id: k8sNamespaceNameKey,
key: k8sNamespaceNameKey,
id: INFRA_MONITORING_ATTR_KEYS.K8S_NAMESPACE_NAME,
key: INFRA_MONITORING_ATTR_KEYS.K8S_NAMESPACE_NAME,
type: 'tag',
},
op: '=',
@@ -1479,8 +1389,8 @@ export const getNamespaceMetricsQueryPayload = (
groupBy: [
{
dataType: DataTypes.String,
id: k8sDaemonsetNameKey,
key: k8sDaemonsetNameKey,
id: INFRA_MONITORING_ATTR_KEYS.K8S_DAEMONSET_NAME,
key: INFRA_MONITORING_ATTR_KEYS.K8S_DAEMONSET_NAME,
type: 'tag',
},
],
@@ -1497,8 +1407,8 @@ export const getNamespaceMetricsQueryPayload = (
{
aggregateAttribute: {
dataType: DataTypes.Float64,
id: k8sDaemonsetReadyNodesKey,
key: k8sDaemonsetReadyNodesKey,
id: INFRA_MONITORING_ATTR_KEYS.K8S_DAEMONSET_READY_NODES,
key: INFRA_MONITORING_ATTR_KEYS.K8S_DAEMONSET_READY_NODES,
type: 'Gauge',
},
aggregateOperator: 'latest',
@@ -1511,8 +1421,8 @@ export const getNamespaceMetricsQueryPayload = (
id: '0416fa6f',
key: {
dataType: DataTypes.String,
id: k8sNamespaceNameKey,
key: k8sNamespaceNameKey,
id: INFRA_MONITORING_ATTR_KEYS.K8S_NAMESPACE_NAME,
key: INFRA_MONITORING_ATTR_KEYS.K8S_NAMESPACE_NAME,
type: 'tag',
},
op: '=',
@@ -1526,8 +1436,8 @@ export const getNamespaceMetricsQueryPayload = (
groupBy: [
{
dataType: DataTypes.String,
id: k8sDaemonsetNameKey,
key: k8sDaemonsetNameKey,
id: INFRA_MONITORING_ATTR_KEYS.K8S_DAEMONSET_NAME,
key: INFRA_MONITORING_ATTR_KEYS.K8S_DAEMONSET_NAME,
type: 'tag',
},
],
@@ -1544,8 +1454,8 @@ export const getNamespaceMetricsQueryPayload = (
{
aggregateAttribute: {
dataType: DataTypes.Float64,
id: k8sDaemonsetMisscheduledNodesKey,
key: k8sDaemonsetMisscheduledNodesKey,
id: INFRA_MONITORING_ATTR_KEYS.K8S_DAEMONSET_MISSCHEDULED_NODES,
key: INFRA_MONITORING_ATTR_KEYS.K8S_DAEMONSET_MISSCHEDULED_NODES,
type: 'Gauge',
},
aggregateOperator: 'latest',
@@ -1558,8 +1468,8 @@ export const getNamespaceMetricsQueryPayload = (
id: 'c0a126d3',
key: {
dataType: DataTypes.String,
id: k8sNamespaceNameKey,
key: k8sNamespaceNameKey,
id: INFRA_MONITORING_ATTR_KEYS.K8S_NAMESPACE_NAME,
key: INFRA_MONITORING_ATTR_KEYS.K8S_NAMESPACE_NAME,
type: 'tag',
},
op: '=',
@@ -1573,8 +1483,8 @@ export const getNamespaceMetricsQueryPayload = (
groupBy: [
{
dataType: DataTypes.String,
id: k8sDaemonsetNameKey,
key: k8sDaemonsetNameKey,
id: INFRA_MONITORING_ATTR_KEYS.K8S_DAEMONSET_NAME,
key: INFRA_MONITORING_ATTR_KEYS.K8S_DAEMONSET_NAME,
type: 'tag',
},
],
@@ -1625,8 +1535,8 @@ export const getNamespaceMetricsQueryPayload = (
{
aggregateAttribute: {
dataType: DataTypes.Float64,
id: k8sDeploymentDesiredKey,
key: k8sDeploymentDesiredKey,
id: INFRA_MONITORING_ATTR_KEYS.K8S_DEPLOYMENT_DESIRED,
key: INFRA_MONITORING_ATTR_KEYS.K8S_DEPLOYMENT_DESIRED,
type: 'Gauge',
},
aggregateOperator: 'latest',
@@ -1639,8 +1549,8 @@ export const getNamespaceMetricsQueryPayload = (
id: '9bc659c1',
key: {
dataType: DataTypes.String,
id: k8sNamespaceNameKey,
key: k8sNamespaceNameKey,
id: INFRA_MONITORING_ATTR_KEYS.K8S_NAMESPACE_NAME,
key: INFRA_MONITORING_ATTR_KEYS.K8S_NAMESPACE_NAME,
type: 'tag',
},
op: '=',
@@ -1654,8 +1564,8 @@ export const getNamespaceMetricsQueryPayload = (
groupBy: [
{
dataType: DataTypes.String,
id: k8sDeploymentNameKey,
key: k8sDeploymentNameKey,
id: INFRA_MONITORING_ATTR_KEYS.K8S_DEPLOYMENT_NAME,
key: INFRA_MONITORING_ATTR_KEYS.K8S_DEPLOYMENT_NAME,
type: 'tag',
},
],
@@ -1672,8 +1582,8 @@ export const getNamespaceMetricsQueryPayload = (
{
aggregateAttribute: {
dataType: DataTypes.Float64,
id: k8sDeploymentAvailableKey,
key: k8sDeploymentAvailableKey,
id: INFRA_MONITORING_ATTR_KEYS.K8S_DEPLOYMENT_AVAILABLE,
key: INFRA_MONITORING_ATTR_KEYS.K8S_DEPLOYMENT_AVAILABLE,
type: 'Gauge',
},
aggregateOperator: 'avg',
@@ -1686,8 +1596,8 @@ export const getNamespaceMetricsQueryPayload = (
id: 'e1696631',
key: {
dataType: DataTypes.String,
id: k8sNamespaceNameKey,
key: k8sNamespaceNameKey,
id: INFRA_MONITORING_ATTR_KEYS.K8S_NAMESPACE_NAME,
key: INFRA_MONITORING_ATTR_KEYS.K8S_NAMESPACE_NAME,
type: 'tag',
},
op: '=',
@@ -1701,8 +1611,8 @@ export const getNamespaceMetricsQueryPayload = (
groupBy: [
{
dataType: DataTypes.String,
id: k8sDeploymentNameKey,
key: k8sDeploymentNameKey,
id: INFRA_MONITORING_ATTR_KEYS.K8S_DEPLOYMENT_NAME,
key: INFRA_MONITORING_ATTR_KEYS.K8S_DEPLOYMENT_NAME,
type: 'tag',
},
],
@@ -1758,21 +1668,14 @@ export const getNamespacePodMetricsQueryPayload = (
namespace: InframonitoringtypesNamespaceRecordDTO,
start: number,
end: number,
dotMetricsEnabled: boolean,
): GetQueryResultsProps[] => {
const k8sNamespaceNameKey = dotMetricsEnabled
? 'k8s.namespace.name'
: 'k8s_namespace_name';
return getPodUtilizationByPodQueryPayloads(
): GetQueryResultsProps[] =>
getPodUtilizationByPodQueryPayloads(
{
workloadNameKey: k8sNamespaceNameKey,
workloadNameKey: INFRA_MONITORING_ATTR_KEYS.K8S_NAMESPACE_NAME,
workloadNameValue: namespace.namespaceName ?? '',
clusterName:
namespace.meta?.[INFRA_MONITORING_ATTR_KEYS.K8S_CLUSTER_NAME] ?? '',
},
start,
end,
dotMetricsEnabled,
);
};

View File

@@ -19,7 +19,7 @@ import { SelectedItemParams } from '../hooks';
export const k8sNodeGetSelectedItemExpression = (
params: SelectedItemParams,
): string =>
`k8s.node.name = ${formatValueForExpression(params.selectedItem ?? '')}`;
`${INFRA_MONITORING_ATTR_KEYS.K8S_NODE_NAME} = ${formatValueForExpression(params.selectedItem ?? '')}`;
export const k8sNodeDetailsMetadataConfig: K8sDetailsMetadataConfig<InframonitoringtypesNodeRecordDTO>[] =
[
@@ -111,89 +111,7 @@ export const getNodeMetricsQueryPayload = (
node: InframonitoringtypesNodeRecordDTO,
start: number,
end: number,
dotMetricsEnabled: boolean,
): GetQueryResultsProps[] => {
const getKey = (dotKey: string, underscoreKey: string): string =>
dotMetricsEnabled ? dotKey : underscoreKey;
const k8sNodeCpuUtilizationKey = getKey(
'k8s.node.cpu.usage',
'k8s_node_cpu_usage',
);
const k8sNodeAllocatableCpuKey = getKey(
'k8s.node.allocatable_cpu',
'k8s_node_allocatable_cpu',
);
const k8sContainerCpuRequestKey = getKey(
'k8s.container.cpu_request',
'k8s_container_cpu_request',
);
const k8sNodeMemoryUsageKey = getKey(
'k8s.node.memory.usage',
'k8s_node_memory_usage',
);
const k8sNodeAllocatableMemoryKey = getKey(
'k8s.node.allocatable_memory',
'k8s_node_allocatable_memory',
);
const k8sContainerMemoryRequestKey = getKey(
'k8s.container.memory_request',
'k8s_container_memory_request',
);
const k8sNodeMemoryWorkingSetKey = getKey(
'k8s.node.memory.working_set',
'k8s_node_memory_working_set',
);
const k8sNodeMemoryRssKey = getKey(
'k8s.node.memory.rss',
'k8s_node_memory_rss',
);
const k8sPodCpuUtilizationKey = getKey(
'k8s.pod.cpu.usage',
'k8s_pod_cpu_usage',
);
const k8sPodMemoryUsageKey = getKey(
'k8s.pod.memory.usage',
'k8s_pod_memory_usage',
);
const k8sNodeNetworkErrorsKey = getKey(
'k8s.node.network.errors',
'k8s_node_network_errors',
);
const k8sNodeNetworkIoKey = getKey(
'k8s.node.network.io',
'k8s_node_network_io',
);
const k8sNodeFilesystemUsageKey = getKey(
'k8s.node.filesystem.usage',
'k8s_node_filesystem_usage',
);
const k8sNodeFilesystemCapacityKey = getKey(
'k8s.node.filesystem.capacity',
'k8s_node_filesystem_capacity',
);
const k8sNodeFilesystemAvailableKey = getKey(
'k8s.node.filesystem.available',
'k8s_node_filesystem_available',
);
const k8sNodeNameKey = getKey('k8s.node.name', 'k8s_node_name');
const k8sPodNameKey = getKey('k8s.pod.name', 'k8s_pod_name');
return [
{
selectedTime: 'GLOBAL_TIME',
@@ -205,7 +123,7 @@ export const getNodeMetricsQueryPayload = (
aggregateAttribute: {
dataType: DataTypes.Float64,
id: 'k8s_node_cpu_usage--float64--Gauge--true',
key: k8sNodeCpuUtilizationKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_NODE_CPU_USAGE,
type: 'Gauge',
},
aggregateOperator: 'avg',
@@ -219,7 +137,7 @@ export const getNodeMetricsQueryPayload = (
key: {
dataType: DataTypes.String,
id: 'k8s_node_name--string--tag--false',
key: k8sNodeNameKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_NODE_NAME,
type: 'tag',
},
op: '=',
@@ -244,7 +162,7 @@ export const getNodeMetricsQueryPayload = (
aggregateAttribute: {
dataType: DataTypes.Float64,
id: 'k8s_node_allocatable_cpu--float64--Gauge--true',
key: k8sNodeAllocatableCpuKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_NODE_ALLOCATABLE_CPU,
type: 'Gauge',
},
aggregateOperator: 'latest',
@@ -258,7 +176,7 @@ export const getNodeMetricsQueryPayload = (
key: {
dataType: DataTypes.String,
id: 'k8s_node_name--string--tag--false',
key: k8sNodeNameKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_NODE_NAME,
type: 'tag',
},
op: '=',
@@ -283,7 +201,7 @@ export const getNodeMetricsQueryPayload = (
aggregateAttribute: {
dataType: DataTypes.Float64,
id: 'k8s_container_cpu_request--float64--Gauge--true',
key: k8sContainerCpuRequestKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_CONTAINER_CPU_REQUEST,
type: 'Gauge',
},
aggregateOperator: 'latest',
@@ -297,7 +215,7 @@ export const getNodeMetricsQueryPayload = (
key: {
dataType: DataTypes.String,
id: 'k8s_node_name--string--tag--false',
key: k8sNodeNameKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_NODE_NAME,
type: 'tag',
},
op: '=',
@@ -322,7 +240,7 @@ export const getNodeMetricsQueryPayload = (
aggregateAttribute: {
dataType: DataTypes.Float64,
id: 'k8s_node_cpu_usage--float64--Gauge--true',
key: k8sNodeCpuUtilizationKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_NODE_CPU_USAGE,
type: 'Gauge',
},
aggregateOperator: 'max',
@@ -336,7 +254,7 @@ export const getNodeMetricsQueryPayload = (
key: {
dataType: DataTypes.String,
id: 'k8s_node_name--string--tag--false',
key: k8sNodeNameKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_NODE_NAME,
type: 'tag',
},
op: '=',
@@ -361,7 +279,7 @@ export const getNodeMetricsQueryPayload = (
aggregateAttribute: {
dataType: DataTypes.Float64,
id: 'k8s_node_cpu_usage--float64--Gauge--true',
key: k8sNodeCpuUtilizationKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_NODE_CPU_USAGE,
type: 'Gauge',
},
aggregateOperator: 'min',
@@ -375,7 +293,7 @@ export const getNodeMetricsQueryPayload = (
key: {
dataType: DataTypes.String,
id: 'k8s_node_name--string--tag--false',
key: k8sNodeNameKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_NODE_NAME,
type: 'tag',
},
op: '=',
@@ -434,7 +352,7 @@ export const getNodeMetricsQueryPayload = (
aggregateAttribute: {
dataType: DataTypes.Float64,
id: 'k8s_node_memory_usage--float64--Gauge--true',
key: k8sNodeMemoryUsageKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_NODE_MEMORY_USAGE,
type: 'Gauge',
},
aggregateOperator: 'avg',
@@ -448,7 +366,7 @@ export const getNodeMetricsQueryPayload = (
key: {
dataType: DataTypes.String,
id: 'k8s_node_name--string--tag--false',
key: k8sNodeNameKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_NODE_NAME,
type: 'tag',
},
op: '=',
@@ -473,7 +391,7 @@ export const getNodeMetricsQueryPayload = (
aggregateAttribute: {
dataType: DataTypes.Float64,
id: 'k8s_node_allocatable_memory--float64--Gauge--true',
key: k8sNodeAllocatableMemoryKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_NODE_ALLOCATABLE_MEMORY,
type: 'Gauge',
},
aggregateOperator: 'latest',
@@ -487,7 +405,7 @@ export const getNodeMetricsQueryPayload = (
key: {
dataType: DataTypes.String,
id: 'k8s_node_name--string--tag--false',
key: k8sNodeNameKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_NODE_NAME,
type: 'tag',
},
op: '=',
@@ -512,7 +430,7 @@ export const getNodeMetricsQueryPayload = (
aggregateAttribute: {
dataType: DataTypes.Float64,
id: 'k8s_container_memory_request--float64--Gauge--true',
key: k8sContainerMemoryRequestKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_CONTAINER_MEMORY_REQUEST,
type: 'Gauge',
},
aggregateOperator: 'latest',
@@ -526,7 +444,7 @@ export const getNodeMetricsQueryPayload = (
key: {
dataType: DataTypes.String,
id: 'k8s_node_name--string--tag--false',
key: k8sNodeNameKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_NODE_NAME,
type: 'tag',
},
op: '=',
@@ -551,7 +469,7 @@ export const getNodeMetricsQueryPayload = (
aggregateAttribute: {
dataType: DataTypes.Float64,
id: 'k8s_node_memory_usage--float64--Gauge--true',
key: k8sNodeMemoryUsageKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_NODE_MEMORY_USAGE,
type: 'Gauge',
},
aggregateOperator: 'max',
@@ -565,7 +483,7 @@ export const getNodeMetricsQueryPayload = (
key: {
dataType: DataTypes.String,
id: 'k8s_node_name--string--tag--false',
key: k8sNodeNameKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_NODE_NAME,
type: 'tag',
},
op: '=',
@@ -590,7 +508,7 @@ export const getNodeMetricsQueryPayload = (
aggregateAttribute: {
dataType: DataTypes.Float64,
id: 'k8s_node_memory_usage--float64--Gauge--true',
key: k8sNodeMemoryUsageKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_NODE_MEMORY_USAGE,
type: 'Gauge',
},
aggregateOperator: 'min',
@@ -604,7 +522,7 @@ export const getNodeMetricsQueryPayload = (
key: {
dataType: DataTypes.String,
id: 'k8s_node_name--string--tag--false',
key: k8sNodeNameKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_NODE_NAME,
type: 'tag',
},
op: '=',
@@ -629,7 +547,7 @@ export const getNodeMetricsQueryPayload = (
aggregateAttribute: {
dataType: DataTypes.Float64,
id: 'k8s_node_memory_working_set--float64--Gauge--true',
key: k8sNodeMemoryWorkingSetKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_NODE_MEMORY_WORKING_SET,
type: 'Gauge',
},
aggregateOperator: 'avg',
@@ -643,7 +561,7 @@ export const getNodeMetricsQueryPayload = (
key: {
dataType: DataTypes.String,
id: 'k8s_node_name--string--tag--false',
key: k8sNodeNameKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_NODE_NAME,
type: 'tag',
},
op: '=',
@@ -668,7 +586,7 @@ export const getNodeMetricsQueryPayload = (
aggregateAttribute: {
dataType: DataTypes.Float64,
id: 'k8s_node_memory_rss--float64--Gauge--true',
key: k8sNodeMemoryRssKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_NODE_MEMORY_RSS,
type: 'Gauge',
},
aggregateOperator: 'avg',
@@ -682,7 +600,7 @@ export const getNodeMetricsQueryPayload = (
key: {
dataType: DataTypes.String,
id: 'k8s_node_name--string--tag--false',
key: k8sNodeNameKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_NODE_NAME,
type: 'tag',
},
op: '=',
@@ -741,7 +659,7 @@ export const getNodeMetricsQueryPayload = (
aggregateAttribute: {
dataType: DataTypes.Float64,
id: 'k8s_node_cpu_usage--float64--Gauge--true',
key: k8sNodeCpuUtilizationKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_NODE_CPU_USAGE,
type: 'Gauge',
},
aggregateOperator: 'avg',
@@ -755,7 +673,7 @@ export const getNodeMetricsQueryPayload = (
key: {
dataType: DataTypes.String,
id: 'k8s_node_name--string--tag--false',
key: k8sNodeNameKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_NODE_NAME,
type: 'tag',
},
op: '=',
@@ -780,7 +698,7 @@ export const getNodeMetricsQueryPayload = (
aggregateAttribute: {
dataType: DataTypes.Float64,
id: 'k8s_node_allocatable_cpu--float64--Gauge--true',
key: k8sNodeAllocatableCpuKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_NODE_ALLOCATABLE_CPU,
type: 'Gauge',
},
aggregateOperator: 'latest',
@@ -794,7 +712,7 @@ export const getNodeMetricsQueryPayload = (
key: {
dataType: DataTypes.String,
id: 'k8s_node_name--string--tag--false',
key: k8sNodeNameKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_NODE_NAME,
type: 'tag',
},
op: '=',
@@ -819,7 +737,7 @@ export const getNodeMetricsQueryPayload = (
aggregateAttribute: {
dataType: DataTypes.Float64,
id: 'k8s_container_cpu_request--float64--Gauge--true',
key: k8sContainerCpuRequestKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_CONTAINER_CPU_REQUEST,
type: 'Gauge',
},
aggregateOperator: 'latest',
@@ -833,7 +751,7 @@ export const getNodeMetricsQueryPayload = (
key: {
dataType: DataTypes.String,
id: 'k8s_node_name--string--tag--false',
key: k8sNodeNameKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_NODE_NAME,
type: 'tag',
},
op: '=',
@@ -905,7 +823,7 @@ export const getNodeMetricsQueryPayload = (
aggregateAttribute: {
dataType: DataTypes.Float64,
id: 'k8s_node_memory_usage--float64--Gauge--true',
key: k8sNodeMemoryUsageKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_NODE_MEMORY_USAGE,
type: 'Gauge',
},
aggregateOperator: 'avg',
@@ -919,7 +837,7 @@ export const getNodeMetricsQueryPayload = (
key: {
dataType: DataTypes.String,
id: 'k8s_node_name--string--tag--false',
key: k8sNodeNameKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_NODE_NAME,
type: 'tag',
},
op: '=',
@@ -944,7 +862,7 @@ export const getNodeMetricsQueryPayload = (
aggregateAttribute: {
dataType: DataTypes.Float64,
id: 'k8s_node_allocatable_memory--float64--Gauge--true',
key: k8sNodeAllocatableMemoryKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_NODE_ALLOCATABLE_MEMORY,
type: 'Gauge',
},
aggregateOperator: 'latest',
@@ -958,7 +876,7 @@ export const getNodeMetricsQueryPayload = (
key: {
dataType: DataTypes.String,
id: 'k8s_node_name--string--tag--false',
key: k8sNodeNameKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_NODE_NAME,
type: 'tag',
},
op: '=',
@@ -983,7 +901,7 @@ export const getNodeMetricsQueryPayload = (
aggregateAttribute: {
dataType: DataTypes.Float64,
id: 'k8s_container_memory_request--float64--Gauge--true',
key: k8sContainerMemoryRequestKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_CONTAINER_MEMORY_REQUEST,
type: 'Gauge',
},
aggregateOperator: 'latest',
@@ -997,7 +915,7 @@ export const getNodeMetricsQueryPayload = (
key: {
dataType: DataTypes.String,
id: 'k8s_node_name--string--tag--false',
key: k8sNodeNameKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_NODE_NAME,
type: 'tag',
},
op: '=',
@@ -1069,7 +987,7 @@ export const getNodeMetricsQueryPayload = (
aggregateAttribute: {
dataType: DataTypes.Float64,
id: 'k8s_pod_cpu_usage--float64--Gauge--true',
key: k8sPodCpuUtilizationKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_POD_CPU_USAGE,
type: 'Gauge',
},
aggregateOperator: 'avg',
@@ -1083,7 +1001,7 @@ export const getNodeMetricsQueryPayload = (
key: {
dataType: DataTypes.String,
id: 'k8s_node_name--string--tag--false',
key: k8sNodeNameKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_NODE_NAME,
type: 'tag',
},
op: '=',
@@ -1097,12 +1015,12 @@ export const getNodeMetricsQueryPayload = (
{
dataType: DataTypes.String,
id: 'k8s_pod_name--string--tag--false',
key: k8sPodNameKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_POD_NAME,
type: 'tag',
},
],
having: [],
legend: `{{${k8sPodNameKey}}}`,
legend: `{{${INFRA_MONITORING_ATTR_KEYS.K8S_POD_NAME}}}`,
limit: 10,
orderBy: [],
queryName: 'A',
@@ -1149,7 +1067,7 @@ export const getNodeMetricsQueryPayload = (
aggregateAttribute: {
dataType: DataTypes.Float64,
id: 'k8s_pod_memory_usage--float64--Gauge--true',
key: k8sPodMemoryUsageKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_POD_MEMORY_USAGE,
type: 'Gauge',
},
aggregateOperator: 'avg',
@@ -1163,7 +1081,7 @@ export const getNodeMetricsQueryPayload = (
key: {
dataType: DataTypes.String,
id: 'k8s_node_name--string--tag--false',
key: k8sNodeNameKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_NODE_NAME,
type: 'tag',
},
op: '=',
@@ -1177,12 +1095,12 @@ export const getNodeMetricsQueryPayload = (
{
dataType: DataTypes.String,
id: 'k8s_pod_name--string--tag--false',
key: k8sPodNameKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_POD_NAME,
type: 'tag',
},
],
having: [],
legend: `{{${k8sPodNameKey}}}`,
legend: `{{${INFRA_MONITORING_ATTR_KEYS.K8S_POD_NAME}}}`,
limit: 10,
orderBy: [],
queryName: 'A',
@@ -1229,7 +1147,7 @@ export const getNodeMetricsQueryPayload = (
aggregateAttribute: {
dataType: DataTypes.Float64,
id: 'k8s_node_network_errors--float64--Sum--true',
key: k8sNodeNetworkErrorsKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_NODE_NETWORK_ERRORS,
type: 'Sum',
},
aggregateOperator: 'increase',
@@ -1243,7 +1161,7 @@ export const getNodeMetricsQueryPayload = (
key: {
dataType: DataTypes.String,
id: 'k8s_node_name--string--tag--false',
key: k8sNodeNameKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_NODE_NAME,
type: 'tag',
},
op: '=',
@@ -1315,7 +1233,7 @@ export const getNodeMetricsQueryPayload = (
aggregateAttribute: {
dataType: DataTypes.Float64,
id: 'k8s_node_network_io--float64--Sum--true',
key: k8sNodeNetworkIoKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_NODE_NETWORK_IO,
type: 'Sum',
},
aggregateOperator: 'rate',
@@ -1329,7 +1247,7 @@ export const getNodeMetricsQueryPayload = (
key: {
dataType: DataTypes.String,
id: 'k8s_node_name--string--tag--false',
key: k8sNodeNameKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_NODE_NAME,
type: 'tag',
},
op: '=',
@@ -1401,7 +1319,7 @@ export const getNodeMetricsQueryPayload = (
aggregateAttribute: {
dataType: DataTypes.Float64,
id: 'k8s_node_filesystem_usage--float64--Gauge--true',
key: k8sNodeFilesystemUsageKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_NODE_FILESYSTEM_USAGE,
type: 'Gauge',
},
aggregateOperator: 'avg',
@@ -1415,7 +1333,7 @@ export const getNodeMetricsQueryPayload = (
key: {
dataType: DataTypes.String,
id: 'k8s_node_name--string--tag--false',
key: k8sNodeNameKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_NODE_NAME,
type: 'tag',
},
op: '=',
@@ -1440,7 +1358,7 @@ export const getNodeMetricsQueryPayload = (
aggregateAttribute: {
dataType: DataTypes.Float64,
id: 'k8s_node_filesystem_capacity--float64--Gauge--true',
key: k8sNodeFilesystemCapacityKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_NODE_FILESYSTEM_CAPACITY,
type: 'Gauge',
},
aggregateOperator: 'avg',
@@ -1454,7 +1372,7 @@ export const getNodeMetricsQueryPayload = (
key: {
dataType: DataTypes.String,
id: 'k8s_node_name--string--tag--false',
key: k8sNodeNameKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_NODE_NAME,
type: 'tag',
},
op: '=',
@@ -1479,7 +1397,7 @@ export const getNodeMetricsQueryPayload = (
aggregateAttribute: {
dataType: DataTypes.Float64,
id: 'k8s_node_filesystem_available--float64--Gauge--true',
key: k8sNodeFilesystemAvailableKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_NODE_FILESYSTEM_AVAILABLE,
type: 'Gauge',
},
aggregateOperator: 'avg',
@@ -1493,7 +1411,7 @@ export const getNodeMetricsQueryPayload = (
key: {
dataType: DataTypes.String,
id: 'k8s_node_name--string--tag--false',
key: k8sNodeNameKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_NODE_NAME,
type: 'tag',
},
op: '=',
@@ -1552,7 +1470,7 @@ export const getNodeMetricsQueryPayload = (
aggregateAttribute: {
dataType: DataTypes.Float64,
id: 'k8s_node_filesystem_usage--float64--Gauge--true',
key: k8sNodeFilesystemUsageKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_NODE_FILESYSTEM_USAGE,
type: 'Gauge',
},
aggregateOperator: 'avg',
@@ -1566,7 +1484,7 @@ export const getNodeMetricsQueryPayload = (
key: {
dataType: DataTypes.String,
id: 'k8s_node_name--string--tag--false',
key: k8sNodeNameKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_NODE_NAME,
type: 'tag',
},
op: '=',
@@ -1591,7 +1509,7 @@ export const getNodeMetricsQueryPayload = (
aggregateAttribute: {
dataType: DataTypes.Float64,
id: 'k8s_node_filesystem_capacity--float64--Gauge--true',
key: k8sNodeFilesystemCapacityKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_NODE_FILESYSTEM_CAPACITY,
type: 'Gauge',
},
aggregateOperator: 'avg',
@@ -1605,7 +1523,7 @@ export const getNodeMetricsQueryPayload = (
key: {
dataType: DataTypes.String,
id: 'k8s_node_name--string--tag--false',
key: k8sNodeNameKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_NODE_NAME,
type: 'tag',
},
op: '=',

File diff suppressed because it is too large Load Diff

View File

@@ -113,21 +113,7 @@ export const getStatefulSetMetricsQueryPayload = (
statefulSet: InframonitoringtypesStatefulSetRecordDTO,
start: number,
end: number,
dotMetricsEnabled: boolean,
): GetQueryResultsProps[] => {
const k8sStatefulSetNameKey = dotMetricsEnabled
? INFRA_MONITORING_ATTR_KEYS.K8S_STATEFULSET_NAME
: 'k8s_statefulset_name';
const k8sNamespaceNameKey = dotMetricsEnabled
? INFRA_MONITORING_ATTR_KEYS.K8S_NAMESPACE_NAME
: 'k8s_namespace_name';
const k8sPodNameKey = dotMetricsEnabled
? INFRA_MONITORING_ATTR_KEYS.K8S_POD_NAME
: 'k8s_pod_name';
const k8sClusterNameKey = dotMetricsEnabled
? INFRA_MONITORING_ATTR_KEYS.K8S_CLUSTER_NAME
: 'k8s_cluster_name';
const clusterName =
statefulSet.meta?.[INFRA_MONITORING_ATTR_KEYS.K8S_CLUSTER_NAME] ?? '';
const namespaceName =
@@ -139,7 +125,7 @@ export const getStatefulSetMetricsQueryPayload = (
key: {
dataType: DataTypes.String,
id: 'k8s_namespace_name--string--tag--false',
key: k8sNamespaceNameKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_NAMESPACE_NAME,
type: 'tag',
},
op: '=',
@@ -150,7 +136,7 @@ export const getStatefulSetMetricsQueryPayload = (
key: {
dataType: DataTypes.String,
id: 'k8s_cluster_name--string--tag--false',
key: k8sClusterNameKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_CLUSTER_NAME,
type: 'tag',
},
op: '=',
@@ -158,45 +144,6 @@ export const getStatefulSetMetricsQueryPayload = (
},
];
const k8sPodCpuUtilKey = dotMetricsEnabled
? 'k8s.pod.cpu.usage'
: 'k8s_pod_cpu_usage';
const k8sContainerCpuRequestKey = dotMetricsEnabled
? 'k8s.container.cpu_request'
: 'k8s_container_cpu_request';
const k8sContainerCpuLimitKey = dotMetricsEnabled
? 'k8s.container.cpu_limit'
: 'k8s_container_cpu_limit';
const k8sPodCpuReqUtilKey = dotMetricsEnabled
? 'k8s.pod.cpu_request_utilization'
: 'k8s_pod_cpu_request_utilization';
const k8sPodCpuLimitUtilKey = dotMetricsEnabled
? 'k8s.pod.cpu_limit_utilization'
: 'k8s_pod_cpu_limit_utilization';
const k8sPodMemUsageKey = dotMetricsEnabled
? 'k8s.pod.memory.usage'
: 'k8s_pod_memory_usage';
const k8sContainerMemRequestKey = dotMetricsEnabled
? 'k8s.container.memory_request'
: 'k8s_container_memory_request';
const k8sContainerMemLimitKey = dotMetricsEnabled
? 'k8s.container.memory_limit'
: 'k8s_container_memory_limit';
const k8sPodMemReqUtilKey = dotMetricsEnabled
? 'k8s.pod.memory_request_utilization'
: 'k8s_pod_memory_request_utilization';
const k8sPodMemLimitUtilKey = dotMetricsEnabled
? 'k8s.pod.memory_limit_utilization'
: 'k8s_pod_memory_limit_utilization';
const k8sPodNetworkIoKey = dotMetricsEnabled
? 'k8s.pod.network.io'
: 'k8s_pod_network_io';
const k8sPodNetworkErrorsKey = dotMetricsEnabled
? 'k8s.pod.network.errors'
: 'k8s_pod_network_errors';
return [
{
selectedTime: 'GLOBAL_TIME',
@@ -208,7 +155,7 @@ export const getStatefulSetMetricsQueryPayload = (
aggregateAttribute: {
dataType: DataTypes.Float64,
id: 'cpu_usage',
key: k8sPodCpuUtilKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_POD_CPU_USAGE,
type: 'Gauge',
},
aggregateOperator: 'avg',
@@ -222,7 +169,7 @@ export const getStatefulSetMetricsQueryPayload = (
key: {
dataType: DataTypes.String,
id: 'ss_name',
key: k8sStatefulSetNameKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_STATEFULSET_NAME,
type: 'tag',
},
op: '=',
@@ -251,7 +198,7 @@ export const getStatefulSetMetricsQueryPayload = (
aggregateAttribute: {
dataType: DataTypes.Float64,
id: 'cpu_request',
key: k8sContainerCpuRequestKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_CONTAINER_CPU_REQUEST,
type: 'Gauge',
},
aggregateOperator: 'latest',
@@ -265,7 +212,7 @@ export const getStatefulSetMetricsQueryPayload = (
key: {
dataType: DataTypes.String,
id: 'pod_name',
key: k8sPodNameKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_POD_NAME,
type: 'tag',
},
op: 'contains',
@@ -294,7 +241,7 @@ export const getStatefulSetMetricsQueryPayload = (
aggregateAttribute: {
dataType: DataTypes.Float64,
id: 'cpu_limit',
key: k8sContainerCpuLimitKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_CONTAINER_CPU_LIMIT,
type: 'Gauge',
},
aggregateOperator: 'latest',
@@ -308,7 +255,7 @@ export const getStatefulSetMetricsQueryPayload = (
key: {
dataType: DataTypes.String,
id: 'pod_name',
key: k8sPodNameKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_POD_NAME,
type: 'tag',
},
op: 'contains',
@@ -357,7 +304,7 @@ export const getStatefulSetMetricsQueryPayload = (
aggregateAttribute: {
dataType: DataTypes.Float64,
id: 'cpu_req_util',
key: k8sPodCpuReqUtilKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_POD_CPU_REQUEST_UTILIZATION,
type: 'Gauge',
},
aggregateOperator: 'avg',
@@ -371,7 +318,7 @@ export const getStatefulSetMetricsQueryPayload = (
key: {
dataType: DataTypes.String,
id: 'ss_name',
key: k8sStatefulSetNameKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_STATEFULSET_NAME,
type: 'tag',
},
op: '=',
@@ -400,7 +347,7 @@ export const getStatefulSetMetricsQueryPayload = (
aggregateAttribute: {
dataType: DataTypes.Float64,
id: 'cpu_limit_util',
key: k8sPodCpuLimitUtilKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_POD_CPU_LIMIT_UTILIZATION,
type: 'Gauge',
},
aggregateOperator: 'avg',
@@ -414,7 +361,7 @@ export const getStatefulSetMetricsQueryPayload = (
key: {
dataType: DataTypes.String,
id: 'ss_name',
key: k8sStatefulSetNameKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_STATEFULSET_NAME,
type: 'tag',
},
op: '=',
@@ -463,7 +410,7 @@ export const getStatefulSetMetricsQueryPayload = (
aggregateAttribute: {
dataType: DataTypes.Float64,
id: 'mem_usage',
key: k8sPodMemUsageKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_POD_MEMORY_USAGE,
type: 'Gauge',
},
aggregateOperator: 'avg',
@@ -477,7 +424,7 @@ export const getStatefulSetMetricsQueryPayload = (
key: {
dataType: DataTypes.String,
id: 'ss_name',
key: k8sStatefulSetNameKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_STATEFULSET_NAME,
type: 'tag',
},
op: '=',
@@ -506,7 +453,7 @@ export const getStatefulSetMetricsQueryPayload = (
aggregateAttribute: {
dataType: DataTypes.Float64,
id: 'mem_request',
key: k8sContainerMemRequestKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_CONTAINER_MEMORY_REQUEST,
type: 'Gauge',
},
aggregateOperator: 'latest',
@@ -520,7 +467,7 @@ export const getStatefulSetMetricsQueryPayload = (
key: {
dataType: DataTypes.String,
id: 'pod_name',
key: k8sPodNameKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_POD_NAME,
type: 'tag',
},
op: 'contains',
@@ -549,7 +496,7 @@ export const getStatefulSetMetricsQueryPayload = (
aggregateAttribute: {
dataType: DataTypes.Float64,
id: 'mem_limit',
key: k8sContainerMemLimitKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_CONTAINER_MEMORY_LIMIT,
type: 'Gauge',
},
aggregateOperator: 'latest',
@@ -563,7 +510,7 @@ export const getStatefulSetMetricsQueryPayload = (
key: {
dataType: DataTypes.String,
id: 'pod_name',
key: k8sPodNameKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_POD_NAME,
type: 'tag',
},
op: 'contains',
@@ -612,7 +559,7 @@ export const getStatefulSetMetricsQueryPayload = (
aggregateAttribute: {
dataType: DataTypes.Float64,
id: 'mem_req_util',
key: k8sPodMemReqUtilKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_POD_MEMORY_REQUEST_UTILIZATION,
type: 'Gauge',
},
aggregateOperator: 'avg',
@@ -626,7 +573,7 @@ export const getStatefulSetMetricsQueryPayload = (
key: {
dataType: DataTypes.String,
id: 'ss_name',
key: k8sStatefulSetNameKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_STATEFULSET_NAME,
type: 'tag',
},
op: '=',
@@ -655,7 +602,7 @@ export const getStatefulSetMetricsQueryPayload = (
aggregateAttribute: {
dataType: DataTypes.Float64,
id: 'mem_limit_util',
key: k8sPodMemLimitUtilKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_POD_MEMORY_LIMIT_UTILIZATION,
type: 'Gauge',
},
aggregateOperator: 'avg',
@@ -669,7 +616,7 @@ export const getStatefulSetMetricsQueryPayload = (
key: {
dataType: DataTypes.String,
id: 'ss_name',
key: k8sStatefulSetNameKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_STATEFULSET_NAME,
type: 'tag',
},
op: '=',
@@ -718,7 +665,7 @@ export const getStatefulSetMetricsQueryPayload = (
aggregateAttribute: {
dataType: DataTypes.Float64,
id: 'net_io',
key: k8sPodNetworkIoKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_POD_NETWORK_IO,
type: 'Sum',
},
aggregateOperator: 'rate',
@@ -732,7 +679,7 @@ export const getStatefulSetMetricsQueryPayload = (
key: {
dataType: DataTypes.String,
id: 'ss_name',
key: k8sStatefulSetNameKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_STATEFULSET_NAME,
type: 'tag',
},
op: '=',
@@ -794,7 +741,7 @@ export const getStatefulSetMetricsQueryPayload = (
aggregateAttribute: {
dataType: DataTypes.Float64,
id: 'net_err',
key: k8sPodNetworkErrorsKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_POD_NETWORK_ERRORS,
type: 'Sum',
},
aggregateOperator: 'increase',
@@ -808,7 +755,7 @@ export const getStatefulSetMetricsQueryPayload = (
key: {
dataType: DataTypes.String,
id: 'ss_name',
key: k8sStatefulSetNameKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_STATEFULSET_NAME,
type: 'tag',
},
op: '=',
@@ -867,15 +814,10 @@ export const getStatefulSetPodMetricsQueryPayload = (
statefulSet: InframonitoringtypesStatefulSetRecordDTO,
start: number,
end: number,
dotMetricsEnabled: boolean,
): GetQueryResultsProps[] => {
const k8sStatefulSetNameKey = dotMetricsEnabled
? INFRA_MONITORING_ATTR_KEYS.K8S_STATEFULSET_NAME
: 'k8s_statefulset_name';
return getPodUtilizationByPodQueryPayloads(
{
workloadNameKey: k8sStatefulSetNameKey,
workloadNameKey: INFRA_MONITORING_ATTR_KEYS.K8S_STATEFULSET_NAME,
workloadNameValue:
statefulSet.meta?.[INFRA_MONITORING_ATTR_KEYS.K8S_STATEFULSET_NAME] ?? '',
clusterName:
@@ -885,6 +827,5 @@ export const getStatefulSetPodMetricsQueryPayload = (
},
start,
end,
dotMetricsEnabled,
);
};

View File

@@ -97,36 +97,7 @@ export const getVolumeMetricsQueryPayload = (
volume: InframonitoringtypesVolumeRecordDTO,
start: number,
end: number,
dotMetricsEnabled: boolean,
): GetQueryResultsProps[] => {
const k8sClusterNameKey = dotMetricsEnabled
? INFRA_MONITORING_ATTR_KEYS.K8S_CLUSTER_NAME
: 'k8s_cluster_name';
const k8sNamespaceNameKey = dotMetricsEnabled
? INFRA_MONITORING_ATTR_KEYS.K8S_NAMESPACE_NAME
: 'k8s_namespace_name';
const k8sVolumeAvailableKey = dotMetricsEnabled
? INFRA_MONITORING_ATTR_KEYS.K8S_VOLUME_AVAILABLE
: 'k8s_volume_available';
const k8sVolumeCapacityKey = dotMetricsEnabled
? INFRA_MONITORING_ATTR_KEYS.K8S_VOLUME_CAPACITY
: 'k8s_volume_capacity';
const k8sVolumeInodesUsedKey = dotMetricsEnabled
? INFRA_MONITORING_ATTR_KEYS.K8S_VOLUME_INODES_USED
: 'k8s_volume_inodes_used';
const k8sVolumeInodesKey = dotMetricsEnabled
? INFRA_MONITORING_ATTR_KEYS.K8S_VOLUME_INODES
: 'k8s_volume_inodes';
const k8sVolumeInodesFreeKey = dotMetricsEnabled
? INFRA_MONITORING_ATTR_KEYS.K8S_VOLUME_INODES_FREE
: 'k8s_volume_inodes_free';
const k8sVolumeTypeKey = dotMetricsEnabled
? INFRA_MONITORING_ATTR_KEYS.K8S_VOLUME_TYPE
: 'k8s_volume_type';
const k8sPVCNameKey = dotMetricsEnabled
? INFRA_MONITORING_ATTR_KEYS.K8S_PERSISTENT_VOLUME_CLAIM_NAME
: 'k8s_persistentvolumeclaim_name';
return [
{
selectedTime: 'GLOBAL_TIME',
@@ -138,7 +109,7 @@ export const getVolumeMetricsQueryPayload = (
aggregateAttribute: {
dataType: DataTypes.Float64,
id: 'k8s_volume_available--float64--Gauge--true',
key: k8sVolumeAvailableKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_VOLUME_AVAILABLE,
type: 'Gauge',
},
aggregateOperator: 'avg',
@@ -152,7 +123,7 @@ export const getVolumeMetricsQueryPayload = (
key: {
dataType: DataTypes.String,
id: 'k8s_cluster_name--string--tag--false',
key: k8sClusterNameKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_CLUSTER_NAME,
type: 'tag',
},
op: '=',
@@ -164,7 +135,7 @@ export const getVolumeMetricsQueryPayload = (
key: {
dataType: DataTypes.String,
id: 'k8s_namespace_name--string--tag--false',
key: k8sNamespaceNameKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_NAMESPACE_NAME,
type: 'tag',
},
op: 'in',
@@ -177,7 +148,7 @@ export const getVolumeMetricsQueryPayload = (
key: {
dataType: DataTypes.String,
id: 'k8s_volume_type--string--tag--false',
key: k8sVolumeTypeKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_VOLUME_TYPE,
type: 'tag',
},
op: 'in',
@@ -188,7 +159,7 @@ export const getVolumeMetricsQueryPayload = (
key: {
dataType: DataTypes.String,
id: 'k8s_persistentvolumeclaim_name--string--tag--false',
key: k8sPVCNameKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_PERSISTENT_VOLUME_CLAIM_NAME,
type: 'tag',
},
op: '=',
@@ -233,7 +204,7 @@ export const getVolumeMetricsQueryPayload = (
aggregateAttribute: {
dataType: DataTypes.Float64,
id: 'k8s_volume_capacity--float64--Gauge--true',
key: k8sVolumeCapacityKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_VOLUME_CAPACITY,
type: 'Gauge',
},
aggregateOperator: 'avg',
@@ -247,7 +218,7 @@ export const getVolumeMetricsQueryPayload = (
key: {
dataType: DataTypes.String,
id: 'k8s_cluster_name--string--tag--false',
key: k8sClusterNameKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_CLUSTER_NAME,
type: 'tag',
},
op: '=',
@@ -259,7 +230,7 @@ export const getVolumeMetricsQueryPayload = (
key: {
dataType: DataTypes.String,
id: 'k8s_namespace_name--string--tag--false',
key: k8sNamespaceNameKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_NAMESPACE_NAME,
type: 'tag',
},
op: 'in',
@@ -272,7 +243,7 @@ export const getVolumeMetricsQueryPayload = (
key: {
dataType: DataTypes.String,
id: 'k8s_volume_type--string--tag--false',
key: k8sVolumeTypeKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_VOLUME_TYPE,
type: 'tag',
},
op: 'in',
@@ -283,7 +254,7 @@ export const getVolumeMetricsQueryPayload = (
key: {
dataType: DataTypes.String,
id: 'k8s_persistentvolumeclaim_name--string--tag--false',
key: k8sPVCNameKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_PERSISTENT_VOLUME_CLAIM_NAME,
type: 'tag',
},
op: '=',
@@ -328,7 +299,7 @@ export const getVolumeMetricsQueryPayload = (
aggregateAttribute: {
dataType: DataTypes.Float64,
id: 'k8s_volume_inodes_used--float64--Gauge--true',
key: k8sVolumeInodesUsedKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_VOLUME_INODES_USED,
type: 'Gauge',
},
aggregateOperator: 'avg',
@@ -342,7 +313,7 @@ export const getVolumeMetricsQueryPayload = (
key: {
dataType: DataTypes.String,
id: 'k8s_cluster_name--string--tag--false',
key: k8sClusterNameKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_CLUSTER_NAME,
type: 'tag',
},
op: '=',
@@ -354,7 +325,7 @@ export const getVolumeMetricsQueryPayload = (
key: {
dataType: DataTypes.String,
id: 'k8s_namespace_name--string--tag--false',
key: k8sNamespaceNameKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_NAMESPACE_NAME,
type: 'tag',
},
op: 'in',
@@ -367,7 +338,7 @@ export const getVolumeMetricsQueryPayload = (
key: {
dataType: DataTypes.String,
id: 'k8s_volume_type--string--tag--false',
key: k8sVolumeTypeKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_VOLUME_TYPE,
type: 'tag',
},
op: 'in',
@@ -378,7 +349,7 @@ export const getVolumeMetricsQueryPayload = (
key: {
dataType: DataTypes.String,
id: 'k8s_persistentvolumeclaim_name--string--tag--false',
key: k8sPVCNameKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_PERSISTENT_VOLUME_CLAIM_NAME,
type: 'tag',
},
op: '=',
@@ -423,7 +394,7 @@ export const getVolumeMetricsQueryPayload = (
aggregateAttribute: {
dataType: DataTypes.Float64,
id: 'k8s_volume_inodes--float64--Gauge--true',
key: k8sVolumeInodesKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_VOLUME_INODES,
type: 'Gauge',
},
aggregateOperator: 'avg',
@@ -437,7 +408,7 @@ export const getVolumeMetricsQueryPayload = (
key: {
dataType: DataTypes.String,
id: 'k8s_cluster_name--string--tag--false',
key: k8sClusterNameKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_CLUSTER_NAME,
type: 'tag',
},
op: '=',
@@ -449,7 +420,7 @@ export const getVolumeMetricsQueryPayload = (
key: {
dataType: DataTypes.String,
id: 'k8s_namespace_name--string--tag--false',
key: k8sNamespaceNameKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_NAMESPACE_NAME,
type: 'tag',
},
op: 'in',
@@ -462,7 +433,7 @@ export const getVolumeMetricsQueryPayload = (
key: {
dataType: DataTypes.String,
id: 'k8s_volume_type--string--tag--false',
key: k8sVolumeTypeKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_VOLUME_TYPE,
type: 'tag',
},
op: 'in',
@@ -473,7 +444,7 @@ export const getVolumeMetricsQueryPayload = (
key: {
dataType: DataTypes.String,
id: 'k8s_persistentvolumeclaim_name--string--tag--false',
key: k8sPVCNameKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_PERSISTENT_VOLUME_CLAIM_NAME,
type: 'tag',
},
op: '=',
@@ -518,7 +489,7 @@ export const getVolumeMetricsQueryPayload = (
aggregateAttribute: {
dataType: DataTypes.Float64,
id: 'k8s_volume_inodes_free--float64--Gauge--true',
key: k8sVolumeInodesFreeKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_VOLUME_INODES_FREE,
type: 'Gauge',
},
aggregateOperator: 'avg',
@@ -532,7 +503,7 @@ export const getVolumeMetricsQueryPayload = (
key: {
dataType: DataTypes.String,
id: 'k8s_cluster_name--string--tag--false',
key: k8sClusterNameKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_CLUSTER_NAME,
type: 'tag',
},
op: '=',
@@ -544,7 +515,7 @@ export const getVolumeMetricsQueryPayload = (
key: {
dataType: DataTypes.String,
id: 'k8s_namespace_name--string--tag--false',
key: k8sNamespaceNameKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_NAMESPACE_NAME,
type: 'tag',
},
op: 'in',
@@ -557,7 +528,7 @@ export const getVolumeMetricsQueryPayload = (
key: {
dataType: DataTypes.String,
id: 'k8s_volume_type--string--tag--false',
key: k8sVolumeTypeKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_VOLUME_TYPE,
type: 'tag',
},
op: 'in',
@@ -568,7 +539,7 @@ export const getVolumeMetricsQueryPayload = (
key: {
dataType: DataTypes.String,
id: 'k8s_persistentvolumeclaim_name--string--tag--false',
key: k8sPVCNameKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_PERSISTENT_VOLUME_CLAIM_NAME,
type: 'tag',
},
op: '=',

View File

@@ -61,6 +61,10 @@ export const INFRA_MONITORING_ATTR_KEYS = {
K8S_CONTAINER_CPU_LIMIT: 'k8s.container.cpu_limit',
K8S_CONTAINER_MEMORY_REQUEST: 'k8s.container.memory_request',
K8S_CONTAINER_MEMORY_LIMIT: 'k8s.container.memory_limit',
CONTAINER_CPU_USAGE: 'container.cpu.usage',
CONTAINER_MEMORY_USAGE: 'container.memory.usage',
CONTAINER_MEMORY_WORKING_SET: 'container.memory.working_set',
CONTAINER_MEMORY_RSS: 'container.memory.rss',
// Deployment
K8S_DEPLOYMENT_NAME: 'k8s.deployment.name',
@@ -109,6 +113,10 @@ export const INFRA_MONITORING_ATTR_KEYS = {
// Environment
DEPLOYMENT_ENVIRONMENT: 'deployment.environment',
// Host System
OS_TYPE: 'os.type',
SYSTEM_CPU_LOAD_AVERAGE_15M: 'system.cpu.load_average.15m',
} as const;
export const DEFAULT_PAGE_SIZE = 10;
@@ -159,81 +167,48 @@ export const K8sCategories = {
VOLUMES: 'volumes',
};
const underscoreMap = {
[InfraMonitoringEntity.HOSTS]: 'system_cpu_load_average_15m',
[InfraMonitoringEntity.PODS]: 'k8s_pod_cpu_usage',
[InfraMonitoringEntity.NODES]: 'k8s_node_cpu_usage',
[InfraMonitoringEntity.NAMESPACES]: 'k8s_pod_cpu_usage',
[InfraMonitoringEntity.CLUSTERS]: 'k8s_node_cpu_usage',
[InfraMonitoringEntity.DEPLOYMENTS]: 'k8s_pod_cpu_usage',
[InfraMonitoringEntity.STATEFULSETS]: 'k8s_pod_cpu_usage',
[InfraMonitoringEntity.DAEMONSETS]: 'k8s_pod_cpu_usage',
[InfraMonitoringEntity.CONTAINERS]: 'k8s_pod_cpu_usage',
[InfraMonitoringEntity.JOBS]: 'k8s_job_desired_successful_pods',
[InfraMonitoringEntity.VOLUMES]: 'k8s_volume_capacity',
};
const dotMap = {
[InfraMonitoringEntity.HOSTS]: 'system.cpu.load_average.15m',
[InfraMonitoringEntity.PODS]: 'k8s.pod.cpu.usage',
[InfraMonitoringEntity.NODES]: 'k8s.node.cpu.usage',
[InfraMonitoringEntity.NAMESPACES]: 'k8s.pod.cpu.usage',
[InfraMonitoringEntity.CLUSTERS]: 'k8s.node.cpu.usage',
[InfraMonitoringEntity.DEPLOYMENTS]: 'k8s.pod.cpu.usage',
[InfraMonitoringEntity.STATEFULSETS]: 'k8s.pod.cpu.usage',
[InfraMonitoringEntity.DAEMONSETS]: 'k8s.pod.cpu.usage',
[InfraMonitoringEntity.CONTAINERS]: 'k8s.pod.cpu.usage',
[InfraMonitoringEntity.JOBS]: 'k8s.job.desired_successful_pods',
[InfraMonitoringEntity.VOLUMES]: 'k8s.volume.capacity',
[InfraMonitoringEntity.HOSTS]:
INFRA_MONITORING_ATTR_KEYS.SYSTEM_CPU_LOAD_AVERAGE_15M,
[InfraMonitoringEntity.PODS]: INFRA_MONITORING_ATTR_KEYS.K8S_POD_CPU_USAGE,
[InfraMonitoringEntity.NODES]: INFRA_MONITORING_ATTR_KEYS.K8S_NODE_CPU_USAGE,
[InfraMonitoringEntity.NAMESPACES]:
INFRA_MONITORING_ATTR_KEYS.K8S_POD_CPU_USAGE,
[InfraMonitoringEntity.CLUSTERS]:
INFRA_MONITORING_ATTR_KEYS.K8S_NODE_CPU_USAGE,
[InfraMonitoringEntity.DEPLOYMENTS]:
INFRA_MONITORING_ATTR_KEYS.K8S_POD_CPU_USAGE,
[InfraMonitoringEntity.STATEFULSETS]:
INFRA_MONITORING_ATTR_KEYS.K8S_POD_CPU_USAGE,
[InfraMonitoringEntity.DAEMONSETS]:
INFRA_MONITORING_ATTR_KEYS.K8S_POD_CPU_USAGE,
[InfraMonitoringEntity.CONTAINERS]:
INFRA_MONITORING_ATTR_KEYS.K8S_POD_CPU_USAGE,
[InfraMonitoringEntity.JOBS]:
INFRA_MONITORING_ATTR_KEYS.K8S_JOB_DESIRED_SUCCESSFUL_PODS,
[InfraMonitoringEntity.VOLUMES]:
INFRA_MONITORING_ATTR_KEYS.K8S_VOLUME_CAPACITY,
};
export function GetK8sEntityToAggregateAttribute(
category: InfraMonitoringEntity,
dotMetricsEnabled: boolean,
): string {
return dotMetricsEnabled ? dotMap[category] : underscoreMap[category];
return dotMap[category];
}
export function GetPodsQuickFiltersConfig(
dotMetricsEnabled: boolean,
): IQuickFiltersConfig[] {
const podKey = dotMetricsEnabled ? 'k8s.pod.name' : 'k8s_pod_name';
const namespaceKey = dotMetricsEnabled
? 'k8s.namespace.name'
: 'k8s_namespace_name';
const nodeKey = dotMetricsEnabled ? 'k8s.node.name' : 'k8s_node_name';
const clusterKey = dotMetricsEnabled ? 'k8s.cluster.name' : 'k8s_cluster_name';
const deploymentKey = dotMetricsEnabled
? 'k8s.deployment.name'
: 'k8s_deployment_name';
const statefulsetKey = dotMetricsEnabled
? 'k8s.statefulset.name'
: 'k8s_statefulset_name';
const daemonsetKey = dotMetricsEnabled
? 'k8s.daemonset.name'
: 'k8s_daemonset_name';
const jobKey = dotMetricsEnabled ? 'k8s.job.name' : 'k8s_job_name';
const environmentKey = dotMetricsEnabled
? 'deployment.environment'
: 'deployment_environment';
// Define aggregate attribute (metric) name
const cpuUtilizationMetric = dotMetricsEnabled
? 'k8s.pod.cpu.usage'
: 'k8s_pod_cpu_usage';
export function GetPodsQuickFiltersConfig(): IQuickFiltersConfig[] {
return [
{
type: FiltersType.CHECKBOX,
title: 'Pod',
attributeKey: {
key: podKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_POD_NAME,
dataType: DataTypes.String,
type: 'tag',
id: `${podKey}--string--tag--true`,
id: `${INFRA_MONITORING_ATTR_KEYS.K8S_POD_NAME}--string--tag--true`,
},
aggregateOperator: 'noop',
aggregateAttribute: cpuUtilizationMetric,
aggregateAttribute: INFRA_MONITORING_ATTR_KEYS.K8S_POD_CPU_USAGE,
dataSource: DataSource.METRICS,
defaultOpen: true,
},
@@ -241,13 +216,13 @@ export function GetPodsQuickFiltersConfig(
type: FiltersType.CHECKBOX,
title: 'Namespace',
attributeKey: {
key: namespaceKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_NAMESPACE_NAME,
dataType: DataTypes.String,
type: 'resource',
id: `${namespaceKey}--string--resource--false`,
id: `${INFRA_MONITORING_ATTR_KEYS.K8S_NAMESPACE_NAME}--string--resource--false`,
},
aggregateOperator: 'noop',
aggregateAttribute: cpuUtilizationMetric,
aggregateAttribute: INFRA_MONITORING_ATTR_KEYS.K8S_POD_CPU_USAGE,
dataSource: DataSource.METRICS,
defaultOpen: false,
},
@@ -255,13 +230,13 @@ export function GetPodsQuickFiltersConfig(
type: FiltersType.CHECKBOX,
title: 'Node',
attributeKey: {
key: nodeKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_NODE_NAME,
dataType: DataTypes.String,
type: 'resource',
id: `${nodeKey}--string--resource--false`,
id: `${INFRA_MONITORING_ATTR_KEYS.K8S_NODE_NAME}--string--resource--false`,
},
aggregateOperator: 'noop',
aggregateAttribute: cpuUtilizationMetric,
aggregateAttribute: INFRA_MONITORING_ATTR_KEYS.K8S_POD_CPU_USAGE,
dataSource: DataSource.METRICS,
defaultOpen: false,
},
@@ -269,13 +244,13 @@ export function GetPodsQuickFiltersConfig(
type: FiltersType.CHECKBOX,
title: 'Cluster',
attributeKey: {
key: clusterKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_CLUSTER_NAME,
dataType: DataTypes.String,
type: 'resource',
id: `${clusterKey}--string--resource--false`,
id: `${INFRA_MONITORING_ATTR_KEYS.K8S_CLUSTER_NAME}--string--resource--false`,
},
aggregateOperator: 'noop',
aggregateAttribute: cpuUtilizationMetric,
aggregateAttribute: INFRA_MONITORING_ATTR_KEYS.K8S_POD_CPU_USAGE,
dataSource: DataSource.METRICS,
defaultOpen: false,
},
@@ -283,13 +258,13 @@ export function GetPodsQuickFiltersConfig(
type: FiltersType.CHECKBOX,
title: 'Deployment',
attributeKey: {
key: deploymentKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_DEPLOYMENT_NAME,
dataType: DataTypes.String,
type: 'resource',
id: `${deploymentKey}--string--resource--false`,
id: `${INFRA_MONITORING_ATTR_KEYS.K8S_DEPLOYMENT_NAME}--string--resource--false`,
},
aggregateOperator: 'noop',
aggregateAttribute: cpuUtilizationMetric,
aggregateAttribute: INFRA_MONITORING_ATTR_KEYS.K8S_POD_CPU_USAGE,
dataSource: DataSource.METRICS,
defaultOpen: false,
},
@@ -297,13 +272,13 @@ export function GetPodsQuickFiltersConfig(
type: FiltersType.CHECKBOX,
title: 'Statefulset',
attributeKey: {
key: statefulsetKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_STATEFULSET_NAME,
dataType: DataTypes.String,
type: 'resource',
id: `${statefulsetKey}--string--resource--false`,
id: `${INFRA_MONITORING_ATTR_KEYS.K8S_STATEFULSET_NAME}--string--resource--false`,
},
aggregateOperator: 'noop',
aggregateAttribute: cpuUtilizationMetric,
aggregateAttribute: INFRA_MONITORING_ATTR_KEYS.K8S_POD_CPU_USAGE,
dataSource: DataSource.METRICS,
defaultOpen: false,
},
@@ -311,13 +286,13 @@ export function GetPodsQuickFiltersConfig(
type: FiltersType.CHECKBOX,
title: 'DaemonSet',
attributeKey: {
key: daemonsetKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_DAEMONSET_NAME,
dataType: DataTypes.String,
type: 'resource',
id: `${daemonsetKey}--string--resource--false`,
id: `${INFRA_MONITORING_ATTR_KEYS.K8S_DAEMONSET_NAME}--string--resource--false`,
},
aggregateOperator: 'noop',
aggregateAttribute: cpuUtilizationMetric,
aggregateAttribute: INFRA_MONITORING_ATTR_KEYS.K8S_POD_CPU_USAGE,
dataSource: DataSource.METRICS,
defaultOpen: false,
},
@@ -325,13 +300,13 @@ export function GetPodsQuickFiltersConfig(
type: FiltersType.CHECKBOX,
title: 'Job',
attributeKey: {
key: jobKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_JOB_NAME,
dataType: DataTypes.String,
type: 'resource',
id: `${jobKey}--string--resource--false`,
id: `${INFRA_MONITORING_ATTR_KEYS.K8S_JOB_NAME}--string--resource--false`,
},
aggregateOperator: 'noop',
aggregateAttribute: cpuUtilizationMetric,
aggregateAttribute: INFRA_MONITORING_ATTR_KEYS.K8S_POD_CPU_USAGE,
dataSource: DataSource.METRICS,
defaultOpen: false,
},
@@ -339,7 +314,7 @@ export function GetPodsQuickFiltersConfig(
type: FiltersType.CHECKBOX,
title: 'Environment',
attributeKey: {
key: environmentKey,
key: INFRA_MONITORING_ATTR_KEYS.DEPLOYMENT_ENVIRONMENT,
dataType: DataTypes.String,
type: 'resource',
},
@@ -348,33 +323,19 @@ export function GetPodsQuickFiltersConfig(
];
}
export function GetNodesQuickFiltersConfig(
dotMetricsEnabled: boolean,
): IQuickFiltersConfig[] {
// Define attribute keys
const nodeKey = dotMetricsEnabled ? 'k8s.node.name' : 'k8s_node_name';
const clusterKey = dotMetricsEnabled ? 'k8s.cluster.name' : 'k8s_cluster_name';
// Define aggregate metric name for node CPU utilization
const cpuUtilMetric = dotMetricsEnabled
? 'k8s.node.cpu.usage'
: 'k8s_node_cpu_usage';
const environmentKey = dotMetricsEnabled
? 'deployment.environment'
: 'deployment_environment';
export function GetNodesQuickFiltersConfig(): IQuickFiltersConfig[] {
return [
{
type: FiltersType.CHECKBOX,
title: 'Node Name',
attributeKey: {
key: nodeKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_NODE_NAME,
dataType: DataTypes.String,
type: 'resource',
id: `${nodeKey}--string--resource--true`,
id: `${INFRA_MONITORING_ATTR_KEYS.K8S_NODE_NAME}--string--resource--true`,
},
aggregateOperator: 'noop',
aggregateAttribute: cpuUtilMetric,
aggregateAttribute: INFRA_MONITORING_ATTR_KEYS.K8S_NODE_CPU_USAGE,
dataSource: DataSource.METRICS,
defaultOpen: true,
},
@@ -382,13 +343,13 @@ export function GetNodesQuickFiltersConfig(
type: FiltersType.CHECKBOX,
title: 'Cluster Name',
attributeKey: {
key: clusterKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_CLUSTER_NAME,
dataType: DataTypes.String,
type: 'resource',
id: `${clusterKey}--string--resource--true`,
id: `${INFRA_MONITORING_ATTR_KEYS.K8S_CLUSTER_NAME}--string--resource--true`,
},
aggregateOperator: 'noop',
aggregateAttribute: cpuUtilMetric,
aggregateAttribute: INFRA_MONITORING_ATTR_KEYS.K8S_NODE_CPU_USAGE,
dataSource: DataSource.METRICS,
defaultOpen: true,
},
@@ -396,7 +357,7 @@ export function GetNodesQuickFiltersConfig(
type: FiltersType.CHECKBOX,
title: 'Environment',
attributeKey: {
key: environmentKey,
key: INFRA_MONITORING_ATTR_KEYS.DEPLOYMENT_ENVIRONMENT,
dataType: DataTypes.String,
type: 'resource',
},
@@ -405,32 +366,19 @@ export function GetNodesQuickFiltersConfig(
];
}
export function GetNamespaceQuickFiltersConfig(
dotMetricsEnabled: boolean,
): IQuickFiltersConfig[] {
const namespaceKey = dotMetricsEnabled
? 'k8s.namespace.name'
: 'k8s_namespace_name';
const clusterKey = dotMetricsEnabled ? 'k8s.cluster.name' : 'k8s_cluster_name';
const cpuUtilMetric = dotMetricsEnabled
? 'k8s.pod.cpu.usage'
: 'k8s_pod_cpu_usage';
const environmentKey = dotMetricsEnabled
? 'deployment.environment'
: 'deployment_environment';
export function GetNamespaceQuickFiltersConfig(): IQuickFiltersConfig[] {
return [
{
type: FiltersType.CHECKBOX,
title: 'Namespace Name',
attributeKey: {
key: namespaceKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_NAMESPACE_NAME,
dataType: DataTypes.String,
type: 'resource',
id: `${namespaceKey}--string--resource`,
id: `${INFRA_MONITORING_ATTR_KEYS.K8S_NAMESPACE_NAME}--string--resource`,
},
aggregateOperator: 'noop',
aggregateAttribute: cpuUtilMetric,
aggregateAttribute: INFRA_MONITORING_ATTR_KEYS.K8S_POD_CPU_USAGE,
dataSource: DataSource.METRICS,
defaultOpen: true,
},
@@ -438,13 +386,13 @@ export function GetNamespaceQuickFiltersConfig(
type: FiltersType.CHECKBOX,
title: 'Cluster Name',
attributeKey: {
key: clusterKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_CLUSTER_NAME,
dataType: DataTypes.String,
type: 'resource',
id: `${clusterKey}--string--resource`,
id: `${INFRA_MONITORING_ATTR_KEYS.K8S_CLUSTER_NAME}--string--resource`,
},
aggregateOperator: 'noop',
aggregateAttribute: cpuUtilMetric,
aggregateAttribute: INFRA_MONITORING_ATTR_KEYS.K8S_POD_CPU_USAGE,
dataSource: DataSource.METRICS,
defaultOpen: true,
},
@@ -452,7 +400,7 @@ export function GetNamespaceQuickFiltersConfig(
type: FiltersType.CHECKBOX,
title: 'Environment',
attributeKey: {
key: environmentKey,
key: INFRA_MONITORING_ATTR_KEYS.DEPLOYMENT_ENVIRONMENT,
dataType: DataTypes.String,
type: 'resource',
},
@@ -461,29 +409,19 @@ export function GetNamespaceQuickFiltersConfig(
];
}
export function GetClustersQuickFiltersConfig(
dotMetricsEnabled: boolean,
): IQuickFiltersConfig[] {
const clusterKey = dotMetricsEnabled ? 'k8s.cluster.name' : 'k8s_cluster_name';
const cpuUtilMetric = dotMetricsEnabled
? 'k8s.node.cpu.usage'
: 'k8s_node_cpu_usage';
const environmentKey = dotMetricsEnabled
? 'deployment.environment'
: 'deployment_environment';
export function GetClustersQuickFiltersConfig(): IQuickFiltersConfig[] {
return [
{
type: FiltersType.CHECKBOX,
title: 'Cluster Name',
attributeKey: {
key: clusterKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_CLUSTER_NAME,
dataType: DataTypes.String,
type: 'resource',
id: `${clusterKey}--string--resource`,
id: `${INFRA_MONITORING_ATTR_KEYS.K8S_CLUSTER_NAME}--string--resource`,
},
aggregateOperator: 'noop',
aggregateAttribute: cpuUtilMetric,
aggregateAttribute: INFRA_MONITORING_ATTR_KEYS.K8S_NODE_CPU_USAGE,
dataSource: DataSource.METRICS,
defaultOpen: true,
},
@@ -491,7 +429,7 @@ export function GetClustersQuickFiltersConfig(
type: FiltersType.CHECKBOX,
title: 'Environment',
attributeKey: {
key: environmentKey,
key: INFRA_MONITORING_ATTR_KEYS.DEPLOYMENT_ENVIRONMENT,
dataType: DataTypes.String,
type: 'resource',
},
@@ -500,35 +438,19 @@ export function GetClustersQuickFiltersConfig(
];
}
export function GetVolumesQuickFiltersConfig(
dotMetricsEnabled: boolean,
): IQuickFiltersConfig[] {
const pvcKey = dotMetricsEnabled
? 'k8s.persistentvolumeclaim.name'
: 'k8s_persistentvolumeclaim_name';
const namespaceKey = dotMetricsEnabled
? 'k8s.namespace.name'
: 'k8s_namespace_name';
const clusterKey = dotMetricsEnabled ? 'k8s.cluster.name' : 'k8s_cluster_name';
const volumeMetric = dotMetricsEnabled
? 'k8s.volume.capacity'
: 'k8s_volume_capacity';
const environmentKey = dotMetricsEnabled
? 'deployment.environment'
: 'deployment_environment';
export function GetVolumesQuickFiltersConfig(): IQuickFiltersConfig[] {
return [
{
type: FiltersType.CHECKBOX,
title: 'PVC Volume Claim Name',
attributeKey: {
key: pvcKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_PERSISTENT_VOLUME_CLAIM_NAME,
dataType: DataTypes.String,
type: 'resource',
id: `${pvcKey}--string--resource`,
id: `${INFRA_MONITORING_ATTR_KEYS.K8S_PERSISTENT_VOLUME_CLAIM_NAME}--string--resource`,
},
aggregateOperator: 'noop',
aggregateAttribute: volumeMetric,
aggregateAttribute: INFRA_MONITORING_ATTR_KEYS.K8S_VOLUME_CAPACITY,
dataSource: DataSource.METRICS,
defaultOpen: true,
},
@@ -536,13 +458,13 @@ export function GetVolumesQuickFiltersConfig(
type: FiltersType.CHECKBOX,
title: 'Namespace Name',
attributeKey: {
key: namespaceKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_NAMESPACE_NAME,
dataType: DataTypes.String,
type: 'resource',
id: `${namespaceKey}--string--resource`,
id: `${INFRA_MONITORING_ATTR_KEYS.K8S_NAMESPACE_NAME}--string--resource`,
},
aggregateOperator: 'noop',
aggregateAttribute: volumeMetric,
aggregateAttribute: INFRA_MONITORING_ATTR_KEYS.K8S_VOLUME_CAPACITY,
dataSource: DataSource.METRICS,
defaultOpen: true,
},
@@ -550,13 +472,13 @@ export function GetVolumesQuickFiltersConfig(
type: FiltersType.CHECKBOX,
title: 'Cluster Name',
attributeKey: {
key: clusterKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_CLUSTER_NAME,
dataType: DataTypes.String,
type: 'resource',
id: `${clusterKey}--string--resource`,
id: `${INFRA_MONITORING_ATTR_KEYS.K8S_CLUSTER_NAME}--string--resource`,
},
aggregateOperator: 'noop',
aggregateAttribute: volumeMetric,
aggregateAttribute: INFRA_MONITORING_ATTR_KEYS.K8S_VOLUME_CAPACITY,
dataSource: DataSource.METRICS,
defaultOpen: true,
},
@@ -564,7 +486,7 @@ export function GetVolumesQuickFiltersConfig(
type: FiltersType.CHECKBOX,
title: 'Environment',
attributeKey: {
key: environmentKey,
key: INFRA_MONITORING_ATTR_KEYS.DEPLOYMENT_ENVIRONMENT,
dataType: DataTypes.String,
type: 'resource',
},
@@ -573,33 +495,19 @@ export function GetVolumesQuickFiltersConfig(
];
}
export function GetDeploymentsQuickFiltersConfig(
dotMetricsEnabled: boolean,
): IQuickFiltersConfig[] {
const deployKey = dotMetricsEnabled
? 'k8s.deployment.name'
: 'k8s_deployment_name';
const namespaceKey = dotMetricsEnabled
? 'k8s.namespace.name'
: 'k8s_namespace_name';
const clusterKey = dotMetricsEnabled ? 'k8s.cluster.name' : 'k8s_cluster_name';
const metric = dotMetricsEnabled ? 'k8s.pod.cpu.usage' : 'k8s_pod_cpu_usage';
const environmentKey = dotMetricsEnabled
? 'deployment.environment'
: 'deployment_environment';
export function GetDeploymentsQuickFiltersConfig(): IQuickFiltersConfig[] {
return [
{
type: FiltersType.CHECKBOX,
title: 'Deployment Name',
attributeKey: {
key: deployKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_DEPLOYMENT_NAME,
dataType: DataTypes.String,
type: 'resource',
id: `${deployKey}--string--resource`,
id: `${INFRA_MONITORING_ATTR_KEYS.K8S_DEPLOYMENT_NAME}--string--resource`,
},
aggregateOperator: 'noop',
aggregateAttribute: metric,
aggregateAttribute: INFRA_MONITORING_ATTR_KEYS.K8S_POD_CPU_USAGE,
dataSource: DataSource.METRICS,
defaultOpen: true,
},
@@ -607,13 +515,13 @@ export function GetDeploymentsQuickFiltersConfig(
type: FiltersType.CHECKBOX,
title: 'Namespace Name',
attributeKey: {
key: namespaceKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_NAMESPACE_NAME,
dataType: DataTypes.String,
type: 'resource',
id: `${namespaceKey}--string--resource`,
id: `${INFRA_MONITORING_ATTR_KEYS.K8S_NAMESPACE_NAME}--string--resource`,
},
aggregateOperator: 'noop',
aggregateAttribute: metric,
aggregateAttribute: INFRA_MONITORING_ATTR_KEYS.K8S_POD_CPU_USAGE,
dataSource: DataSource.METRICS,
defaultOpen: true,
},
@@ -621,13 +529,13 @@ export function GetDeploymentsQuickFiltersConfig(
type: FiltersType.CHECKBOX,
title: 'Cluster Name',
attributeKey: {
key: clusterKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_CLUSTER_NAME,
dataType: DataTypes.String,
type: 'resource',
id: `${clusterKey}--string--resource`,
id: `${INFRA_MONITORING_ATTR_KEYS.K8S_CLUSTER_NAME}--string--resource`,
},
aggregateOperator: 'noop',
aggregateAttribute: metric,
aggregateAttribute: INFRA_MONITORING_ATTR_KEYS.K8S_POD_CPU_USAGE,
dataSource: DataSource.METRICS,
defaultOpen: true,
},
@@ -635,7 +543,7 @@ export function GetDeploymentsQuickFiltersConfig(
type: FiltersType.CHECKBOX,
title: 'Environment',
attributeKey: {
key: environmentKey,
key: INFRA_MONITORING_ATTR_KEYS.DEPLOYMENT_ENVIRONMENT,
dataType: DataTypes.String,
type: 'resource',
},
@@ -644,33 +552,19 @@ export function GetDeploymentsQuickFiltersConfig(
];
}
export function GetStatefulsetsQuickFiltersConfig(
dotMetricsEnabled: boolean,
): IQuickFiltersConfig[] {
const ssKey = dotMetricsEnabled
? 'k8s.statefulset.name'
: 'k8s_statefulset_name';
const namespaceKey = dotMetricsEnabled
? 'k8s.namespace.name'
: 'k8s_namespace_name';
const clusterKey = dotMetricsEnabled ? 'k8s.cluster.name' : 'k8s_cluster_name';
const metric = dotMetricsEnabled ? 'k8s.pod.cpu.usage' : 'k8s_pod_cpu_usage';
const environmentKey = dotMetricsEnabled
? 'deployment.environment'
: 'deployment_environment';
export function GetStatefulsetsQuickFiltersConfig(): IQuickFiltersConfig[] {
return [
{
type: FiltersType.CHECKBOX,
title: 'Statefulset Name',
attributeKey: {
key: ssKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_STATEFULSET_NAME,
dataType: DataTypes.String,
type: 'resource',
id: `${ssKey}--string--resource`,
id: `${INFRA_MONITORING_ATTR_KEYS.K8S_STATEFULSET_NAME}--string--resource`,
},
aggregateOperator: 'noop',
aggregateAttribute: metric,
aggregateAttribute: INFRA_MONITORING_ATTR_KEYS.K8S_POD_CPU_USAGE,
dataSource: DataSource.METRICS,
defaultOpen: true,
},
@@ -678,13 +572,13 @@ export function GetStatefulsetsQuickFiltersConfig(
type: FiltersType.CHECKBOX,
title: 'Namespace Name',
attributeKey: {
key: namespaceKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_NAMESPACE_NAME,
dataType: DataTypes.String,
type: 'resource',
id: `${namespaceKey}--string--resource`,
id: `${INFRA_MONITORING_ATTR_KEYS.K8S_NAMESPACE_NAME}--string--resource`,
},
aggregateOperator: 'noop',
aggregateAttribute: metric,
aggregateAttribute: INFRA_MONITORING_ATTR_KEYS.K8S_POD_CPU_USAGE,
dataSource: DataSource.METRICS,
defaultOpen: true,
},
@@ -692,13 +586,13 @@ export function GetStatefulsetsQuickFiltersConfig(
type: FiltersType.CHECKBOX,
title: 'Cluster Name',
attributeKey: {
key: clusterKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_CLUSTER_NAME,
dataType: DataTypes.String,
type: 'resource',
id: `${clusterKey}--string--resource`,
id: `${INFRA_MONITORING_ATTR_KEYS.K8S_CLUSTER_NAME}--string--resource`,
},
aggregateOperator: 'noop',
aggregateAttribute: metric,
aggregateAttribute: INFRA_MONITORING_ATTR_KEYS.K8S_POD_CPU_USAGE,
dataSource: DataSource.METRICS,
defaultOpen: true,
},
@@ -706,7 +600,7 @@ export function GetStatefulsetsQuickFiltersConfig(
type: FiltersType.CHECKBOX,
title: 'Environment',
attributeKey: {
key: environmentKey,
key: INFRA_MONITORING_ATTR_KEYS.DEPLOYMENT_ENVIRONMENT,
dataType: DataTypes.String,
type: 'resource',
},
@@ -715,35 +609,19 @@ export function GetStatefulsetsQuickFiltersConfig(
];
}
export function GetDaemonsetsQuickFiltersConfig(
dotMetricsEnabled: boolean,
): IQuickFiltersConfig[] {
const nameKey = dotMetricsEnabled
? 'k8s.daemonset.name'
: 'k8s_daemonset_name';
const namespaceKey = dotMetricsEnabled
? 'k8s.namespace.name'
: 'k8s_namespace_name';
const clusterKey = dotMetricsEnabled ? 'k8s.cluster.name' : 'k8s_cluster_name';
const metricName = dotMetricsEnabled
? 'k8s.pod.cpu.usage'
: 'k8s_pod_cpu_usage';
const environmentKey = dotMetricsEnabled
? 'deployment.environment'
: 'deployment_environment';
export function GetDaemonsetsQuickFiltersConfig(): IQuickFiltersConfig[] {
return [
{
type: FiltersType.CHECKBOX,
title: 'DaemonSet Name',
attributeKey: {
key: nameKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_DAEMONSET_NAME,
dataType: DataTypes.String,
type: 'resource',
id: `${nameKey}--string--resource--true`,
id: `${INFRA_MONITORING_ATTR_KEYS.K8S_DAEMONSET_NAME}--string--resource--true`,
},
aggregateOperator: 'noop',
aggregateAttribute: metricName,
aggregateAttribute: INFRA_MONITORING_ATTR_KEYS.K8S_POD_CPU_USAGE,
dataSource: DataSource.METRICS,
defaultOpen: true,
},
@@ -751,12 +629,12 @@ export function GetDaemonsetsQuickFiltersConfig(
type: FiltersType.CHECKBOX,
title: 'Namespace Name',
attributeKey: {
key: namespaceKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_NAMESPACE_NAME,
dataType: DataTypes.String,
type: 'resource',
},
aggregateOperator: 'noop',
aggregateAttribute: metricName,
aggregateAttribute: INFRA_MONITORING_ATTR_KEYS.K8S_POD_CPU_USAGE,
dataSource: DataSource.METRICS,
defaultOpen: true,
},
@@ -764,12 +642,12 @@ export function GetDaemonsetsQuickFiltersConfig(
type: FiltersType.CHECKBOX,
title: 'Cluster Name',
attributeKey: {
key: clusterKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_CLUSTER_NAME,
dataType: DataTypes.String,
type: 'resource',
},
aggregateOperator: 'noop',
aggregateAttribute: metricName,
aggregateAttribute: INFRA_MONITORING_ATTR_KEYS.K8S_POD_CPU_USAGE,
dataSource: DataSource.METRICS,
defaultOpen: true,
},
@@ -777,7 +655,7 @@ export function GetDaemonsetsQuickFiltersConfig(
type: FiltersType.CHECKBOX,
title: 'Environment',
attributeKey: {
key: environmentKey,
key: INFRA_MONITORING_ATTR_KEYS.DEPLOYMENT_ENVIRONMENT,
dataType: DataTypes.String,
type: 'resource',
},
@@ -786,33 +664,19 @@ export function GetDaemonsetsQuickFiltersConfig(
];
}
export function GetJobsQuickFiltersConfig(
dotMetricsEnabled: boolean,
): IQuickFiltersConfig[] {
const nameKey = dotMetricsEnabled ? 'k8s.job.name' : 'k8s_job_name';
const namespaceKey = dotMetricsEnabled
? 'k8s.namespace.name'
: 'k8s_namespace_name';
const clusterKey = dotMetricsEnabled ? 'k8s.cluster.name' : 'k8s_cluster_name';
const metricName = dotMetricsEnabled
? 'k8s.pod.cpu.usage'
: 'k8s_pod_cpu_usage';
const environmentKey = dotMetricsEnabled
? 'deployment.environment'
: 'deployment_environment';
export function GetJobsQuickFiltersConfig(): IQuickFiltersConfig[] {
return [
{
type: FiltersType.CHECKBOX,
title: 'Job Name',
attributeKey: {
key: nameKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_JOB_NAME,
dataType: DataTypes.String,
type: 'resource',
id: `${nameKey}--string--resource--true`,
id: `${INFRA_MONITORING_ATTR_KEYS.K8S_JOB_NAME}--string--resource--true`,
},
aggregateOperator: 'noop',
aggregateAttribute: metricName,
aggregateAttribute: INFRA_MONITORING_ATTR_KEYS.K8S_POD_CPU_USAGE,
dataSource: DataSource.METRICS,
defaultOpen: true,
},
@@ -820,12 +684,12 @@ export function GetJobsQuickFiltersConfig(
type: FiltersType.CHECKBOX,
title: 'Namespace Name',
attributeKey: {
key: namespaceKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_NAMESPACE_NAME,
dataType: DataTypes.String,
type: 'resource',
},
aggregateOperator: 'noop',
aggregateAttribute: metricName,
aggregateAttribute: INFRA_MONITORING_ATTR_KEYS.K8S_POD_CPU_USAGE,
dataSource: DataSource.METRICS,
defaultOpen: true,
},
@@ -833,12 +697,12 @@ export function GetJobsQuickFiltersConfig(
type: FiltersType.CHECKBOX,
title: 'Cluster Name',
attributeKey: {
key: clusterKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_CLUSTER_NAME,
dataType: DataTypes.String,
type: 'resource',
},
aggregateOperator: 'noop',
aggregateAttribute: metricName,
aggregateAttribute: INFRA_MONITORING_ATTR_KEYS.K8S_POD_CPU_USAGE,
dataSource: DataSource.METRICS,
defaultOpen: true,
},
@@ -846,7 +710,7 @@ export function GetJobsQuickFiltersConfig(
type: FiltersType.CHECKBOX,
title: 'Environment',
attributeKey: {
key: environmentKey,
key: INFRA_MONITORING_ATTR_KEYS.DEPLOYMENT_ENVIRONMENT,
dataType: DataTypes.String,
type: 'resource',
},
@@ -965,39 +829,7 @@ export function getPodUtilizationByPodQueryPayloads(
context: WorkloadFilterContext,
start: number,
end: number,
dotMetricsEnabled: boolean,
): GetQueryResultsProps[] {
const getKey = (dotKey: string, underscoreKey: string): string =>
dotMetricsEnabled ? dotKey : underscoreKey;
const k8sPodCpuLimitUtilKey = getKey(
'k8s.pod.cpu_limit_utilization',
'k8s_pod_cpu_limit_utilization',
);
const k8sPodCpuRequestUtilKey = getKey(
'k8s.pod.cpu_request_utilization',
'k8s_pod_cpu_request_utilization',
);
const k8sPodMemLimitUtilKey = getKey(
'k8s.pod.memory_limit_utilization',
'k8s_pod_memory_limit_utilization',
);
const k8sPodMemRequestUtilKey = getKey(
'k8s.pod.memory_request_utilization',
'k8s_pod_memory_request_utilization',
);
const k8sPodFsUsageKey = getKey(
'k8s.pod.filesystem.usage',
'k8s_pod_filesystem_usage',
);
const k8sPodFsCapacityKey = getKey(
'k8s.pod.filesystem.capacity',
'k8s_pod_filesystem_capacity',
);
const k8sPodNameKey = getKey('k8s.pod.name', 'k8s_pod_name');
const k8sClusterNameKey = getKey('k8s.cluster.name', 'k8s_cluster_name');
const k8sNamespaceNameKey = getKey('k8s.namespace.name', 'k8s_namespace_name');
const baseFilters = [
{
id: 'workload',
@@ -1014,8 +846,8 @@ export function getPodUtilizationByPodQueryPayloads(
id: 'cluster',
key: {
dataType: DataTypes.String,
id: `${k8sClusterNameKey}--string--tag--false`,
key: k8sClusterNameKey,
id: `${INFRA_MONITORING_ATTR_KEYS.K8S_CLUSTER_NAME}--string--tag--false`,
key: INFRA_MONITORING_ATTR_KEYS.K8S_CLUSTER_NAME,
type: 'tag',
},
op: '=',
@@ -1027,8 +859,8 @@ export function getPodUtilizationByPodQueryPayloads(
id: 'namespace',
key: {
dataType: DataTypes.String,
id: `${k8sNamespaceNameKey}--string--tag--false`,
key: k8sNamespaceNameKey,
id: `${INFRA_MONITORING_ATTR_KEYS.K8S_NAMESPACE_NAME}--string--tag--false`,
key: INFRA_MONITORING_ATTR_KEYS.K8S_NAMESPACE_NAME,
type: 'tag',
},
op: '=',
@@ -1041,8 +873,8 @@ export function getPodUtilizationByPodQueryPayloads(
const podNameGroupBy = [
{
dataType: DataTypes.String,
id: `${k8sPodNameKey}--string--tag--false`,
key: k8sPodNameKey,
id: `${INFRA_MONITORING_ATTR_KEYS.K8S_POD_NAME}--string--tag--false`,
key: INFRA_MONITORING_ATTR_KEYS.K8S_POD_NAME,
type: 'tag',
},
];
@@ -1074,7 +906,7 @@ export function getPodUtilizationByPodQueryPayloads(
functions: [],
groupBy: podNameGroupBy,
having: [],
legend: `{{${k8sPodNameKey}}}`,
legend: `{{${INFRA_MONITORING_ATTR_KEYS.K8S_POD_NAME}}}`,
limit: null,
orderBy: [],
queryName: 'A',
@@ -1108,7 +940,7 @@ export function getPodUtilizationByPodQueryPayloads(
aggregateAttribute: {
dataType: DataTypes.Float64,
id: 'fs_usage',
key: k8sPodFsUsageKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_POD_FILESYSTEM_USAGE,
type: 'Gauge',
},
aggregateOperator: 'avg',
@@ -1122,7 +954,7 @@ export function getPodUtilizationByPodQueryPayloads(
functions: [],
groupBy: podNameGroupBy,
having: [],
legend: `{{${k8sPodNameKey}}}`,
legend: `{{${INFRA_MONITORING_ATTR_KEYS.K8S_POD_NAME}}}`,
limit: null,
orderBy: [],
queryName: 'A',
@@ -1135,7 +967,7 @@ export function getPodUtilizationByPodQueryPayloads(
aggregateAttribute: {
dataType: DataTypes.Float64,
id: 'fs_capacity',
key: k8sPodFsCapacityKey,
key: INFRA_MONITORING_ATTR_KEYS.K8S_POD_FILESYSTEM_CAPACITY,
type: 'Gauge',
},
aggregateOperator: 'avg',
@@ -1149,7 +981,7 @@ export function getPodUtilizationByPodQueryPayloads(
functions: [],
groupBy: podNameGroupBy,
having: [],
legend: `{{${k8sPodNameKey}}}`,
legend: `{{${INFRA_MONITORING_ATTR_KEYS.K8S_POD_NAME}}}`,
limit: null,
orderBy: [],
queryName: 'B',
@@ -1163,7 +995,7 @@ export function getPodUtilizationByPodQueryPayloads(
{
disabled: false,
expression: 'A/B',
legend: `{{${k8sPodNameKey}}}`,
legend: `{{${INFRA_MONITORING_ATTR_KEYS.K8S_POD_NAME}}}`,
queryName: 'F1',
},
],
@@ -1181,10 +1013,22 @@ export function getPodUtilizationByPodQueryPayloads(
};
return [
buildSingleMetricQuery(k8sPodCpuLimitUtilKey, 'cpu_limit_util'),
buildSingleMetricQuery(k8sPodCpuRequestUtilKey, 'cpu_request_util'),
buildSingleMetricQuery(k8sPodMemLimitUtilKey, 'mem_limit_util'),
buildSingleMetricQuery(k8sPodMemRequestUtilKey, 'mem_request_util'),
buildSingleMetricQuery(
INFRA_MONITORING_ATTR_KEYS.K8S_POD_CPU_LIMIT_UTILIZATION,
'cpu_limit_util',
),
buildSingleMetricQuery(
INFRA_MONITORING_ATTR_KEYS.K8S_POD_CPU_REQUEST_UTILIZATION,
'cpu_request_util',
),
buildSingleMetricQuery(
INFRA_MONITORING_ATTR_KEYS.K8S_POD_MEMORY_LIMIT_UTILIZATION,
'mem_limit_util',
),
buildSingleMetricQuery(
INFRA_MONITORING_ATTR_KEYS.K8S_POD_MEMORY_REQUEST_UTILIZATION,
'mem_request_util',
),
filesystemUsagePercentQuery,
];
}

View File

@@ -55,6 +55,7 @@ export function useCreateExportDashboard({
layouts: [],
panels: {},
variables: [],
links: [],
},
}),
{

View File

@@ -0,0 +1,183 @@
import 'tests/blob-polyfill';
import { fetchExportData } from 'api/v1/download/downloadExportData';
import { prepareQueryRangePayloadV5 } from 'api/v5/v5';
import { downloadFile } from 'lib/exportData/downloadFile';
import { ExportFormat } from 'lib/exportData/types';
import { Query } from 'types/api/queryBuilder/queryBuilderData';
import { runChunkedExport } from '../runChunkedExport';
jest.mock('api/v1/download/downloadExportData', () => ({
fetchExportData: jest.fn(),
}));
jest.mock('api/v5/v5', () => ({
prepareQueryRangePayloadV5: jest.fn(),
}));
jest.mock('lib/exportData/downloadFile', () => ({
downloadFile: jest.fn(),
getTimestampedFileName: jest.fn(
(base: string, ext: string) => `${base}.${ext}`,
),
}));
const mockFetch = fetchExportData as jest.Mock;
const mockPreparePayload = prepareQueryRangePayloadV5 as jest.Mock;
const mockDownloadFile = downloadFile as jest.Mock;
// Minimal query shape — the runner only maps over builder.queryData.
const query = {
builder: { queryData: [{}] },
} as unknown as Query;
const baseArgs = {
query,
timeRange: { start: 100, end: 200 },
fileNameBase: 'trace-x',
format: ExportFormat.Csv,
onProgress: jest.fn(),
};
// EXPORT_PAGE_SIZE is 50_000; rows → parts: 120k → 3, 40k → 1, etc.
const rowsForParts = (parts: number): number => parts * 50_000;
function runArgs(
overrides: Partial<Parameters<typeof runChunkedExport>[0]> = {},
): Parameters<typeof runChunkedExport>[0] {
return {
...baseArgs,
totalRows: rowsForParts(1),
signal: new AbortController().signal,
onProgress: jest.fn(),
...overrides,
};
}
async function savedFileText(): Promise<string> {
expect(mockDownloadFile).toHaveBeenCalledTimes(1);
const [blob] = mockDownloadFile.mock.calls[0];
return (blob as Blob).text();
}
describe('runChunkedExport', () => {
beforeEach(() => {
jest.clearAllMocks();
mockPreparePayload.mockImplementation(({ query: pageQuery }) => ({
// Echo the page offset so fetch calls can be asserted per page.
queryPayload: { offset: pageQuery.builder.queryData[0].offset },
}));
});
it('fetches one page for small exports and saves the file', async () => {
mockFetch.mockResolvedValueOnce(new Blob(['h\na,b\n']));
const onProgress = jest.fn();
await runChunkedExport(runArgs({ totalRows: 40_000, onProgress }));
expect(mockFetch).toHaveBeenCalledTimes(1);
expect(mockFetch.mock.calls[0][0].body).toStrictEqual({ offset: 0 });
expect(onProgress).toHaveBeenCalledWith(100);
await expect(savedFileText()).resolves.toBe('h\na,b\n');
});
it('fetches every page with the right offsets and stitches in order', async () => {
mockFetch.mockImplementation(({ body }) =>
Promise.resolve(new Blob([`h\nrow-${body.offset}\n`])),
);
await runChunkedExport(runArgs({ totalRows: rowsForParts(3) }));
const offsets = mockFetch.mock.calls.map(([props]) => props.body.offset);
expect(offsets.sort((a, b) => a - b)).toStrictEqual([0, 50_000, 100_000]);
await expect(savedFileText()).resolves.toBe(
'h\nrow-0\nrow-50000\nrow-100000\n',
);
});
it('keeps page order even when later pages resolve first', async () => {
const resolvers: Record<number, (b: Blob) => void> = {};
mockFetch.mockImplementation(
({ body }) =>
new Promise((resolve) => {
resolvers[body.offset] = resolve;
}),
);
const promise = runChunkedExport(runArgs({ totalRows: rowsForParts(3) }));
// All 3 pages are in flight (concurrency 3); resolve in reverse order.
await Promise.resolve();
resolvers[100_000](new Blob(['h\nc\n']));
resolvers[50_000](new Blob(['h\nb\n']));
resolvers[0](new Blob(['h\na\n']));
await promise;
await expect(savedFileText()).resolves.toBe('h\na\nb\nc\n');
});
it('stops claiming pages once the server runs dry', async () => {
// Count says 5 pages but the server only has data for page 0.
mockFetch.mockImplementation(({ body }) =>
Promise.resolve(body.offset === 0 ? new Blob(['h\na\n']) : new Blob([])),
);
await runChunkedExport(runArgs({ totalRows: rowsForParts(5) }));
// Workers stop claiming once an empty part is observed — exact count is
// timing-dependent, but it must never fetch all 5 pages.
expect(mockFetch.mock.calls.length).toBeLessThan(5);
await expect(savedFileText()).resolves.toBe('h\na\n');
});
it('rejects on page failure, aborts in-flight siblings, saves nothing', async () => {
const seenSignals: AbortSignal[] = [];
mockFetch.mockImplementation(({ body, signal }) => {
seenSignals.push(signal);
return body.offset === 50_000
? Promise.reject(new Error('boom'))
: new Promise(() => {}); // siblings hang until aborted
});
await expect(
runChunkedExport(runArgs({ totalRows: rowsForParts(3) })),
).rejects.toThrow('boom');
expect(seenSignals.every((s) => s.aborted)).toBe(true);
expect(mockDownloadFile).not.toHaveBeenCalled();
});
it('propagates a user abort to the page fetches', async () => {
const controller = new AbortController();
mockFetch.mockImplementation(
({ signal }) =>
new Promise((_resolve, reject) => {
signal.addEventListener('abort', () =>
reject(new DOMException('Aborted', 'AbortError')),
);
}),
);
const promise = runChunkedExport(
runArgs({ totalRows: rowsForParts(2), signal: controller.signal }),
);
await Promise.resolve();
controller.abort();
await expect(promise).rejects.toThrow('Aborted');
expect(mockDownloadFile).not.toHaveBeenCalled();
});
it('reports whole-number progress per completed part', async () => {
mockFetch.mockImplementation(({ body }) =>
Promise.resolve(new Blob([`h\nrow-${body.offset}\n`])),
);
const onProgress = jest.fn();
await runChunkedExport(runArgs({ totalRows: rowsForParts(3), onProgress }));
const reported = onProgress.mock.calls.map(([p]) => p);
expect(reported).toHaveLength(3);
expect(reported).toStrictEqual(expect.arrayContaining([33, 67, 100]));
});
});

View File

@@ -0,0 +1,4 @@
export const EXPORT_PAGE_SIZE = 50_000;
/** Pages fetched in parallel.*/
export const EXPORT_CONCURRENCY = 3;

View File

@@ -0,0 +1,143 @@
import { fetchExportData } from 'api/v1/download/downloadExportData';
import { prepareQueryRangePayloadV5 } from 'api/v5/v5';
import { PANEL_TYPES } from 'constants/queryBuilder';
import {
downloadFile,
getTimestampedFileName,
} from 'lib/exportData/downloadFile';
import { stitchCsvParts, stitchJsonlParts } from 'lib/exportData/stitchParts';
import { ExportFormat } from 'lib/exportData/types';
import store from 'store';
import { Query } from 'types/api/queryBuilder/queryBuilderData';
import { QueryRangePayloadV5 } from 'types/api/v5/queryRange';
import { EXPORT_CONCURRENCY, EXPORT_PAGE_SIZE } from './constants';
export interface ChunkedExportArgs {
query: Query;
timeRange: { start: number; end: number };
// Total rows the query is expected to return; drives the page count.
totalRows: number;
fileNameBase: string;
}
interface RunChunkedExportProps extends ChunkedExportArgs {
format: ExportFormat;
signal: AbortSignal;
// 0100 whole number: parts completed over total parts.
onProgress: (progress: number) => void;
}
const MIME_BY_FORMAT: Record<ExportFormat, string> = {
[ExportFormat.Csv]: 'text/csv',
[ExportFormat.Jsonl]: 'application/x-ndjson',
};
/**
* Chunked server export: fetches export_raw_data pages through a bounded
* worker pool (EXPORT_CONCURRENCY wide — pages are independent since offsets
* are precomputable), stitches the parts in page order client-side, and saves
* a single file.
*/
export async function runChunkedExport({
query,
timeRange,
totalRows,
fileNameBase,
format,
signal,
onProgress,
}: RunChunkedExportProps): Promise<void> {
const totalParts = Math.max(1, Math.ceil(totalRows / EXPORT_PAGE_SIZE));
const workerCount = Math.min(Math.max(1, EXPORT_CONCURRENCY), totalParts);
// Internal controller so the first failed page (or a user cancel) stops the
// whole fleet instead of letting siblings run to completion for nothing.
const fleet = new AbortController();
const onExternalAbort = (): void => fleet.abort();
signal.addEventListener('abort', onExternalAbort);
if (signal.aborted) {
fleet.abort();
}
const buildPagePayload = (page: number): QueryRangePayloadV5 => {
const pageQuery: Query = {
...query,
builder: {
...query.builder,
queryData: query.builder.queryData.map((qd) => ({
...qd,
limit: EXPORT_PAGE_SIZE,
pageSize: EXPORT_PAGE_SIZE,
offset: page * EXPORT_PAGE_SIZE,
})),
},
};
return prepareQueryRangePayloadV5({
query: pageQuery,
graphType: PANEL_TYPES.LIST,
selectedTime: 'GLOBAL_TIME',
// Read directly (not via hooks) — the absolute bounds below take
// precedence over the global picker in the payload anyway.
globalSelectedInterval: store.getState().globalTime.selectedTime,
start: timeRange.start,
end: timeRange.end,
}).queryPayload;
};
// Indexed by page so out-of-order completion can't scramble the stitch order.
const parts = new Array<Blob | undefined>(totalParts);
let nextPage = 0;
let completedParts = 0;
let serverRanDry = false;
const worker = async (): Promise<void> => {
while (!serverRanDry) {
const page = nextPage;
nextPage += 1;
if (page >= totalParts) {
return;
}
// eslint-disable-next-line no-await-in-loop
const part = await fetchExportData({
format,
body: buildPagePayload(page),
signal: fleet.signal,
});
// Empty part = the row count drifted and the server ran dry early;
// stop claiming further pages (later in-flight pages are empty too).
if (part.size === 0) {
serverRanDry = true;
return;
}
parts[page] = part;
completedParts += 1;
onProgress(Math.round((completedParts / totalParts) * 100));
}
};
try {
await Promise.all(Array.from({ length: workerCount }, () => worker()));
} catch (error) {
fleet.abort();
throw error;
} finally {
signal.removeEventListener('abort', onExternalAbort);
}
const orderedParts = parts.filter((part): part is Blob => Boolean(part));
const stitched =
format === ExportFormat.Csv
? await stitchCsvParts(orderedParts)
: await stitchJsonlParts(orderedParts);
downloadFile(
stitched,
getTimestampedFileName(fileNameBase, format),
MIME_BY_FORMAT[format],
);
}

View File

@@ -0,0 +1,100 @@
import 'tests/blob-polyfill';
import { stitchCsvParts, stitchJsonlParts } from '../stitchParts';
const blob = (content: string): Blob => new Blob([content]);
describe('stitchCsvParts', () => {
it('keeps a single part as-is', async () => {
const out = await stitchCsvParts([blob('h1,h2\na,b\n')]);
await expect(out.text()).resolves.toBe('h1,h2\na,b\n');
expect(out.type).toBe('text/csv');
});
it('strips the header row from parts after the first', async () => {
const out = await stitchCsvParts([
blob('h1,h2\na,b\n'),
blob('h1,h2\nc,d\n'),
blob('h1,h2\ne,f\n'),
]);
await expect(out.text()).resolves.toBe('h1,h2\na,b\nc,d\ne,f\n');
});
it('handles CRLF line endings (the \\r dies with the header)', async () => {
const out = await stitchCsvParts([
blob('h1,h2\r\na,b\r\n'),
blob('h1,h2\r\nc,d\r\n'),
]);
await expect(out.text()).resolves.toBe('h1,h2\r\na,b\r\nc,d\r\n');
});
it('inserts a newline at the seam when a part lacks a trailing one', async () => {
const out = await stitchCsvParts([blob('h1,h2\na,b'), blob('h1,h2\nc,d')]);
await expect(out.text()).resolves.toBe('h1,h2\na,b\nc,d\n');
});
it('preserves multi-byte characters around the header boundary', async () => {
const out = await stitchCsvParts([
blob('höader,h2\naä,b\n'),
blob('höader,h2\ncö,d\n'),
]);
await expect(out.text()).resolves.toBe('höader,h2\naä,b\ncö,d\n');
});
it('strips headers longer than the initial 8KB sniff window', async () => {
// Forces findFirstNewlineEnd through its window-doubling path.
const hugeHeader = Array.from({ length: 1200 }, (_, i) => `column_${i}`).join(
',',
);
expect(hugeHeader.length).toBeGreaterThan(8192);
const out = await stitchCsvParts([
blob(`${hugeHeader}\na,b\n`),
blob(`${hugeHeader}\nc,d\n`),
]);
await expect(out.text()).resolves.toBe(`${hugeHeader}\na,b\nc,d\n`);
});
it('skips empty and header-only parts', async () => {
const out = await stitchCsvParts([
blob('h1,h2\na,b\n'),
blob(''),
blob('h1,h2\n'),
blob('h1,h2'),
blob('h1,h2\nc,d\n'),
]);
await expect(out.text()).resolves.toBe('h1,h2\na,b\nc,d\n');
});
it('returns an empty blob for no parts', async () => {
const out = await stitchCsvParts([]);
expect(out.size).toBe(0);
});
});
describe('stitchJsonlParts', () => {
it('concatenates parts without stripping anything', async () => {
const out = await stitchJsonlParts([
blob('{"a":1}\n{"a":2}\n'),
blob('{"a":3}\n'),
]);
await expect(out.text()).resolves.toBe('{"a":1}\n{"a":2}\n{"a":3}\n');
expect(out.type).toBe('application/x-ndjson');
});
it('guards the seam when a part lacks a trailing newline', async () => {
const out = await stitchJsonlParts([blob('{"a":1}'), blob('{"a":2}')]);
const text = await out.text();
expect(text).toBe('{"a":1}\n{"a":2}\n');
// Every line must stay independently parseable.
const lines = text.trim().split('\n');
expect(lines.map((line) => JSON.parse(line))).toStrictEqual([
{ a: 1 },
{ a: 2 },
]);
});
it('skips empty parts', async () => {
const out = await stitchJsonlParts([blob(''), blob('{"a":1}\n'), blob('')]);
await expect(out.text()).resolves.toBe('{"a":1}\n');
});
});

View File

@@ -1,6 +1,6 @@
/** Triggers a browser download of in-memory string content as a file. */
/** Triggers a browser download of in-memory content (string or Blob) as a file. */
export function downloadFile(
content: string,
content: string | Blob,
fileName: string,
mime: string,
): void {

View File

@@ -0,0 +1,85 @@
/**
* Stitches sequentially-fetched export parts (Blobs) into one downloadable
* Blob. Pure blob surgery — parts are never parsed and `Blob.slice`/`new Blob`
* are zero-copy, so nothing here scales with the data size except the final
* browser-managed blob itself.
*/
const HEADER_SNIFF_BYTES = 8192;
const NEWLINE_BYTE = 0x0a;
/** Byte offset just past the first newline, or -1 when the blob has none. */
async function findFirstNewlineEnd(blob: Blob): Promise<number> {
let sniffBytes = HEADER_SNIFF_BYTES;
for (;;) {
// eslint-disable-next-line no-await-in-loop
const bytes = new Uint8Array(await blob.slice(0, sniffBytes).arrayBuffer());
const newlineIdx = bytes.indexOf(NEWLINE_BYTE);
if (newlineIdx !== -1) {
return newlineIdx + 1;
}
if (sniffBytes >= blob.size) {
return -1;
}
sniffBytes *= 2;
}
}
async function endsWithNewline(blob: Blob): Promise<boolean> {
const lastByte = new Uint8Array(await blob.slice(blob.size - 1).arrayBuffer());
return lastByte[0] === NEWLINE_BYTE;
}
async function stitchParts(
parts: Blob[],
{
stripHeaderAfterFirst,
mime,
}: { stripHeaderAfterFirst: boolean; mime: string },
): Promise<Blob> {
const pieces: (Blob | string)[] = [];
for (let index = 0; index < parts.length; index += 1) {
let piece = parts[index];
if (stripHeaderAfterFirst && index > 0) {
// Every part re-sends the header row; drop it on parts 2..N. Byte-level
// search (not text) so multi-byte characters can't skew the offset.
// ASSUMPTION: the first newline byte ends the header row — i.e. no
// column name contains an embedded (RFC 4180 quoted) newline. Header
// cells are telemetry field names, which can't carry newlines; quoted
// newlines in DATA rows are fine (we only search from byte 0).
// eslint-disable-next-line no-await-in-loop
const headerEnd = await findFirstNewlineEnd(piece);
// A part without any newline is header-only — nothing to keep.
piece = headerEnd === -1 ? piece.slice(piece.size) : piece.slice(headerEnd);
}
if (piece.size === 0) {
continue;
}
pieces.push(piece);
// Guard the seam: without a trailing newline the next part's first row
// would concatenate onto this part's last row.
// eslint-disable-next-line no-await-in-loop
if (!(await endsWithNewline(piece))) {
pieces.push('\n');
}
}
return new Blob(pieces, { type: mime });
}
/** Combines CSV parts: part 1 keeps its header, parts 2..N are decapitated. */
export async function stitchCsvParts(parts: Blob[]): Promise<Blob> {
return stitchParts(parts, { stripHeaderAfterFirst: true, mime: 'text/csv' });
}
/** Combines JSONL parts: plain concatenation with a newline guard per seam. */
export async function stitchJsonlParts(parts: Blob[]): Promise<Blob> {
return stitchParts(parts, {
stripHeaderAfterFirst: false,
mime: 'application/x-ndjson',
});
}

View File

@@ -101,8 +101,10 @@ function DashboardActions({
const handleCreateSection = useCallback(
async (title: string): Promise<void> => {
await addSection(title);
setIsNewSectionOpen(false);
const ok = await addSection(title);
if (ok) {
setIsNewSectionOpen(false);
}
},
[addSection],
);

View File

@@ -78,6 +78,12 @@ function JsonEditorDrawer({
const onKeyDown = useCallback(
(event: KeyboardEvent<HTMLDivElement>): void => {
event.stopPropagation();
if (event.key === 'Escape') {
onClose();
return;
}
if ((event.metaKey || event.ctrlKey) && event.key === 'Enter') {
event.preventDefault();
if (!readOnly) {
@@ -85,7 +91,7 @@ function JsonEditorDrawer({
}
}
},
[apply, readOnly],
[apply, readOnly, onClose],
);
const applyDisabled = readOnly || !isDirty || !validity.valid || isSaving;

View File

@@ -44,8 +44,12 @@ const dashboard = {
},
} as unknown as DashboardtypesGettableDashboardV2DTO;
// The editor only exposes `tags` and `spec`; every other key is redacted.
const redacted = { tags: dashboard.tags, spec: dashboard.spec };
// The editor exposes `spec`, `tags`, `image` (in that order); every other key is redacted.
const redacted = {
spec: dashboard.spec,
tags: dashboard.tags,
image: dashboard.image,
};
const serialized = JSON.stringify(redacted, null, 2);
describe('useJsonEditor', () => {
@@ -65,17 +69,18 @@ describe('useJsonEditor', () => {
expect(result.current.validity.lineCount).toBe(serialized.split('\n').length);
});
it('redacts server-owned keys from the editable draft', () => {
it('exposes spec/tags/image (in order) and redacts server-owned keys', () => {
const { result } = renderHook(() =>
useJsonEditor({ dashboard, isOpen: true, onApplied: jest.fn() }),
);
const parsed = JSON.parse(result.current.draft);
expect(Object.keys(parsed).sort()).toStrictEqual(['spec', 'tags']);
// Key order is intentional: spec, then tags, then image.
expect(Object.keys(parsed)).toStrictEqual(['spec', 'tags', 'image']);
expect(parsed.image).toBe('icon.png');
expect(parsed.id).toBeUndefined();
expect(parsed.name).toBeUndefined();
expect(parsed.schemaVersion).toBeUndefined();
expect(parsed.image).toBeUndefined();
});
it('flags invalid JSON with a line number and marks the draft dirty', () => {

View File

@@ -12,6 +12,7 @@ import { toAPIError } from 'utils/errorUtils';
import { dashboardToUpdatable } from './dashboardToUpdatable';
import { findPanelLayoutIssues } from './danglingPanels';
import { compactSpecLayouts } from '../../layoutCompaction';
import { useDashboardStore } from '../../store/useDashboardStore';
export interface JsonValidity {
@@ -46,15 +47,16 @@ interface Result {
}
/**
* The editable, user-facing view: only `tags` and `spec`. Everything else
* (id, orgId, name, timestamps, locked, schemaVersion, image, …) is redacted so it
* can't be seen, copied, exported or edited; those keys are preserved on save (see `apply`).
* The editable, user-facing view: `spec`, `tags` and `image`, in that key order.
* Everything else (id, orgId, name, timestamps, locked, schemaVersion, …) is redacted
* so it can't be seen, copied, exported or edited; those keys are preserved on save.
*/
const redact = (
dashboard: DashboardtypesGettableDashboardV2DTO,
): Pick<DashboardtypesGettableDashboardV2DTO, 'tags' | 'spec'> => ({
tags: dashboard.tags,
): Pick<DashboardtypesGettableDashboardV2DTO, 'spec' | 'tags' | 'image'> => ({
spec: dashboard.spec,
tags: dashboard.tags,
image: dashboard.image,
});
const serialize = (dashboard: DashboardtypesGettableDashboardV2DTO): string =>
@@ -167,7 +169,18 @@ export function useJsonEditor({
setIsSaving(true);
// The draft only carries name/tags/spec; overlay it on the current dashboard
// so the redacted fields (schemaVersion, image, …) are preserved on save.
const edited = JSON.parse(draft) as Record<string, unknown>;
const edited = JSON.parse(draft) as Pick<
DashboardtypesGettableDashboardV2DTO,
'spec' | 'tags' | 'image'
>;
// Snap hand-edited panel geometry to a non-overlapping layout so a JSON edit
// can't be rejected by the backend's no-overlap check (matches drag/resize).
if (edited.spec?.layouts) {
edited.spec = {
...edited.spec,
layouts: compactSpecLayouts(edited.spec.layouts),
};
}
await updateDashboardV2(
{ id: dashboardId },
dashboardToUpdatable({ ...dashboard, ...edited }),

View File

@@ -1,3 +1,4 @@
import { useEffect, useMemo, useState } from 'react';
import {
Select,
SelectContent,
@@ -26,11 +27,28 @@ function DashboardImagePicker({
onChange,
triggerClassName,
}: Props): JSX.Element {
// A custom image (pasted URL / base64 data-URI, not in the preset set) is kept as
// a selectable option for the picker's lifetime — without a matching option the
// trigger renders the raw value string and the image can't be re-selected.
const [customImages, setCustomImages] = useState<string[]>(() =>
image && !Base64Icons.includes(image) ? [image] : [],
);
useEffect(() => {
if (image && !Base64Icons.includes(image)) {
setCustomImages((prev) => (prev.includes(image) ? prev : [...prev, image]));
}
}, [image]);
const options = useMemo(
() => [...customImages, ...Base64Icons],
[customImages],
);
return (
<Select value={image} onChange={(value): void => onChange(value as string)}>
<SelectTrigger className={cx(styles.trigger, triggerClassName)} />
<SelectContent className={styles.options} withPortal={false}>
{Base64Icons.map((icon) => (
{options.map((icon) => (
<SelectItem key={icon} value={icon} className={styles.item}>
<img src={icon} alt="dashboard-icon" className={styles.image} />
</SelectItem>

View File

@@ -1,6 +1,7 @@
import { useEffect, useMemo, useState } from 'react';
import { Info } from '@signozhq/icons';
import { Typography } from '@signozhq/ui/typography';
import { DashboardtypesDynamicVariableSignalDTO } from 'api/generated/services/sigNoz.schemas';
import cx from 'classnames';
// eslint-disable-next-line signoz/no-antd-components -- fixed-option signal picker
import { Select } from 'antd';
@@ -14,17 +15,16 @@ import { isRetryableError } from 'utils/errorUtils';
import {
DYNAMIC_SIGNAL_LABEL,
DYNAMIC_SIGNALS,
type DynamicSignalOption,
signalForApi,
} from '../variableFormModel';
import styles from './VariableForm.module.scss';
interface DynamicVariableFieldsProps {
attribute: string;
signal: DynamicSignalOption;
signal: DashboardtypesDynamicVariableSignalDTO;
onChange: (patch: {
dynamicAttribute?: string;
dynamicSignal?: DynamicSignalOption;
dynamicSignal?: DashboardtypesDynamicVariableSignalDTO;
}) => void;
onPreview: (values: (string | number)[]) => void;
/** Inline error shown under the attribute field (e.g. duplicate attribute). */
@@ -117,7 +117,9 @@ function DynamicVariableFields({
value: s,
}))}
onChange={(value): void =>
onChange({ dynamicSignal: value as DynamicSignalOption })
onChange({
dynamicSignal: value as DashboardtypesDynamicVariableSignalDTO,
})
}
data-testid="variable-signal-select"
/>

View File

@@ -1,4 +1,4 @@
import { useState } from 'react';
import { useEffect, useRef, useState } from 'react';
import { Button } from '@signozhq/ui/button';
import { Typography } from '@signozhq/ui/typography';
import logEvent from 'api/common/logEvent';
@@ -27,6 +27,7 @@ function QueryVariableFields({
onError,
}: QueryVariableFieldsProps): JSX.Element {
const [isRunning, setIsRunning] = useState(false);
const hasAutoRun = useRef(false);
const runTest = async (): Promise<void> => {
setIsRunning(true);
@@ -59,6 +60,16 @@ function QueryVariableFields({
}
};
// Fetch options on load so the Default Value dropdown is populated without a
// manual Test Run — once, and only when there's a query to run.
useEffect(() => {
if (!hasAutoRun.current && queryValue) {
hasAutoRun.current = true;
void runTest();
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [queryValue]);
return (
<div className={styles.queryContainer}>
<div className={styles.labelContainer}>

View File

@@ -160,6 +160,26 @@
vertical-align: middle;
}
/* The full "Not Recommended" pill — hidden once the tab row gets tight so it
never forces horizontal scroll; the amber info icon takes over below. */
.notRecommendedBadge {
margin-left: 4px;
vertical-align: middle;
@media (max-width: 1280px) {
display: none;
}
}
/* Amber info icon: always present, but the sole "not recommended" cue on small
screens (its tooltip carries the message + learn-more link). */
.notRecommendedInfo {
display: inline-flex;
align-items: center;
margin-left: 4px;
vertical-align: middle;
}
/* Query */
.queryContainer {
display: flex;

View File

@@ -130,6 +130,9 @@ function VariableForm({
value={selectedPanelIds}
onChange={(value): void => setSelectedPanelIds(value as string[])}
data-testid="variable-apply-panels"
// Resolve the closed-state tags to panel names (else they show the id).
showLabels
placement="topRight"
/>
</div>
</div>
@@ -215,7 +218,7 @@ function VariableForm({
variant="solid"
color="primary"
prefix={<Check size={14} />}
disabled={!!nameError || !!attributeError}
disabled={!!nameError || !!attributeError || isSaving}
loading={isSaving}
onClick={handleSave}
testId="variable-save"

View File

@@ -1,3 +1,4 @@
import { Color } from '@signozhq/design-tokens';
import {
ClipboardType,
DatabaseZap,
@@ -67,20 +68,23 @@ function VariableTypeTabs(): JSX.Element {
>
<DatabaseZap size={14} />
Query
<Badge color="amber" className={styles.betaTag}>
{/* Wide screens: the full "Not Recommended" pill. */}
<Badge color="amber" className={styles.notRecommendedBadge}>
Not Recommended
</Badge>
{/* Small screens: an amber info icon stands in for the pill (keeps the
tab row from overflowing), its tooltip carries the same message + link. */}
<span
className={styles.betaTag}
className={styles.notRecommendedInfo}
onClick={(e): void => e.stopPropagation()}
role="presentation"
>
<TextToolTip
text="Learn why we don't recommend"
text="Query variables can be slow and brittle, so they aren't recommended. Learn why"
url="https://signoz.io/docs/userguide/manage-variables/#why-avoid-clickhouse-query-variables"
urlText="here"
useFilledIcon={false}
outlinedIcon={<Info size={14} />}
outlinedIcon={<Info size={14} color={Color.BG_AMBER_600} />}
/>
</span>
</TabsTrigger>

View File

@@ -0,0 +1,147 @@
import { act, renderHook, type RenderHookResult } from '@testing-library/react';
import {
DYNAMIC_SIGNALS,
emptyVariableFormModel,
VARIABLE_SORT,
type VariableFormModel,
} from '../variableFormModel';
import { useVariableForm, type UseVariableForm } from './useVariableForm';
// Mock the store (its full slice graph is huge to transform and irrelevant here;
// the hook only reads dashboardId + variableValues for the Test-Run payload).
jest.mock('../../../store/useDashboardStore', () => ({
useDashboardStore: (selector: (state: unknown) => unknown): unknown =>
selector({ dashboardId: undefined, variableValues: {} }),
}));
function initial(overrides?: Partial<VariableFormModel>): VariableFormModel {
return {
...emptyVariableFormModel(),
type: 'QUERY',
name: 'svc',
defaultValue: 'foo',
...overrides,
};
}
const args = (
init: VariableFormModel,
): Parameters<typeof useVariableForm>[0] => ({
initial: init,
siblings: [],
isNew: false,
onSave: jest.fn(),
});
// The hook resets its form state whenever the `initial` reference changes (open a
// different variable), so the args must be stable across re-renders — otherwise a
// fresh `initial` each render would loop the reset effect. Real callers memoize
// `initial`; mirror that here by building the props once and closing over them.
const renderForm = (
props: Parameters<typeof useVariableForm>[0],
): RenderHookResult<UseVariableForm, unknown> =>
renderHook(() => useVariableForm(props));
describe('useVariableForm default reset — QUERY (on Test Run)', () => {
it('keeps the default when only the sort order changes', () => {
const { result } = renderForm(args(initial()));
act(() => result.current.setRawPreview(['foo', 'bar']));
expect(result.current.defaultValue).toBe('foo');
// order-only change doesn't touch the preview values, so it must not reset
act(() => result.current.set({ sort: VARIABLE_SORT.DESC }));
expect(result.current.defaultValue).toBe('foo');
});
it('resets the default when a Test Run returns values that no longer contain it', () => {
const { result } = renderForm(args(initial()));
act(() => result.current.setRawPreview(['foo', 'bar']));
expect(result.current.defaultValue).toBe('foo');
act(() => result.current.setRawPreview(['bar', 'baz']));
expect(result.current.defaultValue).toBe('');
});
it('keeps the default when a Test Run still contains it', () => {
const { result } = renderForm(args(initial()));
act(() => result.current.setRawPreview(['foo', 'bar']));
act(() => result.current.setRawPreview(['foo', 'baz', 'qux']));
expect(result.current.defaultValue).toBe('foo');
});
it('keeps the default when a re-run yields the same values (no actual change)', () => {
const { result } = renderForm(args(initial({ defaultValue: 'bar' })));
act(() => result.current.setRawPreview(['foo', 'bar']));
// same set again — re-running an unchanged query must not disturb the default
act(() => result.current.setRawPreview(['foo', 'bar']));
expect(result.current.defaultValue).toBe('bar');
});
});
describe('useVariableForm default reset — DYNAMIC (on attribute/signal change)', () => {
const dynamic = (overrides?: Partial<VariableFormModel>): VariableFormModel =>
initial({
type: 'DYNAMIC',
dynamicAttribute: 'service.name',
dynamicSignal: DYNAMIC_SIGNALS[1],
...overrides,
});
it('does not reset on the passive edit-open auto-fetch', () => {
// The auto-fetch populates the preview without going through onDynamicChange,
// so opening an existing variable must never clear its saved default.
const { result } = renderForm(args(dynamic({ defaultValue: 'zzz' })));
act(() => result.current.setRawPreview(['foo', 'bar']));
expect(result.current.defaultValue).toBe('zzz');
});
it('resets when the attribute changes', () => {
const { result } = renderForm(args(dynamic()));
act(() => result.current.onDynamicChange({ dynamicAttribute: 'host.name' }));
expect(result.current.defaultValue).toBe('');
});
it('resets when the signal changes', () => {
const { result } = renderForm(args(dynamic()));
act(() =>
result.current.onDynamicChange({ dynamicSignal: DYNAMIC_SIGNALS[2] }),
);
expect(result.current.defaultValue).toBe('');
});
it('keeps the default when the attribute is set to the same value', () => {
const { result } = renderForm(args(dynamic()));
act(() =>
result.current.onDynamicChange({ dynamicAttribute: 'service.name' }),
);
expect(result.current.defaultValue).toBe('foo');
});
});
describe('useVariableForm default reset — CUSTOM (on options edit)', () => {
const custom = (overrides?: Partial<VariableFormModel>): VariableFormModel =>
initial({ type: 'CUSTOM', ...overrides });
it('resets when the edited options no longer contain the default', () => {
const { result } = renderForm(args(custom()));
act(() => result.current.onCustomChange('bar, baz'));
expect(result.current.defaultValue).toBe('');
});
it('keeps the default when the edited options still contain it', () => {
const { result } = renderForm(args(custom()));
act(() => result.current.onCustomChange('foo, bar, baz'));
expect(result.current.defaultValue).toBe('foo');
});
});

View File

@@ -1,4 +1,4 @@
import { useEffect, useMemo, useState } from 'react';
import { useEffect, useMemo, useRef, useState } from 'react';
import logEvent from 'api/common/logEvent';
import { commaValuesParser } from 'lib/dashboardVariables/customCommaValuesParser';
import { DashboardDetailEvents } from 'pages/DashboardPageV2/constants/events';
@@ -92,6 +92,35 @@ export function useVariableForm({
[rawPreview, model.sort],
);
// QUERY: drop a now-invalid default when the user re-runs the query and the
// returned values actually change. The query preview is populated only by the
// manual "Test Run" (never on edit-open), so keying off `rawPreview` here is
// effectively "on run"; the signature guard skips a re-run that yields the same
// values so a still-valid default is left untouched. DYNAMIC/CUSTOM resets are
// handled in their change handlers instead (see below).
const lastQueryPreviewRef = useRef<string | null>(null);
useEffect(() => {
lastQueryPreviewRef.current = null;
}, [initial]);
useEffect(() => {
if (model.type !== 'QUERY' || rawPreview.length === 0) {
return;
}
const optionValues = rawPreview.map(String);
const signature = JSON.stringify(optionValues);
if (signature === lastQueryPreviewRef.current) {
return;
}
lastQueryPreviewRef.current = signature;
// Clear a now-invalid default; resolution falls back to the first option/ALL.
setDefaultValue((current) =>
current && !optionValues.includes(current) ? '' : current,
);
}, [rawPreview, model.type]);
const existingNames = useMemo(() => siblings.map((v) => v.name), [siblings]);
const existingDynamicAttributes = useMemo(
@@ -140,12 +169,28 @@ export function useVariableForm({
const onCustomChange = (value: string): void => {
set({ customValue: value });
setRawPreview(commaValuesParser(value));
const parsed = commaValuesParser(value);
setRawPreview(parsed);
const optionValues = parsed.map(String);
setDefaultValue((current) =>
current && !optionValues.includes(current) ? '' : current,
);
};
// In add mode, mirror the selected attribute into the name until the user
// edits the name themselves (matches the V1 dynamic-variable behaviour).
const onDynamicChange = (patch: Partial<VariableFormModel>): void => {
const attributeChanged =
patch.dynamicAttribute !== undefined &&
patch.dynamicAttribute !== model.dynamicAttribute;
const signalChanged =
patch.dynamicSignal !== undefined &&
patch.dynamicSignal !== model.dynamicSignal;
if (attributeChanged || signalChanged) {
setDefaultValue('');
}
if (isNew && !nameTouched && patch.dynamicAttribute) {
set({ ...patch, name: patch.dynamicAttribute });
} else {

View File

@@ -54,11 +54,18 @@ function VariableImpactDialog({
useVariableImpactState(usages, open);
const isRename = mode === 'rename';
const isDelete = mode === 'delete';
const count = usages.length;
const plural = count === 1 ? '' : 's';
const intro = isRename
? `$${variableName} is used in ${count} place${plural}. Review the updated queries before renaming to $${newName}.`
: `$${variableName} is used in ${count} place${plural}. Edit or remove each usage before deleting.`;
let intro: string;
if (isRename) {
intro = `$${variableName} is used in ${count} place${plural}. Review the updated queries before renaming to $${newName}.`;
} else if (isDelete) {
intro = `$${variableName} is used in ${count} place${plural}. Edit or remove each usage before deleting.`;
} else {
intro = `Applying $${variableName} can update upto ${count} panel quer${count === 1 ? 'y' : 'ies'}. Review the changes before applying.`;
}
const confirmLabel = isRename ? 'Rename' : isDelete ? 'Delete' : 'Apply';
const footer = (
<div className={styles.footer}>
@@ -73,13 +80,13 @@ function VariableImpactDialog({
</Button>
<Button
variant="solid"
color={isRename ? 'primary' : 'destructive'}
color={isDelete ? 'destructive' : 'primary'}
loading={isLoading}
onClick={(): void => onConfirm(resolvedUsages)}
testId="variable-impact-confirm"
>
<Check size={12} />
{isRename ? 'Rename' : 'Delete'}
{confirmLabel}
</Button>
</div>
);
@@ -92,7 +99,14 @@ function VariableImpactDialog({
onClose();
}
}}
title={isRename ? `Rename $${variableName}` : `Delete $${variableName}`}
title={
// eslint-disable-next-line no-nested-ternary
isRename
? `Rename $${variableName}`
: isDelete
? `Delete $${variableName}`
: `Apply $${variableName} to panels`
}
width="wide"
showCloseButton={false}
// Lift above the settings drawer (z ~1000); overlay off (it would only half-dim).
@@ -104,7 +118,9 @@ function VariableImpactDialog({
<Typography.Text className={styles.intro}>{intro}</Typography.Text>
<div className={styles.rows}>
{rows.map((row) => {
// Only warn on delete: an apply result is meant to reference the variable.
const stillReferences =
isDelete &&
row.included &&
textContainsVariableReference(row.resultingText, variableName);
return (

View File

@@ -1,13 +1,6 @@
import type {
DashboardtypesDashboardSpecDTOPanels,
DashboardtypesJSONPatchOperationDTO,
} from 'api/generated/services/sigNoz.schemas';
import type { DashboardtypesDashboardSpecDTOPanels } from 'api/generated/services/sigNoz.schemas';
import {
buildApplyVariableToPanelsPatch,
buildSyncVariableToPanelsPatch,
getPanelIdsReferencingVariable,
} from '../utils/applyVariableToPanelsPatch';
import { getPanelIdsReferencingVariable } from '../utils/applyVariableToPanelsPatch';
/** Minimal builder-query panel wrapped in a CompositeQuery, with a given filter. */
function compositePanel(filterExpression: string): unknown {
@@ -68,153 +61,12 @@ function listPanel(filterExpression: string): unknown {
};
}
/** A PromQL panel — no builder filter, must be skipped. */
function promqlPanel(): unknown {
return {
kind: 'panel',
spec: {
display: { title: '' },
plugin: { kind: 'signoz/TimeSeries', spec: {} },
queries: [
{
kind: 'promql',
spec: {
plugin: { kind: 'signoz/PromQLQuery', spec: { query: 'up' } },
},
},
],
},
};
}
/** Reads the first builder query's filter expression out of a patch op's value. */
function expressionOf(
op: DashboardtypesJSONPatchOperationDTO,
): string | undefined {
const queries = op.value as Array<{
spec: { plugin: { kind: string; spec: any } };
}>;
const { plugin } = queries[0].spec;
const builderSpec =
plugin.kind === 'signoz/CompositeQuery'
? plugin.spec.queries[0].spec
: plugin.spec;
return builderSpec.filter?.expression;
}
function panels(
map: Record<string, unknown>,
): DashboardtypesDashboardSpecDTOPanels {
return map as DashboardtypesDashboardSpecDTOPanels;
}
describe('buildApplyVariableToPanelsPatch', () => {
it('appends the clause to an existing filter (AND-joined)', () => {
const ops = buildApplyVariableToPanelsPatch(
panels({ p1: compositePanel('env = "prod"') }),
'service.name',
'svc',
);
expect(ops).toHaveLength(1);
expect(ops[0]).toMatchObject({
op: 'replace',
path: '/spec/panels/p1/spec/queries',
});
expect(expressionOf(ops[0])).toBe('env = "prod" AND service.name IN $svc');
});
it('sets the clause when the filter is empty', () => {
const ops = buildApplyVariableToPanelsPatch(
panels({ p1: compositePanel('') }),
'service.name',
'svc',
);
expect(expressionOf(ops[0])).toBe('service.name IN $svc');
});
it('applies to a bare BuilderQuery (LIST) panel', () => {
const ops = buildApplyVariableToPanelsPatch(
panels({ p1: listPanel('') }),
'k8s.pod.name',
'pod',
);
expect(expressionOf(ops[0])).toBe('k8s.pod.name IN $pod');
});
it('is idempotent — re-applying does not duplicate the clause', () => {
const ops = buildApplyVariableToPanelsPatch(
panels({ p1: compositePanel('service.name IN $svc') }),
'service.name',
'svc',
);
expect(ops).toHaveLength(0);
});
it('only targets the requested panels', () => {
const ops = buildApplyVariableToPanelsPatch(
panels({ p1: compositePanel(''), p2: compositePanel('') }),
'service.name',
'svc',
['p2'],
);
expect(ops).toHaveLength(1);
expect(ops[0].path).toBe('/spec/panels/p2/spec/queries');
});
it('skips PromQL panels (no builder filter)', () => {
const ops = buildApplyVariableToPanelsPatch(
panels({ p1: promqlPanel() }),
'service.name',
'svc',
);
expect(ops).toHaveLength(0);
});
it('returns nothing when attribute or name is missing', () => {
expect(
buildApplyVariableToPanelsPatch(
panels({ p1: compositePanel('') }),
'',
'svc',
),
).toHaveLength(0);
});
});
describe('buildSyncVariableToPanelsPatch', () => {
it('adds to selected panels and removes from the rest', () => {
const ops = buildSyncVariableToPanelsPatch(
panels({
p1: compositePanel('service.name IN $svc'), // has it, not selected → remove
p2: compositePanel(''), // selected → add
p3: compositePanel('service.name IN $svc'), // has it, selected → unchanged
}),
'service.name',
'svc',
['p2', 'p3'],
);
const byPath = Object.fromEntries(ops.map((op) => [op.path, op]));
expect(Object.keys(byPath).sort()).toStrictEqual([
'/spec/panels/p1/spec/queries',
'/spec/panels/p2/spec/queries',
]);
expect(expressionOf(byPath['/spec/panels/p1/spec/queries'])).toBe('');
expect(expressionOf(byPath['/spec/panels/p2/spec/queries'])).toBe(
'service.name IN $svc',
);
});
it('removing keeps other clauses intact', () => {
const ops = buildSyncVariableToPanelsPatch(
panels({ p1: compositePanel('env = "prod" AND service.name IN $svc') }),
'service.name',
'svc',
[],
);
expect(expressionOf(ops[0])).toBe('env = "prod"');
});
});
describe('getPanelIdsReferencingVariable', () => {
it('returns only panels whose filter references the variable', () => {
const ids = getPanelIdsReferencingVariable(

View File

@@ -0,0 +1,113 @@
import { act, renderHook } from '@testing-library/react';
import type { DashboardtypesGettableDashboardV2DTO } from 'api/generated/services/sigNoz.schemas';
import { useVariableListActions } from '../hooks/useVariableListActions';
import {
emptyVariableFormModel,
type VariableFormModel,
} from '../variableFormModel';
jest.mock('../../../store/useDashboardStore', () => ({
useDashboardStore: (
selector: (s: { dashboardId: string }) => unknown,
): unknown => selector({ dashboardId: 'd1' }),
}));
jest.mock('api/common/logEvent', () => ({
__esModule: true,
default: jest.fn(),
}));
jest.mock('@signozhq/ui/sonner', () => ({
toast: { success: jest.fn(), error: jest.fn(), info: jest.fn() },
}));
function builderPanel(name: string, expression: string): unknown {
return {
spec: {
display: { name },
queries: [
{
spec: {
plugin: { kind: 'signoz/BuilderQuery', spec: { filter: { expression } } },
},
},
],
},
};
}
function dashboard(
panels: Record<string, unknown>,
): DashboardtypesGettableDashboardV2DTO {
return {
spec: { panels, variables: [] },
} as unknown as DashboardtypesGettableDashboardV2DTO;
}
function dynamicVar(name: string, attribute: string): VariableFormModel {
return {
...emptyVariableFormModel(),
name,
type: 'DYNAMIC',
dynamicAttribute: attribute,
};
}
function renderActions(
dash: DashboardtypesGettableDashboardV2DTO,
variables: VariableFormModel[],
) {
return renderHook(() =>
useVariableListActions({
dashboard: dash,
variables,
setVariables: jest.fn(),
isEditing: null,
setIsEditing: jest.fn(),
save: jest.fn().mockResolvedValue(true),
patchAsync: jest.fn().mockResolvedValue(undefined),
}),
);
}
describe('useVariableListActions — apply to all', () => {
it('marks a variable applied-to-all only when every panel already references it', () => {
const notApplied = renderActions(dashboard({ p1: builderPanel('P1', '') }), [
dynamicVar('pod', 'k8s.pod.name'),
]);
expect(notApplied.result.current.appliedToAllNames.has('pod')).toBe(false);
const applied = renderActions(
dashboard({ p1: builderPanel('P1', 'k8s.pod.name IN $pod') }),
[dynamicVar('pod', 'k8s.pod.name')],
);
expect(applied.result.current.appliedToAllNames.has('pod')).toBe(true);
});
it('requestApplyToAll opens an apply-mode impact for all panels', () => {
const { result } = renderActions(
dashboard({ p1: builderPanel('P1', ''), p2: builderPanel('P2', '') }),
[dynamicVar('pod', 'k8s.pod.name')],
);
act(() => result.current.requestApplyToAll(0));
const { impact } = result.current;
expect(impact?.mode).toBe('apply');
expect(impact?.origin).toBe('applyToAll');
expect(impact?.variableName).toBe('pod');
expect(impact?.usages.map((u) => u.sourceId).sort()).toStrictEqual([
'p1',
'p2',
]);
});
it('requestApplyToAll is a no-op when nothing is left to apply', () => {
const { result } = renderActions(
dashboard({ p1: builderPanel('P1', 'k8s.pod.name IN $pod') }),
[dynamicVar('pod', 'k8s.pod.name')],
);
act(() => result.current.requestApplyToAll(0));
expect(result.current.impact).toBeNull();
});
});

View File

@@ -4,7 +4,11 @@ import {
emptyVariableFormModel,
type VariableFormModel,
} from '../variableFormModel';
import { findVariableUsages } from '../utils/variableUsages';
import {
findApplyUsages,
findVariableUsages,
isVariableAppliedToAllPanels,
} from '../utils/variableUsages';
// Identity adapter so `spec.variables` can be plain form models in the test.
jest.mock('../variableAdapters', () => ({
@@ -96,3 +100,98 @@ describe('findVariableUsages', () => {
expect(findVariableUsages(dash, 'nope', 'delete')).toStrictEqual([]);
});
});
describe('findApplyUsages', () => {
const dash = dashboard(
{
empty: builderPanel('Empty', ''),
ored: builderPanel('Ored', "a = 'x' OR b = 'y'"),
has: builderPanel('Has it', 'k8s.pod.name IN $pod'),
prom: promqlPanel('Prom', 'up'),
promRef: promqlPanel('Prom Ref', 'up{pod="$pod"}'),
},
[],
);
it('appends the clause to selected builder panels, parenthesising an OR', () => {
const usages = findApplyUsages(dash, 'k8s.pod.name', 'pod', 'pod', [
'empty',
'ored',
]);
const byId = Object.fromEntries(usages.map((u) => [u.id, u.resultingText]));
expect(byId['panel:empty:0']).toBe('k8s.pod.name IN $pod');
expect(byId['panel:ored:0']).toBe(
"(a = 'x' OR b = 'y') AND k8s.pod.name IN $pod",
);
});
it('skips a selected panel that already carries the clause (idempotent)', () => {
const usages = findApplyUsages(dash, 'k8s.pod.name', 'pod', 'pod', ['has']);
expect(usages).toStrictEqual([]);
});
it('removes the clause from an unselected builder panel that has it', () => {
const usages = findApplyUsages(dash, 'k8s.pod.name', 'pod', 'pod', ['empty']);
const has = usages.find((u) => u.id === 'panel:has:0');
expect(has?.resultingText).toBe('');
});
it('lists a selected PromQL panel as an editable, unchanged row', () => {
const usages = findApplyUsages(dash, 'k8s.pod.name', 'pod', 'pod', ['prom']);
const prom = usages.find((u) => u.id === 'panel:prom:0');
expect(prom?.kind).toBe('promql');
// Never auto-injected — the row defaults to the current text for manual edits.
expect(prom?.currentText).toBe('up');
expect(prom?.resultingText).toBe('up');
});
it('skips a selected non-builder panel that already references the variable', () => {
const usages = findApplyUsages(dash, 'k8s.pod.name', 'pod', 'pod', [
'promRef',
]);
expect(usages.some((u) => u.sourceId === 'promRef')).toBe(false);
});
it('never touches unselected non-builder panels', () => {
const usages = findApplyUsages(dash, 'k8s.pod.name', 'pod', 'pod', ['empty']);
expect(usages.some((u) => u.sourceId === 'prom')).toBe(false);
expect(usages.some((u) => u.sourceId === 'promRef')).toBe(false);
});
it('returns nothing when every selected query already references the variable', () => {
// The "applied to all" signal: builder carries the clause, PromQL references it.
const usages = findApplyUsages(dash, 'k8s.pod.name', 'pod', 'pod', [
'has',
'promRef',
]);
expect(usages).toStrictEqual([]);
});
});
describe('isVariableAppliedToAllPanels', () => {
it('is true only when every panel query references the variable', () => {
const covered = dashboard(
{
b: builderPanel('B', 'k8s.pod.name IN $pod'),
p: promqlPanel('P', 'up{pod="$pod"}'),
},
[],
);
expect(isVariableAppliedToAllPanels(covered, 'k8s.pod.name', 'pod')).toBe(
true,
);
});
it('is false when any panel query is missing the reference', () => {
const missing = dashboard(
{
b: builderPanel('B', 'k8s.pod.name IN $pod'),
p: promqlPanel('P', 'up'),
},
[],
);
expect(isVariableAppliedToAllPanels(missing, 'k8s.pod.name', 'pod')).toBe(
false,
);
});
});

View File

@@ -1,16 +0,0 @@
.body {
font-size: 13px;
line-height: 20px;
color: var(--l2-foreground);
}
.variableName {
font-family: 'Space Mono', monospace;
color: var(--bg-robin-400);
}
.footer {
display: flex;
justify-content: flex-end;
gap: 8px;
}

View File

@@ -1,67 +0,0 @@
import { Check, X } from '@signozhq/icons';
import { Button } from '@signozhq/ui/button';
import { DialogWrapper } from '@signozhq/ui/dialog';
import styles from './ApplyToAllDialog.module.scss';
interface ApplyToAllDialogProps {
open: boolean;
variableName: string;
isLoading: boolean;
onConfirm: () => void;
onClose: () => void;
}
/** Confirms applying a dynamic variable as a filter to every panel. */
function ApplyToAllDialog({
open,
variableName,
isLoading,
onConfirm,
onClose,
}: ApplyToAllDialogProps): JSX.Element {
const footer = (
<div className={styles.footer}>
<Button variant="solid" color="secondary" onClick={onClose}>
<X size={12} />
Cancel
</Button>
<Button
variant="solid"
color="primary"
loading={isLoading}
onClick={onConfirm}
testId="confirm-apply-to-all"
>
<Check size={12} />
Apply to all
</Button>
</div>
);
return (
<DialogWrapper
open={open}
onOpenChange={(isOpen): void => {
if (!isOpen) {
onClose();
}
}}
title="Apply variable to all panels"
width="narrow"
showCloseButton={false}
// Lift above the settings drawer (z ~1000); overlay off (it would only half-dim).
style={{ zIndex: 1100 }}
showOverlay={false}
footer={footer}
>
<div className={styles.body}>
Add <span className={styles.variableName}>${variableName}</span> as a filter
to every panel on this dashboard. Panels that already reference it are left
unchanged.
</div>
</DialogWrapper>
);
}
export default ApplyToAllDialog;

View File

@@ -64,7 +64,7 @@ $grid-columns: minmax(0, 2fr) minmax(0, 3fr);
.rowActions {
position: absolute;
top: 8px;
top: 6px;
right: 0;
display: flex;
align-items: center;

View File

@@ -22,6 +22,8 @@ interface VariableRowProps {
onCancelDelete: () => void;
/** Apply this variable's filter to all panels. Dynamic variables only. */
onApplyToAll: (index: number) => void;
/** True when this dynamic variable is already applied to every panel. */
isAppliedToAll: boolean;
}
/** A single draggable variable row in the two-column (name / description) table. */
@@ -35,6 +37,7 @@ function VariableRow({
onConfirmDelete,
onCancelDelete,
onApplyToAll,
isAppliedToAll,
}: VariableRowProps): JSX.Element {
const {
attributes,
@@ -121,12 +124,17 @@ function VariableRow({
{variable.type === 'DYNAMIC' ? (
<TooltipSimple
side="top"
title="Add this variable as a filter to every panel"
title={
isAppliedToAll
? 'Already applied to all panels'
: 'Add this variable as a filter to every panel'
}
>
<Button
variant="ghost"
color="secondary"
size="sm"
disabled={isAppliedToAll}
className={styles.applyAllButton}
onClick={(): void => onApplyToAll(index)}
testId={`variable-apply-all-${variable.name}`}

View File

@@ -26,6 +26,8 @@ interface VariablesListProps {
onCancelDelete: () => void;
onMove: (from: number, to: number) => void;
onApplyToAll: (index: number) => void;
/** Names of dynamic variables already applied to every panel. */
appliedToAllNames: Set<string>;
}
function VariablesList({
@@ -38,6 +40,7 @@ function VariablesList({
onCancelDelete,
onMove,
onApplyToAll,
appliedToAllNames,
}: VariablesListProps): JSX.Element {
const sensors = useSensors(
useSensor(PointerSensor, { activationConstraint: { distance: 1 } }),
@@ -82,6 +85,7 @@ function VariablesList({
onConfirmDelete={onConfirmDelete}
onCancelDelete={onCancelDelete}
onApplyToAll={onApplyToAll}
isAppliedToAll={appliedToAllNames.has(variable.name)}
/>
))}
</div>

View File

@@ -2,6 +2,7 @@ import {
type Dispatch,
type SetStateAction,
useCallback,
useMemo,
useState,
} from 'react';
import logEvent from 'api/common/logEvent';
@@ -13,7 +14,6 @@ import type {
import { DashboardDetailEvents } from 'pages/DashboardPageV2/constants/events';
import { useDashboardStore } from '../../../store/useDashboardStore';
import { buildSyncVariableToPanelsPatch } from '../utils/applyVariableToPanelsPatch';
import {
VARIABLE_TYPE_EVENT_LABEL,
type VariableFormModel,
@@ -23,7 +23,9 @@ import {
buildVariableImpactPatch,
} from '../utils/variableImpactPatch';
import {
findApplyUsages,
findVariableUsages,
isVariableAppliedToAllPanels,
type VariableImpactMode,
type VariableUsage,
} from '../utils/variableUsages';
@@ -40,6 +42,8 @@ export interface VariableImpact {
newName?: string;
usages: VariableUsage[];
nextVariables: VariableFormModel[];
/** Where an `apply` impact came from — drives the confirm analytics event. */
origin?: 'form' | 'applyToAll';
}
interface UseVariableListActionsParams {
@@ -64,6 +68,9 @@ interface UseVariableListActions {
handleMove: (from: number, to: number) => void;
requestDelete: (index: number) => void;
handleConfirmDelete: (index: number) => void;
requestApplyToAll: (index: number) => void;
/** Names of dynamic variables already applied to every panel (button disabled). */
appliedToAllNames: Set<string>;
handleImpactConfirm: (resolvedUsages: VariableUsage[]) => Promise<void>;
}
@@ -107,60 +114,52 @@ export function useVariableListActions({
next[editingIndex] = formModel;
}
// A rename that other queries/variables reference must be reviewed first, so
// the references are rewritten alongside the rename (never left dangling).
if (oldName && oldName !== formModel.name) {
const usages = findVariableUsages(
dashboard,
oldName,
'rename',
formModel.name,
);
if (usages.length > 0) {
setIsEditing(null);
setImpact({
mode: 'rename',
variableName: oldName,
newName: formModel.name,
usages,
nextVariables: next,
});
return;
}
const isRename = !!oldName && oldName !== formModel.name;
// Both rename and apply-to-panels edits are reviewed in the impact dialog
// before persisting — never applied silently.
const renameUsages = isRename
? findVariableUsages(dashboard, oldName as string, 'rename', formModel.name)
: [];
const applyUsages =
formModel.type === 'DYNAMIC' && formModel.dynamicAttribute
? findApplyUsages(
dashboard,
formModel.dynamicAttribute,
formModel.name,
oldName ?? formModel.name,
selectedPanelIds,
)
: [];
// Apply usages win per (panel, envelope) over a plain rename rewrite.
const byId = new Map<string, VariableUsage>();
renameUsages.forEach((usage) => byId.set(usage.id, usage));
applyUsages.forEach((usage) => byId.set(usage.id, usage));
const usages = [...byId.values()];
if (usages.length > 0) {
setIsEditing(null);
setImpact({
mode: isRename ? 'rename' : 'apply',
variableName: oldName ?? formModel.name,
newName: formModel.name,
usages,
nextVariables: next,
});
return;
}
setIsEditing(null);
setVariables(next);
// No cross-query impact — persist directly; keep the form open on failure.
void (async (): Promise<void> => {
const saved = await save(next);
if (!saved || formModel.type !== 'DYNAMIC') {
if (!saved) {
return;
}
const ops = buildSyncVariableToPanelsPatch(
dashboard.spec.panels,
formModel.dynamicAttribute,
formModel.name,
selectedPanelIds,
);
if (ops.length === 0) {
return;
}
try {
await patchAsync(ops);
} catch {
toast.error('Could not update panels');
}
setIsEditing(null);
setVariables(next);
})();
},
[
dashboard,
isEditing,
patchAsync,
save,
setIsEditing,
setVariables,
variables,
],
[dashboard, isEditing, save, setIsEditing, setVariables, variables],
);
const handleMove = useCallback(
@@ -218,6 +217,57 @@ export function useVariableListActions({
[dashboard, variables],
);
// "Apply to all": review the additive changes across every panel before applying.
const requestApplyToAll = useCallback(
(index: number): void => {
const variable = variables[index];
if (!variable || variable.type !== 'DYNAMIC' || !variable.dynamicAttribute) {
return;
}
const allPanelIds = Object.keys(dashboard.spec.panels ?? {});
const usages = findApplyUsages(
dashboard,
variable.dynamicAttribute,
variable.name,
variable.name,
allPanelIds,
);
if (usages.length === 0) {
return;
}
setImpact({
mode: 'apply',
variableName: variable.name,
newName: variable.name,
usages,
nextVariables: variables,
origin: 'applyToAll',
});
},
[dashboard, variables],
);
// A dynamic variable is "applied to all" when every panel query already
// references it — i.e. the apply review would be empty. Disables the button.
const appliedToAllNames = useMemo(() => {
const names = new Set<string>();
variables.forEach((variable) => {
if (variable.type !== 'DYNAMIC' || !variable.dynamicAttribute) {
return;
}
if (
isVariableAppliedToAllPanels(
dashboard,
variable.dynamicAttribute,
variable.name,
)
) {
names.add(variable.name);
}
});
return names;
}, [dashboard, variables]);
// Applies a resolved rename/delete: the variables array (rename/delete + edited
// variable queries) and each touched panel's queries, in one atomic patch.
const handleImpactConfirm = useCallback(
@@ -237,11 +287,15 @@ export function useVariableListActions({
setVariables(nextVariables);
try {
await patchAsync(ops);
toast.success(
impact.mode === 'rename'
? `Renamed to $${impact.newName}`
: `Deleted $${impact.variableName}`,
);
let message: string;
if (impact.mode === 'rename') {
message = `Renamed to $${impact.newName}`;
} else if (impact.mode === 'apply') {
message = `Applied $${impact.variableName} to panels`;
} else {
message = `Deleted $${impact.variableName}`;
}
toast.success(message);
if (impact.mode === 'delete') {
const deleted = variables.find((v) => v.name === impact.variableName);
void logEvent(DashboardDetailEvents.VariableDeleted, {
@@ -251,13 +305,22 @@ export function useVariableListActions({
hadReferences: true,
dashboardId,
});
} else if (impact.mode === 'apply' && impact.origin === 'applyToAll') {
void logEvent(DashboardDetailEvents.ApplyToAllConfirmed, {
variableType: 'dynamic',
dashboardId,
});
}
} catch {
toast.error(
impact.mode === 'rename'
? 'Could not rename the variable'
: 'Could not delete the variable',
);
let message: string;
if (impact.mode === 'rename') {
message = 'Could not rename the variable';
} else if (impact.mode === 'apply') {
message = 'Could not apply the variable to panels';
} else {
message = 'Could not delete the variable';
}
toast.error(message);
}
setImpact(null);
},
@@ -273,6 +336,8 @@ export function useVariableListActions({
handleMove,
requestDelete,
handleConfirmDelete,
requestApplyToAll,
appliedToAllNames,
handleImpactConfirm,
};
}

View File

@@ -1,17 +1,11 @@
import { useEffect, useMemo, useState } from 'react';
import { toast } from '@signozhq/ui/sonner';
import logEvent from 'api/common/logEvent';
import type { DashboardtypesGettableDashboardV2DTO } from 'api/generated/services/sigNoz.schemas';
import cx from 'classnames';
import { DashboardDetailEvents } from 'pages/DashboardPageV2/constants/events';
import settingsStyles from '../DashboardSettings.module.scss';
import { useOptimisticPatch } from '../../hooks/useOptimisticPatch';
import { useDashboardStore } from '../../store/useDashboardStore';
import {
buildApplyVariableToPanelsPatch,
getPanelIdsReferencingVariable,
} from './utils/applyVariableToPanelsPatch';
import { getPanelIdsReferencingVariable } from './utils/applyVariableToPanelsPatch';
import { useSaveVariables } from './hooks/useSaveVariables';
import { useVariableListActions } from './hooks/useVariableListActions';
import { dtoToFormModel } from './variableAdapters';
@@ -24,7 +18,6 @@ import VariableImpactDialog from './VariableImpactDialog/VariableImpactDialog';
import VariablesList from './components/VariablesList/VariablesList';
import styles from './Variables.module.scss';
import AddVariableButton from './components/AddVariableButton';
import ApplyToAllDialog from './components/ApplyToAllDialog/ApplyToAllDialog';
import NoVariablesCard from './components/NoVariablesCard/NoVariablesCard';
import { EditingState } from './types';
@@ -34,7 +27,6 @@ interface VariablesSettingsProps {
function VariablesSettings({ dashboard }: VariablesSettingsProps): JSX.Element {
const isEditable = useDashboardStore((s) => s.isEditable);
const dashboardId = useDashboardStore((s) => s.dashboardId);
// The drawer destroys on close, so reading this once on mount is enough to
// open the add-form when deep-linked (e.g. the bar's "Add variable" button).
const openAddOnMount = useDashboardStore(
@@ -59,7 +51,6 @@ function VariablesSettings({ dashboard }: VariablesSettingsProps): JSX.Element {
const [isEditing, setIsEditing] = useState<EditingState>(
openAddOnMount && isEditable ? { type: 'new' } : null,
);
const [applyToAllIndex, setApplyToAllIndex] = useState<number | null>(null);
const {
confirmDeleteIndex,
@@ -70,6 +61,8 @@ function VariablesSettings({ dashboard }: VariablesSettingsProps): JSX.Element {
handleMove,
requestDelete,
handleConfirmDelete,
requestApplyToAll,
appliedToAllNames,
handleImpactConfirm,
} = useVariableListActions({
dashboard,
@@ -116,36 +109,6 @@ function VariablesSettings({ dashboard }: VariablesSettingsProps): JSX.Element {
);
}, [editingFormModel, dashboard.spec.panels]);
const applyToAllVariable =
applyToAllIndex === null ? null : variables[applyToAllIndex];
const handleConfirmApplyToAll = async (): Promise<void> => {
if (!applyToAllVariable) {
return;
}
const ops = buildApplyVariableToPanelsPatch(
dashboard.spec.panels,
applyToAllVariable.dynamicAttribute,
applyToAllVariable.name,
);
if (ops.length === 0) {
toast.info('No panels needed this filter.');
setApplyToAllIndex(null);
return;
}
try {
await patchAsync(ops);
toast.success(`Applied $${applyToAllVariable.name} to all panels`);
void logEvent(DashboardDetailEvents.ApplyToAllConfirmed, {
variableType: 'dynamic',
dashboardId,
});
} catch {
toast.error('Could not apply the variable to panels');
}
setApplyToAllIndex(null);
};
if (editingFormModel) {
return (
<VariableForm
@@ -176,20 +139,14 @@ function VariablesSettings({ dashboard }: VariablesSettingsProps): JSX.Element {
onConfirmDelete={handleConfirmDelete}
onCancelDelete={(): void => setConfirmDeleteIndex(null)}
onMove={handleMove}
onApplyToAll={(index): void => setApplyToAllIndex(index)}
onApplyToAll={requestApplyToAll}
appliedToAllNames={appliedToAllNames}
/>
<div className={styles.footer}>
<AddVariableButton isEditable={isEditable} setIsEditing={setIsEditing} />
</div>
</>
)}
<ApplyToAllDialog
open={applyToAllVariable !== null}
variableName={applyToAllVariable?.name ?? ''}
isLoading={isPatching}
onConfirm={(): void => void handleConfirmApplyToAll()}
onClose={(): void => setApplyToAllIndex(null)}
/>
<VariableImpactDialog
open={impact !== null}
mode={impact?.mode ?? 'delete'}

View File

@@ -1,21 +1,15 @@
import type {
DashboardtypesDashboardSpecDTOPanels,
DashboardtypesJSONPatchOperationDTO,
DashboardtypesQueryDTO,
Querybuildertypesv5BuilderQuerySpecDTO,
Querybuildertypesv5CompositeQueryDTO,
Querybuildertypesv5QueryEnvelopeBuilderDTO,
} from 'api/generated/services/sigNoz.schemas';
import { cloneDeep } from 'lodash-es';
// Injects/removes a dynamic variable's filter (`attribute IN $name`) in panel
// builder queries as JSON-Patch ops. Only builder queries carry a filter.
function clauseFor(attribute: string, variableName: string): string {
return `${attribute} IN $${variableName}`;
}
/** Runs `fn` on every builder-query spec in a panel's single query (Composite or bare Builder). */
function forEachBuilderSpec(
queries: DashboardtypesQueryDTO[],
fn: (spec: Querybuildertypesv5BuilderQuerySpecDTO) => void,
@@ -39,48 +33,6 @@ function forEachBuilderSpec(
}
}
/** Appends the clause to every builder query's filter. Returns whether anything changed. */
function addClause(queries: DashboardtypesQueryDTO[], clause: string): boolean {
let changed = false;
forEachBuilderSpec(queries, (spec) => {
const existing = spec.filter?.expression?.trim();
// Idempotent: a repeated apply must not stack duplicate clauses.
if (existing?.includes(clause)) {
return;
}
spec.filter = {
expression: existing ? `${existing} AND ${clause}` : clause,
};
changed = true;
});
return changed;
}
/** Removes the managed clause (an ` AND `-joined part) from every builder filter. */
function removeClause(
queries: DashboardtypesQueryDTO[],
clause: string,
): boolean {
let changed = false;
forEachBuilderSpec(queries, (spec) => {
const existing = spec.filter?.expression;
if (!existing) {
return;
}
const parts = existing
.split(' AND ')
.map((part) => part.trim())
.filter(Boolean);
const kept = parts.filter((part) => part !== clause);
if (kept.length !== parts.length) {
spec.filter = { expression: kept.join(' AND ') };
changed = true;
}
});
return changed;
}
/** Whether any builder query in the panel already carries the clause. */
function panelHasClause(
queries: DashboardtypesQueryDTO[],
clause: string,
@@ -94,74 +46,6 @@ function panelHasClause(
return has;
}
function replaceQueriesOp(
panelId: string,
queries: DashboardtypesQueryDTO[],
): DashboardtypesJSONPatchOperationDTO {
return {
op: 'replace' as DashboardtypesJSONPatchOperationDTO['op'],
path: `/spec/panels/${panelId}/spec/queries`,
value: queries,
};
}
/** Add-only: inject the variable's filter into the given panels (default: all). */
export function buildApplyVariableToPanelsPatch(
panels: DashboardtypesDashboardSpecDTOPanels,
attribute: string,
variableName: string,
targetPanelIds?: string[],
): DashboardtypesJSONPatchOperationDTO[] {
if (!attribute || !variableName) {
return [];
}
const clause = clauseFor(attribute, variableName);
const ids = targetPanelIds ?? Object.keys(panels);
const ops: DashboardtypesJSONPatchOperationDTO[] = [];
ids.forEach((id) => {
const panel = panels[id];
if (!panel?.spec?.queries?.length) {
return;
}
const queries = cloneDeep(panel.spec.queries);
if (addClause(queries, clause)) {
ops.push(replaceQueriesOp(id, queries));
}
});
return ops;
}
/** Full sync: selected panels get the clause; every other panel has it removed. */
export function buildSyncVariableToPanelsPatch(
panels: DashboardtypesDashboardSpecDTOPanels,
attribute: string,
variableName: string,
selectedPanelIds: string[],
): DashboardtypesJSONPatchOperationDTO[] {
if (!attribute || !variableName) {
return [];
}
const clause = clauseFor(attribute, variableName);
const selected = new Set(selectedPanelIds);
const ops: DashboardtypesJSONPatchOperationDTO[] = [];
Object.keys(panels).forEach((id) => {
const panel = panels[id];
if (!panel?.spec?.queries?.length) {
return;
}
const queries = cloneDeep(panel.spec.queries);
const changed = selected.has(id)
? addClause(queries, clause)
: removeClause(queries, clause);
if (changed) {
ops.push(replaceQueriesOp(id, queries));
}
});
return ops;
}
/** Panel ids whose queries currently reference the variable — pre-populates the picker. */
export function getPanelIdsReferencingVariable(
panels: DashboardtypesDashboardSpecDTOPanels,

View File

@@ -2,7 +2,10 @@ import type {
DashboardtypesGettableDashboardV2DTO,
Querybuildertypesv5QueryEnvelopeDTO,
} from 'api/generated/services/sigNoz.schemas';
import { removeVariableFromExpression } from 'components/QueryBuilderV2/utils';
import {
appendAndClause,
removeVariableFromExpression,
} from 'components/QueryBuilderV2/utils';
import {
rewriteVariableReferences,
textContainsVariableReference,
@@ -18,8 +21,7 @@ export type VariableUsageKind =
| 'clickhouse'
| 'variable';
/** Whether the impact is a rename (rewrite refs) or a delete (remove refs). */
export type VariableImpactMode = 'rename' | 'delete';
export type VariableImpactMode = 'rename' | 'delete' | 'apply';
/**
* One place a variable is referenced — a panel query's builder filter expression,
@@ -161,3 +163,118 @@ export function findVariableUsages(
return usages;
}
// `matchName` is the name in the current query text (the old name during a
// simultaneous rename); `injectName` is written into newly added clauses. Equal
// outside of a rename.
export function findApplyUsages(
dashboard: DashboardtypesGettableDashboardV2DTO,
attribute: string,
injectName: string,
matchName: string,
selectedPanelIds: string[],
): VariableUsage[] {
if (!attribute || !injectName) {
return [];
}
const clause = `${attribute} IN $${injectName}`;
const existingClause = `${attribute} IN $${matchName}`;
const selected = new Set(selectedPanelIds);
const usages: VariableUsage[] = [];
Object.entries(dashboard.spec.panels ?? {}).forEach(([panelId, panel]) => {
const queries = panel?.spec?.queries;
if (!queries?.length) {
return;
}
toQueryEnvelopes(queries).forEach((envelope, index) => {
const pushUsage = (
kind: VariableUsageKind,
currentText: string,
resultingText: string,
): void => {
usages.push({
id: `panel:${panelId}:${index}`,
sourceType: 'panel',
sourceId: panelId,
sourceLabel: panel.spec?.display?.name || panelId,
kind,
envelopeIndex: index,
currentText,
resultingText,
});
};
if (envelope.type === 'builder_query') {
const spec = envelope.spec as
| { filter?: { expression?: string } }
| undefined;
const current = spec?.filter?.expression ?? '';
if (selected.has(panelId)) {
// Already carries the clause (under either name) — a rename usage, if
// any, fixes the name; don't append a duplicate.
if (current.includes(clause) || current.includes(existingClause)) {
return;
}
pushUsage('builder', current, appendAndClause(current, clause));
} else {
const next = removeVariableFromExpression(current, matchName);
if (next !== current) {
pushUsage('builder', current, next);
}
}
return;
}
// PromQL/ClickHouse can't carry the managed clause — never auto-inject or
// remove. Selected panels still get an editable row defaulting to the
// current text, unless the query already references the variable.
if (!selected.has(panelId)) {
return;
}
const ref = envelopeReferenceText(envelope);
if (!ref) {
return;
}
if (
textContainsVariableReference(ref.text, injectName) ||
textContainsVariableReference(ref.text, matchName)
) {
return;
}
pushUsage(ref.kind, ref.text, ref.text);
});
});
return usages;
}
// Cheap yes/no check for the "Apply to all" disabled state: does every panel query
// already reference the variable? Plain string checks — no ANTLR, no rewriting.
export function isVariableAppliedToAllPanels(
dashboard: DashboardtypesGettableDashboardV2DTO,
attribute: string,
variableName: string,
): boolean {
if (!attribute || !variableName) {
return false;
}
const clause = `${attribute} IN $${variableName}`;
const panels = dashboard.spec.panels ?? {};
return Object.values(panels).every((panel) => {
const queries = panel?.spec?.queries;
if (!queries?.length) {
return true;
}
return toQueryEnvelopes(queries).every((envelope) => {
if (envelope.type === 'builder_query') {
const spec = envelope.spec as
| { filter?: { expression?: string } }
| undefined;
return (spec?.filter?.expression ?? '').includes(clause);
}
const ref = envelopeReferenceText(envelope);
return ref ? textContainsVariableReference(ref.text, variableName) : true;
});
});
}

View File

@@ -13,11 +13,7 @@ import type {
} from 'api/generated/services/sigNoz.schemas';
import {
DYNAMIC_SIGNAL_ALL,
DYNAMIC_SIGNALS,
type DynamicSignalOption,
emptyVariableFormModel,
signalForApi,
VARIABLE_SORT_DISABLED,
type VariableFormModel,
} from './variableFormModel';
@@ -69,12 +65,8 @@ export function dtoToFormModel(
...listCommon,
type: 'DYNAMIC',
dynamicAttribute: plugin.spec.name ?? '',
// Unrecognized/empty signal → "all telemetry", so the source always shows.
dynamicSignal: DYNAMIC_SIGNALS.includes(
plugin.spec.signal as DynamicSignalOption,
)
? (plugin.spec.signal as DynamicSignalOption)
: DYNAMIC_SIGNAL_ALL,
// signal is a required wire field (`all` = every telemetry signal), used as-is.
dynamicSignal: plugin.spec.signal,
};
}
// Default to Query (also covers a query plugin or a missing/unknown plugin).
@@ -102,7 +94,7 @@ function buildPlugin(
kind: DynamicPluginKind['signoz/DynamicVariable'],
spec: {
name: model.dynamicAttribute,
signal: signalForApi(model.dynamicSignal),
signal: model.dynamicSignal,
},
};
case 'QUERY':

View File

@@ -1,6 +1,6 @@
import {
DashboardtypesDynamicVariableSignalDTO,
DashboardtypesListVariableSpecSortDTO,
TelemetrytypesSignalDTO,
} from 'api/generated/services/sigNoz.schemas';
import type { DashboardtypesVariableDefaultValueDTO } from 'api/generated/services/sigNoz.schemas';
import { sortBy } from 'lodash-es';
@@ -23,23 +23,6 @@ export const VARIABLE_TYPE_EVENT_LABEL: Record<VariableType, string> = {
DYNAMIC: 'dynamic',
};
/** Telemetry signal — the generated enum (traces / logs / metrics). */
// A query/variable signal is only logs/traces/metrics. TelemetrytypesSignalDTO
// also carries the empty "any" value used on field keys, which is not a valid
// query/variable signal, so exclude it here.
export type TelemetrySignal =
| TelemetrytypesSignalDTO.logs
| TelemetrytypesSignalDTO.traces
| TelemetrytypesSignalDTO.metrics;
/**
* Signal selected in the dynamic-variable editor. `'all'` is UI-only (the
* generated `TelemetrytypesSignalDTO` has no "all") — it searches across every
* signal and maps to an omitted `signal` on the wire (see {@link signalForApi}).
*/
export const DYNAMIC_SIGNAL_ALL = 'all' as const;
export type DynamicSignalOption = TelemetrySignal | typeof DYNAMIC_SIGNAL_ALL;
/**
* Sort order for list-variable values, keyed by the generated wire enum so the
* form model and the DTO `sort` field share one source of truth. The friendly
@@ -81,25 +64,38 @@ export const VARIABLE_SORT_LABEL: Record<VariableSort, string> = {
[VARIABLE_SORT.CI_DESC]: 'Alphabetical, case-insensitive (descending)',
};
export const DYNAMIC_SIGNALS: DynamicSignalOption[] = [
DYNAMIC_SIGNAL_ALL,
TelemetrytypesSignalDTO.traces,
TelemetrytypesSignalDTO.logs,
TelemetrytypesSignalDTO.metrics,
export const DYNAMIC_SIGNALS: DashboardtypesDynamicVariableSignalDTO[] = [
DashboardtypesDynamicVariableSignalDTO.all,
DashboardtypesDynamicVariableSignalDTO.traces,
DashboardtypesDynamicVariableSignalDTO.logs,
DashboardtypesDynamicVariableSignalDTO.metrics,
];
export const DYNAMIC_SIGNAL_LABEL: Record<DynamicSignalOption, string> = {
[DYNAMIC_SIGNAL_ALL]: 'All telemetry',
[TelemetrytypesSignalDTO.traces]: 'Traces',
[TelemetrytypesSignalDTO.logs]: 'Logs',
[TelemetrytypesSignalDTO.metrics]: 'Metrics',
export const DYNAMIC_SIGNAL_LABEL: Record<
DashboardtypesDynamicVariableSignalDTO,
string
> = {
[DashboardtypesDynamicVariableSignalDTO.all]: 'All telemetry',
[DashboardtypesDynamicVariableSignalDTO.traces]: 'Traces',
[DashboardtypesDynamicVariableSignalDTO.logs]: 'Logs',
[DashboardtypesDynamicVariableSignalDTO.metrics]: 'Metrics',
};
/** Maps the editor's signal selection to the wire value (`'all'` → omitted). */
/**
* Field-keys/values API param. The `all` signal is omitted (that endpoint only
* accepts a concrete signal), everything else passes through.
*/
export function signalForApi(
signal: DynamicSignalOption,
): TelemetrySignal | undefined {
return signal === DYNAMIC_SIGNAL_ALL ? undefined : signal;
signal: DashboardtypesDynamicVariableSignalDTO,
):
| Exclude<
DashboardtypesDynamicVariableSignalDTO,
DashboardtypesDynamicVariableSignalDTO.all
>
| undefined {
return signal === DashboardtypesDynamicVariableSignalDTO.all
? undefined
: signal;
}
type SortableValues = (string | number | boolean)[];
@@ -144,7 +140,7 @@ export interface VariableFormModel {
textValue: string; // TEXT
textConstant: boolean; // TEXT
dynamicAttribute: string; // DYNAMIC — the telemetry field name
dynamicSignal: DynamicSignalOption; // DYNAMIC — the telemetry signal
dynamicSignal: DashboardtypesDynamicVariableSignalDTO; // DYNAMIC — the telemetry signal (`all` = every signal)
/**
* Runtime-selected default, not editable in the management tab yet; carried
@@ -166,6 +162,6 @@ export function emptyVariableFormModel(): VariableFormModel {
textValue: '',
textConstant: false,
dynamicAttribute: '',
dynamicSignal: DYNAMIC_SIGNAL_ALL,
dynamicSignal: DashboardtypesDynamicVariableSignalDTO.all,
};
}

View File

@@ -17,8 +17,6 @@ const SIGNAL_LABEL: Record<TelemetrytypesSignalDTO, string> = {
[TelemetrytypesSignalDTO.logs]: 'logs',
[TelemetrytypesSignalDTO.traces]: 'traces',
[TelemetrytypesSignalDTO.metrics]: 'metrics',
// The empty "any" signal only appears on field keys, never on a panel query;
// mapped for exhaustiveness.
[TelemetrytypesSignalDTO['']]: '',
};

View File

@@ -120,7 +120,7 @@ export const SECTION_REGISTRY: {
[SectionKind.ContextLinks]: {
Component: ContextLinksSection,
// Panel-level slice (spec.links), not under the plugin spec — no cast needed.
get: (spec): DashboardtypesLinkDTO[] | undefined => spec.links ?? undefined,
get: (spec): DashboardtypesLinkDTO[] => spec.links,
update: (spec, links): PanelSpec => ({ ...spec, links }),
},
// One editor for every threshold variant (label / comparison / table); the kind's

View File

@@ -49,6 +49,14 @@ describe('newPanelRoute', () => {
return { path, params: new URLSearchParams(search) };
};
// Mirrors useGetCompositeQueryParam: it decodes the param twice.
const readCompositeQuery = (params: URLSearchParams): unknown =>
JSON.parse(
decodeURIComponent(
(params.get('compositeQuery') as string).replace(/\+/g, ' '),
),
);
it.each([
[PANEL_TYPES.TIME_SERIES, 'signoz/TimeSeriesPanel'],
[PANEL_TYPES.TABLE, 'signoz/TablePanel'],
@@ -67,16 +75,34 @@ describe('newPanelRoute', () => {
);
});
it('carries the query as a decodable compositeQuery param', () => {
it('carries the query as a compositeQuery param the reader can decode', () => {
const link = buildExportPanelLink({
dashboardId: 'dash-1',
panelType: PANEL_TYPES.TIME_SERIES,
query,
});
const { params } = parseLink(link);
expect(JSON.parse(params.get('compositeQuery') as string)).toStrictEqual(
query,
);
expect(readCompositeQuery(params)).toStrictEqual(query);
});
// Regression: a bare `%`/`+` must survive the reader's double-decode.
it('round-trips a filter expression containing % and + literals', () => {
const queryWithLiterals = {
id: 'q1',
queryType: 'builder',
builder: {
queryData: [
{ filter: { expression: "severity_text ILIKE 'Inf%' AND path = 'a+b'" } },
],
},
} as unknown as Query;
const link = buildExportPanelLink({
dashboardId: 'dash-1',
panelType: PANEL_TYPES.LIST,
query: queryWithLiterals,
});
const { params } = parseLink(link);
expect(readCompositeQuery(params)).toStrictEqual(queryWithLiterals);
});
it('returns null for a panel type with no V2 kind', () => {

View File

@@ -45,9 +45,11 @@ export function parseNewPanelKind(
/**
* New-panel editor link that exports an explorer query into a V2 dashboard. Carries the
* raw `Query` as `compositeQuery` encoded as the V1 link so `useGetCompositeQueryParam`
* reads it identically (conversion happens in the editor). `null` when the panel type has
* no V2 kind, so the caller skips the export instead of landing on an unrelated kind.
* raw `Query` as `compositeQuery` (conversion happens in the editor). `null` when the panel
* type has no V2 kind, so the caller skips the export instead of landing on an unrelated kind.
*
* Double-encoded on purpose: `useGetCompositeQueryParam` decodes twice, so a single encode
* would let a bare `%`/`+` (e.g. `ILIKE 'Inf%'`) break its second decode and drop the query.
*/
export function buildExportPanelLink({
dashboardId,
@@ -68,7 +70,7 @@ export function buildExportPanelLink({
});
return `${path}${newPanelSearch(kind)}&${
QueryParams.compositeQuery
}=${encodeURIComponent(JSON.stringify(query))}`;
}=${encodeURIComponent(encodeURIComponent(JSON.stringify(query)))}`;
}
/** Target section index for a new panel, or undefined when unset/invalid. */

View File

@@ -0,0 +1,80 @@
import type { DashboardtypesQueryDTO } from 'api/generated/services/sigNoz.schemas';
import { countEnabledQueries } from '../countEnabledQueries';
function compositeQuery(
envelopes: { type: string; disabled?: boolean }[],
): DashboardtypesQueryDTO {
return {
spec: {
plugin: {
kind: 'signoz/CompositeQuery',
spec: {
queries: envelopes.map(({ type, disabled }) => ({
type,
spec: { disabled },
})),
},
},
},
} as unknown as DashboardtypesQueryDTO;
}
function bareBuilderQuery(disabled?: boolean): DashboardtypesQueryDTO {
return {
spec: {
plugin: { kind: 'signoz/BuilderQuery', spec: { signal: 'logs', disabled } },
},
} as unknown as DashboardtypesQueryDTO;
}
describe('countEnabledQueries', () => {
it('returns 0 when there are no queries', () => {
expect(countEnabledQueries([])).toBe(0);
});
it('counts every enabled envelope inside the composite wrapper', () => {
expect(
countEnabledQueries([
compositeQuery([{ type: 'builder_query' }, { type: 'builder_query' }]),
]),
).toBe(2);
});
it('does not count disabled envelopes', () => {
expect(
countEnabledQueries([
compositeQuery([
{ type: 'builder_query' },
{ type: 'builder_query', disabled: true },
]),
]),
).toBe(1);
});
it('counts formula envelopes alongside builder queries', () => {
expect(
countEnabledQueries([
compositeQuery([
{ type: 'builder_query' },
{ type: 'builder_query' },
{ type: 'builder_formula' },
]),
]),
).toBe(3);
});
it('treats an absent disabled flag as enabled', () => {
expect(
countEnabledQueries([compositeQuery([{ type: 'builder_query' }])]),
).toBe(1);
});
it('unwraps a bare builder query (List panel shape)', () => {
expect(countEnabledQueries([bareBuilderQuery()])).toBe(1);
});
it('does not count a disabled bare builder query', () => {
expect(countEnabledQueries([bareBuilderQuery(true)])).toBe(0);
});
});

View File

@@ -0,0 +1,8 @@
import type { DashboardtypesQueryDTO } from 'api/generated/services/sigNoz.schemas';
import { toQueryEnvelopes } from 'pages/DashboardPageV2/DashboardContainer/queryV5/buildQueryRangeRequest';
/** Counts enabled queries, unwrapping the single `signoz/CompositeQuery` wrapper. */
export function countEnabledQueries(queries: DashboardtypesQueryDTO[]): number {
return toQueryEnvelopes(queries).filter((envelope) => !envelope.spec?.disabled)
.length;
}

View File

@@ -1,4 +1,7 @@
import { TelemetrytypesSignalDTO } from 'api/generated/services/sigNoz.schemas';
import {
DashboardtypesDynamicVariableSignalDTO,
TelemetrytypesSignalDTO,
} from 'api/generated/services/sigNoz.schemas';
import type { BuilderQuery } from 'types/api/v5/queryRange';
/**
@@ -17,3 +20,23 @@ export function resolveDrilldownSignal(
return TelemetrytypesSignalDTO.metrics;
}
}
/**
* Maps a clicked query's telemetry signal to a dynamic-variable signal (used
* when a drilldown seeds a new variable). Concrete signals map 1:1; an unset
* signal (no active drilldown) falls back to `all`.
*/
export function dynamicSignalFromQuerySignal(
signal?: TelemetrytypesSignalDTO,
): DashboardtypesDynamicVariableSignalDTO {
switch (signal) {
case TelemetrytypesSignalDTO.traces:
return DashboardtypesDynamicVariableSignalDTO.traces;
case TelemetrytypesSignalDTO.logs:
return DashboardtypesDynamicVariableSignalDTO.logs;
case TelemetrytypesSignalDTO.metrics:
return DashboardtypesDynamicVariableSignalDTO.metrics;
default:
return DashboardtypesDynamicVariableSignalDTO.all;
}
}

View File

@@ -15,6 +15,7 @@ import PanelHeaderSearch from './PanelHeaderSearch';
import PanelStatusPopover from '../PanelStatus/PanelStatusPopover';
import {
panelStatusFromError,
panelStatusFromMultipleEnabledQueries,
panelStatusFromWarning,
} from '../PanelStatus/utils';
import styles from './PanelHeader.module.scss';
@@ -74,11 +75,24 @@ function PanelHeader({
[warning],
);
// Client-derived: warn a Number panel that has more than one enabled query (#9512).
const multiQueryWarningDetail = useMemo(
() => panelStatusFromMultipleEnabledQueries(panel),
[panel],
);
/**
* Hide the entire header when there's no title, description, or status to show,
* and the actions menu is suppressed (editor preview).
*/
if (!name && !description && !errorDetail && !warningDetail && hideActions) {
if (
!name &&
!description &&
!errorDetail &&
!warningDetail &&
!multiQueryWarningDetail &&
hideActions
) {
return <Fragment />;
}
@@ -124,6 +138,13 @@ function PanelHeader({
{warningDetail && (
<PanelStatusPopover variant="warning" detail={warningDetail} />
)}
{multiQueryWarningDetail && (
<PanelStatusPopover
variant="warning"
detail={multiQueryWarningDetail}
testId="panel-status-config-warning"
/>
)}
{/* Renders nothing when no action survives its gates (kind/role/context). */}
{!hideActions && (
<PanelActionsMenu

View File

@@ -17,6 +17,8 @@ const VARIANT_CONFIG: Record<
interface PanelStatusPopoverProps {
variant: PanelStatusVariant;
detail: PanelStatusDetail;
/** Overrides the trigger's test id; defaults to `panel-status-<variant>`. */
testId?: string;
}
/**
@@ -26,6 +28,7 @@ interface PanelStatusPopoverProps {
function PanelStatusPopover({
variant,
detail,
testId,
}: PanelStatusPopoverProps): JSX.Element {
const { color, ariaLabel } = VARIANT_CONFIG[variant];
const Icon = variant === 'error' ? CircleX : TriangleAlert;
@@ -41,7 +44,7 @@ function PanelStatusPopover({
<span
className={styles.trigger}
aria-label={ariaLabel}
data-testid={`panel-status-${variant}`}
data-testid={testId ?? `panel-status-${variant}`}
>
<Icon size={16} color={color} />
</span>

View File

@@ -1,9 +1,16 @@
import type { RenderErrorResponseDTO } from 'api/generated/services/sigNoz.schemas';
import type {
DashboardtypesPanelDTO,
Querybuildertypesv5QueryWarnDataDTO as WarningDTO,
RenderErrorResponseDTO,
} from 'api/generated/services/sigNoz.schemas';
import type { AxiosError } from 'axios';
import type { Querybuildertypesv5QueryWarnDataDTO as WarningDTO } from 'api/generated/services/sigNoz.schemas';
import { StatusCodes } from 'http-status-codes';
import { panelStatusFromError, panelStatusFromWarning } from '../utils';
import {
panelStatusFromError,
panelStatusFromMultipleEnabledQueries,
panelStatusFromWarning,
} from '../utils';
// The query layer rejects with the raw AxiosError from the generated client
// (it is not pre-converted to APIError), so the tests mirror that wire shape.
@@ -87,3 +94,62 @@ describe('panelStatusFromWarning', () => {
});
});
});
function panel(
kind: string,
envelopes: { disabled?: boolean }[],
): DashboardtypesPanelDTO {
return {
spec: {
plugin: { kind, spec: {} },
queries: [
{
spec: {
plugin: {
kind: 'signoz/CompositeQuery',
spec: {
queries: envelopes.map(({ disabled }) => ({
type: 'builder_query',
spec: { disabled },
})),
},
},
},
},
],
},
} as unknown as DashboardtypesPanelDTO;
}
describe('panelStatusFromMultipleEnabledQueries', () => {
it('warns when a Number panel has more than one enabled query', () => {
const detail = panelStatusFromMultipleEnabledQueries(
panel('signoz/NumberPanel', [{}, {}]),
);
expect(detail).not.toBeNull();
expect(detail?.message).toMatch(/single value/i);
expect(detail?.messages).toHaveLength(1);
});
it('counts only enabled queries (a disabled second query is fine)', () => {
expect(
panelStatusFromMultipleEnabledQueries(
panel('signoz/NumberPanel', [{}, { disabled: true }]),
),
).toBeNull();
});
it('does not warn when a Number panel has a single enabled query', () => {
expect(
panelStatusFromMultipleEnabledQueries(panel('signoz/NumberPanel', [{}])),
).toBeNull();
});
it('does not warn for other panel kinds even with multiple enabled queries', () => {
expect(
panelStatusFromMultipleEnabledQueries(
panel('signoz/TimeSeriesPanel', [{}, {}]),
),
).toBeNull();
});
});

View File

@@ -1,7 +1,11 @@
import { convertToApiError } from 'api/ErrorResponseHandlerForGeneratedAPIs';
import type { RenderErrorResponseDTO } from 'api/generated/services/sigNoz.schemas';
import type {
DashboardtypesPanelDTO,
Querybuildertypesv5QueryWarnDataDTO as WarningDTO,
RenderErrorResponseDTO,
} from 'api/generated/services/sigNoz.schemas';
import type { AxiosError } from 'axios';
import type { Querybuildertypesv5QueryWarnDataDTO as WarningDTO } from 'api/generated/services/sigNoz.schemas';
import { countEnabledQueries } from 'pages/DashboardPageV2/DashboardContainer/Panels/utils/countEnabledQueries';
import type { PanelStatusDetail } from './types';
@@ -52,3 +56,25 @@ export function panelStatusFromWarning(
.filter((message): message is string => Boolean(message)),
};
}
/**
* A Number panel renders only the first query's value, so more than one enabled
* query silently hides the rest. Warns for that case; null otherwise.
*/
export function panelStatusFromMultipleEnabledQueries(
panel: DashboardtypesPanelDTO,
): PanelStatusDetail | null {
if (panel.spec.plugin.kind !== 'signoz/NumberPanel') {
return null;
}
if (countEnabledQueries(panel.spec.queries) <= 1) {
return null;
}
return {
message:
'This panel shows a single value, but more than one query is enabled.',
messages: [
"Disable the queries you don't want to display, keeping only the one whose value you want to show.",
],
};
}

View File

@@ -41,6 +41,40 @@ function makePanel(overrides?: {
} as unknown as DashboardtypesPanelDTO;
}
// Blank name so the editor-preview guard test relies on the warning alone.
function makePanelWithQueries(
kind: string,
enabled: number,
disabled = 0,
): DashboardtypesPanelDTO {
const envelope = (isDisabled: boolean): unknown => ({
type: 'builder_query',
spec: { disabled: isDisabled },
});
return {
kind: 'Panel',
spec: {
display: { name: '' },
plugin: { kind, spec: {} },
queries: [
{
spec: {
plugin: {
kind: 'signoz/CompositeQuery',
spec: {
queries: [
...Array.from({ length: enabled }, () => envelope(false)),
...Array.from({ length: disabled }, () => envelope(true)),
],
},
},
},
},
],
},
} as unknown as DashboardtypesPanelDTO;
}
const baseProps = {
panel: makePanel(),
panelId: 'panel-1',
@@ -101,6 +135,53 @@ describe('PanelHeader status indicators', () => {
});
});
describe('PanelHeader multi-query config warning (issue #9512)', () => {
it('warns when a Number panel has more than one enabled query', () => {
renderWithProvider(
<PanelHeader
{...baseProps}
panel={makePanelWithQueries('signoz/NumberPanel', 2)}
/>,
);
expect(screen.getByTestId('panel-status-config-warning')).toBeInTheDocument();
});
it('does not warn when only one query is enabled (others disabled)', () => {
renderWithProvider(
<PanelHeader
{...baseProps}
panel={makePanelWithQueries('signoz/NumberPanel', 1, 2)}
/>,
);
expect(
screen.queryByTestId('panel-status-config-warning'),
).not.toBeInTheDocument();
});
it('does not warn for non-Number panels with multiple enabled queries', () => {
renderWithProvider(
<PanelHeader
{...baseProps}
panel={makePanelWithQueries('signoz/TimeSeriesPanel', 3)}
/>,
);
expect(
screen.queryByTestId('panel-status-config-warning'),
).not.toBeInTheDocument();
});
it('shows the warning in the editor preview (hideActions, no title)', () => {
renderWithProvider(
<PanelHeader
{...baseProps}
panel={makePanelWithQueries('signoz/NumberPanel', 2)}
hideActions
/>,
);
expect(screen.getByTestId('panel-status-config-warning')).toBeInTheDocument();
});
});
describe('PanelHeader search', () => {
it('renders no search affordance when the panel is not searchable', () => {
renderWithProvider(<PanelHeader {...baseProps} />);

View File

@@ -1,6 +1,6 @@
import { render, renderHook, screen } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import { TelemetrytypesSignalDTO } from 'api/generated/services/sigNoz.schemas';
import { DashboardtypesDynamicVariableSignalDTO } from 'api/generated/services/sigNoz.schemas';
import type { FilterData } from 'container/QueryTable/Drilldown/drilldownUtils';
import DrilldownDashboardVariablesMenu from '../DrilldownMenu/DrilldownDashboardVariablesMenu';
@@ -63,7 +63,6 @@ jest.mock(
'pages/DashboardPageV2/DashboardContainer/DashboardSettings/Variables/variableFormModel',
() => ({
emptyVariableFormModel: (): unknown => ({}),
DYNAMIC_SIGNAL_ALL: 'all',
}),
);
jest.mock('components/OverlayScrollbar/OverlayScrollbar', () => ({
@@ -84,7 +83,7 @@ function renderItems(): void {
const { result } = renderHook(() =>
useDrilldownDashboardVariables({
filters,
signal: TelemetrytypesSignalDTO.metrics,
signal: DashboardtypesDynamicVariableSignalDTO.metrics,
onClose: jest.fn(),
}),
);

View File

@@ -19,6 +19,7 @@ import { buildAggregateData } from 'pages/DashboardPageV2/DashboardContainer/Pan
import { getBuilderQueries } from 'pages/DashboardPageV2/DashboardContainer/Panels/utils/getBuilderQueries';
import { getPanelQueryType } from 'pages/DashboardPageV2/DashboardContainer/Panels/utils/getPanelQueryType';
import { fromPerses } from 'pages/DashboardPageV2/DashboardContainer/queryV5/persesQueryAdapters';
import { dynamicSignalFromQuerySignal } from 'pages/DashboardPageV2/DashboardContainer/Panels/utils/drilldown/signal';
import { DashboardDetailEvents } from 'pages/DashboardPageV2/constants/events';
import { EQueryType } from 'types/common/dashboard';
@@ -163,7 +164,7 @@ export function useDrilldown(
const dashboardVariables = useDrilldownDashboardVariables({
filters: context?.filters ?? EMPTY_FILTERS,
signal: context?.signal,
signal: dynamicSignalFromQuerySignal(context?.signal),
onClose: handleClose,
});
@@ -221,7 +222,7 @@ export function useDrilldown(
context={context}
query={v1Query}
isResolving={isResolving}
links={panel.spec.links ?? undefined}
links={panel.spec.links}
canSetDashboardVariables={dashboardVariables.hasFieldVariables}
onViewLogs={(): void => navigate('view_logs')}
onViewTraces={(): void => navigate('view_traces')}

View File

@@ -1,14 +1,13 @@
import { useCallback, useMemo } from 'react';
import { toast } from '@signozhq/ui/sonner';
import logEvent from 'api/common/logEvent';
import type { TelemetrytypesSignalDTO } from 'api/generated/services/sigNoz.schemas';
import { DashboardtypesDynamicVariableSignalDTO } from 'api/generated/services/sigNoz.schemas';
import type { FilterData } from 'container/QueryTable/Drilldown/drilldownUtils';
import {
dtoToFormModel,
formModelToDto,
} from 'pages/DashboardPageV2/DashboardContainer/DashboardSettings/Variables/variableAdapters';
import {
DYNAMIC_SIGNAL_ALL,
emptyVariableFormModel,
type VariableFormModel,
} from 'pages/DashboardPageV2/DashboardContainer/DashboardSettings/Variables/variableFormModel';
@@ -23,8 +22,8 @@ import { DashboardDetailEvents } from 'pages/DashboardPageV2/constants/events';
interface UseDrilldownDashboardVariablesArgs {
/** Group-by field filters from the clicked point (empty when the click has no group-by). */
filters: FilterData[];
/** Clicked query's telemetry signal — seeds a created variable's `dynamicSignal`. */
signal?: TelemetrytypesSignalDTO;
/** Dynamic-variable signal derived from the clicked query — seeds a created variable's `dynamicSignal`. */
signal?: DashboardtypesDynamicVariableSignalDTO;
onClose: () => void;
}
@@ -111,8 +110,7 @@ export function useDrilldownDashboardVariables({
type: 'DYNAMIC',
multiSelect: true,
dynamicAttribute: fieldName,
// `||` (not `??`): an empty "any" signal maps to All, same as unset.
dynamicSignal: signal || DYNAMIC_SIGNAL_ALL,
dynamicSignal: signal ?? DashboardtypesDynamicVariableSignalDTO.all,
};
try {
await patchAsync(

View File

@@ -0,0 +1,5 @@
.footer {
display: flex;
justify-content: flex-end;
gap: 8px;
}

View File

@@ -1,8 +1,10 @@
import { useEffect, useState } from 'react';
import { Modal } from 'antd';
import { Button } from '@signozhq/ui/button';
import { DialogWrapper } from '@signozhq/ui/dialog';
import { Input } from '@signozhq/ui/input';
import { DASHBOARD_NAME_MAX_LENGTH } from '../../constants';
import styles from './SectionTitleModal.module.scss';
interface SectionTitleModalProps {
open: boolean;
@@ -17,7 +19,7 @@ interface SectionTitleModalProps {
onSubmit: (title: string) => void;
}
/** Title-entry modal shared by section create and rename. */
/** Title-entry modal shared by section create and rename (mirrors RenameDashboardModal). */
function SectionTitleModal({
open,
heading,
@@ -37,22 +39,51 @@ function SectionTitleModal({
}
}, [open, initialValue]);
// `!isSaving` also guards a second submit (e.g. a double Enter) while a request
// is in flight — otherwise two sections would be created.
const canSave = value.trim().length > 0 && !isSaving;
const submit = (): void => {
const trimmed = value.trim();
if (trimmed) {
onSubmit(trimmed);
if (!canSave) {
return;
}
onSubmit(value.trim());
};
return (
<Modal
open={open}
<DialogWrapper
title={heading}
onCancel={onClose}
onOk={submit}
okText={okText}
okButtonProps={{ disabled: isSaving || !value.trim() }}
destroyOnClose
open={open}
width="narrow"
onOpenChange={(next): void => {
if (!next) {
onClose();
}
}}
footer={
<div className={styles.footer}>
<Button
variant="ghost"
color="secondary"
size="md"
onClick={onClose}
testId="section-title-cancel"
>
Cancel
</Button>
<Button
variant="solid"
color="primary"
size="md"
disabled={!canSave}
loading={isSaving}
onClick={submit}
testId="section-title-submit"
>
{okText}
</Button>
</div>
}
>
<Input
testId="section-title-input"
@@ -62,13 +93,13 @@ function SectionTitleModal({
placeholder={placeholder}
onChange={(e): void => setValue(e.target.value)}
onKeyDown={(e): void => {
if (e.key === 'Enter') {
if (e.key === 'Enter' && canSave) {
e.preventDefault();
submit();
}
}}
/>
</Modal>
</DialogWrapper>
);
}

View File

@@ -21,7 +21,7 @@ interface Params {
}
interface Result {
addSection: (title: string) => Promise<void>;
addSection: (title: string) => Promise<boolean>;
isSaving: boolean;
}
@@ -38,10 +38,10 @@ export function useAddSection({ layouts }: Params): Result {
const setScrollTargetId = useScrollIntoViewStore((s) => s.setScrollTargetId);
const addSection = useCallback(
async (title: string): Promise<void> => {
async (title: string): Promise<boolean> => {
const trimmed = title.trim();
if (!dashboardId || !trimmed) {
return;
return false;
}
const isFirstSection = !layouts || layouts.length === 0;
const op = isFirstSection
@@ -58,8 +58,10 @@ export function useAddSection({ layouts }: Params): Result {
// key it the way `getSectionStableId` does so it reveals itself on render.
const newIndex = isFirstSection ? 0 : layouts.length;
setScrollTargetId(getSectionStableId([], newIndex));
return true;
} catch (error) {
showErrorModal(error as APIError);
return false;
} finally {
setIsSaving(false);
}

View File

@@ -7,6 +7,7 @@ import { useErrorModal } from 'providers/ErrorModalProvider';
import APIError from 'types/api/error';
import { useOptimisticPatch } from '../../../hooks/useOptimisticPatch';
import { compactGridItems } from '../../../layoutCompaction';
import { replaceSectionItemsOp } from '../../../patchOps';
import { useDashboardStore } from '../../../store/useDashboardStore';
import type { GridItem } from '../../../utils';
@@ -76,7 +77,9 @@ export function usePersistLayout({ layoutIndex, items }: Params): Result {
if (!dashboardId) {
return;
}
const nextItems = mergeRglLayout(rglLayout, items);
// Compact to the snapped, non-overlapping layout RGL shows on-screen, so
// the persisted geometry can never trip the backend's no-overlap check.
const nextItems = compactGridItems(mergeRglLayout(rglLayout, items));
if (!hasGeometryChanged(nextItems, items)) {
return;
}

View File

@@ -86,6 +86,47 @@
:global(.ant-select-selection-overflow) {
flex-wrap: nowrap;
}
// The shared NewSelect selector scrolls (max-height: 200px; overflow: auto),
// which surfaces horizontal + vertical scrollbars inside the fixed-width
// variable pill. Clip instead — the value is a single line (maxTagCount + "+N"),
// so there is nothing to scroll to.
:global(.ant-select-selector) {
max-height: none !important;
overflow: hidden !important;
}
// Let the first tag shrink and truncate so the layout stays [tag…][+N]. Without
// this the "+N" overflow item wins the row's space and the (longer) first tag
// gets offset/clipped — visible after switching a value from ALL to a subset.
:global(.ant-select-selection-overflow-item) {
min-width: 0;
}
:global(.ant-select-selection-item) {
min-width: 0;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
// The shared .custom-multiselect forces the search box to a 60px floor
// (min-width: 60px !important). In this narrow variable pill that reserved
// width is what offsets/clips the tag row, so collapse it here — the extra
// selectors out-specify the shared rule's !important. It still expands to fit
// what the user types while the dropdown is open.
:global(.ant-select-selector .ant-select-selection-search) {
min-width: 0 !important;
flex: 0 1 auto;
}
:global(
.ant-select-selector
.ant-select-selection-search
.ant-select-selection-search-input
) {
min-width: 0 !important;
}
}
.overflowTooltip {

Some files were not shown because too many files have changed in this diff Show More