Skip to content

Commit

Permalink
Replacing memory limiter processor with extension (#4689)
Browse files Browse the repository at this point in the history
  • Loading branch information
michalpristas authored May 9, 2024
1 parent 19e3ebe commit 13a4157
Show file tree
Hide file tree
Showing 6 changed files with 252 additions and 230 deletions.
446 changes: 223 additions & 223 deletions NOTICE.txt

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,12 @@ require (
go.opentelemetry.io/collector/exporter v0.100.0
go.opentelemetry.io/collector/exporter/debugexporter v0.100.0
go.opentelemetry.io/collector/exporter/otlpexporter v0.100.0
go.opentelemetry.io/collector/extension v0.100.0
go.opentelemetry.io/collector/extension/memorylimiterextension v0.100.0
go.opentelemetry.io/collector/featuregate v1.7.0
go.opentelemetry.io/collector/otelcol v0.100.0
go.opentelemetry.io/collector/processor v0.100.0
go.opentelemetry.io/collector/processor/batchprocessor v0.100.0
go.opentelemetry.io/collector/processor/memorylimiterprocessor v0.100.0
go.opentelemetry.io/collector/receiver v0.100.0
go.opentelemetry.io/collector/receiver/otlpreceiver v0.100.0
)
Expand Down Expand Up @@ -235,7 +236,6 @@ require (
go.opentelemetry.io/collector/config/internal v0.100.0 // indirect
go.opentelemetry.io/collector/connector v0.100.0 // indirect
go.opentelemetry.io/collector/consumer v0.100.0 // indirect
go.opentelemetry.io/collector/extension v0.100.0 // indirect
go.opentelemetry.io/collector/extension/auth v0.100.0 // indirect
go.opentelemetry.io/collector/pdata v1.7.0 // indirect
go.opentelemetry.io/collector/semconv v0.100.0 // indirect
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1998,6 +1998,8 @@ go.opentelemetry.io/collector/extension v0.100.0 h1:HT3h5JE+5xK3CCwF7VJKCOuZkLBM
go.opentelemetry.io/collector/extension v0.100.0/go.mod h1:B7jsEl6HAZB79NU41AdoMwLgXn4yTTO5NTlxRrsORoo=
go.opentelemetry.io/collector/extension/auth v0.100.0 h1:Z8QVtntWiORnbVSCQfOxtnOOv9baqTlL8mTOaKi/9nc=
go.opentelemetry.io/collector/extension/auth v0.100.0/go.mod h1:nkqaVzUAdqqkUGdMqoIqH/xlGU0rCxRZy1Altyz0gQk=
go.opentelemetry.io/collector/extension/memorylimiterextension v0.100.0 h1:MICgwhqSuV3DyhKOG+FzDKyG5wSwzwSi+JiI6Je7pUA=
go.opentelemetry.io/collector/extension/memorylimiterextension v0.100.0/go.mod h1:54ubyU8V3YKIVpQk7+0FpmMpmfoWHpLkR6i8Wk2nXGM=
go.opentelemetry.io/collector/extension/zpagesextension v0.100.0 h1:4bHq1NBg8hU+NSd9DBVFAl4vxi40J0tqClmU3IknrEg=
go.opentelemetry.io/collector/extension/zpagesextension v0.100.0/go.mod h1:mcLfCcjq0/yZoieuyO0H5rVL3u7Why0/MRezNV2E7AU=
go.opentelemetry.io/collector/featuregate v1.7.0 h1:8tNgX2VaiR9jrpZevRSvStuJrvvL6WwScT264HNLk7U=
Expand All @@ -2012,8 +2014,6 @@ go.opentelemetry.io/collector/processor v0.100.0 h1:8Zcd3v77SCSM5mAJbGes5aR/Yof3
go.opentelemetry.io/collector/processor v0.100.0/go.mod h1:ZqUC8WWVYyPkaLUT1JXUCNpCpde8zXgSaFfJq2FXuVU=
go.opentelemetry.io/collector/processor/batchprocessor v0.100.0 h1:N94WWv+o9yt4HqvFeRUjL8VNEhY8mCym+2XPKUWxjmo=
go.opentelemetry.io/collector/processor/batchprocessor v0.100.0/go.mod h1:svXHN23yozQ+GLt04dKXHiZRYipWONt4blJifu2bloY=
go.opentelemetry.io/collector/processor/memorylimiterprocessor v0.100.0 h1:morjp97HbT8gcbzThWUuWIh625Mozkig2HN5xypL+9o=
go.opentelemetry.io/collector/processor/memorylimiterprocessor v0.100.0/go.mod h1:/szfMBZ4IanwwOGBIti346fMTzbla3qw++UsZH6nQHw=
go.opentelemetry.io/collector/receiver v0.100.0 h1:RFeOVhS7o39G562w0H0hqfh1o2QvK71ViHQuWnnfglI=
go.opentelemetry.io/collector/receiver v0.100.0/go.mod h1:Qo3xkorbUy0VXHh7WxMQyphIWiqxI3ZOG0O4YqQ2mCE=
go.opentelemetry.io/collector/receiver/otlpreceiver v0.100.0 h1:JuTBkWQ0xc8FargDe5aE6wCoAEk1gxLnBzfdIi8NOL8=
Expand Down
8 changes: 7 additions & 1 deletion internal/pkg/otel/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,13 @@ This section provides a summary of components included in the Elastic Distributi
| resourceprocessor | v0.100.0|
| transformprocessor | v0.100.0|
| batchprocessor | v0.100.0|
| memorylimiterprocessor | v0.100.0|




### Extensions

| Component | Version |
|---|---|
| memorylimiterextension | v0.100.0|

13 changes: 11 additions & 2 deletions internal/pkg/otel/components.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ package otel

import (
"go.opentelemetry.io/collector/exporter"
"go.opentelemetry.io/collector/extension"
"go.opentelemetry.io/collector/otelcol"
"go.opentelemetry.io/collector/processor"
"go.opentelemetry.io/collector/receiver"
Expand All @@ -20,13 +21,15 @@ import (
resourceprocessor "github.com/open-telemetry/opentelemetry-collector-contrib/processor/resourceprocessor" // for modifying resource attributes
transformprocessor "github.com/open-telemetry/opentelemetry-collector-contrib/processor/transformprocessor" // for OTTL processing on logs
"go.opentelemetry.io/collector/processor/batchprocessor" // for batching events
"go.opentelemetry.io/collector/processor/memorylimiterprocessor" // for putting backpressure when approach a memory limit

// Exporters:
"github.com/open-telemetry/opentelemetry-collector-contrib/exporter/elasticsearchexporter"
fileexporter "github.com/open-telemetry/opentelemetry-collector-contrib/exporter/fileexporter" // for e2e tests
debugexporter "go.opentelemetry.io/collector/exporter/debugexporter" // for dev
"go.opentelemetry.io/collector/exporter/otlpexporter"

// Extensions
"go.opentelemetry.io/collector/extension/memorylimiterextension" // for putting backpressure when approach a memory limit
)

func components() (otelcol.Factories, error) {
Expand All @@ -45,7 +48,6 @@ func components() (otelcol.Factories, error) {
// Processors
factories.Processors, err = processor.MakeFactoryMap(
batchprocessor.NewFactory(),
memorylimiterprocessor.NewFactory(),
resourceprocessor.NewFactory(),
attributesprocessor.NewFactory(),
transformprocessor.NewFactory(),
Expand All @@ -66,5 +68,12 @@ func components() (otelcol.Factories, error) {
return otelcol.Factories{}, err
}

factories.Extensions, err = extension.MakeFactoryMap(
memorylimiterextension.NewFactory(),
)
if err != nil {
return otelcol.Factories{}, err
}

return factories, err
}
7 changes: 7 additions & 0 deletions otel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,14 @@ exporters:
sampling_initial: 10000
sampling_thereafter: 10000

extensions:
memory_limiter:
check_interval: 1s
limit_mib: 700
spike_limit_mib: 180

service:
extensions: [memory_limiter]
pipelines:
logs:
receivers: [filelog]
Expand Down

0 comments on commit 13a4157

Please sign in to comment.