Skip to content
This repository has been archived by the owner on Aug 19, 2022. It is now read-only.

Record which direction the resource was blocked #72

Merged
merged 2 commits into from
Jul 27, 2022

Conversation

MarcoPolo
Copy link
Contributor

Adds another tag to record if the blocked thing was an inbound or outbound thing

@@ -320,11 +320,13 @@ func (r StatsTraceReporter) ConsumeEvent(evt rcmgr.TraceEvt) {
tags := []tag.Mutator{tag.Upsert(scopeTag, scopeName), tag.Upsert(resourceTag, resource)}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it make sense to allocate a slice of length 3 here, so the append later doesn't cause any allocs?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm actually not appending to this slice. I make another slice of tags in case the event has both delta in/out (I don't think we are doing this anywhere but we can't assume we will never do this).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I allocated the other slices upfront so maybe they'll be on the stack and not cause a heap alloc. Based on this SO answer/related tweet it seems like the Go 1.17 runtime (and above?) will do stack allocations here.

I couldn't find any official documentation around this though.

@MarcoPolo MarcoPolo merged commit 712ddd3 into master Jul 27, 2022
@MarcoPolo MarcoPolo deleted the marco/record-block-resource-dir branch July 27, 2022 14:01
@ajnavarro ajnavarro mentioned this pull request Aug 24, 2022
72 tasks
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Distinguish inbound vs outbound in blocked resources metrics for statstracereporter
2 participants