-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Make php examples runnable #2896
Make php examples runnable #2896
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
ResourceAttributes::SERVICE_NAME => 'bar', | ||
ResourceAttributes::SERVICE_VERSION => '0.1', | ||
ResourceAttributes::DEPLOYMENT_ENVIRONMENT => 'development', | ||
]))); | ||
$transport = (new GrpcTransportFactory())->create('http://collector:4317' . OtlpUtil::method(Signals::TRACE)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I get an error on this line:
PHP Fatal error: Uncaught Error: Class "OpenTelemetry\Contrib\Grpc\GrpcTransportFactory" not found in /Users/tnajaryan/work/experiments/otel-php/GettingStarted.php:31
Stack trace:
#0 {main}
thrown in /Users/tnajaryan/work/experiments/otel-php/GettingStarted.php on line 31
Do I need to install the Contrib somehow?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated the example to not use grpc (it's covered better in the exporters doc).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tried the updated example, now it can't find SpanExporter:
PHP Fatal error: Uncaught Error: Class "OpenTelemetry\Contrib\Otlp\SpanExporter" not found in /Users/tnajaryan/work/experiments/otel-php/GettingStarted.php:32
Stack trace:
#0 {main}
thrown in /Users/tnajaryan/work/experiments/otel-php/GettingStarted.php on line 32
Please also make examples in I tried this example. It does not include the After copying the
I think it needs to use I also tried example from the repo. It works but requires changing line require __DIR__ . '/../../vendor/autoload.php'; to require 'vendor/autoload.php'; |
@tigrannajaryan more updates made to the docs. I've made it more clear which code sections are a continuation of the initial example, and made the others self-contained. |
- Make sure that the examples all run if copy/pasted. Update/improve the PHP documentation
simplify manual instrumentation example by removing grpc (which is covered in the exporters section) add a log processor and exporter.
several issues have been filed where it was not clear that the extension wasn't a complete solution (like most APM products provide).
to keep the manual examples succinct, let's just export them to console. exporters are covered in more detail in their own page.
7950f22
to
ddaebd4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall there seem to be some good updates in here, thanks!
My main objection is to the addition of manual instrumentation in Getting started. For one, the getting-started page is meant to allow a reader to get some telemetry up-and-running quickly: and the automatic instrumentation does that nicely. Also, we're trying to be consistent across languages: do most other language SIGs add manual instrumentation instructions in their Getting started page @svrnm?
- Learn more about [manual instrumentation][] and try out some | ||
[examples](/docs/instrumentation/php/examples/). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice update here, and good catch.
Python and .NET have a small section, but Ruby and Java do not. So, uhh, it's mixed 😆 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixes: open-telemetry/opentelemetry-php#1042
Preview: https://deploy-preview-2896--opentelemetry.netlify.app/docs/instrumentation/php/