Skip to content

Commit

Permalink
chore: bump kod
Browse files Browse the repository at this point in the history
  • Loading branch information
sysulq committed Dec 25, 2024
1 parent ec6ec7e commit 8fa7652
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 90 deletions.
8 changes: 5 additions & 3 deletions core/otel/otel.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (
sdkmetric "go.opentelemetry.io/otel/sdk/metric"
sdkresource "go.opentelemetry.io/otel/sdk/resource"
sdktrace "go.opentelemetry.io/otel/sdk/trace"
semconv "go.opentelemetry.io/otel/semconv/v1.4.0"
semconv "go.opentelemetry.io/otel/semconv/v1.27.0"
)

type Config struct {
Expand All @@ -24,7 +24,9 @@ type Config struct {
EnableLog bool
}

func (c Config) Init(ctx context.Context, k *kod.Kod) error {
func (c Config) Init(ctx context.Context) error {
k := kod.FromContext(ctx)

resource := lo.Must(sdkresource.New(ctx,
sdkresource.WithFromEnv(),
sdkresource.WithTelemetrySDK(),
Expand All @@ -33,7 +35,7 @@ func (c Config) Init(ctx context.Context, k *kod.Kod) error {
sdkresource.WithAttributes(
semconv.ServiceNameKey.String(k.Config().Name),
semconv.ServiceVersionKey.String(k.Config().Version),
semconv.DeploymentEnvironmentKey.String(k.Config().Env),
semconv.DeploymentEnvironmentNameKey.String(k.Config().Env),
)),
)

Expand Down
4 changes: 3 additions & 1 deletion core/pyroscope/pyroscope.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,13 @@ type Config struct {
ServerAddress string
}

func (c Config) Init(ctx context.Context, k *kod.Kod) error {
func (c Config) Init(ctx context.Context) error {
if c.ServerAddress == "" {
return fmt.Errorf("pyroscope server address is required")
}

k := kod.FromContext(ctx)

p, err := pyroscope.Start(pyroscope.Config{
ApplicationName: k.Config().Name,
// Logger: pyroscope.StandardLogger,
Expand Down
4 changes: 3 additions & 1 deletion core/slog/slog.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ type Config struct {
LogLevel slog.Level `json:"log_level" default:"info"`
}

func (c Config) Init(ctx context.Context, k *kod.Kod) error {
func (c Config) Init(ctx context.Context) error {
k := kod.FromContext(ctx)

defaults.Set(&c)

Check failure on line 20 in core/slog/slog.go

View workflow job for this annotation

GitHub Actions / lint (stable, ubuntu-latest)

Error return value of `defaults.Set` is not checked (errcheck)

Check failure on line 20 in core/slog/slog.go

View workflow job for this annotation

GitHub Actions / lint (stable, macos-latest)

Error return value of `defaults.Set` is not checked (errcheck)

handler := kslog.NewLevelHandler(c.LogLevel)(
Expand Down
35 changes: 16 additions & 19 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ toolchain go1.23.0

require (
github.com/avast/retry-go/v4 v4.6.0
github.com/creasty/defaults v1.8.0
github.com/gin-gonic/gin v1.10.0
github.com/go-kod/kod v0.16.1
github.com/go-kod/kod v0.16.2-0.20241225104003-ebef526b2718
github.com/go-playground/validator/v10 v10.23.0
github.com/go-resty/resty/v2 v2.16.2
github.com/grafana/pyroscope-go v1.2.0
Expand All @@ -30,7 +31,7 @@ require (
go.opentelemetry.io/otel v1.33.0
go.opentelemetry.io/otel/log v0.8.0
go.opentelemetry.io/otel/metric v1.33.0
go.opentelemetry.io/otel/sdk v1.32.0
go.opentelemetry.io/otel/sdk v1.33.0
go.opentelemetry.io/otel/sdk/log v0.8.0
go.opentelemetry.io/otel/sdk/metric v1.32.0
go.opentelemetry.io/otel/trace v1.33.0
Expand All @@ -50,7 +51,6 @@ require (
github.com/cloudwego/iasm v0.2.0 // indirect
github.com/coreos/go-semver v0.3.0 // indirect
github.com/coreos/go-systemd/v22 v22.3.3-0.20220203105225-a9a7ef127534 // indirect
github.com/creasty/defaults v1.8.0 // indirect
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
github.com/dominikbraun/graph v0.23.0 // indirect
github.com/ebitengine/purego v0.8.1 // indirect
Expand All @@ -64,23 +64,30 @@ require (
github.com/go-playground/locales v0.14.1 // indirect
github.com/go-playground/universal-translator v0.18.1 // indirect
github.com/go-sql-driver/mysql v1.7.0 // indirect
github.com/go-viper/mapstructure/v2 v2.2.1 // indirect
github.com/goccy/go-json v0.10.4 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/protobuf v1.5.4 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/grafana/pyroscope-go/godeltaprof v0.1.8 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.23.0 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/jinzhu/inflection v1.0.0 // indirect
github.com/jinzhu/now v1.1.5 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/klauspost/compress v1.17.11 // indirect
github.com/klauspost/cpuid/v2 v2.2.9 // indirect
github.com/knadh/koanf/maps v0.1.1 // indirect
github.com/knadh/koanf/parsers/json v0.1.0 // indirect
github.com/knadh/koanf/parsers/toml/v2 v2.1.0 // indirect
github.com/knadh/koanf/parsers/yaml v0.1.0 // indirect
github.com/knadh/koanf/providers/env v1.0.0 // indirect
github.com/knadh/koanf/providers/file v1.1.2 // indirect
github.com/knadh/koanf/v2 v2.1.2 // indirect
github.com/leodido/go-urn v1.4.0 // indirect
github.com/lufia/plan9stats v0.0.0-20240909124753-873cd0166683 // indirect
github.com/magiconair/properties v1.8.7 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/mitchellh/copystructure v1.2.0 // indirect
github.com/mitchellh/reflectwalk v1.0.2 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
Expand All @@ -91,14 +98,6 @@ require (
github.com/prometheus/common v0.60.1 // indirect
github.com/prometheus/procfs v0.15.1 // indirect
github.com/redis/go-redis/extra/rediscmd/v9 v9.7.0 // indirect
github.com/sagikazarmark/locafero v0.6.0 // indirect
github.com/sagikazarmark/slog-shim v0.1.0 // indirect
github.com/sourcegraph/conc v0.3.0 // indirect
github.com/spf13/afero v1.11.0 // indirect
github.com/spf13/cast v1.7.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/spf13/viper v1.19.0 // indirect
github.com/subosito/gotenv v1.6.0 // indirect
github.com/tklauser/go-sysconf v0.3.14 // indirect
github.com/tklauser/numcpus v0.9.0 // indirect
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
Expand All @@ -120,19 +119,17 @@ require (
go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v1.32.0 // indirect
go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.32.0 // indirect
go.opentelemetry.io/proto/otlp v1.3.1 // indirect
go.uber.org/atomic v1.9.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
go.uber.org/zap v1.21.0 // indirect
go.uber.org/zap v1.26.0 // indirect
golang.org/x/arch v0.12.0 // indirect
golang.org/x/crypto v0.31.0 // indirect
golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 // indirect
golang.org/x/net v0.32.0 // indirect
golang.org/x/net v0.33.0 // indirect
golang.org/x/sys v0.28.0 // indirect
golang.org/x/text v0.21.0 // indirect
golang.org/x/time v0.8.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20241104194629-dd2ea8efbc28 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20241209162323-e6fa225c2576 // indirect
google.golang.org/protobuf v1.35.2 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)

Expand Down
Loading

0 comments on commit 8fa7652

Please sign in to comment.