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

General thread attributes - Java's Thread.currentThread().getId() is deprecated #1375

Closed
arminru opened this issue Aug 30, 2024 · 1 comment · Fixed by #1378
Closed

General thread attributes - Java's Thread.currentThread().getId() is deprecated #1375

arminru opened this issue Aug 30, 2024 · 1 comment · Fixed by #1378
Assignees
Labels
good first issue Good for newcomers help wanted Extra attention is needed

Comments

@arminru
Copy link
Member

arminru commented Aug 30, 2024

Thread.currentThread().getId() is deprecated since java 19. There is a Thread.currentThread().threadId() instead.

Originally posted by @johantiden in open-telemetry/opentelemetry-specification#789 (comment)


This would need to be updated in https://github.com/open-telemetry/semantic-conventions/blob/main/docs/general/attributes.md#general-thread-attributes.

@johantiden
Copy link
Contributor

To reiterate:
Thread.currentThread().getId() has been deprecated in favor of Thread.currentThread().threadId(), which is more secure since it can't be overridden.
https://bugs.openjdk.org/browse/JDK-8017617?page=com.atlassian.jira.plugin.system.issuetabpanels%3Aall-tabpanel

We should change the example docs to reflect the latest Java LTS version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants