-
Notifications
You must be signed in to change notification settings - Fork 335
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
refactor: Use two instances of the query service for queries and https outcall transform functions #3992
Conversation
…d transform queries for https outcalls
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One part where I would appreciate any better ideas is how to handle instantiating the same service twice, specifically because of registering metrics with the same name (if done naively).
For now I took the approach of passing an extra "namespace" argument when creating the service which is used as the prefix of the exported metrics. While it's not too bad, it still feels somewhat hacky. If anyone has a better idea, let me know.
I guess one alternative could be to instead switch to a |
That's an interesting alternative. It does feel kinda wrong though as each service has a single metric, so making it a |
Another alternative would be to use the Histogram::with_opts constructor and provide a list of fixed labels (see https://sourcegraph.com/github.com/dfinity/ic/-/blob/rs/artifact_pool/src/consensus_pool.rs?L137-147 for an example of how we do it in the consensus pool) |
I'm actually not sure any of these would work after thinking about it some more. As long as the metric name is the same, we're still gonna have an issue I think as the metric name cannot be registered twice with the |
Hmm, seems I was wrong. Trying out @kpop-dfinity's suggestion seems to work. Not entirely sure it's a lot better but I'm also ok with that and it doesn't make a whole lot of difference in the amount of changes needed. |
In a previous change, the older
AnonymousQueryService
was dropped in order to re-use the sameQueryService
for handling both regular queries and transform functions from https outcalls.While this change is a step in a good direction as we don't have mostly duplicate code in
AnonymousQueryService
, it couples regular queries with transform function executions. To provide better quality of service, go back to using two instances of the same service. This way we can get the best of both worlds: code reusability as well as isolation between the two types of queries.