-
Notifications
You must be signed in to change notification settings - Fork 452
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
doc: customized auto-instrumentation #762
Changes from 3 commits
7d35ffa
90a4420
cf57276
aca5035
9e2875d
a34dc41
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -215,6 +215,61 @@ The possible values for the annotation can be | |
* `"my-instrumentation"` - name of `Instrumentation` CR instance. | ||
* `"false"` - do not inject | ||
|
||
#### Use Customized Image for auto-instrumentation injection | ||
|
||
Although the default auto-instrumentation image can handle some mostly used libraries, it may still | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. By default, the operator uses upstream auto-instrumentation libraries. Custom auto-instrumentation can be configured by overriding the image field in a CR. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. updated |
||
miss the ones you need. In this case, you can tell the operator to use your own customized image. | ||
|
||
```yaml | ||
apiVersion: opentelemetry.io/v1alpha1 | ||
kind: Instrumentation | ||
metadata: | ||
name: my-instrumentation | ||
spec: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. could you please change the CR and keep only the image configuration? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. updated |
||
exporter: | ||
endpoint: http://otel-collector:4317 | ||
propagators: | ||
- tracecontext | ||
- baggage | ||
- b3 | ||
sampler: | ||
type: parentbased_traceidratio | ||
argument: "0.25" | ||
java: | ||
image: your-customized-auto-instrumentation-image:java | ||
nodejs: | ||
image: your-customized-auto-instrumentation-image:nodejs | ||
python: | ||
image: your-customized-auto-instrumentation-image:python | ||
``` | ||
|
||
To build your customized image, you can start by reusing the default dockerfiles. They are stored in the `autoinstrumentation` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. updated |
||
directory. In general, you should comply with the guidelines below. | ||
- Python | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I actually don't like to have this detailed information in the root readme. Could we move this doc to auto-instrumentation dockefiles and describe there what to do if a custom image needs to be build? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. moved to dockerfiles |
||
- Ensure the packages are installed in the `/autoinstrumentation` directory. This is required as when instrumenting the pod, | ||
one init container will be created to copy all the content in `/autoinstrumentation` directory to your app's container. Then | ||
update the `PYTHONPATH` environment variable accordingly. To achieve this, you can mimic the one in `autoinstrumentation/python/Dockerfile` | ||
by using multi-stage builds. In the first stage, install all the required packages in one custom directory with `pip install --target`. | ||
Then in the second stage, copy the directory to `/autoinstrumentation`. | ||
- Ensure you have `opentelemetry-distro` and `opentelemetry-instrumentation` or your customized alternatives installed. | ||
Those two packages are essential to Python auto-instrumentation. | ||
- Grant the necessary access to `/autoinstrumentation` directory. `chmod -R go+r /autoinstrumentation` | ||
- Node.js | ||
- Ensure the packages are installed in the `/autoinstrumentation` directory. This is required as when instrumenting the pod, | ||
one init container will be created to copy all the content in `/autoinstrumentation` directory to your app's container. Then | ||
update the `NODE_OPTIONS` environment variable accordingly. To achieve this, you can mimic the one in `autoinstrumentation/nodejs/Dockerfile` | ||
by using multi-stage builds. In the first stage, install all the required packages in one custom directory. | ||
Then in the second stage, copy the directory to `/autoinstrumentation`. | ||
- Ensure you have `@opentelemetry/api`, `@opentelemetry/auto-instrumentations-node`, and `@opentelemetry/sdk-node` or your customized | ||
alternatives installed. | ||
- Grant the necessary access to `/autoinstrumentation` directory. `chmod -R go+r /autoinstrumentation` | ||
- Java | ||
- Download your customized `javaagent.jar` to `/javaagent.jar`. This is required as when instrumenting the pod, | ||
one init container will be created to copy the jar to your app's container. | ||
- To customize the instrumentation library, you may need fork https://github.com/open-telemetry/opentelemetry-java-instrumentation/tree/main/javaagent | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We can remove this line, there are different ways how the java agent can be modified or extended. Most users won't probably do it anyways. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. removed |
||
and make changes accordingly. | ||
- Grant the necessary access to the jar. `chmod -R go+r /javaagent.jar` | ||
|
||
## Compatibility matrix | ||
|
||
### OpenTelemetry Operator vs. OpenTelemetry Collector | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use customized or vendor instrumentation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated