JavaVersionSpecific returns millisecond precision for currentTimeNanos()

Đang mở
#6,233 7 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 3 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
35/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
java
Lĩnh vực
observability-sre

Hướng nghiên cứu

Bắt đầu tại JavaVersionSpecific.currentTimeNanos() trong artifact opentelemetry-sdk-common và theo dõi cách AnchoredClock được tạo cho các span không có parent. Tái hiện chuỗi hai span trên Java 8, sau đó xác minh rằng Span.startEpochNanos sử dụng độ chính xác gần nhất hiện có và không thể lùi về trước thời điểm kết thúc của span trước đó.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Bug

From a Java 8 JVM perspective there are limitations to the precision of time, however looking at the implementation of JavaVersionSpecific.currentTimeNanos() for Java 8, this should return as close as possible, the nanosecond precision since epoch, however it is currently only to millisecond precision.

Steps to reproduce
Create two Spans in the following order

  1. Create and start Span 1 - startEpochNanos is set to millisecond precision
  2. End Span 1 - endEpochNanos is set to nanosecond precision
  3. Create and start Span 2 - startEpochNanos is set to millisecond precision
  4. End Span 2 - endEpochNanos is set to nanosecond precision

It looks like a new AnchoredClock is created for each Span if it is not inheriting from a parentSpan, therefore if the spans are created in less than 1 millisecond of each other, there is a potential the Span1.endEpochNanos is greater than Span2.startEpochNanos

What did you expect to see?
I would expect Span.startEpochNanos to be at nanosecond precision

What did you see instead?
Span.startEpochNanos is at millisecond precision

What version and what artifacts are you using?
Artifacts: opentelemetry-sdk-common
Version: 1.35

Environment
OS: Centos
Runtime: Java 8 OpenJdk

Ngôn ngữ chính
Java
Star
2.5k
Fork
1.1k
Merge trung bình
5 ngày 11 giờ
Pull request đã merge (30 ngày)
41

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của open-telemetry/opentelemetry-java

Tất cả issue của open-telemetry/opentelemetry-java

Issue tương tự

Thêm issue về Java

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.