Skip to content

Conversation

@joe-elliott
Copy link

Allows for setting the span status and the percentage of the span that an event occurs at.

Signed-off-by: Joe Elliott <[email protected]>
Signed-off-by: Joe Elliott <[email protected]>
Copy link
Collaborator

@stoewer stoewer left a 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

Comment on lines +110 to +111
// PercentageOfSpan if set controls where in the span the event is generated. If missing, the event is generated randomly
PercentageOfSpan float32 `js:"percentageOfSpan"`
Copy link
Collaborator

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:

  1. It might be more consistent if the default behavior always adds the event when PercentageOfSpan is not set
  2. What do you think about renaming it to Rate or EventRate for clarity?
  3. 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

Comment on lines 185 to +186
rate float32
percentageOfSpan float32
Copy link
Collaborator

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)))
Copy link
Collaborator

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants