-
Notifications
You must be signed in to change notification settings - Fork 178
chore: Discourse Mixin Modernization #1539
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
10
commits into
grafana:master
Choose a base branch
from
schmikei:chore/discourse-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 4 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
8e43aab
modernize the discourse mixin
schmikei c061312
remove .lint addition
schmikei 3279937
update readme for alerts rename
schmikei 05a474c
update import so that it uses the jsonnetfile.json
schmikei 52beb8e
pr feedback; minus validation on histogram switch
schmikei 0270875
add grafonnet dependency to jsonnetfile.json
schmikei 72e5129
PR feedback; histogram cleanups
schmikei 1cdb2d0
Merge branch 'master' of github.com:grafana/jsonnet-libs into chore/d…
schmikei 9f48116
make dashboards_out
schmikei 6f06ca3
forgot to change signal type to raw for histogram change
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 |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| { | ||
| new(this): { | ||
| groups: [ | ||
| { | ||
| name: this.config.uid + '-alerts', | ||
| rules: [ | ||
| { | ||
| alert: 'DiscourseHigh5xxErrors', | ||
| expr: ||| | ||
| 100 * rate(discourse_http_requests{status="500"}[5m]) / on() group_left() (sum(rate(discourse_http_requests[5m])) by (instance)) > %(alertsCritical5xxResponses)s | ||
| ||| % this.config, | ||
| 'for': '5m', | ||
| labels: { | ||
| severity: 'critical', | ||
| }, | ||
| annotations: { | ||
| summary: 'More than %(alertsCritical5xxResponses)s%% of all requests result in a 5XX.' % this.config, | ||
| description: | ||
| ('{{ printf "%%.2f" $value }}%% of all requests are resulting in 500 status codes, ' + | ||
| 'which is above the threshold %(alertsCritical5xxResponses)s%%, ' + | ||
| 'indicating a potentially larger issue for {{$labels.instance}}') % this.config, | ||
| }, | ||
| }, | ||
| { | ||
| alert: 'DiscourseHigh4xxErrors', | ||
| expr: ||| | ||
| 100 * rate(discourse_http_requests{status=~"4..", %(filteringSelector)s}[5m]) / on() group_left() (sum(rate(discourse_http_requests[5m])) by (instance)) > %(alertsWarning4xxResponses)s | ||
| ||| % this.config, | ||
| 'for': '5m', | ||
| labels: { | ||
| severity: 'warning', | ||
| }, | ||
| annotations: { | ||
| summary: 'More than %(alertsWarning4xxResponses)s%% of all requests result in a 4XX.' % this.config, | ||
| description: | ||
| ('{{ printf "%%.2f" $value }}%% of all requests are resulting in 400 status code, ' + | ||
| 'which is above the threshold %(alertsWarning4xxResponses)s%%, ' + | ||
| 'indicating a potentially larger issue for {{$labels.instance}}') % this.config, | ||
| }, | ||
| }, | ||
| ], | ||
| }, | ||
| ], | ||
| }, | ||
| } | ||
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,12 +1,32 @@ | ||
| { | ||
| _config+:: { | ||
| dashboardTags: ['discourse-mixin'], | ||
| dashboardPeriod: 'now-1h', | ||
| dashboardTimezone: 'default', | ||
| dashboardRefresh: '1m', | ||
|
|
||
| // for alerts | ||
| alertsCritical5xxResponses: '10', // % | ||
| alertsWarning4xxResponses: '30', // % | ||
| local this = self, | ||
|
|
||
| // Filtering | ||
| filteringSelector: 'job="integrations/discourse"', | ||
| groupLabels: ['job'], | ||
| instanceLabels: ['instance'], | ||
|
|
||
| // Dashboard settings | ||
| dashboardTags: ['discourse-mixin'], | ||
| dashboardPeriod: 'now-1h', | ||
| dashboardTimezone: 'default', | ||
| dashboardRefresh: '1m', | ||
| dashboardNamePrefix: 'Discourse', | ||
| uid: 'discourse', | ||
|
|
||
| // Logs configuration | ||
| enableLokiLogs: false, | ||
|
|
||
| // Alert thresholds | ||
| alertsCritical5xxResponses: 10, // % | ||
| alertsWarning4xxResponses: 30, // % | ||
|
|
||
| // Metrics source | ||
| metricsSource: 'prometheus', | ||
|
|
||
| // Signal categories | ||
| signals: { | ||
| overview: (import './signals/overview.libsonnet')(this), | ||
| jobs: (import './signals/jobs.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,86 @@ | ||
| 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='discourse_page_views', | ||
| customAllValue='.+', | ||
| enableLokiLogs=this.config.enableLokiLogs, | ||
| ); | ||
| local annotations = {}; | ||
| local refresh = this.config.dashboardRefresh; | ||
| local period = this.config.dashboardPeriod; | ||
| local timezone = this.config.dashboardTimezone; | ||
|
|
||
| { | ||
| 'discourse-overview.json': | ||
| g.dashboard.new(prefix + ' overview') | ||
| + g.dashboard.withDescription('Overview of Discourse application performance and traffic.') | ||
| + g.dashboard.withPanels( | ||
| g.util.panel.resolveCollapsedFlagOnRows( | ||
| g.util.grid.wrapPanels( | ||
| [ | ||
| this.grafana.rows.overviewRow, | ||
| this.grafana.rows.latencyRow, | ||
| ] | ||
| ) | ||
| ) | ||
| ) | ||
| + root.applyCommon( | ||
| vars.multiInstance, | ||
| uid + '-overview', | ||
| tags, | ||
| links { overview+:: {} }, | ||
| annotations, | ||
| timezone, | ||
| refresh, | ||
| period | ||
| ), | ||
|
|
||
| 'discourse-jobs.json': | ||
| g.dashboard.new(prefix + ' jobs processing') | ||
| + g.dashboard.withDescription('Discourse job processing, workers, and memory usage.') | ||
| + g.dashboard.withPanels( | ||
| g.util.panel.resolveCollapsedFlagOnRows( | ||
| g.util.grid.wrapPanels( | ||
| [ | ||
| this.grafana.rows.jobStatsRow, | ||
| this.grafana.rows.jobCountsRow, | ||
| this.grafana.rows.jobDurationRow, | ||
| this.grafana.rows.memoryRow, | ||
| ] | ||
| ) | ||
| ) | ||
| ) | ||
| + root.applyCommon( | ||
| vars.multiInstance, | ||
| uid + '-jobs', | ||
| tags, | ||
| links { jobs+:: {} }, | ||
| annotations, | ||
| timezone, | ||
| refresh, | ||
| period | ||
| ), | ||
| }, | ||
|
|
||
| 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)) | ||
| + g.dashboard.graphTooltip.withSharedCrosshair(), | ||
| } |
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.