Feature/make guides accessible (#311)
* Reduce image size for Laravel guide * Compress symfony guide images * Add user guide link to readme
This commit is contained in:
parent
8bc993ea27
commit
08b149fa2a
|
@ -98,6 +98,9 @@ The easy way to test the example out with docker and docker-compose is:
|
|||
|
||||
4.) In order to stop docker containers for this example just run `make stop-prometheus`
|
||||
|
||||
## User Integration Guides
|
||||
* [Integrating OpenTelemetry PHP into Laravel Applications](./docs/laravel-integration.md)
|
||||
* [Integrating OpenTelemetry PHP into Symfony Applications](./docs/symfony-integration.md)
|
||||
## Versioning
|
||||
|
||||
Versioning rationale can be found in the [Versioning Documentation](/docs/versioning.md)
|
||||
|
|
|
@ -19,12 +19,11 @@ The Laravel framework supports creating applications using composer. To do that,
|
|||
|
||||
To confirm that our application works, we can move to the application directory using `cd otel-php-laravel-basic-example` , then serve the application with `php artisan serve` .
|
||||
|
||||

|
||||

|
||||
|
||||
Let's navigate to `http://127.0.0.1:8000` on our browser to see the default Laravel welcome page.
|
||||
|
||||

|
||||
|
||||

|
||||
## Step 2 - Require OpenTelemetry PHP Package
|
||||
|
||||
Laravel comes with most packages needed for development out of the box, so for this example, we will only require the open-telemetry PHP package. Let's run `composer require open-telemetry/opentelemetry` to pull that in.
|
||||
|
@ -56,13 +55,13 @@ services:
|
|||
|
||||
Next, we pull in Zipkin and Jaeger by running `docker-compose up -d`. This might take some time, depending on your internet connection speed.
|
||||
|
||||

|
||||

|
||||
|
||||
We can confirm that Zipkin is up by navigating to `http://localhost:9411/` on our browser. For Jaeger, navigating to `http://localhost:16686/` on our browser should display the Jaeger home page.
|
||||
|
||||

|
||||

|
||||
|
||||

|
||||

|
||||
|
||||
## Step 5 - Instrument Laravel Application
|
||||
|
||||
|
@ -164,30 +163,31 @@ We also need reload both Zipkin and Jaeger on our browser, using the URLs `http:
|
|||
|
||||
For Jaeger under service, you should see a `Hello World Web Server Jaeger` service. Go ahead and click find traces to see exported traces.
|
||||
|
||||

|
||||

|
||||
|
||||
|
||||
Once we click on `Find Traces`, you should be able to see traces like below:
|
||||
|
||||
|
||||

|
||||

|
||||
|
||||
|
||||
|
||||
We can click on a trace to get more information about the trace.
|
||||
|
||||

|
||||

|
||||
|
||||
|
||||
For Zipkin, we can visualize our trace by clicking on `Run Query`
|
||||
|
||||

|
||||

|
||||
|
||||
|
||||
Since resources in Laravel's `public\index.php` file are available to the entire application, we can use any of the already instantiated tracers to further instrument controllers or any other parts of our application.
|
||||
|
||||
Let's create a `Hello` controller to check this out. Run the command `php artisan make:controller HelloController`
|
||||
|
||||

|
||||

|
||||
|
||||
|
||||
Next we need to add a route for accessing the controller. To do this we need to utilize the `HelloController` class within our web routes file located in the `routes\web.php` as follows:
|
||||
|
||||
|
@ -208,7 +208,8 @@ public function index(){
|
|||
```
|
||||
Let's confirm that everything works well by visiting the `/hello` route on our browser.
|
||||
|
||||

|
||||

|
||||
|
||||
|
||||
Now that we have the `index` method working, we can simulate adding an exception event to our Zipkin trace as follows:
|
||||
|
||||
|
@ -234,7 +235,8 @@ In the above snippet we change the span name and attributes for our Zipkin trace
|
|||
|
||||
We need to reload our `http://127.0.0.1:8000/hello` route, then navigate to Zipkin like before, to see that our span name gets updated to `new name` and our `Exception Example` is visible.
|
||||
|
||||

|
||||

|
||||
|
||||
|
||||
## Summary
|
||||
With the above example we have been able to instrument a Laravel application using the OpenTelemetry PHP library. You can fork the example project [here](https://github.com/prondubuisi/otel-php-laravel-basic-example).
|
|
@ -47,16 +47,20 @@ class HelloController extends AbstractController
|
|||
|
||||
To check out the routes available in our current project run `php bin/console debug:router`.
|
||||
|
||||

|
||||

|
||||
|
||||
|
||||
|
||||
Let's confirm that our application works by running the command `symfony server:start`.
|
||||
|
||||

|
||||

|
||||
|
||||
|
||||
|
||||
You can navigate to `http://127.0.0.1:8000/hello` route to see the `Hello world` response returned from the HelloController index method above.
|
||||

|
||||
|
||||

|
||||
|
||||
|
||||
|
||||
## Step 3 - Require the OpenTelemetry PHP Library
|
||||
|
@ -87,14 +91,14 @@ services:
|
|||
|
||||
To confirm that docker is installed and running on our system, we can run the hello world docker example using the command `docker run -it --rm hello-world`. If everything works well, run `docker-compose up -d` to pull in Zipkin and Jaeger. This might take some time, depending on your internet connection speed.
|
||||
|
||||

|
||||

|
||||
|
||||
|
||||
We can confirm that Zipkin is up by navigating to `http://localhost:9411/` on our browser. For Jaeger, navigating to `http://localhost:16686/` on our browser should display the Jaeger home page.
|
||||
|
||||

|
||||

|
||||
|
||||

|
||||

|
||||
|
||||
|
||||
Now it is time to utilize our OpenTelemetry PHP Library to export traces to both Zipkin and Jaeger.
|
||||
|
@ -178,30 +182,30 @@ if (SamplingResult::RECORD_AND_SAMPLED === $samplingResult->getDecision()) {
|
|||
|
||||
lets confirm that we can see exported traces on both Zipkin and Jaeger. To do that we need to reload `http://127.0.0.1:8000/hello` or any other route on our symfony server;
|
||||
|
||||

|
||||

|
||||
|
||||
We also need reload both Zipkin and Jaeger on our browser, using the URLs `http://localhost:9411/` and `http://localhost:16686/`. Do ensure that both your symfony server and docker instance are running for this step.
|
||||
|
||||
For Jaeger under service, you should see a `Hello World Web Server Jaeger` service, go ahead and click find traces to see exported traces.
|
||||
|
||||

|
||||
)
|
||||

|
||||
|
||||
|
||||
Once we click on `Find Traces` you should be able to see traces like below:
|
||||
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||
|
||||
We can click on a trace to get more information about the trace.
|
||||
|
||||

|
||||

|
||||
|
||||
|
||||
For Zipkin, we can visualize our trace by clicking on `Run Query`
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||
Since resources in Symfony's `public\index.php` file are available to the entire application, we can use any of the already instantiated tracers within `HelloController`. In addition to the tracers, we can also utilize associated properties, methods and events.
|
||||
|
||||
|
@ -229,7 +233,7 @@ In the above snippet we change the span name and attributes for our Zipkin trace
|
|||
|
||||
We need to reload our `http://127.0.0.1:8000/hello` route, then navigate to Zipkin like before to see that our span name gets updated to `new name` and our `Exception Example` is visible
|
||||
|
||||

|
||||

|
||||
|
||||
## Summary
|
||||
|
||||
|
|
Loading…
Reference in New Issue