common icon indicating copy to clipboard operation
common copied to clipboard

Allow MetricFamilyToText to omit Type information if specified

Open conorevans opened this issue 2 years ago • 1 comments

Similar to HELP, it would be nice to have the option to toggle TYPE being included

	// Comments, first HELP, then TYPE.
	if in.Help != nil {
        }

Some context: https://github.com/influxdata/telegraf/pull/11417

Note: I would like to make this contribution 🙂

conorevans avatar Aug 16 '22 11:08 conorevans

Hmm ok, re-reading, MetricFamily.Type cannot legitimately be nil. So far I see a few options (going to try to look for a better one)

  • if in.Help is nil, we can also node show the Type comment... doesn't feel quite right
  • add a func parameter (but it would have to be a bool arg, we couldn't apply an Option func) but this method is exported and that's an annoying change for most downstream users

Each of those definitely requires some sign-off from maintainers (hi @roidelapluie)

E: I couldn't see a nice way to do it here.

conorevans avatar Aug 16 '22 17:08 conorevans