-
Notifications
You must be signed in to change notification settings - Fork 12
Additional Support for setting fields #31
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
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Joe Elliott <[email protected]>
Signed-off-by: Joe Elliott <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great PR. I think those are good additions to the span/event template. However, I think the PercentageOfSpan parameter might need some small changes (see comments).
It would also be nice to use the new parameters somewhere in examples/template/template.js for documentation purposes
| // PercentageOfSpan if set controls where in the span the event is generated. If missing, the event is generated randomly | ||
| PercentageOfSpan float32 `js:"percentageOfSpan"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see a couple of potential improvements here:
- It might be more consistent if the default behavior always adds the event when
PercentageOfSpanis not set - What do you think about renaming it to
RateorEventRatefor clarity? - Unless I'm missing something, the current implementation seems to use PercentageOfSpan only to calculate the event time (L322) but does not influence whether the event is actually added
| rate float32 | ||
| percentageOfSpan float32 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The internalEventTemplate already includes a rate field that controls whether an event is added to the span. I think it makes sense to use it here
|
|
||
| var eventTime time.Time | ||
| if e.percentageOfSpan > 0 { | ||
| eventTime = start.Add(time.Duration(float64(duration) * float64(e.percentageOfSpan))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I might be missing something here, but could you explain the rationale behind e.percentageOfSpan controlling the event timestamp?
Allows for setting the span status and the percentage of the span that an event occurs at.