Repository navigation
feat: logs are searchable by any field in OpenSearch, next to Loki - #452
Merged
Merged
Conversation
The collector hands every log line to an OpenSearch exporter as well as Loki, with structlog's JSON keys parsed into attributes, one index a day, flat_object attributes so mixed types can't reject a line, and a 30-day retention policy. Grafana gets the OpenSearch datasource. Mongo's info lines (connection and login churn, 85% of what Loki scanned) are dropped in the collector, and Loki's limit goes to 512m.
HardMax71
enabled auto-merge (squash)
October 22, 2026 19:19
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configuration
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
|
Codecov Report✅ All modified and coverable lines are covered by tests.
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
6 of 17 tasks
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.



Summary
Closes #373. Log search in Loki is slow: on prod, one execution id over the 10 days Loki holds takes 3.4 s, and a field search with
| json8.2 s, since Loki reads every chunk. Mongo's connection and login lines are 85% of those bytes.Changes
The collector drops Mongo's info lines and hands every log line to OpenSearch as well as Loki. structlog's JSON keys become attributes, stored as
flat_object, so a key that's a number in one line and a string in another can't get a line rejected. One index a day, deleted after 30 days by a policy that start.sh applies together with the index template. Grafana gets the OpenSearch plugin and datasource. Loki's limit goes to 512m, since those searches took it to 207 MiB.Warning
Prod gets a new container: OpenSearch 3.9 with a 512m heap, about 1.1 GiB resident at 30 days (limit 1536m), against 3.8 GB available today. Lines sent while it restarts are dropped from OpenSearch, because the exporter doesn't retry a refused connection; Loki keeps them.
Type of Change
Test Plan
cd backend && uv run pytest tests/unit)cd frontend && npm run test)docker compose exec -T backend sh -c 'uv sync --group test --no-dev --frozen --no-install-project --no-build && pytest tests/e2e')cd frontend && npm run test:e2e)./deploy.sh openapi, then./deploy.sh types), never edited by handValidation: local stack from this branch. With 1.94 M synthetic lines over 31 daily indices, a search by execution id took 6 to 8 ms in OpenSearch and 25 to 75 ms through Grafana. A first start from empty volumes applies the template and policy and installs the plugin, and a restart leaves every index green. The contract test and strict mkdocs pass.
Checklist
pre-commit run --all-filesand all checks passSummary by cubic
Adds OpenSearch log search alongside Loki to address #373: searches can query indexed fields instead of scanning Loki chunks.
Written for commit 2db2d6e. Summary will update on new commits.