Skip to content

[M2] Create Loki Push Handler #66

@miciav

Description

@miciav

Description

Implement non-blocking HTTP push to Loki.

Files to create

  • lb_common/handlers/loki_handler.py (new)

Key features

  • Async HTTP POST to Loki push API (/loki/api/v1/push)
  • Batching with configurable flush interval
  • Non-blocking queue with overflow protection
  • Automatic retry with exponential backoff
  • Graceful fallback to file-only on errors

Loki push format

{
  "streams": [{
    "stream": {
      "component": "runner",
      "host": "target-1",
      "run_id": "run-xxx"
    },
    "values": [
      ["1704547800000000000", "{\"level\":\"INFO\",...}"]
    ]
  }]
}

Acceptance criteria

  • Non-blocking push (queue-based)
  • Batching for efficiency
  • Retry logic with backoff
  • Falls back silently on failure
  • Unit tests with mocked Loki

Milestone: M2 - Loki Push Integration
Issue: 2.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions