Skip to content

feat: Add count and count_with_tags metric for batch histogram#879

Merged
jrconlin merged 6 commits intomasterfrom
feat/878
Oct 29, 2020
Merged

feat: Add count and count_with_tags metric for batch histogram#879
jrconlin merged 6 commits intomasterfrom
feat/878

Conversation

@jrconlin
Copy link
Member

Description

Adding a metric handler for counts. This will allow us to do histograms to determine loads for things like batch processing.

Testing

are batches metricked?

Issue(s)

Closes #878

@jrconlin jrconlin requested a review from a team October 29, 2020 17:56
.param_types(param_types.clone())
.execute_dml_async(&db.conn)
.await?;
db.metrics.count_with_tags(
Copy link
Member

Choose a reason for hiding this comment

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

this emits within the update loop (one per update) and always emits the same count_update (the number of total updates). and it's the same count emitted above (existing.len() as storage.spanner.batch.pre-existing). so I think this should just be killed?

Copy link
Member Author

Choose a reason for hiding this comment

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

I should move it out of the update loop ('doh) but I was thinking more that exists is whatever was already in the table and this was the number of elements that resulted in updates, because a batch could self update as well (rare, but potential).

Copy link
Member Author

Choose a reason for hiding this comment

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

If anything I was debating killing the metrics.incr above, since it's fairly low information


pub(super) fn get_collection_name(&self, id: i32) -> String {
self.coll_cache
.get_name(id)
Copy link
Member

Choose a reason for hiding this comment

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

this returns <Result<Option>>

we probably wanna propagate it, there's a lock underneath which could have been poisoned. feels bad hiding that kind of error

Suggested change
.get_name(id)
.get_name(id)?

Copy link
Member

Choose a reason for hiding this comment

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

(FYI I actually implemented a _get_collection_name for mysql. apparently it is never used)

Copy link
Member Author

Choose a reason for hiding this comment

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

so you're saying that it's a TODO to make this a trait? ;)

@jrconlin jrconlin merged commit 8afcbe6 into master Oct 29, 2020
@jrconlin jrconlin deleted the feat/878 branch October 29, 2020 23:41
@jrconlin jrconlin mentioned this pull request Oct 29, 2020
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.

Add count metric for histogram around batch updates

2 participants