[chore] update go dependencies (#4304)

- github.com/KimMachineGun/automemlimit v0.7.2 => v0.7.3
- github.com/gin-contrib/cors v1.7.5 => v1.7.6
- github.com/minio/minio-go/v7 v7.0.92 => v7.0.94
- github.com/spf13/cast v1.8.0 => v1.9.2
- github.com/uptrace/bun{,/*} v1.2.11 => v1.2.14
- golang.org/x/image v0.27.0 => v0.28.0
- golang.org/x/net v0.40.0 => v0.41.0
- code.superseriousbusiness.org/go-swagger v0.31.0-gts-go1.23-fix => v0.32.3-gts-go1.23-fix

Reviewed-on: https://codeberg.org/superseriousbusiness/gotosocial/pulls/4304
Co-authored-by: kim <grufwub@gmail.com>
Co-committed-by: kim <grufwub@gmail.com>
This commit is contained in:
kim 2025-06-30 15:19:09 +02:00 committed by kim
commit 8b0ea56027
294 changed files with 139999 additions and 21873 deletions

View file

@ -12,6 +12,7 @@ import (
"go.opentelemetry.io/otel/attribute"
"go.opentelemetry.io/otel/metric"
"go.opentelemetry.io/otel/semconv/v1.34.0/goconv"
"go.opentelemetry.io/contrib/instrumentation/runtime/internal/deprecatedruntime"
"go.opentelemetry.io/contrib/instrumentation/runtime/internal/x"
@ -43,78 +44,48 @@ func Start(opts ...Option) error {
metric.WithInstrumentationVersion(Version()),
)
if x.DeprecatedRuntimeMetrics.Enabled() {
return deprecatedruntime.Start(meter, c.MinimumReadMemStatsInterval)
if err := deprecatedruntime.Start(meter, c.MinimumReadMemStatsInterval); err != nil {
return err
}
}
memoryUsedInstrument, err := meter.Int64ObservableUpDownCounter(
"go.memory.used",
metric.WithUnit("By"),
metric.WithDescription("Memory used by the Go runtime."),
)
memoryUsed, err := goconv.NewMemoryUsed(meter)
if err != nil {
return err
}
memoryLimitInstrument, err := meter.Int64ObservableUpDownCounter(
"go.memory.limit",
metric.WithUnit("By"),
metric.WithDescription("Go runtime memory limit configured by the user, if a limit exists."),
)
memoryLimit, err := goconv.NewMemoryLimit(meter)
if err != nil {
return err
}
memoryAllocatedInstrument, err := meter.Int64ObservableCounter(
"go.memory.allocated",
metric.WithUnit("By"),
metric.WithDescription("Memory allocated to the heap by the application."),
)
memoryAllocated, err := goconv.NewMemoryAllocated(meter)
if err != nil {
return err
}
memoryAllocationsInstrument, err := meter.Int64ObservableCounter(
"go.memory.allocations",
metric.WithUnit("{allocation}"),
metric.WithDescription("Count of allocations to the heap by the application."),
)
memoryAllocations, err := goconv.NewMemoryAllocations(meter)
if err != nil {
return err
}
memoryGCGoalInstrument, err := meter.Int64ObservableUpDownCounter(
"go.memory.gc.goal",
metric.WithUnit("By"),
metric.WithDescription("Heap size target for the end of the GC cycle."),
)
memoryGCGoal, err := goconv.NewMemoryGCGoal(meter)
if err != nil {
return err
}
goroutineCountInstrument, err := meter.Int64ObservableUpDownCounter(
"go.goroutine.count",
metric.WithUnit("{goroutine}"),
metric.WithDescription("Count of live goroutines."),
)
goroutineCount, err := goconv.NewGoroutineCount(meter)
if err != nil {
return err
}
processorLimitInstrument, err := meter.Int64ObservableUpDownCounter(
"go.processor.limit",
metric.WithUnit("{thread}"),
metric.WithDescription("The number of OS threads that can execute user-level Go code simultaneously."),
)
processorLimit, err := goconv.NewProcessorLimit(meter)
if err != nil {
return err
}
gogcConfigInstrument, err := meter.Int64ObservableUpDownCounter(
"go.config.gogc",
metric.WithUnit("%"),
metric.WithDescription("Heap size target percentage configured by the user, otherwise 100."),
)
configGogc, err := goconv.NewConfigGogc(meter)
if err != nil {
return err
}
otherMemoryOpt := metric.WithAttributeSet(
attribute.NewSet(attribute.String("go.memory.type", "other")),
attribute.NewSet(memoryUsed.AttrMemoryType(goconv.MemoryTypeOther)),
)
stackMemoryOpt := metric.WithAttributeSet(
attribute.NewSet(attribute.String("go.memory.type", "stack")),
attribute.NewSet(memoryUsed.AttrMemoryType(goconv.MemoryTypeStack)),
)
collector := newCollector(c.MinimumReadMemStatsInterval, runtimeMetrics)
var lock sync.Mutex
@ -124,30 +95,30 @@ func Start(opts ...Option) error {
defer lock.Unlock()
collector.refresh()
stackMemory := collector.getInt(goHeapMemory)
o.ObserveInt64(memoryUsedInstrument, stackMemory, stackMemoryOpt)
o.ObserveInt64(memoryUsed.Inst(), stackMemory, stackMemoryOpt)
totalMemory := collector.getInt(goTotalMemory) - collector.getInt(goMemoryReleased)
otherMemory := totalMemory - stackMemory
o.ObserveInt64(memoryUsedInstrument, otherMemory, otherMemoryOpt)
o.ObserveInt64(memoryUsed.Inst(), otherMemory, otherMemoryOpt)
// Only observe the limit metric if a limit exists
if limit := collector.getInt(goMemoryLimit); limit != math.MaxInt64 {
o.ObserveInt64(memoryLimitInstrument, limit)
o.ObserveInt64(memoryLimit.Inst(), limit)
}
o.ObserveInt64(memoryAllocatedInstrument, collector.getInt(goMemoryAllocated))
o.ObserveInt64(memoryAllocationsInstrument, collector.getInt(goMemoryAllocations))
o.ObserveInt64(memoryGCGoalInstrument, collector.getInt(goMemoryGoal))
o.ObserveInt64(goroutineCountInstrument, collector.getInt(goGoroutines))
o.ObserveInt64(processorLimitInstrument, collector.getInt(goMaxProcs))
o.ObserveInt64(gogcConfigInstrument, collector.getInt(goConfigGC))
o.ObserveInt64(memoryAllocated.Inst(), collector.getInt(goMemoryAllocated))
o.ObserveInt64(memoryAllocations.Inst(), collector.getInt(goMemoryAllocations))
o.ObserveInt64(memoryGCGoal.Inst(), collector.getInt(goMemoryGoal))
o.ObserveInt64(goroutineCount.Inst(), collector.getInt(goGoroutines))
o.ObserveInt64(processorLimit.Inst(), collector.getInt(goMaxProcs))
o.ObserveInt64(configGogc.Inst(), collector.getInt(goConfigGC))
return nil
},
memoryUsedInstrument,
memoryLimitInstrument,
memoryAllocatedInstrument,
memoryAllocationsInstrument,
memoryGCGoalInstrument,
goroutineCountInstrument,
processorLimitInstrument,
gogcConfigInstrument,
memoryUsed.Inst(),
memoryLimit.Inst(),
memoryAllocated.Inst(),
memoryAllocations.Inst(),
memoryGCGoal.Inst(),
goroutineCount.Inst(),
processorLimit.Inst(),
configGogc.Inst(),
)
if err != nil {
return err