GithubHelp home page GithubHelp logo

ramnarayana-janapala / instrumenting-java-apps-using-opentelemetry Goto Github PK

View Code? Open in Web Editor NEW

This project forked from build-on-aws/instrumenting-java-apps-using-opentelemetry

0.0 0.0 0.0 1.94 MB

Microservice written in Java that shows how to instrument applications using OpenTelemetry, to produce telemetry data for traces and metrics. Also how to switch the observability backend without code changes.

License: MIT No Attribution

Shell 14.28% Java 77.18% Dockerfile 8.54%

instrumenting-java-apps-using-opentelemetry's Introduction

Instrumenting Java Applications using OpenTelemetry

This project provides an example of microservice written in Java that produces telemetry data for traces and metrics using OpenTelemetry. It also shows how to de-couple the application from the observability backend using the OpenTelemetry Collector and the OTLP protocol, so you can be easily switch the observability backend for another without code changes.

๐Ÿ’ก If you want to learn how to build this code with a hands-on tutorial, you can watch the YouTube series below.

Instrumenting Java Applications using OpenTelemetry

Alternatively, you can also read the blog post: https://www.buildon.aws/posts/instrumenting-java-apps-using-opentelemetry

Requirements

๐Ÿข Running the microservice with Grafana, Grafana Tempo, and Prometheus as observability backend.

You can have the microservice sending telemetry data to a local observability backend. Traces will be sent to Grafana Tempo and the metrics to Prometheus. Then you can use Grafana to visualize the the generated telemetry data.

  1. Start the containers using Docker Compose.
docker compose -f docker-compose.yaml up -d
  1. Access the Grafana UI: http://localhost:3000

๐ŸŒฉ Running the microservice with AWS X-Ray and Amazon CloudWatch as observability backend.

You can have the microservice sending telemetry data to AWS as observability backend. Traces will be sent to AWS X-Ray and the metrics to Amazon CloudWatch. This is possible thanks to the AWS Distro for OpenTelemetry that provides out-of-the-box integration with AWS services. Before running the code; make sure to configure your AWS credentials in your machine, as the code will use them to connect with the target services.

  1. Start the containers using Docker Compose.
docker compose -f docker-compose-aws.yaml up -d
  1. Access the AWS Console: https://console.aws.amazon.com

โšก๏ธ Invoke the Microservice API manually

The microservice expose an API over the port 8888 using HTTP.

  1. Invoke this API for testing purposes.
curl -X GET http://localhost:8888/hello

Security

See CONTRIBUTING for more information.

Disclaimers

This package requires and may incorporate or retrieve a number of third-party
software packages (such as open source packages) at install-time or build-time
or run-time ("External Dependencies"). The External Dependencies are subject to
license terms that you must accept in order to use this package. If you do not
accept all of the applicable license terms, you should not use this package. We
recommend that you consult your company's open source approval policy before
proceeding.

Provided below is a list of External Dependencies and the applicable license
identification as indicated by the documentation associated with the External
Dependencies as of Amazon's most recent review.

THIS INFORMATION IS PROVIDED FOR CONVENIENCE ONLY. AMAZON DOES NOT PROMISE THAT
THE LIST OR THE APPLICABLE TERMS AND CONDITIONS ARE COMPLETE, ACCURATE, OR
UP-TO-DATE, AND AMAZON WILL HAVE NO LIABILITY FOR ANY INACCURACIES. YOU SHOULD
CONSULT THE DOWNLOAD SITES FOR THE EXTERNAL DEPENDENCIES FOR THE MOST COMPLETE
AND UP-TO-DATE LICENSING INFORMATION.

YOUR USE OF THE EXTERNAL DEPENDENCIES IS AT YOUR SOLE RISK. IN NO EVENT WILL
AMAZON BE LIABLE FOR ANY DAMAGES, INCLUDING WITHOUT LIMITATION ANY DIRECT,
INDIRECT, CONSEQUENTIAL, SPECIAL, INCIDENTAL, OR PUNITIVE DAMAGES (INCLUDING
FOR ANY LOSS OF GOODWILL, BUSINESS INTERRUPTION, LOST PROFITS OR DATA, OR
COMPUTER FAILURE OR MALFUNCTION) ARISING FROM OR RELATING TO THE EXTERNAL
DEPENDENCIES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, EVEN
IF AMAZON HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
AND DISCLAIMERS APPLY EXCEPT TO THE EXTENT PROHIBITED BY APPLICABLE LAW.

Grafana (https://grafana.com) โ€“ Affero General Public License 3.0

License

This library is licensed under the MIT-0 License. See the LICENSE file.

instrumenting-java-apps-using-opentelemetry's People

Contributors

amazon-auto avatar riferrei avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.