-
Notifications
You must be signed in to change notification settings - Fork 30
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
Support aliases for function & module names (to handle refactors) #66
Comments
A simpler way of doing that could be to "just" duplicate the metric, so calling There are 2 issues with that approach Breaking SLOsWe need to only count one of the metrics for the SLO error budget otherwise that would break the SLO (the expectation of acceptable error levels vs. what error rate actually triggers the alert). To fix that, we can make sure that when feeding data to the alias metric, we never add the Tracking metric from new to oldThis proposal would make it really easy to see the new stats when querying only A solution for that would be to add |
Hello @emschwartz @gagbo, I am interested in contributing to Autometrics. Will it be okay if I start working on this issue ? |
@Archisman-Mridha 100%! let us know if you run into any issues or if we can help in any way. Thank you for the support! |
Btw, 1 thing to note here - Let's say we have this scenario initially - struct Foo;
#[autometrics]
impl Foo {
fn bar( ) { }
} Metrics for the function will be generated with name Now, we change the struct name to struct Fiber;
#[autometrics(alias = "Foo")]
impl Fiber {
fn bar( ) { }
} Metrics for the function will now be generated with names But then, if we also rename struct Fiber;
#[autometrics(alias = "Foo")]
impl Fiber {
fn plane( ) { }
} Metrics for the function will now be generated with names |
Also, someone can assign this issue to me :) |
Yeah, to solve this, you would need to add an alias when changing the function from #[autometrics(alias = "Foo")]
impl Fiber {
#[autometrics(alias = "bar")]
fn plane( ) { }
} But it’s also not so important if we lose the metrics that are at least two different refactorings away. Renaming like this shouldn’t happen too often, and we do not necessarily want to generate 10 metrics if a function changed name 10 times, because it takes space. |
If you refactor your code and change the names of functions or modules, you might want to keep some continuity with the metric names.
@akesling suggested allowing users to specify an alias for each function such that the metrics would be produced with the new and the old function/module names. That way, you could keep using the old name and then transition to the new name later and remove the alias once you've moved everything over.
I like the idea of having a parameter for the macro along the lines of
function_alias="other_function_name"
orfunction_aliases=["function_1", "function_2"]
and the equivalent formodule_alias
andmodule_aliases
. We could then duplicate the tracking code so it produces the metrics under all of the given names.The text was updated successfully, but these errors were encountered: