feat: add tutorial for lokiExchangeStore - #3115
Conversation
Adds tutorials/operation/70-Loki.yaml, teaching how to push exchanges to Grafana Loki and query them with LogQL. It follows on from the Prometheus and Grafana steps: those cover aggregate metrics, this one covers the content of individual calls. The tutorial walks through starting Loki and Grafana, generating traffic on two named APIs, and querying by stream label, by json stage and by line_format. It also notes the three things that surprise people: only finished exchanges are pushed, bodies are Base64-encoded inside the JSON, and the store is write-only. Support files: a docker-compose for Loki and Grafana with the Loki datasource pre-provisioned. LokiTutorialTest verifies the lesson end-to-end. A local router stands in for Loki on the port the tutorial configures, so the push is asserted without needing a container: the job and api labels, and log lines that render as the tutorial's line_format claims.
|
/ok-to-test |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThe PR adds a Loki and Grafana tutorial, a Loki exchange-store configuration with sample APIs, and an end-to-end test that captures and validates Loki push payloads. ChangesLoki tutorial
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant LokiTutorialTest
participant MembraneRouter
participant BackendA
participant BackendB
participant MockLokiRouter
LokiTutorialTest->>MembraneRouter: Send successful and failed API requests
MembraneRouter->>BackendA: Invoke API returning 200
BackendA-->>MembraneRouter: Return 200
MembraneRouter->>MockLokiRouter: Push exchange payload
MembraneRouter->>BackendB: Invoke API returning 404
BackendB-->>MembraneRouter: Return 404
MembraneRouter->>MockLokiRouter: Push exchange payload
LokiTutorialTest->>MockLokiRouter: Poll and validate captured streams
Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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 |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
distribution/tutorials/operation/loki/docker-compose.yml (1)
3-3: 🔒 Security & Privacy | 🔵 Trivial | ⚡ Quick winUpdate the pinned Loki and Grafana image versions.
grafana/loki:2.9.8andgrafana/grafana:9.5.2are previous major versions. Update these tags to current stable releases so the tutorial does not ship unpatched images.Also applies to the Grafana-compose pin for
grafana/grafana:9.5.2.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@distribution/tutorials/operation/loki/docker-compose.yml` at line 3, Update the image tags in the Loki Docker Compose configuration, including the grafana/loki image and the grafana/grafana image, from their outdated pinned versions to current stable releases. Keep the images pinned to explicit stable version tags rather than using floating tags.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@distribution/tutorials/operation/loki/docker-compose.yml`:
- Line 3: Update the image tags in the Loki Docker Compose configuration,
including the grafana/loki image and the grafana/grafana image, from their
outdated pinned versions to current stable releases. Keep the images pinned to
explicit stable version tags rather than using floating tags.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 608d2720-571f-4b46-9c6a-1c3ff444fa09
📒 Files selected for processing (4)
distribution/src/test/java/com/predic8/membrane/tutorials/operation/LokiTutorialTest.javadistribution/tutorials/operation/70-Loki.yamldistribution/tutorials/operation/loki/docker-compose.ymldistribution/tutorials/operation/loki/provisioning/datasources/datasource.yml
Adds tutorials/operation/70-Loki.yaml, teaching how to push exchanges to Grafana Loki and query them with LogQL. It follows on from the Prometheus and Grafana steps: those cover aggregate metrics, this one covers the content of individual calls.
The tutorial walks through starting Loki and Grafana, generating traffic on two named APIs, and querying by stream label, by json stage and by line_format. It also notes the three things that surprise people: only finished exchanges are pushed, bodies are Base64-encoded inside the JSON, and the store is write-only.
Support files: a docker-compose for Loki and Grafana with the Loki datasource pre-provisioned.
LokiTutorialTest verifies the lesson end-to-end. A local router stands in for Loki on the port the tutorial configures, so the push is asserted without needing a container: the job and api labels, and log lines that render as the tutorial's line_format claims.
Summary by CodeRabbit
New Features
Documentation
Tests