Skip to content

Commit

Permalink
fix: Change MetricServer name to resolve golint issue
Browse files Browse the repository at this point in the history
  • Loading branch information
kianaza committed May 25, 2024
1 parent 9e337d6 commit d951eb0
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions internal/metric/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,29 +10,29 @@ import (
)

// MetricServer contains information about metrics server.
type server struct {
type ServerInfo struct {
srv *http.ServeMux
address string
}

// NewServer creates a new monitoring server.
func NewServer(cfg Config) server {
func NewServer(cfg Config) ServerInfo {
var srv *http.ServeMux

Check warning on line 20 in internal/metric/server.go

View check run for this annotation

Codecov / codecov/patch

internal/metric/server.go#L19-L20

Added lines #L19 - L20 were not covered by tests

if cfg.Enabled {
srv = http.NewServeMux()
srv.Handle("/metrics", promhttp.Handler())

Check warning on line 24 in internal/metric/server.go

View check run for this annotation

Codecov / codecov/patch

internal/metric/server.go#L22-L24

Added lines #L22 - L24 were not covered by tests
}

return server{
return ServerInfo{
address: cfg.Server.Address,
srv: srv,

Check warning on line 29 in internal/metric/server.go

View check run for this annotation

Codecov / codecov/patch

internal/metric/server.go#L27-L29

Added lines #L27 - L29 were not covered by tests
}
}

// Start creates and run a metric server for prometheus in new go routine.
// nolint: mnd
func (s server) Start(logger *zap.Logger) {
func (s ServerInfo) Start(logger *zap.Logger) {
go func() {

Check warning on line 36 in internal/metric/server.go

View check run for this annotation

Codecov / codecov/patch

internal/metric/server.go#L35-L36

Added lines #L35 - L36 were not covered by tests
// nolint: exhaustruct
srv := http.Server{
Expand Down

0 comments on commit d951eb0

Please sign in to comment.