Skip to content

Commit

Permalink
Merge branch 'main' into alexg/datadog-receiver-add-service-checks
Browse files Browse the repository at this point in the history
  • Loading branch information
alexgreenbank committed Aug 14, 2024
2 parents d75fc3c + a5096f1 commit f7cd099
Show file tree
Hide file tree
Showing 20 changed files with 1 addition and 224 deletions.
1 change: 0 additions & 1 deletion cmd/otelcontribcol/builder-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ dist:

extensions:
- gomod: go.opentelemetry.io/collector/extension/zpagesextension v0.107.0
- gomod: go.opentelemetry.io/collector/extension/ballastextension v0.107.0
- gomod: github.com/open-telemetry/opentelemetry-collector-contrib/extension/ackextension v0.107.0
- gomod: github.com/open-telemetry/opentelemetry-collector-contrib/extension/asapauthextension v0.107.0
- gomod: github.com/open-telemetry/opentelemetry-collector-contrib/extension/awsproxy v0.107.0
Expand Down
3 changes: 0 additions & 3 deletions cmd/otelcontribcol/components.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 0 additions & 8 deletions cmd/otelcontribcol/extensions_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import (
"go.opentelemetry.io/collector/component"
"go.opentelemetry.io/collector/component/componenttest"
"go.opentelemetry.io/collector/extension"
"go.opentelemetry.io/collector/extension/ballastextension"
"go.opentelemetry.io/collector/extension/extensiontest"
"go.opentelemetry.io/collector/extension/zpagesextension"

Expand Down Expand Up @@ -116,13 +115,6 @@ func TestDefaultExtensions(t *testing.T) {
return cfg
},
},
{
extension: "memory_ballast",
getConfigFn: func() component.Config {
cfg := extFactories["memory_ballast"].CreateDefaultConfig().(*ballastextension.Config)
return cfg
},
},
{
extension: "asapclient",
getConfigFn: func() component.Config {
Expand Down
1 change: 0 additions & 1 deletion cmd/otelcontribcol/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,6 @@ require (
go.opentelemetry.io/collector/exporter/otlpexporter v0.107.0
go.opentelemetry.io/collector/exporter/otlphttpexporter v0.107.0
go.opentelemetry.io/collector/extension v0.107.0
go.opentelemetry.io/collector/extension/ballastextension v0.107.0
go.opentelemetry.io/collector/extension/zpagesextension v0.107.0
go.opentelemetry.io/collector/otelcol v0.107.0
go.opentelemetry.io/collector/pdata v1.13.0
Expand Down
2 changes: 0 additions & 2 deletions cmd/otelcontribcol/go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion cmd/oteltestbedcol/builder-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ dist:
otelcol_version: 0.107.0

extensions:
- gomod: go.opentelemetry.io/collector/extension/ballastextension v0.107.0
- gomod: go.opentelemetry.io/collector/extension/zpagesextension v0.107.0
- gomod: github.com/open-telemetry/opentelemetry-collector-contrib/extension/pprofextension v0.107.0
- gomod: github.com/open-telemetry/opentelemetry-collector-contrib/extension/storage/filestorage v0.107.0
Expand Down
3 changes: 0 additions & 3 deletions cmd/oteltestbedcol/components.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion cmd/oteltestbedcol/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ require (
go.opentelemetry.io/collector/exporter/otlpexporter v0.107.0
go.opentelemetry.io/collector/exporter/otlphttpexporter v0.107.0
go.opentelemetry.io/collector/extension v0.107.0
go.opentelemetry.io/collector/extension/ballastextension v0.107.0
go.opentelemetry.io/collector/extension/zpagesextension v0.107.0
go.opentelemetry.io/collector/otelcol v0.107.0
go.opentelemetry.io/collector/processor v0.107.0
Expand Down
2 changes: 0 additions & 2 deletions cmd/oteltestbedcol/go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 1 addition & 3 deletions confmap/provider/s3provider/testdata/otel-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
extensions:
memory_ballast:
size_mib: 512
zpages:
endpoint: 0.0.0.0:55679

Expand Down Expand Up @@ -34,4 +32,4 @@ service:
processors: [memory_limiter, batch]
exporters: [debug]

extensions: [memory_ballast, zpages]
extensions: [zpages]
2 changes: 0 additions & 2 deletions exporter/clickhouseexporter/example/otel-collector-config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@ extensions:
health_check:
pprof:
zpages:
memory_ballast:
size_mib: 1000

service:
extensions: [ pprof, zpages, health_check ]
Expand Down
1 change: 0 additions & 1 deletion exporter/elasticsearchexporter/integrationtest/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,6 @@ require (
go.opentelemetry.io/collector/exporter/otlpexporter v0.107.0 // indirect
go.opentelemetry.io/collector/exporter/otlphttpexporter v0.107.0 // indirect
go.opentelemetry.io/collector/extension/auth v0.107.0 // indirect
go.opentelemetry.io/collector/extension/ballastextension v0.107.0 // indirect
go.opentelemetry.io/collector/extension/zpagesextension v0.107.0 // indirect
go.opentelemetry.io/collector/featuregate v1.13.0 // indirect
go.opentelemetry.io/collector/internal/globalgates v0.107.0 // indirect
Expand Down
2 changes: 0 additions & 2 deletions exporter/elasticsearchexporter/integrationtest/go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions exporter/sapmexporter/examples/signalfx-k8s.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,6 @@ spec:
- command:
- "/otelcontribcol"
- "--config=/conf/otel-collector-config.yaml"
# Memory Ballast size should be max 1/3 to 1/2 of memory.
- "--mem-ballast-size-mib=683"
image: otel/opentelemetry-collector-contrib:0.12.0
name: otel-collector
resources:
Expand Down
1 change: 0 additions & 1 deletion internal/buildscripts/modules
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ beta_modules=(
"go.opentelemetry.io/collector/exporter/otlphttpexporter"
"go.opentelemetry.io/collector/extension"
"go.opentelemetry.io/collector/extension/auth"
"go.opentelemetry.io/collector/extension/ballastextension"
"go.opentelemetry.io/collector/extension/zpagesextension"
"go.opentelemetry.io/collector/otelcol"
"go.opentelemetry.io/collector/processor"
Expand Down
1 change: 0 additions & 1 deletion testbed/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ require (
go.opentelemetry.io/collector/exporter/otlpexporter v0.107.0
go.opentelemetry.io/collector/exporter/otlphttpexporter v0.107.0
go.opentelemetry.io/collector/extension v0.107.0
go.opentelemetry.io/collector/extension/ballastextension v0.107.0
go.opentelemetry.io/collector/extension/zpagesextension v0.107.0
go.opentelemetry.io/collector/otelcol v0.107.0
go.opentelemetry.io/collector/pdata v1.13.0
Expand Down
2 changes: 0 additions & 2 deletions testbed/go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions testbed/testbed/components.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import (
"go.opentelemetry.io/collector/exporter/otlpexporter"
"go.opentelemetry.io/collector/exporter/otlphttpexporter"
"go.opentelemetry.io/collector/extension"
"go.opentelemetry.io/collector/extension/ballastextension"
"go.opentelemetry.io/collector/extension/zpagesextension"
"go.opentelemetry.io/collector/otelcol"
"go.opentelemetry.io/collector/processor"
Expand Down Expand Up @@ -40,7 +39,6 @@ func Components() (

extensions, err := extension.MakeFactoryMap(
zpagesextension.NewFactory(),
ballastextension.NewFactory(),
)
errs = multierr.Append(errs, err)

Expand Down
87 changes: 0 additions & 87 deletions testbed/tests/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,9 @@
package tests

import (
"fmt"
"path/filepath"
"testing"
"time"

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

"github.com/open-telemetry/opentelemetry-collector-contrib/internal/common/testutil"
Expand Down Expand Up @@ -51,87 +48,3 @@ func TestIdleMode(t *testing.T) {

tc.Sleep(tc.Duration)
}

const ballastConfig = `
memory_ballast:
size_mib: %d
`

func TestBallastMemory(t *testing.T) {
tests := []struct {
ballastSize uint32
maxRSS uint32
}{
{100, 80},
{500, 110},
{1000, 120},
}

resultDir, err := filepath.Abs(filepath.Join("results", t.Name()))
require.NoError(t, err)

options := testbed.LoadOptions{DataItemsPerSecond: 10_000, ItemsPerBatch: 10}
dataProvider := testbed.NewPerfTestDataProvider(options)
for _, test := range tests {
t.Run(fmt.Sprintf("ballast-size-%d", test.ballastSize), func(t *testing.T) {
sender := testbed.NewOTLPTraceDataSender(testbed.DefaultHost, testutil.GetAvailablePort(t))
receiver := testbed.NewOTLPDataReceiver(testutil.GetAvailablePort(t))
ballastCfg := createConfigYaml(
t, sender, receiver, resultDir, nil,
map[string]string{"memory_ballast": fmt.Sprintf(ballastConfig, test.ballastSize)})
cp := testbed.NewChildProcessCollector(testbed.WithEnvVar("GOMAXPROCS", "2"))
cleanup, err := cp.PrepareConfig(ballastCfg)
require.NoError(t, err)
t.Cleanup(cleanup)

tc := testbed.NewTestCase(
t,
dataProvider,
sender,
receiver,
cp,
&testbed.PerfTestValidator{},
performanceResultsSummary,
testbed.WithSkipResults(),
testbed.WithResourceLimits(
testbed.ResourceSpec{
ExpectedMaxRAM: test.maxRSS,
ResourceCheckPeriod: time.Second,
MaxConsecutiveFailures: 5,
},
),
)
tc.StartAgent()
t.Cleanup(tc.Stop)

var rss, vms uint32
// It is possible that the process is not ready or the ballast code path
// is not hit immediately so we give the process up to a couple of seconds
// to fire up and setup ballast. 2 seconds is a long time for this case but
// it is short enough to not be annoying if the test fails repeatedly
tc.WaitForN(func() bool {
rss, vms, _ = tc.AgentMemoryInfo()
return vms > test.ballastSize
}, time.Second*5, fmt.Sprintf("VMS must be greater than %d", test.ballastSize))

// https://github.com/open-telemetry/opentelemetry-collector/issues/3233
// given that the maxRSS isn't an absolute maximum and that the actual maximum might be a bit off,
// we give some room here instead of failing when the memory usage isn't that much higher than the max
lenientMax := 1.1 * float32(test.maxRSS)

// https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/6927#issuecomment-1138624098
// During garbage collection, we may observe the ballast in rss.
// If this happens, adjust the baseline expectation for RSS size and validate that additional memory is
// still within the expected limit.
garbageCollectionMax := lenientMax + float32(test.ballastSize)

rssTooHigh := fmt.Sprintf("The RSS memory usage (%d) is >10%% higher than the limit (%d).", rss, test.maxRSS)

if rss > test.ballastSize {
assert.LessOrEqual(t, float32(rss), garbageCollectionMax, rssTooHigh)
} else {
assert.LessOrEqual(t, float32(rss), lenientMax, rssTooHigh)
}
})
}
}
Loading

0 comments on commit f7cd099

Please sign in to comment.