-
Notifications
You must be signed in to change notification settings - Fork 177
chore: Modernize squid-mixin #1526
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,3 +2,4 @@ | |
| vendor | ||
| jsonnetfile.lock.json | ||
| *.zip | ||
| .worktrees | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,10 +1,14 @@ | ||
| exclusions: | ||
| template-job-rule: | ||
| reason: "Prometheus datasource variable is being named as prometheus_datasource now while linter expects 'datasource'" | ||
| panel-datasource-rule: | ||
| reason: "Modern mixins use signal-based architecture where datasource references are handled by the framework" | ||
| template-datasource-rule: | ||
| reason: "Based on new convention we are using variable names prometheus_datasource and loki_datasource where as linter expects 'datasource'" | ||
| template-instance-rule: | ||
| reason: "Based on new convention we are using variable names prometheus_datasource and loki_datasource where as linter expects 'datasource'" | ||
| panel-units-rule: | ||
| reason: "Custom units are used for better user experience in these panels" | ||
| entries: | ||
| - panel: "Client request errors" | ||
| - panel: "Server request errors" | ||
| template-datasource-rule: | ||
| reason: "Based on new convention we are using variable names prometheus_datasource and loki_datasource where as linter expects 'datasource'" | ||
| template-instance-rule: | ||
| reason: "Based on new convention we are using variable names prometheus_datasource and loki_datasource where as linter expects 'datasource'" | ||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1,16 +1,41 @@ | ||||||
| { | ||||||
| _config+:: { | ||||||
| dashboardTags: ['squid'], | ||||||
| dashboardPeriod: 'now-1h', | ||||||
| dashboardTimezone: 'default', | ||||||
| dashboardRefresh: '1m', | ||||||
| local this = self, | ||||||
|
|
||||||
| // alerts thresholds | ||||||
| alertsCriticalHighPercentageRequestErrors: 5, | ||||||
| alertsWarningLowCacheHitRatio: 85, | ||||||
| enableLokiLogs: true, | ||||||
| enableMultiCluster: false, | ||||||
| multiclusterSelector: 'job=~"$job"', | ||||||
| squidSelector: if self.enableMultiCluster then 'job=~"$job", cluster=~"$cluster"' else 'job=~"$job"', | ||||||
| // Basic filtering | ||||||
| filteringSelector: 'job=~"$job", instance=~"$instance"', | ||||||
|
Contributor
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. I think this is the incorrect filtering selector. I believe its default should probably be
Suggested change
|
||||||
| groupLabels: ['job'], | ||||||
| instanceLabels: ['instance'], | ||||||
|
|
||||||
| // Dashboard settings | ||||||
| dashboardTags: ['squid'], | ||||||
|
Contributor
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
|
||||||
| dashboardPeriod: 'now-1h', | ||||||
| dashboardTimezone: 'default', | ||||||
| dashboardRefresh: '1m', | ||||||
| uid: 'squid', | ||||||
| dashboardNamePrefix: 'Squid', | ||||||
|
|
||||||
| // Logs configuration | ||||||
| enableLokiLogs: true, | ||||||
| logLabels: ['job', 'instance', 'filename'], | ||||||
| extraLogLabels: [], | ||||||
| logsVolumeGroupBy: 'level', | ||||||
| showLogsVolume: true, | ||||||
|
|
||||||
| // Multi-cluster support | ||||||
| enableMultiCluster: false, | ||||||
| multiclusterSelector: if self.enableMultiCluster then 'job=~"$job", cluster=~"$cluster"' else 'job=~"$job"', | ||||||
|
|
||||||
| // Alert thresholds | ||||||
| alertsCriticalHighPercentageRequestErrors: 5, // % | ||||||
| alertsWarningLowCacheHitRatio: 85, // % | ||||||
|
|
||||||
| // Metrics source | ||||||
| metricsSource: 'prometheus', | ||||||
|
|
||||||
| // Signal definitions | ||||||
| signals: { | ||||||
| client: (import './signals/client.libsonnet')(this), | ||||||
| server: (import './signals/server.libsonnet')(this), | ||||||
| serviceTime: (import './signals/service_time.libsonnet')(this), | ||||||
| }, | ||||||
| } | ||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,64 @@ | ||
| local g = import './g.libsonnet'; | ||
| local commonlib = import 'common-lib/common/main.libsonnet'; | ||
|
|
||
| { | ||
| local root = self, | ||
| new(this): | ||
| local prefix = this.config.dashboardNamePrefix; | ||
| local links = this.grafana.links; | ||
| local tags = this.config.dashboardTags; | ||
| local uid = this.config.uid; | ||
| local vars = commonlib.variables.new( | ||
| filteringSelector=this.config.filteringSelector, | ||
| groupLabels=this.config.groupLabels, | ||
| instanceLabels=this.config.instanceLabels, | ||
| varMetric='squid_server_http_requests_total', | ||
| customAllValue='.+', | ||
| enableLokiLogs=this.config.enableLokiLogs, | ||
| ); | ||
| local annotations = {}; | ||
| local refresh = this.config.dashboardRefresh; | ||
| local period = this.config.dashboardPeriod; | ||
| local timezone = this.config.dashboardTimezone; | ||
|
|
||
| { | ||
| 'squid-overview.json': | ||
| g.dashboard.new(prefix + ' overview') | ||
| + g.dashboard.withDescription('') | ||
| + g.dashboard.withPanels( | ||
| g.util.panel.resolveCollapsedFlagOnRows( | ||
| g.util.grid.wrapPanels( | ||
| [ | ||
| this.grafana.rows.clientRow, | ||
| this.grafana.rows.serverRow, | ||
| ] | ||
| + | ||
| if this.config.enableLokiLogs then | ||
|
Contributor
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. I think we should be using the logs-lib library here instead of combined logs/metrics panels. |
||
| [this.grafana.rows.logsRow] | ||
| else | ||
| [] | ||
| ) | ||
| ) | ||
| ) | ||
| + root.applyCommon( | ||
| vars.multiInstance, | ||
| uid + '-overview', | ||
| tags, | ||
| links, | ||
| annotations, | ||
| timezone, | ||
| refresh, | ||
| period | ||
| ), | ||
| }, | ||
|
|
||
| applyCommon(vars, uid, tags, links, annotations, timezone, refresh, period): | ||
| g.dashboard.withTags(tags) | ||
| + g.dashboard.withUid(uid) | ||
| + g.dashboard.withLinks([links[key].asDashboardLink() for key in std.objectFields(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.
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.
I think this is wrong. Ideally our refactor shouldn't really touch the .lint file