Skip to content

Commit e37695d

Browse files
author
Pavel Okhlopkov
committed
init
Signed-off-by: Pavel Okhlopkov <[email protected]>
1 parent e4f317f commit e37695d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

74 files changed

+1818
-386
lines changed

.golangci.yaml

+28
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ linters:
2424
- nolintlint
2525
- prealloc
2626
- revive
27+
- sloglint
2728
- staticcheck
2829
- stylecheck
2930
- unconvert
@@ -39,6 +40,33 @@ linters-settings:
3940
local-prefixes: github.com/flant/
4041
nolintlint:
4142
allow-unused: true
43+
sloglint:
44+
# Enforce not mixing key-value pairs and attributes.
45+
no-mixed-args: true
46+
# Enforce using key-value pairs only (overrides no-mixed-args, incompatible with attr-only).
47+
kv-only: false
48+
# Enforce using attributes only (overrides no-mixed-args, incompatible with kv-only).
49+
attr-only: false
50+
# Enforce not using global loggers.
51+
no-global: ""
52+
# Enforce using methods that accept a context.
53+
context: ""
54+
# Enforce using static values for log messages.
55+
static-msg: false
56+
# Enforce using constants instead of raw keys.
57+
no-raw-keys: false
58+
# Enforce a single key naming convention.
59+
key-naming-case: ""
60+
# Enforce not using specific keys.
61+
forbidden-keys:
62+
- level
63+
- msg
64+
- logger
65+
- source
66+
- stacktrace
67+
- time
68+
# Enforce putting arguments on separate lines.
69+
args-on-sep-lines: false
4270
depguard:
4371
rules:
4472
Main:

cmd/shell-operator/main.go

+5-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import (
1313
"github.com/flant/shell-operator/pkg/debug"
1414
"github.com/flant/shell-operator/pkg/jq"
1515
shell_operator "github.com/flant/shell-operator/pkg/shell-operator"
16+
"github.com/flant/shell-operator/pkg/unilogger"
1617
utils_signal "github.com/flant/shell-operator/pkg/utils/signal"
1718
)
1819

@@ -35,6 +36,9 @@ func main() {
3536
return nil
3637
})
3738

39+
logger := unilogger.NewLogger(unilogger.Options{})
40+
unilogger.SetDefault(logger)
41+
3842
// start main loop
3943
startCmd := kpApp.Command("start", "Start shell-operator.").
4044
Default().
@@ -45,7 +49,7 @@ func main() {
4549
rand.Seed(time.Now().UnixNano())
4650

4751
// Init logging and initialize a ShellOperator instance.
48-
operator, err := shell_operator.Init()
52+
operator, err := shell_operator.Init(logger.Named("shell-operator"))
4953
if err != nil {
5054
os.Exit(1)
5155
}

go.mod

+6-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ require (
1717
github.com/onsi/gomega v1.34.1
1818
github.com/pkg/errors v0.9.1
1919
github.com/prometheus/client_golang v1.19.1
20-
github.com/sirupsen/logrus v1.9.3
2120
github.com/stretchr/testify v1.9.0
2221
golang.org/x/time v0.7.0
2322
gopkg.in/alecthomas/kingpin.v2 v2.2.6
@@ -33,6 +32,11 @@ require (
3332
// Remove 'in body' from errors, fix for Go 1.16 (https://github.com/go-openapi/validate/pull/138).
3433
replace github.com/go-openapi/validate => github.com/flant/go-openapi-validate v0.19.12-flant.0
3534

35+
require (
36+
github.com/DataDog/gostackparse v0.7.0
37+
github.com/gojuno/minimock/v3 v3.4.0
38+
)
39+
3640
require (
3741
github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751 // indirect
3842
github.com/alecthomas/units v0.0.0-20211218093645-b94a6e3cc137 // indirect
@@ -53,7 +57,6 @@ require (
5357
github.com/go-stack/stack v1.8.0 // indirect
5458
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 // indirect
5559
github.com/gogo/protobuf v1.3.2 // indirect
56-
github.com/gojuno/minimock/v3 v3.4.0 // indirect
5760
github.com/golang/protobuf v1.5.4 // indirect
5861
github.com/google/btree v1.0.1 // indirect
5962
github.com/google/gnostic-models v0.6.8 // indirect
@@ -76,6 +79,7 @@ require (
7679
github.com/prometheus/client_model v0.5.0 // indirect
7780
github.com/prometheus/common v0.48.0 // indirect
7881
github.com/prometheus/procfs v0.12.0 // indirect
82+
github.com/sirupsen/logrus v1.9.0 // indirect
7983
github.com/spf13/pflag v1.0.5 // indirect
8084
github.com/tidwall/pretty v1.2.0 // indirect
8185
go.mongodb.org/mongo-driver v1.5.4 // indirect

go.sum

+9-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
2+
github.com/DataDog/gostackparse v0.7.0 h1:i7dLkXHvYzHV308hnkvVGDL3BR4FWl7IsXNPz/IGQh4=
3+
github.com/DataDog/gostackparse v0.7.0/go.mod h1:lTfqcJKqS9KnXQGnyQMCugq3u1FP6UZMfWR0aitKFMM=
24
github.com/PuerkitoBio/purell v1.1.0/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0=
35
github.com/PuerkitoBio/purell v1.1.1/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0=
46
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE=
@@ -90,6 +92,7 @@ github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg78
9092
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 h1:tfuBGBXKqDEevZMzYi5KSi8KkcZtzBcTgAUUtapy0OI=
9193
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572/go.mod h1:9Pwr4B2jHnOSGXyyzV8ROjYa2ojvAY6HCGYYfMoC3Ls=
9294
github.com/go-task/slim-sprig/v3 v3.0.0 h1:sUs3vkvUymDpBKi3qH1YSqBQk9+9D/8M2mN1vB6EwHI=
95+
github.com/go-task/slim-sprig/v3 v3.0.0/go.mod h1:W848ghGpv3Qj3dhTPRyJypKRiqCdHZiAzKg9hl15HA8=
9396
github.com/gobuffalo/attrs v0.0.0-20190224210810-a9411de4debd/go.mod h1:4duuawTqi2wkkpB4ePgWMaai6/Kc6WEz83bhFwpHzj0=
9497
github.com/gobuffalo/depgen v0.0.0-20190329151759-d478694a28d3/go.mod h1:3STtPUQYuzV0gBVOY3vy6CfMm/ljR4pABfrTeHNLHUY=
9598
github.com/gobuffalo/depgen v0.1.0/go.mod h1:+ifsuy7fhi15RWncXQQKjWS9JPkdah5sZvtHc2RXGlg=
@@ -147,6 +150,7 @@ github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/
147150
github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0=
148151
github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
149152
github.com/google/pprof v0.0.0-20240424215950-a892ee059fd6 h1:k7nVchz72niMH6YLQNvHSdIE7iqsQxK1P41mySCvssg=
153+
github.com/google/pprof v0.0.0-20240424215950-a892ee059fd6/go.mod h1:kf6iHlnVGwgKolg33glAes7Yg/8iWP8ukqeldJSO7jw=
150154
github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
151155
github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
152156
github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I=
@@ -182,6 +186,7 @@ github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxv
182186
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
183187
github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
184188
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
189+
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
185190
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
186191
github.com/kr/pty v1.1.5/go.mod h1:9r2w37qlBe7rQ6e1fg1S/9xpWHSnaqNdHD3WcMdbPDA=
187192
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
@@ -216,6 +221,7 @@ github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108
216221
github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE=
217222
github.com/onsi/ginkgo v1.16.5/go.mod h1:+E8gABHa3K6zRBolWtd+ROzc/U5bkGt0FwiG042wbpU=
218223
github.com/onsi/ginkgo/v2 v2.19.0 h1:9Cnnf7UHo57Hy3k6/m5k3dRfGTMXGvxhHFvkDTCTpvA=
224+
github.com/onsi/ginkgo/v2 v2.19.0/go.mod h1:rlwLi9PilAFJ8jCg9UE1QP6VBpd6/xj3SRC0d6TU0To=
219225
github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY=
220226
github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo=
221227
github.com/onsi/gomega v1.34.1 h1:EUMJIKUjM8sKjYbtxQI9A4z2o+rruxnzNvpknOXie6k=
@@ -243,12 +249,13 @@ github.com/rogpeppe/go-internal v1.1.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFR
243249
github.com/rogpeppe/go-internal v1.2.2/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
244250
github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
245251
github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ=
252+
github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog=
246253
github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo=
247254
github.com/sirupsen/logrus v1.4.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
248255
github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q=
249256
github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
250-
github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ=
251-
github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
257+
github.com/sirupsen/logrus v1.9.0 h1:trlNQbNUG3OdDrDil03MCb1H2o9nJ1x4/5LYw7byDE0=
258+
github.com/sirupsen/logrus v1.9.0/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
252259
github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ=
253260
github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
254261
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=

pkg/app/log.go

+37-50
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
package app
22

33
import (
4-
"bytes"
54
"fmt"
65
"strings"
76
"time"
87

9-
log "github.com/sirupsen/logrus"
108
"gopkg.in/alecthomas/kingpin.v2"
119

1210
"github.com/flant/shell-operator/pkg/config"
11+
"github.com/flant/shell-operator/pkg/unilogger"
1312
)
1413

1514
// Use info level with timestamps and a text output by default
@@ -45,33 +44,34 @@ func DefineLoggingFlags(cmd *kingpin.CmdClause) {
4544
}
4645

4746
// SetupLogging sets logger formatter and level.
48-
func SetupLogging(runtimeConfig *config.Config) {
49-
jsonFormatter := log.JSONFormatter{DisableTimestamp: LogNoTime}
50-
textFormatter := log.TextFormatter{DisableTimestamp: LogNoTime, DisableColors: true}
51-
colorFormatter := log.TextFormatter{DisableTimestamp: LogNoTime, ForceColors: true, FullTimestamp: true}
52-
switch strings.ToLower(LogType) {
53-
case "json":
54-
log.SetFormatter(&jsonFormatter)
55-
case "text":
56-
log.SetFormatter(&textFormatter)
57-
case "color":
58-
log.SetFormatter(&colorFormatter)
59-
default:
60-
log.SetFormatter(&jsonFormatter)
61-
}
62-
if LogProxyHookJSON {
63-
formatter := log.StandardLogger().Formatter
64-
log.SetFormatter(&ProxyJsonWrapperFormatter{WrappedFormatter: formatter})
65-
}
47+
func SetupLogging(runtimeConfig *config.Config, logger *unilogger.Logger) {
48+
// TODO: if we need formatters - add to logger
49+
// jsonFormatter := log.JSONFormatter{DisableTimestamp: LogNoTime}
50+
// textFormatter := log.TextFormatter{DisableTimestamp: LogNoTime, DisableColors: true}
51+
// colorFormatter := log.TextFormatter{DisableTimestamp: LogNoTime, ForceColors: true, FullTimestamp: true}
52+
// switch strings.ToLower(LogType) {
53+
// case "json":
54+
// log.SetFormatter(&jsonFormatter)
55+
// case "text":
56+
// log.SetFormatter(&textFormatter)
57+
// case "color":
58+
// log.SetFormatter(&colorFormatter)
59+
// default:
60+
// log.SetFormatter(&jsonFormatter)
61+
// }
62+
// if LogProxyHookJSON {
63+
// formatter := log.StandardLogger().Formatter
64+
// log.SetFormatter(&ProxyJsonWrapperFormatter{WrappedFormatter: formatter})
65+
// }
6666

67-
setLogLevel(LogLevel)
67+
unilogger.SetDefaultLevel(unilogger.LogLevelFromStr(LogLevel))
6868

6969
runtimeConfig.Register("log.level",
7070
fmt.Sprintf("Global log level. Default duration for debug level is %s", ForcedDurationForDebugLevel),
7171
strings.ToLower(LogLevel),
7272
func(oldValue string, newValue string) error {
73-
log.Infof("Set log level to '%s'", newValue)
74-
setLogLevel(newValue)
73+
unilogger.Infof("Set log level to '%s'", newValue)
74+
unilogger.SetDefaultLevel(unilogger.LogLevelFromStr(newValue))
7575
return nil
7676
}, func(oldValue string, newValue string) time.Duration {
7777
if strings.ToLower(newValue) == "debug" {
@@ -81,32 +81,19 @@ func SetupLogging(runtimeConfig *config.Config) {
8181
})
8282
}
8383

84-
func setLogLevel(logLevel string) {
85-
switch strings.ToLower(logLevel) {
86-
case "debug":
87-
log.SetLevel(log.DebugLevel)
88-
case "error":
89-
log.SetLevel(log.ErrorLevel)
90-
case "info":
91-
log.SetLevel(log.InfoLevel)
92-
default:
93-
log.SetLevel(log.InfoLevel)
94-
}
95-
}
96-
97-
type ProxyJsonWrapperFormatter struct {
98-
WrappedFormatter log.Formatter
99-
}
84+
// type ProxyJsonWrapperFormatter struct {
85+
// WrappedFormatter log.Formatter
86+
// }
10087

101-
func (f *ProxyJsonWrapperFormatter) Format(entry *log.Entry) ([]byte, error) {
102-
// if proxying the json message is intended, just return the bytes
103-
// TODO: Find a more elegant way to carry this info
104-
if entry.Data[ProxyJsonLogKey] == true {
105-
b := bytes.NewBufferString(entry.Message)
106-
b.WriteString("\n")
107-
return b.Bytes(), nil
108-
}
88+
// func (f *ProxyJsonWrapperFormatter) Format(entry *log.Entry) ([]byte, error) {
89+
// // if proxying the json message is intended, just return the bytes
90+
// // TODO: Find a more elegant way to carry this info
91+
// if entry.Data[ProxyJsonLogKey] == true {
92+
// b := bytes.NewBufferString(entry.Message)
93+
// b.WriteString("\n")
94+
// return b.Bytes(), nil
95+
// }
10996

110-
// otherwise, use the wrapped formatter
111-
return f.WrappedFormatter.Format(entry)
112-
}
97+
// // otherwise, use the wrapped formatter
98+
// return f.WrappedFormatter.Format(entry)
99+
// }

pkg/config/config.go

+9-8
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@ package config
22

33
import (
44
"fmt"
5+
"log/slog"
56
"sort"
67
"strings"
78
"sync"
89
"time"
910

10-
log "github.com/sirupsen/logrus"
11+
"github.com/flant/shell-operator/pkg/unilogger"
1112
)
1213

1314
/**
@@ -42,16 +43,16 @@ type Config struct {
4243
temporalValues map[string]*TemporalValue
4344
expireTicker *time.Ticker
4445

45-
logEntry *log.Entry
46+
logger *unilogger.Logger
4647
}
4748

48-
func NewConfig() *Config {
49+
func NewConfig(logger *unilogger.Logger) *Config {
4950
return &Config{
5051
params: make(map[string]*Parameter),
5152
values: make(map[string]string),
5253
temporalValues: make(map[string]*TemporalValue),
5354
errors: make(map[string]error),
54-
logEntry: log.WithField("component", "runtimeConfig"),
55+
logger: logger.With(slog.String("component", "runtimeConfig")),
5556
}
5657
}
5758

@@ -131,7 +132,7 @@ func (c *Config) IsValid(name, value string) error {
131132
// maybe we should register it together with a parameter
132133
switch name {
133134
case "log.level":
134-
_, err := log.ParseLevel(value)
135+
_, err := unilogger.ParseLevel(value)
135136
if err != nil {
136137
return err
137138
}
@@ -254,7 +255,7 @@ func (c *Config) expireOverrides() {
254255

255256
for _, expire := range expires {
256257
name, oldValue, newValue := expire[0], expire[1], expire[2]
257-
c.logEntry.Debugf("Parameter '%s' expired", name)
258+
c.logger.Debug("Parameter is expired", slog.String("parameter", name))
258259
c.callOnChange(name, oldValue, newValue)
259260
}
260261
}
@@ -266,8 +267,8 @@ func (c *Config) callOnChange(name string, oldValue string, newValue string) {
266267
}
267268
err := c.params[name].onChange(oldValue, newValue)
268269
if err != nil {
269-
c.logEntry.Errorf("OnChange handler failed for '%s' during value change from '%s' to '%s': %v",
270-
name, oldValue, newValue, err)
270+
c.logger.Error("OnChange handler failed for parameter during value change values",
271+
slog.String("parameter", name), slog.String("old_value", oldValue), slog.String("new_value", newValue), slog.String("error", err.Error()))
271272
}
272273
c.m.Lock()
273274
delete(c.errors, name)

pkg/config/config_test.go

+4-3
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,12 @@ import (
55
"testing"
66
"time"
77

8+
"github.com/flant/shell-operator/pkg/unilogger"
89
"github.com/stretchr/testify/assert"
910
)
1011

1112
func TestConfig_Register(t *testing.T) {
12-
c := NewConfig()
13+
c := NewConfig(unilogger.NewNop())
1314

1415
c.Register("log.level", "", "info", nil, nil)
1516

@@ -32,7 +33,7 @@ func TestConfig_Register(t *testing.T) {
3233
}
3334

3435
func TestConfig_OnChange(t *testing.T) {
35-
c := NewConfig()
36+
c := NewConfig(unilogger.NewNop())
3637

3738
newValue := ""
3839
c.Register("log.level", "", "info", func(oldValue string, n string) error {
@@ -66,7 +67,7 @@ func TestConfig_OnChange(t *testing.T) {
6667

6768
func TestConfig_Errors(t *testing.T) {
6869
var err error
69-
c := NewConfig()
70+
c := NewConfig(unilogger.NewNop())
7071

7172
c.Register("log.level", "", "info", func(oldValue string, n string) error {
7273
if n == "debug" {

0 commit comments

Comments
 (0)