feat: integrate django-prometheus for web serivce metrics#1085
feat: integrate django-prometheus for web serivce metrics#1085devnchill wants to merge 4 commits into
Conversation
|
hello @fricklerhandwerk , I wanted to clear this point that I have to connect grafana just for us to see how metrics would show up in grafana right ? I don't have to modify infra side for this , just the project side and then use nix to create test vm where grafana would be setup and visualize the metrics coming from the project ? |
Hello! Technically you only need to setup Prometheus in a test VM to collect the metrics, no Grafana is needed. If you want to test the changes you made, I think adding a VM test or python test to check that the metrics endpoint ( |
|
Yeah, having a way to at least manually check out of band what a given change is like would be good. I thought about maybe just adding instances to our clumsy NixOS dev module. It's dumb but it gets you the thing quickly. But for this change, a check in the smoke test should be enough. |
|
got it |
|
ig i'll wait for #1131 to merge ? would help me in testing 😆 |
|
In the meantime or later on I'd strongly recommend going through the contributing guide and exercising the workflows to obtain data locally. Such as "fetch some channels and run an evaluation". Because without data you don't have anything to look at in the dashboards. Likely there are some papercuts there, such as for how to get a reasonable number of CVEs for testing. It would be such a great contribution if you extracted one such workflow as a separate guide like @DarshanCode2005 did in #1072. Right now these bits and pieces are scattered. |
|
Makes sense, I'll work on that in the meantime 😆 |
0872a06 to
ebcdb88
Compare
|
hello @fricklerhandwerk , I first saved the new dashboard as copy so due to that the version i believe started counter from Oh also from prev discussion it seemed that there were 2 ways to add test for this, one was through pytest and another was through nix test , atm I picked django , do I need to add test for nix vm too ? apart from that this pr had so much of learning experience lol , learned several new stuff because of this 😄 . |
|
Since we're exposing directly from Django, the unit test is perfectly fine. I still need to get the Grafana dev setup working again (not sure what got messed up before I merged it, but it worked and now doesn't) to try it out. Not sure the stray changes to the dashboard JSON are all needed though. @Erethon opinions? |
|
Hmm weird, Grafana dev setup was working for me couple hrs ago though, will try it again when I go home. Regarding the dashboard, I thought you mentioned in initial issue that it would be nice to connect it to Grafana for quick lookup locally .. So I thought this is what you meant from that ... Mb for misunderstanding 😅 I'll remove dashboard changes when I reach home |
|
Oh the dashboard changes adding the data are fine, I mean all the unrelated stuff such as reformatting. |
|
Oh my nvim is configured to format on save so I believe it used prettier for that when I saved the file |
The |
| "uid": "${DS_PROMETHEUS}" | ||
| }, | ||
| "editorMode": "builder", | ||
| "expr": "django_http_requests_latency_seconds_by_view_method_count", |
There was a problem hiding this comment.
Please add a filter to distinguish between the staging/production instance or any other instances of django_http_requests_latency_seconds_by_view_method_count
There was a problem hiding this comment.
hello @Erethon , I have a doubt ,
"expr": "django_http_requests_latency_seconds_by_view_method_count{instance=\"$Instance\"}",if i use this, then it would show empty results no? because label is instance scraping the sql_delta metric and since sql and django run on different port, label would end up becoming different for both sql and django no? any advice ?
| "uid": "${DS_PROMETHEUS}" | ||
| }, | ||
| "editorMode": "builder", | ||
| "expr": "django_http_responses_total_by_status_total", |
There was a problem hiding this comment.
Please add a filter to distinguish between the staging/production instance or any other instances of django_http_responses_total_by_status_total.
Closes #1037