Compare commits

...

1 Commits

Author SHA1 Message Date
Naman Verma
d3a278c43e docs: perses schema for dashboards 2026-03-17 14:56:07 +05:30
31 changed files with 965 additions and 0 deletions

View File

@@ -0,0 +1,70 @@
package common
// Signal is the telemetry signal type for a builder query.
#Signal: "metrics" | "logs" | "traces"
// QueryName is a valid identifier for a query (e.g., "A", "B1", "my_query").
#QueryName: =~"^[A-Za-z][A-Za-z0-9_]*$"
// ReduceTo specifies how a multi-series result is reduced to a single value.
#ReduceTo: "sum" | "count" | "avg" | "min" | "max" | "last" | "median"
// Limit constrains the maximum number of result rows.
#Limit: int & >=0 & <=10000
// PageSize constrains the number of rows per page.
#PageSize: int & >=1
// Offset is a non-negative row offset for pagination.
#Offset: int & >=0
// VariableSortOrder controls how variable values are sorted.
#VariableSortOrder: *"DISABLED" | "ASC" | "DESC"
// MetricAggregation defines a structured aggregation for metrics queries.
#MetricAggregation: close({
metricName: string & !=""
timeAggregation: "latest" | "sum" | "avg" | "min" | "max" | "count" | "rate" | "increase"
spaceAggregation: "sum" | "avg" | "min" | "max" | "count" | "p50" | "p75" | "p90" | "p95" | "p99"
reduceTo?: #ReduceTo
temporality?: "delta" | "cumulative" | "unspecified"
})
// ExpressionAggregation defines an expression-based aggregation for logs/traces queries.
#ExpressionAggregation: close({
expression: string & !=""
alias?: string
})
// FilterExpression is a filter condition string.
#FilterExpression: close({
expression: string
})
// GroupByItem specifies a grouping column.
#GroupByItem: close({
name: string & !=""
fieldDataType?: string
fieldContext?: string
})
// OrderByItem specifies a column ordering.
#OrderByItem: close({
columnName: string & !=""
order: "asc" | "desc"
})
// HavingExpression is a post-aggregation filter.
#HavingExpression: close({
expression: string
})
// Function is a post-query transformation.
#Function: close({
name: "cutOffMin" | "cutOffMax" | "clampMin" | "clampMax" |
"absolute" | "runningDiff" | "log2" | "log10" |
"cumulativeSum" | "ewma3" | "ewma5" | "ewma7" |
"median3" | "median5" | "median7" | "timeShift" |
"anomaly" | "fillZero"
args?: [...close({value: number | string | bool})]
})

View File

@@ -0,0 +1,4 @@
module: "github.com/signoz/signoz/schemas"
language: {
version: "v0.12.0"
}

View File

@@ -0,0 +1,9 @@
{
"id": "signoz",
"name": "signoz",
"metaData": {
"buildInfo": {
"buildVersion": "0.0.1"
}
}
}

118
perses/config/package.json Normal file
View File

@@ -0,0 +1,118 @@
{
"name": "@signoz/perses-plugin",
"version": "0.0.1",
"_comment_panels": "TimeSeriesChart is the only panel type used currently. Other Perses built-in panels like StatChart, GaugeChart, BarChart, PieChart, Table, etc. can be added as needed.",
"_comment_queries": "Only TimeSeriesQuery is used currently since the example dashboard only has time series queries. LogQuery, TraceQuery, and ProfileQuery kinds will also be needed.",
"perses": {
"plugins": [
{
"kind": "Panel",
"spec": {
"name": "TimeSeriesChart",
"display": {
"name": "Time Series Chart"
}
}
},
{
"kind": "TimeSeriesQuery",
"spec": {
"name": "SigNozBuilderQuery",
"display": {
"name": "SigNoz Builder Query"
}
}
},
{
"kind": "TimeSeriesQuery",
"spec": {
"name": "SigNozFormula",
"display": {
"name": "SigNoz Formula"
}
}
},
{
"kind": "TimeSeriesQuery",
"spec": {
"name": "SigNozJoin",
"display": {
"name": "SigNoz Join"
}
}
},
{
"kind": "TimeSeriesQuery",
"spec": {
"name": "SigNozTraceOperator",
"display": {
"name": "SigNoz Trace Operator"
}
}
},
{
"kind": "TimeSeriesQuery",
"spec": {
"name": "SigNozCompositeQuery",
"display": {
"name": "SigNoz Composite Query"
}
}
},
{
"kind": "TimeSeriesQuery",
"spec": {
"name": "SigNozPromQL",
"display": {
"name": "SigNoz PromQL"
}
}
},
{
"kind": "TimeSeriesQuery",
"spec": {
"name": "SigNozClickHouseSQL",
"display": {
"name": "SigNoz ClickHouse SQL"
}
}
},
{
"kind": "Variable",
"spec": {
"name": "SigNozQueryVariable",
"display": {
"name": "SigNoz Query Variable"
}
}
},
{
"kind": "Variable",
"spec": {
"name": "SigNozCustomVariable",
"display": {
"name": "SigNoz Custom Variable"
}
}
},
{
"kind": "Variable",
"spec": {
"name": "SigNozDynamicVariable",
"display": {
"name": "SigNoz Dynamic Variable"
}
}
},
{
"kind": "Datasource",
"spec": {
"name": "SigNozDatasource",
"display": {
"name": "SigNoz Datasource"
}
}
}
]
}
}

View File

@@ -0,0 +1,27 @@
Panel Plugins
All SigNoz panels use Perses built-in panel kinds directly. No custom CUE
schemas exist yet because Perses does not publish CUE schemas for its panel
plugins (only Go SDK + TypeScript). Once it does, each panel can embed the
upstream spec and add the SigNoz-specific fields listed below.
SigNoz-specific fields by panel type:
TimeSeriesChart timePreference
StatChart timePreference, contextLinks
BarChart timePreference, contextLinks
PieChart timePreference, contextLinks
Table timePreference, contextLinks
LogsTable (List) timePreference, selectedLogFields, selectedTracesFields, columnWidths
TraceTable timePreference, selectedTracesFields, columnWidths
HistogramChart timePreference, contextLinks, bucketCount, bucketWidth, mergeAllActiveQueries
Common fields:
timePreference — panel-local vs dashboard-global time range
contextLinks — clickable drill-down links on data points
Panel-specific fields:
selectedLogFields / selectedTracesFields — which fields to display as columns in list views
columnWidths — saved column width overrides
bucketCount / bucketWidth — histogram bucket configuration
mergeAllActiveQueries — combine multiple queries into one histogram

View File

@@ -0,0 +1,37 @@
package model
import "github.com/signoz/signoz/schemas/common"
// Source: pkg/types/querybuildertypes/querybuildertypesv5/builder_query.go — QueryBuilderQuery
kind: "SigNozBuilderQuery"
spec: close({
name: common.#QueryName
signal: common.#Signal
expression: string
disabled?: bool | *false
// Metrics use structured aggregations; logs/traces use expression-based.
aggregations?: [...common.#MetricAggregation]
expressionAggregations?: [...common.#ExpressionAggregation]
filter?: common.#FilterExpression
groupBy?: [...common.#GroupByItem]
order?: [...common.#OrderByItem]
selectFields?: [...]
limit?: common.#Limit
limitBy?: #LimitBy
offset?: common.#Offset
cursor?: string
having?: common.#HavingExpression
// secondaryAggregations not added — not yet implemented.
functions?: [...common.#Function]
legend?: string
stepInterval?: number
reduceTo?: common.#ReduceTo
pageSize?: common.#PageSize
source?: string
})
#LimitBy: close({
keys: [...string]
value: string
})

View File

@@ -0,0 +1,24 @@
{
"kind": "SigNozBuilderQuery",
"spec": {
"name": "A",
"signal": "metrics",
"expression": "A",
"aggregations": [
{
"metricName": "redis_keyspace_hits",
"timeAggregation": "rate",
"spaceAggregation": "sum",
"reduceTo": "sum"
}
],
"filter": {
"expression": "host_name IN $host_name"
},
"groupBy": [],
"order": [],
"disabled": false,
"legend": "Hit/s across all hosts",
"stepInterval": 60
}
}

View File

@@ -0,0 +1,12 @@
package model
import "github.com/signoz/signoz/schemas/common"
// Source: pkg/types/querybuildertypes/querybuildertypesv5/clickhouse_query.go — ClickHouseQuery
kind: "SigNozClickHouseSQL"
spec: close({
name: common.#QueryName
query: string & !=""
disabled?: bool | *false
legend?: string
})

View File

@@ -0,0 +1,9 @@
{
"kind": "SigNozClickHouseSQL",
"spec": {
"name": "A",
"query": "SELECT toStartOfInterval(timestamp, INTERVAL 1 MINUTE) AS ts, count() AS total FROM signoz_logs.distributed_logs GROUP BY ts ORDER BY ts",
"disabled": false,
"legend": "Log count"
}
}

View File

@@ -0,0 +1,24 @@
package model
// Source: pkg/types/querybuildertypes/querybuildertypesv5/req.go — CompositeQuery
// SigNozCompositeQuery groups multiple query plugins into a single
// query request. Each entry is a typed envelope whose spec is
// validated by the corresponding plugin schema.
kind: "SigNozCompositeQuery"
spec: close({
queries: [...#QueryEnvelope]
})
// QueryEnvelope wraps a single query plugin with a type discriminator.
#QueryEnvelope: close({
type: #QueryType
spec: {...}
})
#QueryType:
"builder_query" |
"builder_formula" |
"builder_join" |
"builder_trace_operator" |
"promql" |
"clickhouse_sql"

View File

@@ -0,0 +1,53 @@
{
"kind": "SigNozCompositeQuery",
"spec": {
"queries": [
{
"type": "builder_query",
"spec": {
"name": "A",
"signal": "metrics",
"expression": "A",
"aggregations": [
{
"metricName": "redis_keyspace_hits",
"timeAggregation": "rate",
"spaceAggregation": "sum",
"reduceTo": "sum"
}
],
"filter": {
"expression": "host_name IN $host_name"
}
}
},
{
"type": "builder_query",
"spec": {
"name": "B",
"signal": "metrics",
"expression": "B",
"aggregations": [
{
"metricName": "redis_keyspace_misses",
"timeAggregation": "rate",
"spaceAggregation": "sum",
"reduceTo": "sum"
}
],
"filter": {
"expression": "host_name IN $host_name"
}
}
},
{
"type": "builder_formula",
"spec": {
"name": "F1",
"expression": "A / (A + B) * 100",
"legend": "Hit rate %"
}
}
]
}
}

View File

@@ -0,0 +1,12 @@
package model
import "github.com/signoz/signoz/schemas/common"
// defaultValue lives on the Perses ListVariable wrapper (spec level).
kind: "SigNozCustomVariable"
spec: close({
customValue: string
sort?: common.#VariableSortOrder
multiSelect?: bool
showALLOption?: bool
})

View File

@@ -0,0 +1,8 @@
{
"kind": "SigNozCustomVariable",
"spec": {
"customValue": "production,staging,development",
"sort": "DISABLED",
"multiSelect": false
}
}

View File

@@ -0,0 +1,9 @@
package model
kind: "SigNozDatasource"
// SigNoz has a single built-in backend — the frontend already knows
// the API endpoint, so there is no connection config to validate.
// Add fields here if SigNoz ever supports multiple backends or
// configurable API versions.
spec: close({})

View File

@@ -0,0 +1,4 @@
{
"kind": "SigNozDatasource",
"spec": {}
}

View File

@@ -0,0 +1,13 @@
package model
import "github.com/signoz/signoz/schemas/common"
// defaultValue lives on the Perses ListVariable wrapper (spec level).
kind: "SigNozDynamicVariable"
spec: close({
dynamicVariablesAttribute: string
dynamicVariablesSource: string
sort?: common.#VariableSortOrder
multiSelect?: bool
showALLOption?: bool
})

View File

@@ -0,0 +1,10 @@
{
"kind": "SigNozDynamicVariable",
"spec": {
"dynamicVariablesAttribute": "host_name",
"dynamicVariablesSource": "metrics",
"sort": "ASC",
"multiSelect": true,
"showALLOption": true
}
}

View File

@@ -0,0 +1,16 @@
package model
import "github.com/signoz/signoz/schemas/common"
// Source: pkg/types/querybuildertypes/querybuildertypesv5/formula.go — QueryBuilderFormula
kind: "SigNozFormula"
spec: close({
name: common.#QueryName
expression: string
disabled?: bool | *false
legend?: string
limit?: common.#Limit
having?: common.#HavingExpression
stepInterval?: number
order?: [...common.#OrderByItem]
})

View File

@@ -0,0 +1,8 @@
{
"kind": "SigNozFormula",
"spec": {
"name": "F1",
"expression": "A / B * 100",
"legend": "Hit rate %"
}
}

View File

@@ -0,0 +1,30 @@
package model
import "github.com/signoz/signoz/schemas/common"
// Source: pkg/types/querybuildertypes/querybuildertypesv5/join.go — QueryBuilderJoin
kind: "SigNozJoin"
spec: close({
name: common.#QueryName
left: #QueryRef
right: #QueryRef
type: #JoinType
on: string
disabled?: bool | *false
aggregations?: [...common.#MetricAggregation]
expressionAggregations?: [...common.#ExpressionAggregation]
selectFields?: [...]
filter?: common.#FilterExpression
groupBy?: [...common.#GroupByItem]
having?: common.#HavingExpression
// secondaryAggregations not added — not yet implemented.
order?: [...common.#OrderByItem]
limit?: common.#Limit
functions?: [...common.#Function]
})
#QueryRef: close({
name: common.#QueryName
})
#JoinType: "inner" | "left" | "right" | "full" | "cross"

View File

@@ -0,0 +1,11 @@
{
"kind": "SigNozJoin",
"spec": {
"name": "J1",
"left": {"name": "A"},
"right": {"name": "B"},
"type": "inner",
"on": "service.name = service.name",
"disabled": false
}
}

View File

@@ -0,0 +1,14 @@
package model
import "github.com/signoz/signoz/schemas/common"
// Source: pkg/types/querybuildertypes/querybuildertypesv5/prom_query.go — PromQuery
kind: "SigNozPromQL"
spec: close({
name: common.#QueryName
query: string & !=""
disabled?: bool | *false
step?: number
stats?: bool
legend?: string
})

View File

@@ -0,0 +1,9 @@
{
"kind": "SigNozPromQL",
"spec": {
"name": "A",
"query": "rate(http_requests_total{status=\"200\"}[5m])",
"disabled": false,
"legend": "{{method}} {{path}}"
}
}

View File

@@ -0,0 +1,12 @@
package model
import "github.com/signoz/signoz/schemas/common"
// defaultValue lives on the Perses ListVariable wrapper (spec level).
kind: "SigNozQueryVariable"
spec: close({
queryValue: string
sort?: common.#VariableSortOrder
multiSelect?: bool
showALLOption?: bool
})

View File

@@ -0,0 +1,9 @@
{
"kind": "SigNozQueryVariable",
"spec": {
"queryValue": "SELECT DISTINCT host_name FROM signoz_metrics.distributed_time_series_v4_1day WHERE metric_name = 'redis_cpu_time'",
"sort": "ASC",
"multiSelect": true,
"showALLOption": true
}
}

View File

@@ -0,0 +1,31 @@
package model
import "github.com/signoz/signoz/schemas/common"
// Source: pkg/types/querybuildertypes/querybuildertypesv5/trace_operator.go — QueryBuilderTraceOperator
// SigNozTraceOperator composes multiple trace BuilderQueries using
// relational operators (=>, ->, &&, ||, NOT) to query trace relationships.
// Signal is implicitly "traces" — all referenced queries must be trace queries.
kind: "SigNozTraceOperator"
spec: close({
name: common.#QueryName
// Operator expression composing trace queries, e.g. "A => B && C".
expression: string & !=""
disabled?: bool | *false
// Which query's spans to return (must be a query referenced in expression).
returnSpansFrom?: common.#QueryName
aggregations?: [...common.#ExpressionAggregation]
filter?: common.#FilterExpression
groupBy?: [...common.#GroupByItem]
order?: [...common.#OrderByItem]
limit?: common.#Limit
offset?: common.#Offset
cursor?: string
functions?: [...common.#Function]
stepInterval?: number
having?: common.#HavingExpression
legend?: string
selectFields?: [...]
})

View File

@@ -0,0 +1,19 @@
{
"kind": "SigNozTraceOperator",
"spec": {
"name": "T1",
"expression": "A => B",
"returnSpansFrom": "A",
"aggregations": [
{
"expression": "count()",
"alias": "request_count"
}
],
"filter": {
"expression": "service.name = 'frontend'"
},
"groupBy": [],
"order": []
}
}

View File

@@ -0,0 +1,10 @@
package model
// Stub for the Perses built-in TimeSeriesChart panel plugin.
// percli --plugin.path does not load built-in schemas, so we provide an
// open spec here to let panel validation pass. Replace with the real
// schema from https://github.com/perses/plugins/tree/main/timeserieschart
// when strict panel validation is needed.
kind: "TimeSeriesChart"
spec: {...}

View File

@@ -0,0 +1,185 @@
{
"description": "This dashboard shows the Redis instance overview. It includes latency, hit/miss rate, connections, and memory information.\n",
"id": "redis-overview",
"layout": [
{
"h": 3,
"i": "a77227c7-16f5-4353-952e-b183c715a61c",
"moved": false,
"static": false,
"w": 6,
"x": 0,
"y": 0
},
{
"h": 3,
"i": "bf0deeeb-e926-4234-944c-82bacd96af47",
"moved": false,
"static": false,
"w": 6,
"x": 6,
"y": 0
}
],
"tags": [
"redis",
"database"
],
"title": "Redis overview",
"variables": {
"94f19b3c-ad9f-4b47-a9b2-f312c09fa965": {
"allSelected": true,
"customValue": "",
"description": "List of hosts sending Redis metrics",
"id": "94f19b3c-ad9f-4b47-a9b2-f312c09fa965",
"key": "94f19b3c-ad9f-4b47-a9b2-f312c09fa965",
"modificationUUID": "4c5b0c03-9cbc-425b-8d8e-7152e5c39ba8",
"multiSelect": true,
"name": "host_name",
"order": 0,
"queryValue": "SELECT JSONExtractString(labels, 'host_name') AS host_name\nFROM signoz_metrics.distributed_time_series_v4_1day\nWHERE metric_name = 'redis_cpu_time'\nGROUP BY host_name",
"selectedValue": [
"Srikanths-MacBook-Pro.local"
],
"showALLOption": true,
"sort": "ASC",
"textboxValue": "",
"type": "QUERY"
}
},
"version": "v5",
"widgets": [
{
"description": "Rate successful lookup of keys in the main dictionary",
"fillSpans": false,
"id": "a77227c7-16f5-4353-952e-b183c715a61c",
"isStacked": false,
"nullZeroValues": "zero",
"opacity": "1",
"panelTypes": "graph",
"query": {
"builder": {
"queryData": [
{
"aggregations": [
{
"metricName": "redis_keyspace_hits",
"reduceTo": "sum",
"spaceAggregation": "sum",
"temporality": null,
"timeAggregation": "rate"
}
],
"dataSource": "metrics",
"disabled": false,
"expression": "A",
"filter": {
"expression": "host_name IN $host_name"
},
"groupBy": [],
"having": {
"expression": ""
},
"legend": "Hit/s across all hosts",
"limit": null,
"orderBy": [],
"queryName": "A",
"stepInterval": 60
}
],
"queryFormulas": []
},
"clickhouse_sql": [
{
"disabled": false,
"legend": "",
"name": "A",
"query": ""
}
],
"id": "42c9c117-bfaf-49f7-b528-aad099392295",
"promql": [
{
"disabled": false,
"legend": "",
"name": "A",
"query": ""
}
],
"queryType": "builder"
},
"softMax": null,
"softMin": null,
"thresholds": [],
"timePreferance": "GLOBAL_TIME",
"title": "Hits/s",
"yAxisUnit": "none"
},
{
"description": "Number of clients pending on a blocking call",
"fillSpans": false,
"id": "bf0deeeb-e926-4234-944c-82bacd96af47",
"isStacked": false,
"nullZeroValues": "zero",
"opacity": "1",
"panelTypes": "graph",
"query": {
"builder": {
"queryData": [
{
"aggregations": [
{
"metricName": "redis_clients_blocked",
"reduceTo": "sum",
"spaceAggregation": "sum",
"temporality": null,
"timeAggregation": "sum"
}
],
"dataSource": "metrics",
"disabled": false,
"expression": "A",
"filter": {
"expression": "host_name IN $host_name"
},
"groupBy": [],
"having": {
"expression": ""
},
"legend": "Blocked clients across all hosts",
"limit": null,
"orderBy": [],
"queryName": "A",
"stepInterval": 60
}
],
"queryFormulas": []
},
"clickhouse_sql": [
{
"disabled": false,
"legend": "",
"name": "A",
"query": ""
}
],
"id": "6b48fc1c-014a-45e6-a4ce-2c0e06a23302",
"promql": [
{
"disabled": false,
"legend": "",
"name": "A",
"query": ""
}
],
"queryType": "builder"
},
"softMax": null,
"softMin": null,
"thresholds": [],
"timePreferance": "GLOBAL_TIME",
"title": "Blocked clients",
"yAxisUnit": "none"
}
]
}

View File

@@ -0,0 +1,160 @@
{
"kind": "Dashboard",
"metadata": {
"name": "redis-overview",
"project": "signoz"
},
"spec": {
"display": {
"name": "Redis overview",
"description": "This dashboard shows the Redis instance overview. It includes latency, hit/miss rate, connections, and memory information."
},
"duration": "1h",
"variables": [
{
"kind": "ListVariable",
"spec": {
"name": "host_name",
"display": {
"name": "host_name",
"description": "List of hosts sending Redis metrics"
},
"allowAllValue": true,
"allowMultiple": true,
"plugin": {
"kind": "SigNozQueryVariable",
"spec": {
"queryValue": "SELECT JSONExtractString(labels, 'host_name') AS host_name\nFROM signoz_metrics.distributed_time_series_v4_1day\nWHERE metric_name = 'redis_cpu_time'\nGROUP BY host_name",
"sort": "ASC",
"multiSelect": true,
"showALLOption": true
}
}
}
}
],
"panels": {
"a77227c7": {
"kind": "Panel",
"spec": {
"display": {
"name": "Hits/s",
"description": "Rate successful lookup of keys in the main dictionary"
},
"plugin": {
"kind": "TimeSeriesChart",
"spec": {}
},
"queries": [
{
"kind": "TimeSeriesQuery",
"spec": {
"plugin": {
"kind": "SigNozBuilderQuery",
"spec": {
"name": "A",
"signal": "metrics",
"aggregations": [
{
"metricName": "redis_keyspace_hits",
"reduceTo": "sum",
"spaceAggregation": "sum",
"timeAggregation": "rate"
}
],
"filter": {
"expression": "host_name IN $host_name"
},
"groupBy": [],
"order": [],
"expression": "A",
"disabled": false,
"legend": "Hit/s across all hosts",
"stepInterval": 60,
"having": {
"expression": ""
}
}
}
}
}
]
}
},
"bf0deeeb": {
"kind": "Panel",
"spec": {
"display": {
"name": "Blocked clients",
"description": "Number of clients pending on a blocking call"
},
"plugin": {
"kind": "TimeSeriesChart",
"spec": {}
},
"queries": [
{
"kind": "TimeSeriesQuery",
"spec": {
"plugin": {
"kind": "SigNozBuilderQuery",
"spec": {
"name": "A",
"signal": "metrics",
"aggregations": [
{
"metricName": "redis_clients_blocked",
"reduceTo": "sum",
"spaceAggregation": "sum",
"timeAggregation": "sum"
}
],
"filter": {
"expression": "host_name IN $host_name"
},
"groupBy": [],
"order": [],
"expression": "A",
"disabled": false,
"legend": "Blocked clients across all hosts",
"stepInterval": 60,
"having": {
"expression": ""
}
}
}
}
}
]
}
}
},
"layouts": [
{
"kind": "Grid",
"spec": {
"items": [
{
"x": 0,
"y": 0,
"width": 6,
"height": 3,
"content": {
"$ref": "#/spec/panels/a77227c7"
}
},
{
"x": 6,
"y": 0,
"width": 6,
"height": 3,
"content": {
"$ref": "#/spec/panels/bf0deeeb"
}
}
]
}
}
]
}
}

8
perses/validate.sh Executable file
View File

@@ -0,0 +1,8 @@
#!/bin/bash
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
percli lint -f "$SCRIPT_DIR/examples/redis-overview-perses.json" --plugin.path "$SCRIPT_DIR" --log.level fatal
# percli lint auto-generates this file as a side effect; clean it up.
rm -f "$SCRIPT_DIR/plugin-modules.json"