* Add build scripts for HTTP example Add HTTP example Improved naming and formatting Add Semantic Convention to traces Fix semantic convention * Add Examples as OpenTelementry project * Changed the build configuration - Examples are compiled with the main project * Addressing comment of @carlosalberto * Addressed the feedback of @bogdandrutu * Removed InMemory exporter. Example as standalone project. * Remove examples from main build * Making the exporter private and static Change visibility of attributes * Update HTTP example README * Apply java format Co-authored-by: Inseo Kim <sano307@naver.com> |
||
|---|---|---|
| .. | ||
| gradle/wrapper | ||
| src/main/java/io/opentelemetry/example/http | ||
| README.md | ||
| build.gradle | ||
| gradlew | ||
| gradlew.bat | ||
| settings.gradle | ||
README.md
HTTP Example
Note: This is an advanced scenario useful for people that want to manually instrument their own code.
This is a simple example that demonstrates how to use the OpenTelemetry SDK to manually instrument a simple HTTP based Client/Server application. The example creates the Root Span on the client and sends the context over the HTTP request. On the server side, the example shows how to extract the context and create a Child Span with attached a Span Event.
How to run
Prerequisites
- Java 1.8.231
- Be on the project root folder
1 - Compile
gradlew fatJar
2 - Start the Server
java -cp ./build/libs/opentelemetry-example-http-all-0.2.0.jar io.opentelemetry.example.http.HttpServer
3 - Start the Client
java -cp ./build/libs/opentelemetry-example-http-all-0.2.0.jar io.opentelemetry.example.http.HttpClient