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

Uwsgi pmda does not update metric values when server stops #1964

Closed
sfeifer opened this issue Apr 22, 2024 · 2 comments
Closed

Uwsgi pmda does not update metric values when server stops #1964

sfeifer opened this issue Apr 22, 2024 · 2 comments

Comments

@sfeifer
Copy link
Contributor

sfeifer commented Apr 22, 2024

When I start the uwsgi server, the metric values update correctly. Upon stopping the server though, the metric values persist. For example, I start the server with 1 worker and uwsgi.summary.total_workers gets updated to have a value of 1. When I stop the server, uwsgi.summary.total_workers keeps its value of 1, even though there is no longer a uwsgi server running.

@natoscott
Copy link
Member

@jainnikhil30 I took a quick look and I think this is a partial fix, but @sfeifer mentioned it doesn't completely solve the problem in grafana-pcp...

git diff
src/pmdas/uwsgi/pmdauwsgi.python
--- /tmp/git-blob-EJVmCw/pmdauwsgi.python       2024-04-23 10:27:25.584880409 +1000
+++ src/pmdas/uwsgi/pmdauwsgi.python    2024-04-19 08:17:11.134455391 +1000
@@ -185,7 +185,7 @@ class UwsgiPMDA(PMDA):
             #self.log("refresh_all stats:", str(stats))
         except Exception:
             self.get_failed = True
-            return
+            stats = {}
 
         avg_response_time_msec = 0
         summary = UWSGISUMMARY()
@@ -213,7 +213,8 @@ class UwsgiPMDA(PMDA):
                 summary.total_pause_worker_count += 1
             avg_response_time_msec += worker.avg_rt
             self.workers[str(worker_id)] = worker
-        summary.avg_response_time_msec = avg_response_time_msec/summary.total_workers
+        if summary.total_workers > 0:
+            summary.avg_response_time_msec = avg_response_time_msec / summary.total_workers
         self.summary = summary
 
     def read_config(self):

natoscott added a commit to natoscott/pcp that referenced this issue May 6, 2024
Testing against a sample uWSGI server application from Sam,
this now seems to be resolved.  Minor changes to improve the
help text, handling of long-running global counters, and the
naming of worker instances.

Resolves Github issue performancecopilot#1964
@natoscott
Copy link
Member

Fixed in pcp-6.2.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants