Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PoC] Run integration tests locally #1140

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

MrAlias
Copy link
Contributor

@MrAlias MrAlias commented Sep 30, 2024

Adds a runner utility to run testing target applications with auto-instrumentation setup. This removes the need to have a kubernetes cluster, or even docker containers, to run our integration tests.

Example

$ sudo ./runner -bin ../e2e/autosdk/autosdk -log-level=info -out=test.json
{"time":"2024-09-30T07:47:10.620513125-07:00","level":"INFO","source":{"function":"go.opentelemetry.io/auto/internal/pkg/process.remoteAllocate.func1","file":"/home/tyler/go/src/go.opentelemetry.io/auto/internal/pkg/process/allocate.go","line":70},"msg":"Detaching from process","pid":1698111}
{"time":"2024-09-30T07:47:10.620603764-07:00","level":"INFO","source":{"function":"go.opentelemetry.io/auto.NewInstrumentation","file":"/home/tyler/go/src/go.opentelemetry.io/auto/instrumentation.go","line":113},"msg":"target process analysis completed","pid":1698111,"go_version":"1.23.1","dependencies":{"github.com/gogo/protobuf":"1.3.2","github.com/json-iterator/go":"1.1.12","github.com/modern-go/concurrent":"0.0.0-20180306012644-bacd9c7ef1dd","github.com/modern-go/reflect2":"1.0.2","go.opentelemetry.io/auto/sdk":"0.0.0-00010101000000-000000000000","go.opentelemetry.io/collector/pdata":"1.16.0","go.opentelemetry.io/otel":"1.30.0","go.opentelemetry.io/otel/trace":"1.30.0","go.uber.org/multierr":"1.11.0","golang.org/x/net":"0.26.0","golang.org/x/sys":"0.25.0","golang.org/x/text":"0.16.0","google.golang.org/genproto/googleapis/rpc":"0.0.0-20240604185151-ef581f913117","google.golang.org/grpc":"1.66.2","google.golang.org/protobuf":"1.34.2","std":"1.23.1"},"total_functions_found":8}
{"time":"2024-09-30T07:47:10.620923226-07:00","level":"INFO","source":{"function":"go.opentelemetry.io/auto/internal/pkg/instrumentation.(*Manager).load","file":"/home/tyler/go/src/go.opentelemetry.io/auto/internal/pkg/instrumentation/manager.go","line":324},"msg":"loading probe","name":{"SpanKind":3,"InstrumentedPkg":"google.golang.org/grpc"}}
{"time":"2024-09-30T07:47:10.94166247-07:00","level":"INFO","source":{"function":"go.opentelemetry.io/auto/internal/pkg/instrumentation.(*Manager).load","file":"/home/tyler/go/src/go.opentelemetry.io/auto/internal/pkg/instrumentation/manager.go","line":324},"msg":"loading probe","name":{"SpanKind":2,"InstrumentedPkg":"google.golang.org/grpc"}}
{"time":"2024-09-30T07:47:10.970407948-07:00","level":"INFO","source":{"function":"go.opentelemetry.io/auto/internal/pkg/instrumentation.(*Manager).load","file":"/home/tyler/go/src/go.opentelemetry.io/auto/internal/pkg/instrumentation/manager.go","line":324},"msg":"loading probe","name":{"SpanKind":3,"InstrumentedPkg":"go.opentelemetry.io/auto"}}
{"time":"2024-09-30T07:47:10.97756692-07:00","level":"INFO","source":{"function":"go.opentelemetry.io/auto/internal/pkg/instrumentation.(*Manager).ConfigLoop","file":"/home/tyler/go/src/go.opentelemetry.io/auto/internal/pkg/instrumentation/manager.go","line":238},"msg":"Configuration provider closed, configuration updates will no longer be received"}

$ sudo cat test.json
{"resourceSpans":[{"resource":{"attributes":[{"key":"process.runtime.description","value":{"stringValue":"go version 1.23.1 linux/amd64"}},{"key":"process.runtime.name","value":{"stringValue":"go"}},{"key":"process.runtime.version","value":{"stringValue":"1.23.1"}},{"key":"service.name","value":{"stringValue":"testing"}},{"key":"telemetry.distro.name","value":{"stringValue":"opentelemetry-go-instrumentation"}},{"key":"telemetry.distro.version","value":{"stringValue":"v0.14.0-alpha"}},{"key":"telemetry.sdk.language","value":{"stringValue":"go"}}]},"scopeSpans":[{"scope":{"name":"go.opentelemetry.io/auto/internal/test/e2e/autosdk","version":"v1.23.42"},"spans":[{"traceId":"cdf1e88da751aaa9491577ec7b09638a","spanId":"a2a171ba79099060","parentSpanId":"5e4f77143b8584ae","name":"Run","kind":3,"startTimeUnixNano":"946684800000500000","endTimeUnixNano":"946684801000000000","status":{}},{"traceId":"cdf1e88da751aaa9491577ec7b09638a","spanId":"5e4f77143b8584ae","parentSpanId":"","name":"main","kind":3,"startTimeUnixNano":"946684800000000000","endTimeUnixNano":"946684805000000000","status":{}}]}],"schemaUrl":"https://opentelemetry.io/schemas/1.26.0"}]}

TODO

  • Needs to be run as sudo, which means the output traces are owned by root
  • Makefile needs to be updated to run this and evaluate the output
  • Target binaries need to be updated to support the SIGCONT signal. This may mean having a generic wrapper of these binaries would be better

@pellared
Copy link
Member

pellared commented Oct 2, 2024

I guess it makes also debugging easier.

@RonFed
Copy link
Contributor

RonFed commented Oct 3, 2024

looks great.
To run this on non-Linux machines we'll need to run it inside a container, right?

@MrAlias
Copy link
Contributor Author

MrAlias commented Oct 3, 2024

looks great. To run this on non-Linux machines we'll need to run it inside a container, right?

I'm guessing, based on what @damemi said in the SIG meeting, it'll need to be run in a VM given the kernel still needs to support eBPF outside of the container.

That said, we'll probably still want to run this in a container on Linux to get sandbox the permissions issues and not have to run this with sudo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants