Closed sergeyklay closed 6 years ago
the UnsupportedFormat exception is a logical exception which means that it should be part of static checks and not related to user input. I don't think we should remove it. For RuntimeExceptions I agree we should instead log them.
Den lør. 18. aug. 2018, 10:24 skrev Serghei Iakovlev < notifications@github.com>:
Short description of what this PR does:
- Don't throw exception on Tracer::inject and Tracer::extract
All exceptions thrown from Tracer::inject and Tracer::extract should be caught and logged on WARN level so that business code execution isn't affected. If possible, catch implementation specific exceptions and log more meaningful information. Checklist
- I have made a material change to the repo (functionality, testing, spelling, grammar)
- I have read the [Contribution Guide] and my PR follows them.
- I updated my branch with the master branch.
- I have added tests that prove my fix is effective or that my feature works
- I have added necessary documentation about the functionality in the appropriate .md file
- I have added in line documentation to the code I modified
You can view, comment on, or merge this pull request online at:
https://github.com/opentracing/opentracing-php/pull/81 Commit Summary
- Don't throw exception on Tracer::inject/extract
File Changes
- M src/OpenTracing/Tracer.php https://github.com/opentracing/opentracing-php/pull/81/files#diff-0 (17)
Patch Links:
- https://github.com/opentracing/opentracing-php/pull/81.patch
- https://github.com/opentracing/opentracing-php/pull/81.diff
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/opentracing/opentracing-php/pull/81, or mute the thread https://github.com/notifications/unsubscribe-auth/AC7sAiPKbSynvcNhoIa1Et-ZjIW8gEwdks5uR88fgaJpZM4WCfCl .
--
José Carlos
I'm pretty sure that tracing shouldn't stop application the same as the autoloader (PSR-4) or, for example the logger. Let's take a look for example at Java Client:
and
Could you explain why an introduction of opentracing into the project should increase risks in the form of UnsupportedFormat exception?
This document you point out is for the Extractor
interface which is being
used when you actually extract the context and this is a Runtime thing, of
course UnsupportedFormat is not a thing here because the decision on what
extractor should be use is made one layer up. What you are looking for here
is where the tracer calls the injector/extractor which occurs in
https://github.com/jaegertracing/jaeger-client-java/blob/b6a824d0f6e54f246a1c5583e45536a1143c4c30/jaeger-core/src/main/java/io/jaegertracing/internal/JaegerTracer.java#L194
and as you can see it also throws the UnsupportedFormat exception. As I
said before, this is something that should be checked statically and does
not involve the user input.
Den lør. 18. aug. 2018, 14:18 skrev Serghei Iakovlev < notifications@github.com>:
I'm pretty sure that tracing shouldn't stop application the same as the autoloader (PSR-4) or, for example the logger. Let's take a look for example at Java Client:
and
Could you explain why an introduction of opentracing into the project should increase risks in the form of UnsupportedFormat exception?
— You are receiving this because you commented.
Reply to this email directly, view it on GitHub https://github.com/opentracing/opentracing-php/pull/81#issuecomment-414054138, or mute the thread https://github.com/notifications/unsubscribe-auth/AC7sArWfB8D6K-fL5-1e5hOhLfmRsJmiks5uSAYCgaJpZM4WCfCl .
--
José Carlos
Maybe an example is more clarifier: if the context comes with a wrong format we are not throwing an exception. This exception is being thrown when you attempt (programmatically) to inject/extract a context on binary format but you did not configure such injector/extractor. This exception should show up in development or tests stage, never in production. Think of it as passing a wrong type in the signature of a PHP function.
Den lør. 18. aug. 2018, 14:33 skrev José Carlos Chávez <jcchavezs@gmail.com
:
This document you point out is for the
Extractor
interface which is being used when you actually extract the context and this is a Runtime thing, of course UnsupportedFormat is not a thing here because the decision on what extractor should be use is made one layer up. What you are looking for here is where the tracer calls the injector/extractor which occurs in https://github.com/jaegertracing/jaeger-client-java/blob/b6a824d0f6e54f246a1c5583e45536a1143c4c30/jaeger-core/src/main/java/io/jaegertracing/internal/JaegerTracer.java#L194 and as you can see it also throws the UnsupportedFormat exception. As I said before, this is something that should be checked statically and does not involve the user input.Den lør. 18. aug. 2018, 14:18 skrev Serghei Iakovlev < notifications@github.com>:
I'm pretty sure that tracing shouldn't stop application the same as the autoloader (PSR-4) or, for example the logger. Let's take a look for example at Java Client:
and
Could you explain why an introduction of opentracing into the project should increase risks in the form of UnsupportedFormat exception?
— You are receiving this because you commented.
Reply to this email directly, view it on GitHub https://github.com/opentracing/opentracing-php/pull/81#issuecomment-414054138, or mute the thread https://github.com/notifications/unsubscribe-auth/AC7sArWfB8D6K-fL5-1e5hOhLfmRsJmiks5uSAYCgaJpZM4WCfCl .
--
José Carlos
--
José Carlos
Thank you
Short description of what this PR does:
Tracer::inject
andTracer::extract
All exceptions thrown from
Tracer::inject
andTracer::extract
should be caught and logged on WARN level so that business code execution isn't affected. If possible, catch implementation specific exceptions and log more meaningful information.Checklist