Repository navigation
feat(telemetry): DynamoDB events table with TTL and persistent sink (#127) - #357
Merged
Kaap10 merged 2 commits intoNov 23, 2026
Conversation
7 of 8 tasks
Kaap10
requested changes
Nov 21, 2026
Kaap10
left a comment
Collaborator
There was a problem hiding this comment.
Thanks for working on this! The DynamoDB telemetry event model, non-blocking batch sink, TTL configuration, and privacy-first defaults (redaction, no raw query text by default) are well designed and thoroughly tested.
Before this can be merged, there are a few important points to address:
- Missing Documentation (Acceptance Criteria of #127): Issue #127 specifically requires "Docs on what's stored". Please add documentation (e.g. in
docs/or user guides) explaining the telemetry event schema, what fields are collected, privacy/redaction guarantees, and how to enable TTL and query events. - Silent Drop of Unprocessed Items: In
_write_batch, if DynamoDB throttles andretriesare exhausted whileUnprocessedItemsstill remain, the loop exits silently without logging a warning about dropped telemetry events. - Flushing on Process Exit (
atexit): The sink buffers up to 25 events before writing. If an application executes fewer than 25 queries and terminates without explicitly callingclient.close()or using a context manager, buffered events are lost. Addingatexit.register(self.close)prevents this. - Hybrid Recorder In-Memory Buffer Inconsistency: In
DynamoDBTelemetryRecorder.record(), events passed asDynamoDBTelemetryEventordictare written to DynamoDB but skipped from the in-memory ring buffer. - PR Description Format: Please update the PR description to follow
.github/pull_request_template.mdand clean up the escaped backslashes (\).
See the inline comments below for suggested fixes.
…g warnings, and TTL waiter (codeforstartups#127)
Collaborator
Author
|
Thanks @Kaap10 for the thorough review! All feedback has been addressed:
|
Kaap10
approved these changes
Nov 23, 2026
Kaap10
left a comment
Collaborator
There was a problem hiding this comment.
LGTM! Thanks for addressing all feedback on atexit flushing, throttling warnings, and table status waiting.
We can track adding a dedicated docs guide (docs/telemetry.md) in a small follow-up PR. Approved and ready to merge.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Introduces persistent telemetry event storage on Amazon DynamoDB with single-table design, TTL expiration, and asynchronous batch writes in dynalogs, addressing issue #127.
Related issue
Fixes #127
Changes
pk = "{namespace}#events",sk = "{timestamp}#{query_id}", with numericttlepoch attribute.query_id,namespace,top_k,stage_latencies,result_ids,cache_hit,timestamp,ttl,latency_ms,status. Enforces privacy by omitting raw prompt text and PII by default unlesscapture_text=True.DynamoDBTelemetrySink:BatchWriteItemin chunks of 25 with unprocessed keys retry).atexithook so buffered events in short-lived CLI scripts are safely flushed on process termination.DynamoDBTelemetryRecorderhybrid recorder:TelemetryEvent,DynamoDBTelemetryEvent, anddictinputs.create_telemetry_tableinsrc/dynavec/provisioning.py:TableStatus == "ACTIVE"before configuring TTL, avoidingResourceInUseExceptionduring concurrent table creation.tests/test_telemetry_dynamodb.pycovering table provisioning, TTL configuration, batch writes, non-blocking asynchronous flush, atexit hook lifecycle, recorder buffer synchronization, and Dynavec client integration.Testing
pytest tests/test_telemetry_dynamodb.py tests/test_telemetry.py-> 22 passed)ruff check src/dynavec/telemetry.py src/dynavec/provisioning.py tests/test_telemetry_dynamodb.py-> All checks passed)mypy src/dynavec/telemetry.py-> Success: no issues found)Checklist