Skip to content
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

consumption_metrics: send timeline_written_size_delta #4822

Merged
merged 12 commits into from
Jul 31, 2023

Conversation

koivunej
Copy link
Member

@koivunej koivunej commented Jul 27, 2023

We want to have timeline_written_size_delta which is defined as difference to the previously sent timeline_written_size from the current timeline_written_size.

Solution is to send it. On the first round disk_consistent_lsn is used which is captured during load time. After that an incremental "event" is sent on every collection. Incremental "events" are not part of deduplication.

I've added some infrastructure to allow somewhat typesafe EventType::Absolute and EventType::Incremental factories per metrics, now that we have our first EventType::Incremental usage.

@koivunej koivunej requested review from a team as code owners July 27, 2023 07:15
@koivunej koivunej requested review from fprasx and shanyp and removed request for a team July 27, 2023 07:15
@koivunej
Copy link
Member Author

koivunej commented Jul 27, 2023

As far as testing this thing goes... Unsure if a test should be added. I am quite unsure on how to add non-flaky tests in general :) After overhauling the consumption metrics sending completly we could easily test this out.

@github-actions
Copy link

github-actions bot commented Jul 27, 2023

1240 tests run: 1185 passed, 0 failed, 55 skipped (full report)


Flaky tests (1)

Postgres 14

  • test_get_tenant_size_with_multiple_branches: debug

@kelvich kelvich requested a review from ololobus July 27, 2023 08:23
pageserver/src/consumption_metrics.rs Outdated Show resolved Hide resolved
pageserver/src/consumption_metrics.rs Outdated Show resolved Hide resolved
@ololobus ololobus requested a review from lubennikovaav July 31, 2023 11:43
@ololobus
Copy link
Member

Tagged @lubennikovaav fore review as well. Shany is on vacation and I think that I'm only partially capable of doing review here

koivunej added 12 commits July 31, 2023 17:09
no need to keep them separate anymore.
because why not, assuming it will keep growing with similar ... variants,
if there can be any, those should also be copy.
this should give us a data point in the first iteration as well.
this is just the written_size_delta_bytes.
restore the name of factory fn to be unrelated of the suffix.
if we would always use the latest absolute time, it would work until
last_record_lsn stops to update because compute is down. after the value
no longer grows, we will no longer send it, and thus the cached value
will no longer advance. however incremental values are not cache
deduplicated, so we would had started the time range for the incremental
value from the last absolute value.

perhaps this could be the cached incremental value as well. or...
perhaps we should never put these incremental values into the cache at
all.
@koivunej koivunej force-pushed the delta_consumption_metric branch from 8dbd49d to 821c41d Compare July 31, 2023 14:21
@koivunej
Copy link
Member Author

Writing a unit test for this is possible, but now that I finally have it (monkeyd from #4674), unsure if the errors are because of the tenant harness differences or something else.

@koivunej
Copy link
Member Author

Still trying to get the CI to pass 👍

@koivunej koivunej enabled auto-merge (squash) July 31, 2023 18:55
@koivunej koivunej merged commit 326189d into main Jul 31, 2023
@koivunej koivunej deleted the delta_consumption_metric branch July 31, 2023 19:10
koivunej added a commit that referenced this pull request Aug 1, 2023
Two stabs at this, by mocking a http receiver and the globals out (now
reverted) and then by separating the timeline dependency and just
testing what kind of events certain timelines produce. I think this
pattern could work for some of our problems.

Follow-up to #4822.
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.

5 participants