-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
output/cloudv2: Flush the aggregated metrics #3083
Conversation
6ef4fd7
to
ae25fa1
Compare
Codecov Report
@@ Coverage Diff @@
## master #3083 +/- ##
==========================================
- Coverage 73.70% 73.61% -0.10%
==========================================
Files 239 240 +1
Lines 18258 18364 +106
==========================================
+ Hits 13457 13518 +61
- Misses 3933 3974 +41
- Partials 868 872 +4
Flags with carried forward coverage won't be shown. Click here to find out more.
|
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.
Looks good as far as I can tell 🤝
I've left a couple of nit comments. There are a lot of TODOs left, and I didn't know if we should consider them blocking ❓
output/cloud/expv2/flush.go
Outdated
return nil | ||
} | ||
|
||
// pivot of the data structure (slice of time buckets) |
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 unfortunately didn't understand this sentence 😢
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.
Extended
output/cloud/expv2/flush.go
Outdated
TestRunID string | ||
AggregationPeriodInSeconds uint32 | ||
|
||
// TODO: the pointer here needs to be removed asap |
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.
Not being extremely familiar with the plumber of the Go runtime, I had to do a bit of research to understand what was meant by this comment.
Here is an explanation for others who might bump into the same question: the Go memory model does not guarantee the safety of pointers in maps, and the Garbage Collector does not track the usage of pointers as map keys either. It means that the object the pointer points to could be moved or collected by the GC while still being used as a map key, leading to hard-to-diagnose errors. Although I understand that objects are not moved (their address does not change) once they've been allocated in the current version of Go?
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.
Regardless, if we expect this map
to remain small, my first intuition was to switch to a slice or array as commented indeed.
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.
@codebien atlas/tagset also depends on this or at least a lot of code using it depend on it.
I can't find any plans on go moving to a moving gc.
There is already a project that just checks that you are using a go version that is known to not have a moving gc - https://github.com/go4org/unsafe-assume-no-moving-gc.
Support for a way to pin memory is already merged, although the use case there is different.
Also, AFAIK using a pointer a map key is not as uncommon and likely will break quite a lot of software, so again - very unlikely to happen. And likely will have a lot of additional problems across the ecosystem.
Maybe open an issue either way?
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.
Removed, not really necessary to hurry about this. The real improvement is mostly to change to the ID or having some slice/array but we need to know better about the tracking/untracking.
output/cloud/expv2/flush.go
Outdated
TestRunID string | ||
AggregationPeriodInSeconds uint32 | ||
|
||
// TODO: the pointer here needs to be removed asap |
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.
@codebien atlas/tagset also depends on this or at least a lot of code using it depend on it.
I can't find any plans on go moving to a moving gc.
There is already a project that just checks that you are using a go version that is known to not have a moving gc - https://github.com/go4org/unsafe-assume-no-moving-gc.
Support for a way to pin memory is already merged, although the use case there is different.
Also, AFAIK using a pointer a map key is not as uncommon and likely will break quite a lot of software, so again - very unlikely to happen. And likely will have a lot of additional problems across the ecosystem.
Maybe open an issue either way?
0e50e23
to
9531f91
Compare
ae25fa1
to
5d1444d
Compare
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.
LGTM!
The gauge comment is the most blockign, but even that isn't really blocking, just checking why are we sending so many stuff for gauge.
b5e3a64
to
9a9adc1
Compare
0bf7552
to
06f65e0
Compare
06f65e0
to
e2152b8
Compare
e2152b8
to
1d7eed8
Compare
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.
LGTM! Left a not blocking comment.
It implements the drain of the queue of the aggregated metrics and the conversion to Protobuf.