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

Introduce hard span storage size limit in sweeper #121

Merged

Conversation

deadtrickster
Copy link
Member

Let's discuss while I'm thinking about tests

@codecov-io
Copy link

codecov-io commented Dec 12, 2018

Codecov Report

Merging #121 into master will decrease coverage by 0.45%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #121      +/-   ##
==========================================
- Coverage   80.32%   79.86%   -0.46%     
==========================================
  Files          35       35              
  Lines         737      750      +13     
==========================================
+ Hits          592      599       +7     
- Misses        145      151       +6
Impacted Files Coverage Δ
oc_span_sweeper.erl 71.42% <0%> (-7.89%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9ae08af...efb2a87. Read the comment docs.

ttl=TTL,
storage_size=MaxSize}) ->

StorageSize = ets:info(?SPAN_TAB, memory) * erlang:system_info({wordsize, external}),
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't bother with these when storage_size is infinity.

Copy link
Member Author

Choose a reason for hiding this comment

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

oh right

@tsloughter
Copy link
Member

I'm not opposed to this, but I do think something like this makes more sense to effect the sampling. Like a sampler that lowers the probability relative to the size of the table.

@deadtrickster
Copy link
Member Author

well, 'overflow' could happen probably with any sampler other than none. So to me it's a bit different thing, like literally what shields from crashes. Looking forward to more fancy samples though

@tsloughter
Copy link
Member

Sure, and the sampler that lowers based on size could go all the way to none in times over overload.

@deadtrickster
Copy link
Member Author

but it means that only this particular sampler cares about table size, not all of them? I mean if this code stays here all samplers are covered, otherwise I have to stick to one sampler

ttl=TTL}) when is_function(Fun) ->
Expired = select_expired(TTL),
[Fun(Span) || Span <- Expired],
{keep_state_and_data, [{next_event, internal, just_do_it},
Copy link
Member

Choose a reason for hiding this comment

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

What is this new internal event?

Copy link
Member Author

Choose a reason for hiding this comment

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

copy-pasta, at the beginning I wanted to first sweep by ttl and then memory, that's a left over

storage_size=MaxSize}) ->

StorageSize = case MaxSize of
infinity ->
Copy link
Member

Choose a reason for hiding this comment

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

Not a big deal, but personally I'd find it cleaner to be like:

do_gc(#data{strategy=Strategy,
            ttl=TTL,
            storage_size=infinity}) ->
    sweep_spans(Strategy, TTL);
do_gc(#data{strategy=Strategy,
            ttl=TTL,
            storage_size=MaxSize}) ->
    StorageSize = ets:info(?SPAN_TAB, memory) * erlang:system_info({wordsize, external}),
    ...

Copy link
Member Author

Choose a reason for hiding this comment

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

was thinking about this, thought would be ugly, but now I see it's not

@deadtrickster
Copy link
Member Author

Elvis complains about if. Imo looks rather nice. ignore?

@tsloughter
Copy link
Member

Weird, yea, I would ignore that from elvis.

@tsloughter
Copy link
Member

Looks like you need to fix up the dialyzer ignores as well and then this'll be good to go.

@deadtrickster deadtrickster merged commit a639371 into census-instrumentation:master Dec 27, 2018
@deadtrickster deadtrickster deleted the size-sweeper branch December 27, 2018 13:01
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.

None yet

3 participants