-
Notifications
You must be signed in to change notification settings - Fork 202
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: hfuss <haydenfuss@gmail.com>
- Loading branch information
1 parent
cd42330
commit b5bf575
Showing
4 changed files
with
83 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package apiserver | ||
|
||
import ( | ||
"github.com/hyperledger/firefly/internal/config" | ||
) | ||
|
||
const ( | ||
MetricsEnabled = "enabled" | ||
MetricsPath = "path" | ||
) | ||
|
||
func initMetricsConfPrefix(prefix config.Prefix) { | ||
prefix.AddKnownKey(MetricsEnabled, true) | ||
prefix.AddKnownKey(MetricsPath, "/metrics") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package metrics | ||
|
||
import "github.com/prometheus/client_golang/prometheus" | ||
|
||
var registry *prometheus.Registry | ||
|
||
// Registry returns FireFly's customized Prometheus registry | ||
func Registry() *prometheus.Registry { | ||
if registry == nil { | ||
registry = prometheus.NewRegistry() | ||
registry.MustRegister(prometheus.NewGoCollector()) | ||
registry.MustRegister(prometheus.NewProcessCollector(prometheus.ProcessCollectorOpts{})) | ||
} | ||
|
||
return registry | ||
} | ||
|
||
// Clear will reset the Prometheus metrics registry, useful for testing | ||
func Clear() { | ||
registry = nil | ||
} |