Skip to content

Commit 4b231f6

Browse files
committed
Update with suggested comments and small edits
1 parent 67b0c44 commit 4b231f6

File tree

1 file changed

+24
-16
lines changed

1 file changed

+24
-16
lines changed

examples/README.md

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,39 +2,42 @@
22
# Tracing with AWS Sample Apps
33

44
## Overview
5+
56
![Current Version](https://img.shields.io/github/v/tag/open-telemetry/opentelemetry-php)
67

7-
This is a getting started guide for the example applications found in the AWS contrib folder. This walkthrough covers prerequite, installations, how to run the applications, and viewing the traces on X-Ray. Before reading this guide, you should familiarize with distributed tracing and the basics of OpenTelemetry. To learn more about getting started with OpenTelemetry PHP, see the OpenTelemetry developer documentation.
8+
This is a getting started guide for the example applications found in the AWS contrib folder. This walkthrough covers prerequisite, installations, how to run the applications, and viewing the traces on X-Ray. Before reading this guide, you should familiarize with distributed tracing and the basics of OpenTelemetry. To learn more about getting started with OpenTelemetry PHP, see the OpenTelemetry developer documentation.
89

910
## About the Sample Apps
1011

11-
Currently, the ability to instrument an application automatically does not exist, so manually instrumenting the apps was necessary. In both of the applications, creation of a tracer, generation of spans, propagation of contexts, and closing spans was implemented manually. Both of these applications are console applications that export trace data to the OTEL Collector which is then exported to AWS X-Ray.
12+
Currently, the ability to instrument an application automatically does not exist, so manually instrumenting the apps was necessary. In both of the applications, creation of a tracer, generation of spans, propagation of contexts, and closing spans was implemented manually. Both of these applications are console applications that export trace data to the OTEL Collector which is then exported to AWS X-Ray.
1213

1314
### Sample App 1
1415

15-
The first sample app in its implementation is creation of a span, then a child span, which is then populated in an HTTP header that makes a request to either aws.amazon.com (http://aws.amazon.com/) or the AWS SDK. The application will prompt you for input on which action you would like to take, and subsequently prints out the trace ID.
16+
The first sample app in its implementation is creation of a span, then a child span, which is then populated in an HTTP header that makes a request to either aws.amazon.com (http://aws.amazon.com/) or the AWS SDK. The application will prompt you for input on which action you would like to take, and subsequently prints out the trace ID.
1617

1718
### Sample App 2
1819

1920
The second application is a more robust example of how a real-world application may make a request to different services. A main application will make a call to two different microservices called Service1 and Service2. Before calling either of the services, the span context is injected into a carrier that is then taken to the service. Then, the services will extract the context from the carrier and create a new span based upon it. After the services are concluded, the child spans are ended and then the main root span is ended in the main application.
2021

2122
## Prerequisites
22-
The following downloads are necessary for running either of the above specified applications. The two repositories below can be downloaded anywhere on your machine. If you are having an issue with not being able to access the collector with your credentials, clone the aws-otel-collector in your root directory.
23+
24+
The following downloads are necessary for running either of the above specified applications. The two repositories below can be downloaded anywhere on your machine. If you are having an issue with not being able to access the collector with your credentials, clone the aws-otel-collector in your root directory.
2325

2426
Download Docker here: https://docs.docker.com/get-docker/
2527

2628
Clone locally the opentelemetry-php-contrib here: https://github.com/open-telemetry/opentelemetry-php-contrib
2729

2830
Clone locally the aws-otel-collector here: https://github.com/aws-observability/aws-otel-collector
2931

30-
## Set Up
32+
## Set Up
3133

3234
### Docker
3335

3436
Make sure Docker Desktop is running.
3537

3638
### AWS Access Keys
37-
First make sure that your AWS access keys are configured in your root directory. To see if your credentials are setup run the following command:
39+
40+
Now make sure that your AWS access keys are configured in your root directory. To see if your credentials are setup run the following command:
3841

3942
`cat .aws/credentials`
4043

@@ -49,10 +52,9 @@ In your root directory, run the following commands. These commands will take a w
4952
`sudo pecl install grpc`
5053

5154
If you are having issues please visit one of these resources:
55+
5256
- https://github.com/grpc/grpc/tree/master/src/php
53-
- https://programmersought.com/article/22193951689/
5457
- https://grpc.io/docs/languages/php/quickstart/
55-
- https://cjyabraham.github.io/docs/quickstart/php/
5658

5759
### Composer
5860

@@ -66,7 +68,7 @@ If the above does not work, please visit [here](https://getcomposer.org/download
6668

6769
### Update Repository Packages and Dependencies
6870

69-
In the php contrib repository, run the following:
71+
In the php contrib repository, run the following four commands:
7072

7173
`make install`
7274

@@ -88,10 +90,11 @@ At this point all necessary items have been installed in your system and you are
8890

8991
### Run Collector
9092

91-
Open a new terminal window and navigate into the aws-otel-collector folder.
93+
Open a new terminal window and navigate into the aws-otel-collector folder.
9294

9395
Run the following command. Make sure to replace `YOUR_ACCESS_KEY_HERE` and `YOUR_SECRET_ACCESS_KEY_HERE` with your own specific keys.
94-
```
96+
97+
```console
9598
docker run --rm -p 4317:4317 -p 55681:55681 -p 8889:8888 \
9699
-e AWS_REGION=us-west-2 \
97100
-e AWS_ACCESS_KEY_ID=YOUR_ACCESS_KEY_HERE \
@@ -100,14 +103,16 @@ docker run --rm -p 4317:4317 -p 55681:55681 -p 8889:8888 \
100103
--name awscollector public.ecr.aws/aws-observability/aws-otel-collector:latest \
101104
--config otel-local-config.yaml
102105
```
106+
103107
In another terminal window, navigate to the opentelemetry-php-contrib folder.
104108

105109
Run the following command for Sample App 1:
106110

107111
`php examples/aws/SampleApp1/SampleApp1.php`
108112

109113
The output for this app should look similar to the following:
110-
```
114+
115+
```console
111116
Starting Sample App
112117
Which call would you like to make?
113118
Type outgoing-http-call or aws-sdk-call
@@ -116,22 +121,25 @@ Final trace ID: {"traceId":"1-6115648a-d40b50a270b3c1249bcf60c2"}
116121
Sample App complete!
117122
```
118123

124+
Currently the `aws-sdk-call` option is commented out. This is due to dependency conflicts between AWS and the PHP Library. If you would like to enable it, follow the instructions in the comments of the SampleApp1.php file.
125+
119126
Run the following command for Sample App 2:
120127

121128
`php examples/aws/SampleApp2/SampleApp2.php`
122129

123130
The output for this app should look similar to the following:
124-
```
131+
132+
```console
125133
Starting Sample App
126134
Child span trace ID after service 2: {"traceId":"1-6115649a-230ef2ffe1d289a056b8d0ea"}
127135
Sample App complete!
128136
```
129137

130-
The trace IDs in any sample app will be completely unique. The first number is the version, the second section is the timestamp, and the last section is a randomized hexadecimal string.
138+
The trace IDs in any sample app will be completely unique. The first number is the version, the second section is the timestamp, and the last section is a randomized hexadecimal string.
131139

132140
## Viewing Traces on AWS X-Ray
133141

134-
Navigate to AWS X-Ray on your internet browser.
142+
Navigate to AWS X-Ray on your internet browser.
135143

136144
Click on the traces tab on the left hand side, like the image below:
137145

@@ -141,6 +149,6 @@ Make sure your region is set to us-west-2:
141149

142150
<img width="291" alt="Screen Shot 2021-08-12 at 11 21 59 AM" src="https://user-images.githubusercontent.com/46689344/129248725-d3f7a655-fe3b-47d4-a229-583365e16a54.png">
143151

144-
After running the sample app, there should be traces under the traces tab with all relevant information.
152+
After running the sample app, there should be traces under the traces tab with all relevant information.
145153

146154
<img width="1398" alt="Screen Shot 2021-08-09 at 11 42 50 PM" src="https://user-images.githubusercontent.com/46689344/129248704-0888b387-2fa8-4753-824e-d99e0c9a67b6.png">

0 commit comments

Comments
 (0)