apache / apache/apisix

feat: loki-logger support for structured metadata

Open
#13,451 1 comment 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Lua
Stars
17.1k
Forks
2.9k
Avg merge
3d 16h
Merged PRs (30d)
63

Description

### Description

As recommended in loki documentation, labels should be used for fields with limited cardinality - a good example would be http request method, which can have one of few values. Labels should not be used for indexing fields with high value cardinality, like IP address or request id. For this case, loki has a feature called "structured metadata" - it can and should be used to index searchable fields.

At the moment, loki-logger plugin allows defining loki labels, but does not provide an option to specify structured metadata. This makes the plugin hardly usable in real-world, high-traffic scenarios where we need to index fields with high cardinality.

Contributor guide

Open the contributing guide

Research direction

Start by locating the loki-logger plugin and reviewing how it currently defines Loki labels. Add an option for structured metadata for high-cardinality searchable fields, and verify that the plugin can send this metadata separately from labels.

Written by the indexing model from the issue text.

Assessment

Tech stack
lua
Domain
observability
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.