Closed dapryor closed 1 year ago
Yeah looks like we changed the signature for the middleware log filter here https://github.com/snok/asgi-correlation-id/pull/14/files, and forgot to alter the celery one :woozy_face:
I agree they should match, but let's dig into exactly how thing might break existing apps if we do it in one go. I'm at the end of a long-ish day, so I might be missing something obvious here, but I can't really see how it would:
None
(default) would mean we don't trim, which means the IDs would remain 32 charsCould you specify exactly why it would be a breaking change?
If you agree, I vote we just change the signature and call it a bugfix
I'll go with whatever you say haha.
I think you are right in that it wont immediately break, but it could cause confusion in scenarios where someone was under the assumption that leaving uuid_length blank defaulted to not trimming.
ill put up a separate PR for fixing the signature unless someone else gets to it first.
Issue
There is a very similar interface between
CorrelationIdFilter
andCeleryTracingIdsFilter
that caused confusion and also limits feature parity between the modules log filters.as you can see above, the first filter takes an
Optional[int]
and the second filter takes anint
.There were two main problems we had with this
CeleryTracingIdsFilter
only supports trimming of the IDs. This is unlikeCorrelationIdFilter
which allows None to be passed to the uuid_length and it passes the untrimmed ID to the log.This also relates to #50 since i am attempting to allow the actually celery task id to be used which is in uuid str form. This is 36 characters long due to the
-
characters, which leads toCeleryTracingIdsFilter
truncating thiis uuid by defaultSolution
The solution can be done in two parts.
CeleryTracingIdsFilter
toOptional[int]
and do not trim the string when `None is passedCeleryTracingIdsFilter
matchCorrelationIdFilter
by defaulting toNone
The reason this is suggested to be a two part fix is because the second point would break existing code when users did not explicitly define
uuid_length