Skip to content

Latest commit

 

History

History
12 lines (8 loc) · 1.25 KB

File metadata and controls

12 lines (8 loc) · 1.25 KB

php-angular1-sample

PHP Angular App showing an example of OpenTracing (LightStep) context propagation

The PHP backend is a simple proxy server. The Angular frontend is generated by the Angular sample app generator using Angular 1. The PHP dependencies are loaded via composer.

How to run the example

Add to an Apache Server to view (for example, your /Sites folder) and navigate to http://localhost/fe/app. The console log will show browser tracing events since verbosity is set to 4. Replace {ACCESS_TOKEN_HERE} with a LightStep access token. Clicking the button "backend request" will send a url to the proxy.php server, which then sends a request to a hypothetical backend service, in this case a free website for json data.

How it works

The tracer is created in the TracerService Angular service. To use tracing within Angular modules, add the TracerService dependency, see the view1 module for reference. The TracerService is a singleton service, additional functionality and shortcuts can extend that service (currently it only gets the LightStep tracer).

The tracer on the PHP script is created at the invocation of the script and the "join" function is used to extract span context from the frontend request. Opentracing-php is listed as an optional dependency.