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

Don't modify user source code #303

Open
anuraaga opened this issue Jan 24, 2025 · 1 comment
Open

Don't modify user source code #303

anuraaga opened this issue Jan 24, 2025 · 1 comment
Labels
enhancement New feature or request

Comments

@anuraaga
Copy link

Is your feature request related to a problem? Please describe.

Currently, when instrumenting, main.go gets modified with many blank imports. I think this is confusing to users and doesn't feel like "no-code". It is unavoidable to add code to support go mod tidy but it is best to not modify actual user code.

import _ "github.com/myproject/mymodule/example-alibaba/otel_rules"

import _ "go.opentelemetry.io/otel/exporters/prometheus"
import _ "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp"
import _ "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc"
import _ "go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp"
import _ "go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc"
import _ "go.opentelemetry.io/otel/exporters/otlp/otlptrace"
import _ "go.opentelemetry.io/otel"

Describe the solution you'd like

Output blank imports to a separate file. For example, orchestrion outputs orchestrion.tool.go with build tag +tool. I think the build tag is overkill, but having a separate file is much nicer than having user code modified.

Describe alternatives you've considered

No response

Additional context

No response

@anuraaga anuraaga added the enhancement New feature or request label Jan 24, 2025
@y1yang0
Copy link
Member

y1yang0 commented Jan 24, 2025

Ideally, we will restore all modified files(code, go.mod, etc) after instrumentation, but it appears to be broken after latest commit, will fix #301

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

No branches or pull requests

2 participants