Skip to content

Commit

Permalink
metrics: set the highest priority for metrics service.
Browse files Browse the repository at this point in the history
Metrics port should be opened before all other ports, and start served
before all other services.

 Refs: #2428.

Signed-off-by: Ekaterina Pavlova <[email protected]>
  • Loading branch information
AliceInHunterland committed Nov 13, 2023
1 parent 59a8198 commit 092d3f1
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Changelog for NeoFS Node
- Transaction witness scope no longer uses CustomGroups relying on more strict Rules now (#2619)
- New optimized SDK version is integrated (#2622)
- IR uses internal LOCODE DB from Go package (#2610)
- The priority of metrics service is increased (#2428)

### Removed
- deprecated `no-precheck` flag of `neofs-cli container set-eacl` (#2496)
Expand Down
4 changes: 2 additions & 2 deletions cmd/neofs-node/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ func initAndLog(c *cfg, name string, initializer func(*cfg)) {
}

func initApp(c *cfg) {
initAndLog(c, "prometheus", initMetrics)
initAndLog(c, "gRPC", initGRPC)
initLocalStorage(c)

c.ctx, c.ctxCancel = signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM)
Expand All @@ -88,7 +90,6 @@ func initApp(c *cfg) {
fatalOnErr(c.cfgObject.cfgLocalStorage.localStorage.Init())
})

initAndLog(c, "gRPC", initGRPC)
initAndLog(c, "netmap", initNetmapService)
initAndLog(c, "accounting", initAccountingService)
initAndLog(c, "container", initContainerService)
Expand All @@ -97,7 +98,6 @@ func initApp(c *cfg) {
initAndLog(c, "notification", initNotifications)
initAndLog(c, "object", initObjectService)
initAndLog(c, "pprof", initProfiler)
initAndLog(c, "prometheus", initMetrics)
initAndLog(c, "tree", initTreeService)
initAndLog(c, "control", initControlService)

Expand Down
8 changes: 3 additions & 5 deletions cmd/neofs-node/metrics.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package main

import (
"context"

metricsconfig "github.com/nspcc-dev/neofs-node/cmd/neofs-node/config/metrics"
httputil "github.com/nspcc-dev/neofs-node/pkg/util/http"
"github.com/prometheus/client_golang/prometheus/promhttp"
Expand All @@ -26,12 +24,12 @@ func initMetrics(c *cfg) {
),
)

c.workers = append(c.workers, newWorkerFromFunc(func(context.Context) {
runAndLog(c, "metrics", false, func(c *cfg) {
go func() {
runAndLog(c, "metrics", true, func(c *cfg) {
fatalOnErr(srv.Serve())
})
}))

Check failure on line 31 in cmd/neofs-node/metrics.go

View workflow job for this annotation

GitHub Actions / lint

unnecessary trailing newline (whitespace)
}()
c.closers = append(c.closers, func() {
c.log.Debug("shutting down metrics service")

Expand Down

0 comments on commit 092d3f1

Please sign in to comment.