-
Notifications
You must be signed in to change notification settings - Fork 170
Update ClickHouse mixin to better utilize libraries #1445
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
Open
schmikei
wants to merge
8
commits into
grafana:master
Choose a base branch
from
schmikei:clickhouse-modernization
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
f8e0483
update clickhouse to latest mixin standards
schmikei 0261e61
remove redundant wrapPanels
schmikei b92345f
Merge branch 'master' into clickhouse-modernization
schmikei 1110855
cleanup
schmikei 04709db
Merge branch 'master' into clickhouse-modernization
schmikei 349279a
fix variable setting
schmikei 0993930
Merge branch 'clickhouse-modernization' of github.com:schmikei/jsonne…
schmikei 25f9197
remove unused variables
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
8 changes: 4 additions & 4 deletions
8
clickhouse-mixin/alerts/alerts.libsonnet → clickhouse-mixin/alerts.libsonnet
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,20 +1,26 @@ | ||
{ | ||
_config+:: { | ||
enableMultiCluster: false, | ||
clickhouseSelector: if self.enableMultiCluster then 'job=~"$job", instance=~"$instance", cluster=~"$cluster"' else 'job=~"$job", instance=~"$instance"', | ||
enableMultiCluster: false, | ||
filteringSelector: 'job="integrations/clickhouse"', | ||
groupLabels: if self.enableMultiCluster then ['job', 'cluster'] else ['job'], | ||
logLabels: if self.enableMultiCluster then ['job', 'cluster', 'instance'] else ['job', 'instance'], | ||
pureInstanceLabels: ['instance'], | ||
|
||
dashboardTags: ['clickhouse-mixin'], | ||
dashboardPeriod: 'now-30m', | ||
dashboardTimezone: 'default', | ||
dashboardRefresh: '1m', | ||
logLabels: if self.enableMultiCluster then ['job', 'instance', 'cluster', 'level'] | ||
else ['job', 'instance', 'level'], | ||
dashboardTags: [self.uid], | ||
uid: 'clickhouse', | ||
dashboardNamePrefix: 'ClickHouse', | ||
dashboardPeriod: 'now-30m', | ||
dashboardTimezone: 'default', | ||
dashboardRefresh: '1m', | ||
|
||
// for alerts | ||
alertsReplicasMaxQueueSize: '99', | ||
// Legend panel configuration | ||
legendLabels: ['instance'], | ||
|
||
filterSelector: 'job=~".*/clickhouse.*"', | ||
// Logging configuration | ||
enableLokiLogs: true, | ||
extraLogLabels: ['level'], // Required by logs-lib | ||
logsVolumeGroupBy: 'level', | ||
showLogsVolume: true, | ||
|
||
enableLokiLogs: true, | ||
}, | ||
// Alerts configuration | ||
alertsReplicasMaxQueueSize: '99', | ||
} |
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,142 @@ | ||||||
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; | ||||||
|
||||||
{ | ||||||
'clickhouse-replica': | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
.json suffix should be used for dashboards. |
||||||
g.dashboard.new(prefix + ' replica') | ||||||
+ g.dashboard.withPanels( | ||||||
g.util.grid.wrapPanels( | ||||||
[ | ||||||
panels.interserverConnectionsPanel { gridPos+: { w: 12 } }, | ||||||
panels.replicaQueueSizePanel { gridPos+: { w: 12 } }, | ||||||
panels.replicaOperationsPanel { gridPos+: { w: 12 } }, | ||||||
panels.replicaReadOnlyPanel { gridPos+: { w: 12 } }, | ||||||
panels.zooKeeperWatchesPanel { gridPos+: { w: 12 } }, | ||||||
panels.zooKeeperSessionsPanel { gridPos+: { w: 12 } }, | ||||||
panels.zooKeeperRequestsPanel { gridPos+: { w: 24 } }, | ||||||
] | ||||||
) | ||||||
) | ||||||
+ root.applyCommon( | ||||||
vars.singleInstance, | ||||||
uid + '_clickhouse_replica', | ||||||
tags, | ||||||
links { clickhouseReplica+:: {} }, | ||||||
annotations, | ||||||
timezone, | ||||||
refresh, | ||||||
period | ||||||
), | ||||||
|
||||||
'clickhouse-overview': | ||||||
g.dashboard.new(prefix + ' overview') | ||||||
+ g.dashboard.withPanels( | ||||||
g.util.grid.wrapPanels( | ||||||
[ | ||||||
panels.successfulQueriesPanel { gridPos+: { w: 24 } }, | ||||||
panels.failedQueriesPanel { gridPos+: { w: 12 } }, | ||||||
panels.rejectedInsertsPanel { gridPos+: { w: 12 } }, | ||||||
panels.memoryUsagePanel { gridPos+: { w: 12 } }, | ||||||
panels.memoryUsageGaugePanel { gridPos+: { w: 12 } }, | ||||||
panels.activeConnectionsPanel { gridPos+: { w: 24 } }, | ||||||
panels.networkReceivedPanel { gridPos+: { w: 12 } }, | ||||||
panels.networkTransmittedPanel { gridPos+: { w: 12 } }, | ||||||
] | ||||||
) | ||||||
) | ||||||
+ root.applyCommon( | ||||||
vars.singleInstance, | ||||||
uid + '_clickhouse_overview', | ||||||
tags, | ||||||
links { clickhouseOverview+:: {} }, | ||||||
annotations, | ||||||
timezone, | ||||||
refresh, | ||||||
period | ||||||
), | ||||||
|
||||||
'clickhouse-latency': | ||||||
g.dashboard.new(prefix + ' latency') | ||||||
+ g.dashboard.withPanels( | ||||||
g.util.grid.wrapPanels( | ||||||
[ | ||||||
panels.diskReadLatencyPanel { gridPos+: { w: 12 } }, | ||||||
panels.diskWriteLatencyPanel { gridPos+: { w: 12 } }, | ||||||
panels.networkTransmitLatencyInboundPanel { gridPos+: { w: 12 } }, | ||||||
panels.networkTransmitLatencyOutboundPanel { gridPos+: { w: 12 } }, | ||||||
panels.zooKeeperWaitTimePanel { gridPos+: { w: 24 } }, | ||||||
] | ||||||
) | ||||||
) | ||||||
+ root.applyCommon( | ||||||
vars.singleInstance, | ||||||
uid + '_clickhouse_latency', | ||||||
tags, | ||||||
links { clickhouseLatency+:: {} }, | ||||||
annotations, | ||||||
timezone, | ||||||
refresh, | ||||||
period | ||||||
), | ||||||
|
||||||
} | ||||||
+ | ||||||
if this.config.enableLokiLogs then | ||||||
{ | ||||||
logs: | ||||||
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.logLabels + 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+: | ||||||
{ | ||||||
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)), | ||||||
} |
This file was deleted.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
overall, I think cluster could be considered a specific case of a member of groupLabel. Do we need any specific support for clusterLabel?