-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #23 from ultravioletrs/NOISSUE-metric
NOISSUE - Add Metric To Internal Package
- Loading branch information
Showing
2 changed files
with
28 additions
and
17 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
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,25 @@ | ||
package internal | ||
|
||
import ( | ||
kitprometheus "github.com/go-kit/kit/metrics/prometheus" | ||
stdprometheus "github.com/prometheus/client_golang/prometheus" | ||
) | ||
|
||
// MakeMetrics returns an instance of metrics. | ||
func MakeMetrics(namespace, subsystem string) (*kitprometheus.Counter, *kitprometheus.Summary) { | ||
counter := kitprometheus.NewCounterFrom(stdprometheus.CounterOpts{ | ||
Namespace: namespace, | ||
Subsystem: subsystem, | ||
Name: "request_count", | ||
Help: "Number of requests received.", | ||
}, []string{"method"}) | ||
latency := kitprometheus.NewSummaryFrom(stdprometheus.SummaryOpts{ | ||
Namespace: namespace, | ||
Subsystem: subsystem, | ||
Objectives: map[float64]float64{0.5: 0.05, 0.9: 0.01, 0.99: 0.001}, | ||
Name: "request_latency_microseconds", | ||
Help: "Total duration of requests in microseconds.", | ||
}, []string{"method"}) | ||
|
||
return counter, latency | ||
} |