-
Notifications
You must be signed in to change notification settings - Fork 290
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
Prometheus source plugin #942
Prometheus source plugin #942
Conversation
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.
LGTM 🚀
internal/source/prometheus/source.go
Outdated
return api.JSONSchema{ | ||
Value: heredoc.Docf(`{ | ||
"$schema": "http://json-schema.org/draft-04/schema#", | ||
"title": "botkube/prometheus", |
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.
"title": "botkube/prometheus", | |
"title": "Prometheus", |
the repository name can be change in different part of the configuration, so I would not put that here.
internal/source/prometheus/source.go
Outdated
log := loggerx.New(loggerx.Config{ | ||
Level: config.Log.Level, | ||
}) | ||
prometheus, err := p.getPrometheusClient(config.URL) |
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.
nit
we can move it to Stream
method, same as you did with MergeConfigs
, so you will return an error there
prometheus, err := p.getPrometheusClient(config.URL)
if err != nil {
return source.StreamOutput{}, fmt.Errorf("while creating Prometheus client: %w", err)
}
or move that into for
loop, and just do the log.Errorf
only, so client creation will be "retried" in case of error.
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.
ok I kept it in consumeAlerts function, and removed mutex
57f231f
to
93af89c
Compare
93af89c
to
115753d
Compare
Description
Changes proposed in this pull request:
Test
Checkout branch
gh pr checkout 942
Build plugins
make build-plugins
Generate plugin index
PLUGIN_DOWNLOAD_URL_BASE_PATH=http://localhost:8080/dist make gen-plugins-index
Run local plugin repository
npx serve --listen 8080
Install Prometheus stack in k8s
Export prometheus endpoint
kubectl port-forward prometheus-botkube-kube-prometheus-st-prometheus-0 9090
Prepare botkube config
Run botkube
Deploy problematic nginx
kubectl run nginx --image nginx:1.23_err -n default
Related issue(s)
#849