metrics.go
func DumpMetrics(ctx context.Context, task string) (string, error) {
	gatherer := prometheus.DefaultGatherer
	mfs, err := gatherer.Gather()
	if err != nil {
		return "", errors.Wrap(err, "gathering metrics")
	}

	buf := &bytes.Buffer{}
	enc := expfmt.NewEncoder(buf, expfmt.FmtText)

	for _, mf := range mfs {
		if err := enc.Encode(mf); err != nil {
			return buf.String(), errors.Wrap(err, "encoding metrics")
		}
	}
	return buf.String(), nil
}
func DumpMetrics(ctx context.Context, task string) (string, error) {
	gatherer := prometheus.DefaultGatherer
	mfs, err := gatherer.Gather()
	if err != nil {
		return "", errors.Wrap(err, "gathering metrics")
	}

	buf := &bytes.Buffer{}
	enc := expfmt.NewEncoder(buf, expfmt.FmtText)

	for _, mf := range mfs {
		if err := enc.Encode(mf); err != nil {
			return buf.String(), errors.Wrap(err, "encoding metrics")
		}
	}
	return buf.String(), nil
}
func DumpMetrics ( ctx context . Context , task string ) ( string , error ) { gatherer := prometheus . DefaultGatherer mfs , err := gatherer . Gather ( ) if err != nil { return " " , errors . Wrap ( err , " " ) } buf := & bytes . Buffer { } enc := expfmt . NewEncoder ( buf , expfmt . FmtText ) for _ , mf := range mfs { if err := enc . Encode ( mf ) ; err != nil { return buf . String ( ) , errors . Wrap ( err , " " ) } } return buf . String ( ) , nil }
// DumpMetrics returns the metrics prometheus would return when collected
// as a string, for fun and testing
DumpMetrics returns the metrics prometheus would return when collected as a string for fun and testing