Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
Signed-off-by: Jan-Otto Kröpke <[email protected]>
  • Loading branch information
jkroepke committed Dec 20, 2024
1 parent 687e4da commit 3eb433d
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions cmd/windows_exporter/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@ package main
//goland:noinspection GoUnsortedImport
//nolint:gofumpt

Check failure on line 21 in cmd/windows_exporter/main.go

View workflow job for this annotation

GitHub Actions / lint

directive `//nolint:gofumpt` is unused for linter "gofumpt" (nolintlint)
import (
// Its important that we do these first so that we can register with the Windows service control ASAP to avoid timeouts.
"github.com/prometheus-community/windows_exporter/internal/windowsservice"

"context"
"errors"
"fmt"
Expand All @@ -33,10 +30,14 @@ import (
"os/signal"
"os/user"
"runtime"
"runtime/debug"
"slices"
"strings"
"time"

// Its important that we do these first so that we can register with the Windows service control ASAP to avoid timeouts.
"github.com/prometheus-community/windows_exporter/internal/windowsservice"

"github.com/alecthomas/kingpin/v2"
"github.com/prometheus-community/windows_exporter/internal/config"
"github.com/prometheus-community/windows_exporter/internal/httphandler"
Expand Down Expand Up @@ -103,6 +104,10 @@ func run() int {
"process.priority",
"Priority of the exporter process. Higher priorities may improve exporter responsiveness during periods of system load. Can be one of [\"realtime\", \"high\", \"abovenormal\", \"normal\", \"belownormal\", \"low\"]",
).Default("normal").String()
memoryLimit = app.Flag(
"process.memory-limit",
"Limit memory usage in bytes. This is a soft-limit and not guaranteed. 0 means no limit. Read more at https://pkg.go.dev/runtime/debug#SetMemoryLimit .",
).Default("200000000").Int64()
)

logFile := &log.AllowedFile{}
Expand Down Expand Up @@ -132,6 +137,8 @@ func run() int {
return 1
}

debug.SetMemoryLimit(*memoryLimit)

logger, err := log.New(logConfig)
if err != nil {
//nolint:sloglint // we do not have an logger yet
Expand Down

0 comments on commit 3eb433d

Please sign in to comment.