Skip to content
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

Add labels to Pepr services for Prometheus scrapes #426

Closed
cmwylie19 opened this issue Dec 7, 2023 · 0 comments · Fixed by #427
Closed

Add labels to Pepr services for Prometheus scrapes #426

cmwylie19 opened this issue Dec 7, 2023 · 0 comments · Fixed by #427
Assignees
Labels
enhancement New feature or request metrics Prometheus/Grafana

Comments

@cmwylie19
Copy link
Collaborator

cmwylie19 commented Dec 7, 2023

Is your feature request related to a problem? Please describe.

When creating a ServiceMonitor it is very common to use a label selector. In the case of Pepr's services, there are no labels.

Describe the solution you'd like

  • Given I issue k get svc -n pepr-system --show-labels
  • When the results show
  • Then the labels are not <none>

related to #412

Describe alternatives you've considered

(optional) A clear and concise description of any alternative solutions or features you've considered.

Additional context

Add any other context or screenshots about the feature request here.

@cmwylie19 cmwylie19 added enhancement New feature or request metrics Prometheus/Grafana labels Dec 7, 2023
@cmwylie19 cmwylie19 self-assigned this Dec 7, 2023
cmwylie19 added a commit that referenced this issue Dec 12, 2023
## Description

This PR is a draft and discussion around adding labels to kube artifacts
to distinguish what is what. For instance, I may want to get logs from
only the watcher or admission pods without looking up the pod/deployment
or uuid names. It also creates a method for scraping services using a
`ServiceMonitor`'s `MatchLabel`. This PR was created while writing
documentation around scraping the Pepr services with Prometheus.

It also provides documentation how to scrape the Pepr services. Use this
[gist](https://gist.github.com/cmwylie19/f9503ddebe848616a4e8891bfaeafb3e)
as a guide if needed

End Result:

```bash
┌─[cmwylie19@Cases-MacBook-Pro] - [~/pepr] - [2023-12-07 04:21:28]
└─[0] <git:(426 324b16f) > k get svc,po,deploy -n pepr-system  --show-labels     
NAME                               TYPE        CLUSTER-IP     EXTERNAL-IP   PORT(S)   AGE     LABELS
service/pepr-static-test           ClusterIP   10.43.9.3      <none>        443/TCP   5m24s   pepr.dev/controller=admission
service/pepr-static-test-watcher   ClusterIP   10.43.75.252   <none>        443/TCP   5m24s   pepr.dev/controller=watcher

NAME                                            READY   STATUS    RESTARTS   AGE     LABELS
pod/pepr-static-test-b7f858d7-fsx5z             1/1     Running   0          5m24s   app=pepr-static-test,pepr.dev/controller=admission,pod-template-hash=b7f858d7
pod/pepr-static-test-b7f858d7-vr89k             1/1     Running   0          5m24s   app=pepr-static-test,pepr.dev/controller=admission,pod-template-hash=b7f858d7
pod/pepr-static-test-watcher-78647f6bbd-8jckv   1/1     Running   0          5m24s   app=pepr-static-test-watcher,pepr.dev/controller=watcher,pod-template-hash=78647f6bbd

NAME                                       READY   UP-TO-DATE   AVAILABLE   AGE     LABELS
deployment.apps/pepr-static-test           2/2     2            2           5m24s   app=pepr-static-test,pepr.dev/controller=admission
deployment.apps/pepr-static-test-watcher   1/1     1            1           5m24s   app=pepr-static-test-watcher,pepr.dev/controller=watcher
```

## Related Issue

Fixes #426 
<!-- or -->
Relates to #412

## Type of change

- [ ] Bug fix (non-breaking change which fixes an issue)
- [x] New feature (non-breaking change which adds functionality)
- [ ] Other (security config, docs update, etc)

## Checklist before merging

- [x] Test, docs, adr added or updated as needed
- [x] [Contributor Guide
Steps](https://github.com/defenseunicorns/pepr/blob/main/CONTRIBUTING.md#submitting-a-pull-request)
followed

---------

Signed-off-by: Case Wylie <cmwylie19@defenseunicorns.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request metrics Prometheus/Grafana
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

1 participant