softwaremill / softwaremill/tapir
[BUG] DefaultServerLog.decodeFailureHandled should use doLogAllDecodeFailures function
Nobody has claimed this yet.
- Dominant language
- Scala
- Stars
- 1.5k
- Forks
- 468
- Avg merge
- 5h 37m
- Merged PRs (30d)
- 34
Description
Tapir version: 1.2.11
Scala version: 2.13
Describe the bug
Currently, it's not possible to disable logging of decode error. decodeFailureHandled doesn't take into account logAllDecodeFailures and doesn't use doLogAllDecodeFailures function, so we can't override such behavior.
We don't want to log decode errors since it might contain sensitive information but we still want to log other logWhenHandled events that are not related for decoding.
override def decodeFailureNotHandled(ctx: DecodeFailureContext, token: TOKEN): F[Unit] =
if (logAllDecodeFailures)
doLogAllDecodeFailures(
s"Request: ${showRequest(ctx.request)}, not handled by: ${showEndpoint(ctx.endpoint)}${took(token)}; decode failure: ${ctx.failure}, on input: ${ctx.failingInput.show}",
exception(ctx)
)
else noLog
override def decodeFailureHandled(ctx: DecodeFailureContext, response: ServerResponse[_], token: TOKEN): F[Unit] =
if (logWhenHandled)
doLogWhenHandled(
s"Request: ${showRequest(ctx.request)}, handled by: ${showEndpoint(
ctx.endpoint
)}${took(token)}; decode failure: ${ctx.failure}, on input: ${ctx.failingInput.show}; response: ${showResponse(response)}",
exception(ctx)
)
else noLog
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in server/core/src/main/scala/sttp/tapir/server/interceptor/log/ServerLog.scala at decodeFailureHandled, comparing it with the shown decodeFailureNotHandled implementation and the doLogAllDecodeFailures function. Done means decode failures can be excluded through logAllDecodeFailures while unrelated logWhenHandled events remain logged; check the relevant server logging tests if available.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- scala
- Domain
- backend, observability
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 50/100