Skip to content

Commit

Permalink
metrics, pprof: support reloading services with SIGHUP
Browse files Browse the repository at this point in the history
Reload prometheus and pprof services, even if the config is not updated.

Closes #1868.

Signed-off-by: Andrey Butusov <andrey@nspcc.io>
  • Loading branch information
End-rey committed Nov 14, 2024
1 parent e8ea614 commit 1520f03
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ attribute, which is used for container domain name in NNS contracts (#2954)
- Docs files for cli commands to the `docs/cli-commands` folder (#2983)
- `logger.encoding` config option (#2999)
- Reloading morph endpoints with SIGHUP (#2998)
- Reloading pprof/metrics services with SIGHUP (#3016)

### Fixed
- Do not search for tombstones when handling their expiration, use local indexes instead (#2929)
Expand Down
13 changes: 13 additions & 0 deletions cmd/neofs-node/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"os"
"os/signal"
"path/filepath"
"slices"
"sync"
"sync/atomic"
"syscall"
Expand Down Expand Up @@ -848,6 +849,18 @@ func (c *cfg) configWatcher(ctx context.Context) {
continue
}

// Prometheus and pprof

for _, lastCloser := range c.veryLastClosers {
lastCloser()
}

Check warning on line 856 in cmd/neofs-node/config.go

View check run for this annotation

Codecov / codecov/patch

cmd/neofs-node/config.go#L854-L856

Added lines #L854 - L856 were not covered by tests

c.veryLastClosers = slices.Delete(c.veryLastClosers, 0, len(c.veryLastClosers))

preRunAndLog(c, "prometheus", initMetrics(c))

preRunAndLog(c, "pprof", initProfiler(c))

Check warning on line 863 in cmd/neofs-node/config.go

View check run for this annotation

Codecov / codecov/patch

cmd/neofs-node/config.go#L858-L863

Added lines #L858 - L863 were not covered by tests
// Logger

err = c.internals.logLevel.UnmarshalText([]byte(c.logger.level))
Expand Down

0 comments on commit 1520f03

Please sign in to comment.