Skip to content
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

Version Metrics updated (#4860) #4870

Merged
merged 6 commits into from
Nov 8, 2022
Merged

Version Metrics updated (#4860) #4870

merged 6 commits into from
Nov 8, 2022

Conversation

OlegJakushkin
Copy link
Contributor

Implemented a system for resolving #4860 needs

Resolves #4860

Added a system that allows for Static Metrics labelling.

Now versioning looks like this:
Screenshot 2022-11-07 142426

Changes:

  • Added attributes for static properties labelling with data from static class properties
  • Fixed metrics "Help" fields passing in the Metric descriptions

Types of changes

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation Update
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • Other (please describe):

Testing

Cosmetic data publishing change for external metric tools. Code covered by previously existing tests

  • Yes
  • No

In case you checked yes, did you write tests??

  • Yes
  • No

Tested on local Prometheus

Implemented a system for resolving #4860 needs
Added exceptions to make sure that only initialised fields are used for metrics
Copy link
Member

@LukaszRozmej LukaszRozmej left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall good, few minor changes

configuration.StaticLabels = tagValues;

string description = propertyInfo.GetCustomAttribute<DescriptionAttribute>()?.Description;
_gauges[gaugeName] = CreateGauge(BuildGaugeName(propertyInfo.Name), description, configuration);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Naming: Get method creates something inside, can we keep it that it returns it higher where it is inserted to dictionary?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you. Yeah, it is primarily a builder - it creates a Gauge for metrics, I will rename it properly.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed naming

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hm.. would still make this return CreateGauge(BuildGaugeName(propertyInfo.Name), description, configuration); and set _gauges[gaugeName] = CreateMemberInfoMectricsGauge() in the call method to be more readable with less side effects.

1) throw concrete exceptions
2) Naming
3) Unused removal
4) Function simplified
5) standarizing is all over the solution
@OlegJakushkin
Copy link
Contributor Author

@LukaszRozmej added fixes following your review. Please take a look

configuration.StaticLabels = tagValues;

string description = propertyInfo.GetCustomAttribute<DescriptionAttribute>()?.Description;
_gauges[gaugeName] = CreateGauge(BuildGaugeName(propertyInfo.Name), description, configuration);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hm.. would still make this return CreateGauge(BuildGaugeName(propertyInfo.Name), description, configuration); and set _gauges[gaugeName] = CreateMemberInfoMectricsGauge() in the call method to be more readable with less side effects.

@LukaszRozmej
Copy link
Member

Not sure why you did == to is change it is here: #4852

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement Version Metrics
2 participants