Skip to content

Conversation

dgrisonnet
Copy link

When parsing text format it is sometimes useful to keep all the MetricFamilies around, even the ones that don't have any timeseries. This is the case for the testutil library in client_golang where we need to distinguish registered metrics from erronous inputs.

When parsing text format it is sometimes useful to keep all the
MetricFamilies around, even the ones that don't have any timeseries.
This is the case for the testutil library in client_golang where we need
to distinguish registered metrics from erronous inputs.

Signed-off-by: Damien Grisonnet <[email protected]>
Comment on lines -79 to -82
// Fail-fast checks.
if len(in.Metric) == 0 {
return 0, fmt.Errorf("MetricFamily has no metrics: %s", in)
}
Copy link
Author

@dgrisonnet dgrisonnet Oct 10, 2024

Choose a reason for hiding this comment

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

Tests are failing because of this. I guess I will need to introduce a new function just to keep MetricFamilies without timeseries around

Copy link
Member

Choose a reason for hiding this comment

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

...or variadic option 🤔 or "both", so

NewMFConverter(opts).MetricFamilyToText

then keeping MetricFamilyToText as NewMFConverter(nil).MetricFamilyToText(....)

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.

2 participants