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

HPCC4J-612 Ensure proper OTel SDK initialization #745

Conversation

rpastrana
Copy link
Member

@rpastrana rpastrana commented Sep 6, 2024

  • Adds util functions to detect use of otel javaagent
  • Adds logic to optionally bypass manual initialization of otelsdk

Type of change:

  • This change is a bug fix (non-breaking change which fixes an issue).
  • This change is a new feature (non-breaking change which adds functionality).
  • This change is a breaking change (fix or feature that will cause existing behavior to change).

Checklist:

  • I have created a corresponding JIRA ticket for this submission
  • My code follows the code style of this project.
    • I have applied the Eclipse code-format template provided.
  • My change requires a change to the documentation.
    • I have updated the documentation accordingly, or...
    • I have created a JIRA ticket to update the documentation.
    • Any new interfaces or exported functions are appropriately commented.
  • I have read the HPCC Systems CONTRIBUTORS document (https://github.com/hpcc-systems/HPCC-Platform/wiki/Guide-for-contributors).
  • The change has been fully tested:
    • This change does not cause any existing JUnits to fail.
    • I have include JUnit coverage to test this change
    • I have performed system test and covered possible regressions and side effects.
  • I have given due consideration to all of the following potential concerns:
    • Scalability
    • Performance
    • Security
    • Thread-safety
    • Premature optimization
    • This change fixes the problem, not just the symptom

Testing:

@rpastrana
Copy link
Member Author

@jpmcmu I don't expect this to be the final draft, but please take a look and comment on the overall approach.

Copy link

github-actions bot commented Sep 6, 2024

Jira Issue: https://hpccsystems.atlassian.net/browse/HPCC4J-612

Jirabot Action Result:
Changing assignee from: [email protected] to: [email protected]
Workflow Transition To: Merge Pending
Updated PR

pom.xml Outdated
@@ -135,6 +135,11 @@
<groupId>io.opentelemetry</groupId>
<artifactId>opentelemetry-exporter-otlp</artifactId>
</dependency>
<dependency>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is not needed for this change

if (Utils.isOtelJavaagentUsed())
{
System.out.println("Otel javaagent enabled, will not initialize Otel SDK");
globalOTel = GlobalOpenTelemetry.get();
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what happens if otel javaegent incorrectly configured?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

apparently the process is stopped:
Error opening zip file or JAR manifest missing : opentwelemetry-javaagent.jar
Error occurred during initialization of VM
agent library failed to init: instrument

Copy link
Contributor

@jpmcmu jpmcmu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rpastrana looks pretty good, a few comments but nothing critical IMO

else
{
globalOTel = GlobalOpenTelemetry.get();
if (Utils.isOtelJavaagentUsed())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we add an env variable to override to turn this behavior off? IE: If we get a false positive from a non-otel java agent and the user needs to enable the AutoSDK.

- Adds util functions to detect use of otel javaagent
- Adds logic to optionally bypass manual initialization of otelsdk

Signed-off-by: Pastrana <[email protected]>
@rpastrana rpastrana changed the title HPCC4J-612 WIP HPCC4J-612 Ensure proper OTel SDK initialization Sep 10, 2024
@rpastrana
Copy link
Member Author

@jpmcmu take a look at latest changes.

@jpmcmu
Copy link
Contributor

jpmcmu commented Sep 10, 2024

@rpastrana looks good to me

@rpastrana rpastrana merged commit 7050cb3 into hpcc-systems:candidate-9.6.x Sep 10, 2024
4 of 6 checks passed
Copy link

Jirabot Action Result:
Added fix version: 9.6.46
Added fix version: 9.8.20
Workflow Transition: 'Resolve issue'

Copy link

Jirabot Action Result:
Added fix version: 9.6.48
Added fix version: 9.8.22
Workflow Transition: 'Resolve issue'

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.

2 participants