golemfactory / ya-runtime-ai

1 stars 1 forks source link

request counters #75

Closed pwalski closed 3 months ago

pwalski commented 3 months ago

Resolves: https://github.com/golemfactory/ya-runtime-ai/issues/56 Resolves: https://github.com/golemfactory/ya-runtime-ai/issues/57

pwalski commented 3 months ago

First of all some part of counters implementations should be in yagna. Requests counters are something that every user of the library would like to use. On the other side duration counter is something more general and should probably stay in ya-runtime-ai. Abstractions that you build should reflect this split of responsibility.

I made gsb-http-proxy to provide only a Response/RequestMonitor traits and their functions usage implementation, because I considered counters to be a part of Agreement domain and gsb-http-proxy knows nothing about it. Library knows what is a response and what is a request, and it is all it does regarding counters. The way Requests counter and Request (GPU) duration counter internally work is inseparable to its id/name, and this is a part of Agreement and I assumed it should not be inside gsb-http-proxy. Additionally I wanted to implement counters as a tool converting golem/com/usage/vector from Agreement into corresponding currentUsage property of Activity, and hide this implementation. This conversion of a list of some names into a list of f64 values according to some opaque rules is confusing (can the list be empty? what to do on unsupported counter? can it have duplicates? (accidentally it can)). @nieznanysprawiciel

pwalski commented 3 months ago

Work continued in PR https://github.com/golemfactory/ya-runtime-ai/pull/84