Skip to content
This repository has been archived by the owner on Mar 6, 2023. It is now read-only.

Make Context.Sampled an int32 #19

Open
bg451 opened this issue Mar 23, 2016 · 3 comments
Open

Make Context.Sampled an int32 #19

bg451 opened this issue Mar 23, 2016 · 3 comments

Comments

@bg451
Copy link
Contributor

bg451 commented Mar 23, 2016

@bensigelman mentioned in a comment the idea of making (Context).Sampled an int32.

This would allow detailed sampling information to be stored, such as the sampling rate, whether the trace was forced sampled, etc.

@bg451 bg451 changed the title Make Sampled a uint32. Make Context.Sampled an int32 Mar 23, 2016
@yurishkuro
Copy link
Member

How would a sampling rate be stored, in some encoding? Why not report it out of band?

Ours is just a float number atm, although I can see it being stored as a power of 2 instead.

@bhs
Copy link
Contributor

bhs commented Mar 24, 2016

If I remember correctly (I might not!), the sampling rate in dapper was encoded as an "integer reciprocal"... i.e., 1024 for 1/1024 sampling. Some sort of fixed-point fraction would also work, I guess.

Reporting out-of-band: it's kind of a long story, but the short version is that it made things easier on the analysis size and it seemed like a small price to pay. (Certain statistical statements could be made locally rather than after trace assembly)

@yurishkuro
Copy link
Member

In this case I would encode it as 1/(2^n) and only store n, which will need 4 or 5 bits at most (can still fit in byte).

But I have no objections to int32.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants