Repository navigation
(chore): Write both copies of an actor lifecycle event from one call - #1771
Merged
Krisztian F (krisztianfekete) merged 2 commits intoSep 21, 2026
Conversation
Krisztian F (krisztianfekete)
marked this pull request as ready for review
September 21, 2026 14:41
Jeff Luo (JeffLuoo)
requested changes
Sep 21, 2026
Comment on lines
+165
to
+168
| func (e *Emitter) Log(ctx context.Context, ev Event, attrs []slog.Attr) { | ||
| slog.LogAttrs(ctx, ev.Level(), ev.Body, attrs...) | ||
| e.emit(ctx, ev, attrs) | ||
| } |
Collaborator
There was a problem hiding this comment.
The two copies still take two different timestamps. slog.LogAttrs stamps the stdout record with its own time.Now(), and emit calls time.Now() again at BuildRecord.
The package comment now says that nothing about a record is kept in step by hand, but a consumer that joins the stdout copy to the OTLP copy on an exact timestamp finds no match, because the two differ by microseconds.
Let's also align on the timestamps.
Collaborator
Author
There was a problem hiding this comment.
This is now done.
Krisztian F (krisztianfekete)
enabled auto-merge
September 21, 2026 20:21
Jeff Luo (JeffLuoo)
approved these changes
Sep 21, 2026
Krisztian F (krisztianfekete)
deleted the
follow-up/lifecycle-event-single-emit
branch
September 22, 2026 08:50
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.
An actor lifecycle record went to stdout and to OTLP in two separate calls. The attributes were shared, but the severity was not, so the slog level sat at the call site and the OTel severity sat on the
Event. Nothing made a caller write both copies either, so a new record could reach stdout only and no test would notice.Since this PR
actorevent.Lognow writes both copies. The level comes fromEvent.Severity, so it is stored once. The OTLP onlyEmitand the exported body constants are gone, so the dual write is the only way out of the package.Also normalizes
ate.actor.operation.nameon the crash event, which the state change event already did.Fixes #1744
Testing
Unit tests for the level mapping, the dual write, and the registry check.
End to end on a fresh kind cluster. Both event names arrive with the right severity (9 and 17), the right attributes, and trace context on the record fields. The stdout copies match record for record.
Tests pass
Appropriate changes to documentation are included in the PR