Repository navigation
openssl: correct hex event timestamps - #1108
Merged
Merged
Conversation
Treat the BPF monotonic timestamp as nanoseconds and apply the existing clock offset, matching the ordinary text formatter.
Keep external and local imports in the configured order.
📄 Knowledge review✏️ Suggested updates1 page suggestion needs review.
|
8 tasks
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues were identified for the OpenSSL hex-output timestamp correction.
No open issues 🎉
What changed in this PR
Corrects OpenSSL hook-text timestamps in hex output by converting monotonic nanoseconds to wall time, matching ordinary text output. Event payloads and wire timestamps remain unchanged.
Changes:
- Apply the existing clock-offset conversion in
StringHex. - Add a regression test using a real monotonic timestamp.
- Add a focused hex-formatting benchmark with allocation reporting.
| File | Description |
|---|---|
internal/probe/openssl/event.go |
Convert hex-output timestamps to wall time. |
internal/probe/openssl/event_test.go |
Verify that hex output displays the current wall time. |
internal/probe/openssl/event_benchmark_test.go |
Benchmark hex formatting and allocations. |
Review effort: Balanced
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
OpenSSL hook-text events carry a monotonic nanosecond timestamp.
StringHexpasses that value totime.Unixas seconds, so--hexprints dates such as[5780590-06-11 14:17:34.000]. Ordinary text already converts the same field to wall time correctly.Change
Use the existing
getClockOffsetconversion inStringHex, matchingString. Production scope is +5/-1 in one formatter, with a regression and a focused benchmark. The wire timestamp and event payload stay intact.Validation
CLOCK_MONOTONICtimestamp and checks the displayed wall time. On master9c00018, it fails while parsing the resulting million-year date. It passes with the fix.go test -race -count=1 ./internal/probe/opensslpasses. The same package also passes withebpfassets,dynamicand the existing core-only assets. The initial production-tag attempt lackedpcap.h; supplying the already-available libpcap headers and library completed that check.go test -race -count=1 ./...run passes outsideinternal/probe/mysql. That package requires/usr/sbin/mysqld, which is absent; its configuration and initialization tests fail on that prerequisite.Performance
Same Linux x86-64 machine, Intel Core Ultra 9 285K, Go 1.26, CPU 2 pinned, five 200 ms benchmark rounds per revision, the same 103-byte event and benchmark source:
The measured median increases 2.19%. The formatter adds two clock reads for the existing offset calculation; a correctly sized date also uses fewer bytes. This work executes in the collector's hex-output formatting path. Probe callbacks, BPF helpers, maps and perf transport receive no changes.
Related investigation: eunomia-bpf/bpftime#1083.