-
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
Add autoinstrumentation of NodeJS #507
Add autoinstrumentation of NodeJS #507
Conversation
I think this is basically code complete for a first version, I will add docs but want to confirm the approach for supporting multiple languages. I went with a language annotation as it seemed the most straight forward among a few options I thought of such as changing the language specs to pointers and apply all specs that are defined (assuming there should only be one in practice). But let me know if this makes sense or of any better ideas. Also this is my first significant change - I was able to verify things fine with a normal app on minikube, but currently when I run |
4c8896a
to
fc367e1
Compare
fc367e1
to
ba0bede
Compare
7461be9
to
8a3770a
Compare
I'm really excited about this one, thank you for the PR! There are a couple of tests failing:
As the original author of the auto-instrumentation for Java, I'll let @pavolloffay review this one. |
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.
I would like to know why the annotations changes. Could you do this change in a separate PR?
@@ -23,15 +23,16 @@ import ( | |||
const ( | |||
// annotationInjectJava indicates whether java auto-instrumentation should be injected or not. | |||
// Possible values are "true", "false" or "<Instrumentation>" name. | |||
annotationInjectJava = "instrumentation.opentelemetry.io/inject-java" |
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.
can you explain the intentions for changing this annotation?
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.
Yeah I'm happy to split out the annotation change if it makes sense.
I found our current, SDK-agnostic (?) sdk.go uses this Java annotation. I need it to be able to support multiple languages and came up with this change. Any idea that could work better?
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.
Could you please explain why we need two annotations?
We can have "instrumentation.opentelemetry.io/inject-java"
, "instrumentation.opentelemetry.io/inject-node"
and then `"instrumentation.opentelemetry.io/inject" - to just inject the basic configuration (users could use the operator as a control plane to manage instrumentations).
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.
I don't think we want to allow multiple languages on the same pod as that shouldn't ever be a use case I think. While we could check the annotations and fail if there are multiple this split seemed to model more directly that only one language can be injected.
I made language required without thinking too much but could definitely remove that to allow the control plane only injection if this otherwise makes sense.
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.
I don't see much value of limiting it to only a single language, quite the opposite.
What I don't like is to have two annotations from the UX perspective.
annotationInject = "instrumentation.opentelemetry.io/inject"
annotationLanguage = "instrumentation.opentelemetry.io/language"
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.
I believe these sort of annotations are always copy-pasted or frameworked, so I don't think there is a usability difference between the two patterns. If we think there is a use case for multiple annotations, then it makes sense but for example having both otel.inject=true
and otel.inject-java=true
on the same pod would be redundant and I think that leads to some cognitive dissonance.
Great to hear everyone's ideas on the matter :)
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.
Discussed with @pavolloffay offline and for now sticking to the current annotation format, but we'll need to address it soon. We can see the awkwardness here
where common config can be injected from different instrumentations in a surprising way. Having separate annotations for the instrumentation config and what languages to use in the future will hopefully solve that.
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.
+1 let's discuss it in a separate issue. maybe there are other ways we can mitigate the issue
…or into nodejs-autoinstrumentatioon
…or into nodejs-autoinstrumentatioon
bf8bc85
to
0636df0
Compare
6e0ad24
to
b36d889
Compare
b36d889
to
a302e31
Compare
…or into nodejs-autoinstrumentatioon
438fc57
to
0b72fa3
Compare
0a2c238
to
cff5521
Compare
Sorry for the churn - I filed a couple of issues for some of the challenges I run into while developing here. But this should finally be ready @pavolloffay @jpkrohling |
README.md
Outdated
- baggage | ||
- b3 | ||
nodejs: | ||
image: ghcr.io/open-telemetry/opentelemetry-operator/autoinstrumentation-nodejs:latest |
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.
@pavolloffay I didn't document this image like you did in Java since I think it's too complicated to create oneself, at least unless someone asks for that.
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.
I think, that is fine. I do not expect many people providing custom builds.
I hoped that vendors could use this operator with their agent distros in the future.
README.md
Outdated
|
||
```yaml | ||
kubectl apply -f - <<EOF | ||
apiVersion: opentelemetry.io/v1alpha1 |
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.
I think we should have only a single instrumentation CR in the readme and then have a bulletoints/section for each language with annotations.
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.
Tweaked the README - hoping to be able to follow up with additional doc nits in another PR since it's been a big struggle keeping up with merge conflicts.
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.
Agree I had to rebase yesterday like 100k times
@@ -23,15 +23,16 @@ import ( | |||
const ( | |||
// annotationInjectJava indicates whether java auto-instrumentation should be injected or not. | |||
// Possible values are "true", "false" or "<Instrumentation>" name. | |||
annotationInjectJava = "instrumentation.opentelemetry.io/inject-java" |
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.
+1 let's discuss it in a separate issue. maybe there are other ways we can mitigate the issue
spec: | ||
containers: | ||
- name: myapp | ||
image: ghcr.io/anuraaga/express-hello-world:latest |
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.
We should probably create an application that would call an API on our test apps (java, js) that would result in a trace.
Then report the trace to an inmemory storage and asser it exists (e.g. what we do in the java auto-instrumentation tests).
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.
Yup think we will want this
…or into nodejs-autoinstrumentatioon
README.md
Outdated
EOF | ||
nodejs: | ||
image: ghcr.io/open-telemetry/opentelemetry-operator/autoinstrumentation-nodejs:latest | ||
EOF |
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.
there are empty spaces which should not be there
README.md
Outdated
instrumentation.opentelemetry.io/inject-nodejs: "true" | ||
``` | ||
|
||
The value can be |
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.
I think we should DRY this, the semantics for the annotation are the same for all languages, no need to repeat this.
README.md
Outdated
``` | ||
|
||
The above CR can be queried by `kubectl get otelinst`. | ||
|
||
1. Container image with [OpenTelemetry Java auto-instrumentation](https://github.com/open-telemetry/opentelemetry-java-instrumentation). The image must contain the Java agent JAR `/javaagent.jar`, and the operator will copy it to a shared volume mounted to the application container. |
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.
Let's delete this and consider it as impl detail for now
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.
I'm approving based on @pavolloffay's approval.
* Add autoinstrumentation of NodeJS * Drift * Switch to single annotation * Fix merge * Fix * Hurts * Format * Revert autogen * Drift * Revert autogen * autogen * Drift * Add doc * e2e * Less doc * Cleanup
* Add autoinstrumentation of NodeJS * Drift * Switch to single annotation * Fix merge * Fix * Hurts * Format * Revert autogen * Drift * Revert autogen * autogen * Drift * Add doc * e2e * Less doc * Cleanup
@pavolloffay @jpkrohling