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

Add sync metrics #533

Merged
merged 9 commits into from
Jun 21, 2024
Merged

Add sync metrics #533

merged 9 commits into from
Jun 21, 2024

Conversation

gruuya
Copy link
Contributor

@gruuya gruuya commented Jun 20, 2024

Add metrics tracking byte size/row count for:

  • incoming request
  • compaction
  • flushing
    as well as timings for the last two ops.

@gruuya gruuya changed the base branch from main to datafusion-39-upgrade June 20, 2024 07:27
@gruuya gruuya requested a review from mildbyte June 20, 2024 07:27
Comment on lines 6 to 11
const REQUEST: &str = "seafowl_sync_writer_request";
const IN_MEMORY: &str = "seafowl_sync_writer_in_memory";
const COMPACTION_TIME: &str = "seafowl_sync_writer_compaction_time";
const COMPACTED: &str = "seafowl_sync_writer_compacted";
const FLUSHING_TIME: &str = "seafowl_sync_writer_flushing_time";
const FLUSHED: &str = "seafowl_sync_writer_flushed";
Copy link
Contributor

Choose a reason for hiding this comment

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

https://prometheus.io/docs/practices/naming/

The rule of thumb for these is that if you sum up some metric by all possible label values, it should still be a meaningful value, so we can't have different units in the same metric, instead:

# counter: total rows requested and total size of requests
seafowl_sync_writer_requests_rows_total
seafowl_sync_writer_requests_bytes_total

# gauges: how many rows in memory and how much space do they take
seafowl_sync_writer_in_memory_rows_total
seafowl_sync_writer_in_memory_bytes_total

# histogram: time taken by compaction
seafowl_sync_writer_compaction_time_seconds

# counter: total rows compacted, amount and size
seafowl_sync_writer_compacted_rows_total
seafowl_sync_writer_compacted_bytes_total

# histogram: time taken by flushes
seafowl_sync_writer_flushed_time_seconds

# counter: total rows flushed, amount and size
seafowl_sync_writer_flushed_bytes_total
seafowl_sync_writer_flushed_rows_total

Gauge, Histogram,
};

const REQUEST: &str = "seafowl_sync_writer_request";
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should rename this sync to something else, seafowl_delta_writer? seafowl_writer? seafowl_changeset_writer?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll go with seafowl_changeset_writer.

src/frontend/flight/sync/writer.rs Show resolved Hide resolved
src/frontend/flight/sync/writer.rs Show resolved Hide resolved
Base automatically changed from datafusion-39-upgrade to main June 20, 2024 13:05
const REQUEST_ROWS: &str = "seafowl_changeset_writer_request_rows";
const IN_MEMORY_BYTES: &str = "seafowl_changeset_writer_in_memory_bytes";
const IN_MEMORY_ROWS: &str = "seafowl_changeset_writer_in_memory_rows";
const IN_MEMORY_OLDEST: &str = "seafowl_changeset_writer_in_memory_oldest";
Copy link
Contributor

Choose a reason for hiding this comment

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

_oldest_timestamp_seconds?

"The reduction in byte size due to batch compaction"
);
describe_counter!(
COMPACTED_BYTES,
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
COMPACTED_BYTES,
COMPACTED_ROWS,

@gruuya gruuya merged commit f07c74f into main Jun 21, 2024
1 check passed
@gruuya gruuya deleted the sync-metrics branch June 21, 2024 06:02
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.

None yet

2 participants