-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support using event targets as labels #16
Comments
As you found out in the docs, it's probably something one shouldn't really do. I find it hard to justify working towards that if I don't see the use case. Can you explain why you want it after having read the docs? |
In use-cases where the cardinality of the Honestly, the more flexible solution would be to support a callback that can add arbitrary labels to a single event, given its metadata. |
And you do have such a use case, it's not entirely hypothetical?
Currently, the code exploits that the labels never change during the runtime. Changing this assumption is probably going to cost a bit of performance. This means that there should be a clear use case. |
I second this issue, and would even go further. I would like to have a way to specify any field in the builder to be sent as label. Something like: let (layer, task) = tracing_loki::builder()
.label("host", "mine")?
.extra_field("pid", format!("{}", process::id()))?
.export_field_as_label("target")
.export_field_as_label("my_custom_field")
.build_url(Url::parse("http://127.0.0.1:3100").unwrap())?;
// ...
info!(my_custom_field="one", "test"); Sometimes I need to filter the logs with custom fields to debug an application, and there are a lot of logs and filtering on a field is very slow. Since it's my application, I fully control the cardinality of those labels. I think this would be a very useful feature, and it lets the developer have the control on whether they want to pay the price for more indexes for faster look ups. |
I had a hell of a time figuring out how to actually filter events by target in Grafana, because it appears they're not provided as labels: https://github.com/hrxi/tracing-loki/blob/master/src/lib.rs#L241
Having dug into Loki more, I understand why this choice was made (as it may exceed cardinality limits) but I would at least like to have the option.
Renaming
target
to_target
also just makes it more annoying to use thejson
parser, as I have to do| json target="_target"
instead of just| json target
.The text was updated successfully, but these errors were encountered: