Skip to content

Vector logging#1497

Draft
BenGalewsky wants to merge 4 commits into
developfrom
vector_logging
Draft

Vector logging#1497
BenGalewsky wants to merge 4 commits into
developfrom
vector_logging

Conversation

@BenGalewsky

Copy link
Copy Markdown
Contributor

This pull request introduces a new application logging pipeline using a Vector sidecar container, which ships structured application logs directly to a Postgres table. It includes all the necessary Helm chart, application, and database changes, and adds a paginated log viewer to the transformation request page. The most important changes are summarized below.


Vector Sidecar Logging Pipeline

  • Adds a Vector sidecar container to the app deployment (enabled via logging.vector.enabled) that receives logs over a localhost TCP socket and writes them to a new Postgres log_messages table. Configurable via Helm values for image, port, batching, and resource limits. (helm/servicex/templates/app/deployment.yaml, helm/servicex/values.yaml, docs/deployment/reference.md, [1] [2] [3] [4] [5] [6]
  • Adds a Helm-managed vector-configmap.yaml for the Vector sidecar configuration, including source, transform (adds UUID), and Postgres sink details. (helm/servicex/templates/app/vector-configmap.yaml, helm/servicex/templates/app/vector-configmap.yamlR1-R36)
  • Adds a new Alembic migration to create the log_messages table, and a corresponding SQLAlchemy model for schema management. (servicex_app/migrations/versions/1.8.4.py, servicex_app/servicex_app/models.py, [1] [2]

Application Logging Integration

  • Adds a VectorFormatter to serialize log records as JSON matching the log_messages schema. Application logs are shipped to the Vector sidecar via a non-blocking QueueHandler and QueueListener thread, ensuring logging does not block the app. (servicex_app/servicex_app/__init__.py, [1] [2] [3]

User Interface Enhancements

  • Adds a paginated, filterable log viewer to the transformation request page, showing log messages from the new log_messages table, with level-based filtering and Bootstrap styling. (servicex_app/servicex_app/templates/transformation_request.html, servicex_app/servicex_app/web/transformation_request.py, [1] [2] [3] [4]

Testing

  • Adds test utilities to seed and test the new log viewer functionality. (servicex_app/servicex_app_test/web/test_transformation_request.py, [1] [2]

BenGalewsky and others added 3 commits July 3, 2026 21:13
Add an optional Vector sidecar to the ServiceX app pod that receives
application logs over a localhost TCP socket and writes them to a Postgres
log_messages table.

App side (servicex_app/__init__.py): a VectorFormatter emits JSON with
stable, column-matching keys, and the socket send runs on a QueueListener
background thread (app.logger -> QueueHandler -> listener -> TCPLogstashHandler)
so logging never blocks the app. Enabled via VECTOR_HOST/VECTOR_PORT; the
existing logstash and stdout handlers are untouched.

Schema: new LogMessage model plus Alembic migration v1_8_4 creating
log_messages. The id is a UUID string minted by Vector (not a serial) so the
sink's json_populate_recordset INSERT never has to populate an auto-generated
primary key.

Helm: logging.vector.* values (default disabled), a vector-configmap.yaml
(socket source -> remap add_id -> postgres sink), and a sidecar container in
the app deployment. Vector's DB credentials are sourced identically to the
app's SQLALCHEMY_DATABASE_URI (same secret/inline password). Requires
postgres.enabled.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Pull request_id and dataset_id out of the Vector log `extra` JSON blob
into dedicated nullable columns on the log_messages table so they can be
filtered and joined directly. VectorFormatter now hoists both keys to the
top level of the event (removing them from `extra`), and migration 1.8.4
plus the LogMessage model gain the matching columns.

Assisted-by: ClaudeCode:claude-opus-4.8
…st page

Show log_messages rows for a transformation request at the bottom of its
detail page, joined on the request's request_id UUID. Supports filtering by
log level and paginates (50/page, newest first) so requests with hundreds of
messages stay usable.

Assisted-by: ClaudeCode:claude-opus-4.8
@BenGalewsky BenGalewsky marked this pull request as draft July 4, 2026 19:10
@codecov

codecov Bot commented Jul 4, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 63.63636% with 16 lines in your changes missing coverage. Please review.
✅ Project coverage is 88.89%. Comparing base (f06b45a) to head (6e1af72).

Files with missing lines Patch % Lines
servicex_app/servicex_app/__init__.py 27.27% 15 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #1497      +/-   ##
===========================================
- Coverage    89.20%   88.89%   -0.31%     
===========================================
  Files          103      103              
  Lines         3732     3773      +41     
  Branches       460      463       +3     
===========================================
+ Hits          3329     3354      +25     
- Misses         326      341      +15     
- Partials        77       78       +1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

1 participant