Export walk: re-decodes per page, skips no segments, and is unbenchmarked

Đang mở
#1,895 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
45/100
Loại issue
Tính năng
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
go
Lĩnh vực
backend, performance

Hướng nghiên cứu

Start with sessionexport.Walk, archive.Earlier, and the exportTimeout comment; then read docs/session-export.md and the referenced discussion in #1830. Benchmark the walk over an archive large enough to expose paging costs, and use that result to guide the ?since segment skip and forward iteration work. Done means the benchmark and measured timeout documentation are updated and the proposed performance improvements are verified.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

enhancement

The walk re-decodes each segment per page, and nothing measures it

sessionexport.Walk reads each session through archive.Earlier(id, 0, ...), which pages
500 events at a time with before = last. Every page re-opens and re-decodes its segment
from the first event, so the cost is roughly quadratic in a session's depth rather than
linear.

Measured by @clawgenti while reviewing #1830:

Shape Time
30k records through Earlier's paging 2.16s
the same data in one Page call 0.20s

About 10x, on one session.

The ten-second figure in the code is not a measurement

exportTimeout's doc comment used to say the walk "measured ~10s for a 30-day archive".
It did not: the number was extrapolated from a much smaller fixture. #1830 corrects the
comment to say so, but the honest state is that nothing benchmarks the walk at all, so
we do not know what a busy month actually costs. Given the figure above it could be well
above ten seconds.

This matters beyond the comment: agentop export advertises a ten-minute client budget
sized against that estimate, and GET /v1/export is the endpoint a user is told to point
at a month of traffic.

Three things, smallest first
  1. Benchmark the walk over a realistic archive — enough sessions and depth that the
    paging behaviour shows — and replace the extrapolated figure in exportTimeout and
    docs/session-export.md with a measured one. This is the part that unblocks judging
    the other two.

  2. Skip segments below the ?since floor. A segment whose LastWrite precedes the
    floor cannot contain a qualifying event, so it never needs decoding. agentop export --since 24h against a 30-day archive currently decodes all thirty days and discards
    most of it — the common case, and the cheapest win.

  3. Read forward per segment, newest segment first, instead of paging backwards through
    Earlier. This is the actual fix for the re-decode, and the largest change: it needs
    sessionexport to reach segment-level iteration and LastWrite, which today sit behind
    archive's read API. Worth doing as its own PR with the benchmark from (1) in place to
    prove it.

Why this was not done in #1830

@clawgenti raised it there and labelled it "not blocking for v1", and (3) reshapes an
archive read path mid-review. Filing it so the decision is tracked rather than rediscovered
the first time someone exports a large archive and waits.

Refs #1830, #1810

Ngôn ngữ chính
Go
Star
31
Fork
49
Merge trung bình
9 giờ 43 phút
Pull request đã merge (30 ngày)
367

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của rossoctl/cortex

Tất cả issue của rossoctl/cortex

Issue tương tự

Thêm issue về Go

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.