-
Notifications
You must be signed in to change notification settings - Fork 177
feat: grafana modular lib Couchbase #1454
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Dasomeone
merged 16 commits into
grafana:master
from
schmikei:feat/couchbase-modernization
Sep 3, 2025
Merged
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
54a7d35
grafana modular lib Couchbase
schmikei 493b39a
readd rows based off new guidance
schmikei a0fa2d8
make fmt
schmikei 37c390d
Merge branch 'master' into feat/couchbase-modernization
schmikei acb7cdf
Merge branch 'master' into feat/couchbase-modernization
schmikei 7f5311b
Merge branch 'master' into feat/couchbase-modernization
schmikei aeb053f
Merge branch 'master' of github.com:grafana/jsonnet-libs into feat/co…
schmikei 842472a
Merge branch 'master' of github.com:grafana/jsonnet-libs into feat/co…
schmikei c4b7cc6
use signals API; wip
schmikei b721b04
Merge branch 'feat/couchbase-modernization' of github.com:schmikei/js…
schmikei 12a907b
fix queries from last commit
schmikei 6a8a999
cleanup config object after recent changes to signals
schmikei 33decb5
make fmt
schmikei 5d74cfa
Merge branch 'master' of github.com:grafana/jsonnet-libs into feat/co…
schmikei 51486c4
pr feedback: increase usage, setence casing, using more of the groupL…
schmikei d3605e1
make fmt
schmikei File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,40 @@ | ||
{ | ||
_config+:: { | ||
enableMultiCluster: false, | ||
couchbaseSelector: if self.enableMultiCluster then 'job=~"$job", cluster=~"$cluster"' else 'job=~"$job"', | ||
multiclusterSelector: 'job=~"$job"', | ||
dashboardTags: ['couchbase-mixin'], | ||
dashboardPeriod: 'now-1h', | ||
dashboardTimezone: 'default', | ||
dashboardRefresh: '1m', | ||
local this = self, | ||
enableMultiCluster: false, | ||
filteringSelector: 'job=~"integrations/couchbase"', | ||
groupLabels: if self.enableMultiCluster then ['job', 'cluster', 'couchbase_cluster'] else ['job', 'couchbase_cluster'], | ||
instanceLabels: ['instance'], | ||
dashboardTags: ['couchbase-mixin'], | ||
uid: 'couchbase', | ||
dashboardNamePrefix: 'Couchbase', | ||
|
||
// alerts thresholds | ||
alertsCriticalCPUUsage: 85, // % | ||
alertsCriticalMemoryUsage: 85, // % | ||
alertsWarningMemoryEvictionRate: 10, // count | ||
alertsWarningInvalidRequestVolume: 1000, // count | ||
|
||
enableLokiLogs: true, | ||
// additional params | ||
dashboardPeriod: 'now-1h', | ||
dashboardTimezone: 'default', | ||
dashboardRefresh: '1m', | ||
|
||
// logs lib related | ||
enableLokiLogs: true, | ||
logLabels: if self.enableMultiCluster then ['job', 'instance', 'cluster', 'level'] else ['job', 'instance', 'level'], | ||
extraLogLabels: [], // Required by logs-lib | ||
logsVolumeGroupBy: 'level', | ||
showLogsVolume: true, | ||
|
||
// alerts thresholds | ||
alertsCriticalCPUUsage: 85, // % | ||
alertsCriticalMemoryUsage: 85, // % | ||
alertsWarningMemoryEvictionRate: 10, // count | ||
alertsWarningInvalidRequestVolume: 1000, // count | ||
|
||
// metrics source for signals library | ||
metricsSource: 'prometheus', | ||
|
||
signals+: { | ||
cluster: (import './signals/cluster.libsonnet')(this), | ||
node: (import './signals/node.libsonnet')(this), | ||
query: (import './signals/query.libsonnet')(this), | ||
bucket: (import './signals/bucket.libsonnet')(this), | ||
index: (import './signals/index.libsonnet')(this), | ||
}, | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,155 @@ | ||
local g = import './g.libsonnet'; | ||
local logslib = import 'logs-lib/logs/main.libsonnet'; | ||
{ | ||
local root = self, | ||
new(this):: | ||
local prefix = this.config.dashboardNamePrefix; | ||
local links = this.grafana.links; | ||
local tags = this.config.dashboardTags; | ||
local uid = g.util.string.slugify(this.config.uid); | ||
local vars = this.grafana.variables; | ||
local annotations = this.grafana.annotations; | ||
local refresh = this.config.dashboardRefresh; | ||
local period = this.config.dashboardPeriod; | ||
local timezone = this.config.dashboardTimezone; | ||
local panels = this.grafana.panels; | ||
|
||
{ | ||
'couchbase-bucket-overview.json': | ||
g.dashboard.new(prefix + ' bucket overview') | ||
+ g.dashboard.withPanels( | ||
g.util.grid.wrapPanels( | ||
[ | ||
panels.bucket_topBucketsByMemoryUsedPanel { gridPos+: { w: 12 } }, | ||
panels.bucket_topBucketsByDiskUsedPanel { gridPos+: { w: 12 } }, | ||
panels.bucket_topBucketsByCurrentItemsPanel { gridPos+: { w: 8 } }, | ||
panels.bucket_topBucketsByOperationsPanel { gridPos+: { w: 8 } }, | ||
panels.bucket_topBucketsByOperationsFailedPanel { gridPos+: { w: 8 } }, | ||
panels.bucket_topBucketsByHighPriorityRequestsPanel { gridPos+: { w: 12 } }, | ||
panels.bucket_bottomBucketsByCacheHitRatioPanel { gridPos+: { w: 12 } }, | ||
panels.bucket_topBucketsByVBucketsCountPanel { gridPos+: { w: 12 } }, | ||
panels.bucket_topBucketsByVBucketQueueMemoryPanel { gridPos+: { w: 12 } }, | ||
], | ||
) | ||
) | ||
+ root.applyCommon( | ||
vars.multiInstance, | ||
uid + '_couchbase_bucket_overview', | ||
tags, | ||
links { couchbaseBucketOverview+:: {} }, | ||
annotations, | ||
timezone, | ||
refresh, | ||
period | ||
), | ||
|
||
'couchbase-node-overview.json': | ||
g.dashboard.new(prefix + ' node overview') | ||
+ g.dashboard.withPanels( | ||
g.util.panel.resolveCollapsedFlagOnRows( | ||
g.util.grid.wrapPanels( | ||
[ | ||
panels.node_memoryUtilizationPanel { gridPos+: { w: 12 } }, | ||
panels.node_cpuUtilizationPanel { gridPos+: { w: 12 } }, | ||
panels.node_totalMemoryUsedByServicePanel { gridPos+: { w: 8 } }, | ||
panels.node_backupSizePanel { gridPos+: { w: 8 } }, | ||
panels.node_currentConnectionsPanel { gridPos+: { w: 8 } }, | ||
panels.node_httpResponseCodesPanel { gridPos+: { w: 12 } }, | ||
panels.node_httpRequestMethodsPanel { gridPos+: { w: 12 } }, | ||
panels.node_queryServiceRequestsPanel { gridPos+: { w: 12 } }, | ||
panels.node_queryServiceRequestProcessingTimePanel { gridPos+: { w: 12 } }, | ||
panels.node_indexServiceRequestsPanel { gridPos+: { w: 8 } }, | ||
panels.node_indexCacheHitRatioPanel { gridPos+: { w: 8 } }, | ||
panels.node_averageScanLatencyPanel { gridPos+: { w: 8 } }, | ||
] | ||
) | ||
) | ||
) | ||
+ root.applyCommon( | ||
vars.multiInstance, | ||
uid + '_couchbase_node_overview', | ||
tags, | ||
links { couchbaseNodeOverview+:: {} }, | ||
annotations, | ||
timezone, | ||
refresh, | ||
period | ||
), | ||
|
||
'couchbase-cluster-overview.json': | ||
g.dashboard.new(prefix + ' cluster overview') | ||
+ g.dashboard.withPanels( | ||
g.util.panel.resolveCollapsedFlagOnRows( | ||
g.util.grid.wrapPanels( | ||
[ | ||
panels.cluster_topNodesByMemoryUsagePanel { gridPos+: { w: 12 } }, | ||
panels.cluster_topNodesByHTTPRequestsPanel { gridPos+: { w: 12 } }, | ||
panels.cluster_topNodesByQueryServiceRequestsPanel { gridPos+: { w: 12 } }, | ||
panels.cluster_topNodesByIndexAverageScanLatencyPanel { gridPos+: { w: 12 } }, | ||
panels.cluster_xdcrReplicationRatePanel { gridPos+: { w: 8 } }, | ||
panels.cluster_xdcrDocsReceivedPanel { gridPos+: { w: 8 } }, | ||
panels.cluster_localBackupSizePanel { gridPos+: { w: 8 } }, | ||
] + this.grafana.rows.clusterOverviewBucket, | ||
) | ||
) | ||
) | ||
+ root.applyCommon( | ||
vars.multiInstance, | ||
uid + '_couchbase_cluster_overview', | ||
tags, | ||
links { couchbaseClusterOverview+:: {} }, | ||
annotations, | ||
timezone, | ||
refresh, | ||
period | ||
), | ||
|
||
} | ||
+ | ||
if this.config.enableLokiLogs then | ||
{ | ||
'couchbase-logs.json': | ||
logslib.new( | ||
prefix + ' logs', | ||
datasourceName=this.grafana.variables.datasources.loki.name, | ||
datasourceRegex=this.grafana.variables.datasources.loki.regex, | ||
filterSelector=this.config.filteringSelector, | ||
labels=this.config.groupLabels + this.config.extraLogLabels, | ||
formatParser=null, | ||
showLogsVolume=this.config.showLogsVolume, | ||
) | ||
{ | ||
dashboards+: | ||
{ | ||
logs+: | ||
// reference to self, already generated variables, to keep them, but apply other common data in applyCommon | ||
root.applyCommon(super.logs.templating.list, uid=uid + '-logs', tags=tags, links=links { logs+:: {} }, annotations=annotations, timezone=timezone, refresh=refresh, period=period), | ||
}, | ||
panels+: | ||
{ | ||
// modify log panel | ||
logs+: | ||
g.panel.logs.options.withEnableLogDetails(true) | ||
+ g.panel.logs.options.withShowTime(false) | ||
+ g.panel.logs.options.withWrapLogMessage(false), | ||
}, | ||
variables+: { | ||
// add prometheus datasource for annotations processing | ||
toArray+: [ | ||
this.grafana.variables.datasources.prometheus { hide: 2 }, | ||
], | ||
}, | ||
}.dashboards.logs, | ||
} | ||
else {}, | ||
|
||
applyCommon(vars, uid, tags, links, annotations, timezone, refresh, period): | ||
g.dashboard.withTags(tags) | ||
+ g.dashboard.withUid(uid) | ||
+ g.dashboard.withLinks(std.objectValues(links)) | ||
+ g.dashboard.withTimezone(timezone) | ||
+ g.dashboard.withRefresh(refresh) | ||
+ g.dashboard.time.withFrom(period) | ||
+ g.dashboard.withVariables(vars) | ||
+ g.dashboard.withAnnotations(std.objectValues(annotations)), | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.