2015-12-03 13:00 GMT+01:00 Riccardo Magliocchetti <[email protected]>: >> Currently, I'm working on a metric system supporting the creation of >> metrics during the runtime and I would like to know how other uwsgi >> developper would implement it. > > > Am looking at the metrics subsystem for the first time, uwsgi_metrics_loop > may give you some hints on how metrics are scanned and the locking needed > when touch uwsgi.metrics. > > I think you can hack a quick prototype by using something like -1 as a > freq value to indicate to do not collect the metric and by modifying it > at runtime. This would let you just turn on / off them though and not > dinamically add them. But once you have the locking right it could be > doable.
Turning on / off metrics won't be enough for our use case. We want to have stats about the response time of some endpoint, and we have a lot of endpoints. We don't want to change the configuration file each time we want to have metrics on a specific endpoint, because we would also have to reload uWSGI, which we want to avoid if possible. If I understand processes' behaviour correctly, I can't add metrics dynamically while keeping the actual system, because I can't share metrics across processes after the fork. I could allocate shared memory but then I would have to set a limit on the quantity of dynamic metrics one can use. >> The choice I made is to let the original metric system untouched, and >> to make a new system with less features but supporting the creation at >> runtime. It's an hard choice, but I don't know how to do better, since >> creation of metrics cannot be added to the current system and I'm a >> bit afraid of modifying the whole metric system to support creation. > > > I don't think that duplicating a subsystem would be something that can be > applied upstream :) You're right. If it ends with a duplication of the system (which I would dislike), we'll keep it in a fork. -- Alexandre BONNETAIN _______________________________________________ uWSGI mailing list [email protected] http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi
