fix: function names

This commit is contained in:
Elton Minetto
2020-06-30 13:37:51 -03:00
parent 4c6b43b04d
commit 2ae9c39824
11 changed files with 50 additions and 50 deletions
+2 -2
View File
@@ -57,8 +57,8 @@ func (h *HTTP) Finished() {
h.Duration = time.Since(h.StartedAt).Seconds()
}
//UseCase definition
type UseCase interface {
//Service definition
type Service interface {
SaveCLI(c *CLI) error
SaveHTTP(h *HTTP)
}
+6 -6
View File
@@ -6,14 +6,14 @@ import (
"github.com/prometheus/client_golang/prometheus/push"
)
//Service implements UseCase interface
type Service struct {
//service implements Service interface
type service struct {
pHistogram *prometheus.HistogramVec
httpRequestHistogram *prometheus.HistogramVec
}
//NewPrometheusService create a new prometheus service
func NewPrometheusService() (*Service, error) {
func NewPrometheusService() (*service, error) {
cli := prometheus.NewHistogramVec(prometheus.HistogramOpts{
Namespace: "pushgateway",
Name: "cmd_duration_seconds",
@@ -27,7 +27,7 @@ func NewPrometheusService() (*Service, error) {
Buckets: prometheus.DefBuckets,
}, []string{"handler", "method", "code"})
s := &Service{
s := &service{
pHistogram: cli,
httpRequestHistogram: http,
}
@@ -43,13 +43,13 @@ func NewPrometheusService() (*Service, error) {
}
//SaveCLI send metrics to server
func (s *Service) SaveCLI(c *CLI) error {
func (s *service) SaveCLI(c *CLI) error {
gatewayURL := config.PROMETHEUS_PUSHGATEWAY
s.pHistogram.WithLabelValues(c.Name).Observe(c.Duration)
return push.New(gatewayURL, "cmd_job").Collector(s.pHistogram).Push()
}
//SaveHTTP send metrics to server
func (s *Service) SaveHTTP(h *HTTP) {
func (s *service) SaveHTTP(h *HTTP) {
s.httpRequestHistogram.WithLabelValues(h.Handler, h.Method, h.StatusCode).Observe(h.Duration)
}
+2 -2
View File
@@ -1,7 +1,7 @@
package password
//UseCase interface
type UseCase interface {
//Service interface
type Service interface {
Generate(raw string) (string, error)
Compare(p1, p2 string) error
}