feat(metrics): Add describe() calls to metrics (#1141)

Co-authored-by: lambdaclass-user <github@lambdaclass.com>
This commit is contained in:
Francisco Krause Arnim
2023-02-02 15:28:10 -03:00
committed by GitHub
parent c63f5ff942
commit d050e47a8a

View File

@ -66,6 +66,8 @@ pub(crate) fn derive(node: &DeriveInput) -> Result<proc_macro2::TokenStream> {
quote! { quote! {
impl Default for #ty { impl Default for #ty {
fn default() -> Self { fn default() -> Self {
#ty::describe();
Self { Self {
#(#defaults)* #(#defaults)*
} }
@ -127,6 +129,8 @@ pub(crate) fn derive(node: &DeriveInput) -> Result<proc_macro2::TokenStream> {
impl #ty { impl #ty {
/// Create new instance of metrics with provided scope. /// Create new instance of metrics with provided scope.
#vis fn new(scope: &str) -> Self { #vis fn new(scope: &str) -> Self {
#ty::describe(scope);
Self { Self {
#(#defaults)* #(#defaults)*
} }
@ -147,7 +151,6 @@ pub(crate) fn derive(node: &DeriveInput) -> Result<proc_macro2::TokenStream> {
} }
} }
}; };
Ok(quote! { Ok(quote! {
#register_and_describe #register_and_describe