21700: Install Bundler system-wide in Rails postinst
[arvados.git] / sdk / go / arvadostest / metrics.go
1 // Copyright (C) The Arvados Authors. All rights reserved.
2 //
3 // SPDX-License-Identifier: Apache-2.0
4
5 package arvadostest
6
7 import (
8         "bytes"
9
10         "github.com/prometheus/client_golang/prometheus"
11         "github.com/prometheus/common/expfmt"
12 )
13
14 func GatherMetricsAsString(reg *prometheus.Registry) string {
15         buf := bytes.NewBuffer(nil)
16         enc := expfmt.NewEncoder(buf, expfmt.FmtText)
17         got, _ := reg.Gather()
18         for _, mf := range got {
19                 enc.Encode(mf)
20         }
21         return buf.String()
22 }