Nebo15 / logger_json

JSON logger formatter with support for Google Cloud, DataDog and other for Elixir.
https://nebo15.github.io/logger_json/
MIT License
237 stars 92 forks source link

feat: add phoenix route to plug metadata #90

Closed btkostner closed 2 years ago

btkostner commented 2 years ago

This adds the phoenix route to plug metadata, so you will be able to get /resource/:id as well as the regular url like /resources/1234. It depends on Phoenix.Router code, so I can't add tests, but I did test locally.

coveralls commented 2 years ago

Coverage Status

Coverage decreased (-0.6%) to 74.902% when pulling a0ff074c1ec8e085bd1a2cb288f678f753aa030f on btkostner:datadog-phx-route into 8f9ed25d733ea88fd999e4932521865316b381e6 on Nebo15:master.

coveralls commented 2 years ago

Coverage Status

Coverage remained the same at 75.494% when pulling db489b7fa1da9fe7891781da9009b93281a763ff on btkostner:datadog-phx-route into 8f9ed25d733ea88fd999e4932521865316b381e6 on Nebo15:master.

btkostner commented 2 years ago

Worth noting that this will require Phoenix 1.5.0 or greater

AndrewDryga commented 2 years ago

Hello @btkostner, I believe we already are writing conn.request_path both in GKE and DataDog formatter, can you please share a use case when it's not enough?

btkostner commented 2 years ago

This will have the params in the url. /products/1234 is what we currently have and /products/:id is what this adds. At least for Datadog, the APM includes it and it's much easier to query by.

AndrewDryga commented 2 years ago

@btkostner can we keep this change to DataDog only? For Google Cloud, we already have a full request path. Other than that thank you and LGTM.

btkostner commented 2 years ago

Sounds good. PR updated!