summaryrefslogtreecommitdiff
path: root/vendor/go.opentelemetry.io/otel/sdk/log/provider.go
diff options
context:
space:
mode:
authorLibravatar kim <grufwub@gmail.com>2025-09-04 15:29:27 +0200
committerLibravatar kim <gruf@noreply.codeberg.org>2025-09-04 15:29:27 +0200
commit78defcd9166a202eb3140dc27afd288e1f9bfec4 (patch)
treedfe061abc810096f0141b7f585d38401c099c488 /vendor/go.opentelemetry.io/otel/sdk/log/provider.go
parent[performance] faster request id generation (#4405) (diff)
downloadgotosocial-78defcd9166a202eb3140dc27afd288e1f9bfec4.tar.xz
[chore] bump dependencies (#4406)
- codeberg.org/gruf/go-ffmpreg: v0.6.9 -> v0.6.10 - github.com/ncruces/go-sqlite3: v0.27.1 -> v0.28.0 - github.com/stretchr/testify: v1.10.0 -> v1.11.1 - github.com/tdewolff/minify/v2 v2.23.11 -> v2.24.2 - go.opentelemetry.io/otel{,/*}: v1.37.0 -> v1.38.0 - go.opentelemetry.io/contrib/*: v0.62.0 -> v0.63.0 Reviewed-on: https://codeberg.org/superseriousbusiness/gotosocial/pulls/4406 Co-authored-by: kim <grufwub@gmail.com> Co-committed-by: kim <grufwub@gmail.com>
Diffstat (limited to 'vendor/go.opentelemetry.io/otel/sdk/log/provider.go')
-rw-r--r--vendor/go.opentelemetry.io/otel/sdk/log/provider.go21
1 files changed, 21 insertions, 0 deletions
diff --git a/vendor/go.opentelemetry.io/otel/sdk/log/provider.go b/vendor/go.opentelemetry.io/otel/sdk/log/provider.go
index 359357b7e..c69422e12 100644
--- a/vendor/go.opentelemetry.io/otel/sdk/log/provider.go
+++ b/vendor/go.opentelemetry.io/otel/sdk/log/provider.go
@@ -32,6 +32,7 @@ type providerConfig struct {
fltrProcessors []FilterProcessor
attrCntLim setting[int]
attrValLenLim setting[int]
+ allowDupKeys setting[bool]
}
func newProviderConfig(opts []LoggerProviderOption) providerConfig {
@@ -67,6 +68,7 @@ type LoggerProvider struct {
fltrProcessors []FilterProcessor
attributeCountLimit int
attributeValueLengthLimit int
+ allowDupKeys bool
loggersMu sync.Mutex
loggers map[instrumentation.Scope]*logger
@@ -93,6 +95,7 @@ func NewLoggerProvider(opts ...LoggerProviderOption) *LoggerProvider {
fltrProcessors: cfg.fltrProcessors,
attributeCountLimit: cfg.attrCntLim.Value,
attributeValueLengthLimit: cfg.attrValLenLim.Value,
+ allowDupKeys: cfg.allowDupKeys.Value,
}
}
@@ -254,3 +257,21 @@ func WithAttributeValueLengthLimit(limit int) LoggerProviderOption {
return cfg
})
}
+
+// WithAllowKeyDuplication sets whether deduplication is skipped for log attributes or other key-value collections.
+//
+// By default, the key-value collections within a log record are deduplicated to comply with the OpenTelemetry Specification.
+// Deduplication means that if multiple key–value pairs with the same key are present, only a single pair
+// is retained and others are discarded.
+//
+// Disabling deduplication with this option can improve performance e.g. of adding attributes to the log record.
+//
+// Note that if you disable deduplication, you are responsible for ensuring that duplicate
+// key-value pairs within in a single collection are not emitted,
+// or that the telemetry receiver can handle such duplicates.
+func WithAllowKeyDuplication() LoggerProviderOption {
+ return loggerProviderOptionFunc(func(cfg providerConfig) providerConfig {
+ cfg.allowDupKeys = newSetting(true)
+ return cfg
+ })
+}