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

Servlet snippet inject do not work #8734

Closed
oliver-zhang opened this issue Jun 15, 2023 · 4 comments · Fixed by #8736
Closed

Servlet snippet inject do not work #8734

oliver-zhang opened this issue Jun 15, 2023 · 4 comments · Fixed by #8736
Labels
bug Something isn't working

Comments

@oliver-zhang
Copy link
Contributor

Describe the bug
Servlet snippet inject do not work

Steps to reproduce
I am using auto java instrumentation and set -Dotel.experimental.javascript-snippet="<script src="http://cdn.jsdelivr.net/webjars/jquery/2.1.4/jquery.min.js"></script>" from my springboot project
My html is as follows:

<html xmlns:th="http://www.thymeleaf.org">
<head lang="en">
    <title>Spring Framework Sample</title>
</head>

What did you expect to see?

<html xmlns:th="http://www.thymeleaf.org">
<head lang="en">
    <script src="http://cdn.jsdelivr.net/webjars/jquery/2.1.4/jquery.min.js"></script>
    <title>Spring Framework Sample</title>
</head>

What did you see instead?

<html xmlns:th="http://www.thymeleaf.org">
<head lang="en">
    <title>Spring Framework Sample</title>
</head>

What version are you using?
1.26

@oliver-zhang oliver-zhang added the bug Something isn't working label Jun 15, 2023
@oliver-zhang
Copy link
Contributor Author

oliver-zhang commented Jun 15, 2023

I haved check the code, the html content must contains <head>, if not this functionlly can not work, can we check the content start with <head ... and end with > ?

@oliver-zhang
Copy link
Contributor Author

The config otel.experimental.javascript-snippet only support system properties, It may be better support system env at the same time

@mateuszrzeszutek
Copy link
Member

FYI @siyuniu-ms

The config otel.experimental.javascript-snippet only support system properties, It may be better support system env at the same time

It does support env vars actually -- you can use OTEL_EXPERIMENTAL_JAVASCRIPT_SNIPPET

@siyuniu-ms
Copy link
Contributor

I haved check the code, the html content must contains <head>, if not this functionlly can not work, can we check the content start with <head ... and end with > ?

Yes, this will be the part of the following improvement we are going to made.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants