Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

add system load avg info to stats #216

Closed
wants to merge 1 commit into from

2 participants

@prymitive
Collaborator

When looking at stats from multiple nodes it is useful to have also load avg stats from those nodes, so it would be nice to add it.

I'm not sure about availability, it seems that this is present on all UNIXes and Cygwin emulates it, but I've seen mixed reports so (provided that you are willing to merge it) we might:
a) push it as is and wait for people to complain that it does not compile on some platforms
b) ifdef it with __linux__, __FreeBSD__, __sun__ and __APPLE__ (for example)

@unbit
Owner

i have committed the first tech draft for the metric subsystem:

https://github.com/unbit/uwsgi/blob/master/core/metrics.c

i think i will make a first version in 1.9.7 (if not in 1.9.6). I need only to define how to correctly manage time (the problem we had with carbon metrics with 1 second frequency)

So, i think i can integrate this directly as a metric

@prymitive
Collaborator

how to correctly manage time

AFAIR the issue was that we need metric fetching (reading metrics from source and storing it in uWSGI buffer) and pushing (sending to carbon/mongo/whatever) to not block each other, the most obvious solution would be 2 threads and fixed size queue in between them.

@unbit
Owner

It seems high resolution timers are not needed for the metrics thread, the problem rises when we send the values to a system that need to make computation on them (based on time). The metrics thread is only a collector. This should speedup development :)

@prymitive prymitive referenced this pull request
Closed

System metrics #455

@unbit
Owner

Same as #236

@unbit unbit closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Apr 7, 2013
  1. @prymitive
This page is out of date. Refresh to see the latest.
Showing with 10 additions and 0 deletions.
  1. +10 −0 core/master_utils.c
View
10 core/master_utils.c
@@ -828,6 +828,16 @@ struct uwsgi_stats *uwsgi_master_generate_stats() {
if (uwsgi_stats_keylong_comma(us, "load", (unsigned long long) uwsgi.shared->load))
goto end;
+
+ double load[3];
+ char loadavg[128] = "N/A";
+ if (getloadavg(load, 3) != -1) {
+ if (sprintf(loadavg, "%.2f, %.2f, %.2f", load[0], load[1], load[2]) < 0)
+ uwsgi_error("getloadavg()\n");
+ }
+ if (uwsgi_stats_keyval_comma(us, "system_loadavg", loadavg))
+ goto end;
+
if (uwsgi_stats_keylong_comma(us, "pid", (unsigned long long) getpid()))
goto end;
if (uwsgi_stats_keylong_comma(us, "uid", (unsigned long long) getuid()))
Something went wrong with that request. Please try again.