{"id":18602110,"url":"https://github.com/build-on-aws/instrumenting-java-apps-using-opentelemetry","last_synced_at":"2025-04-10T19:30:57.814Z","repository":{"id":156470213,"uuid":"537254520","full_name":"build-on-aws/instrumenting-java-apps-using-opentelemetry","owner":"build-on-aws","description":"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.","archived":false,"fork":false,"pushed_at":"2023-08-04T20:20:00.000Z","size":1989,"stargazers_count":51,"open_issues_count":3,"forks_count":45,"subscribers_count":24,"default_branch":"main","last_synced_at":"2025-03-25T03:11:37.723Z","etag":null,"topics":["aws-x-ray","cloud-watch","grafana","grafana-tempo","java","metrics","observability","opentelemetry","opentelemetry-collector","otlp","prometheus","tracing"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit-0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/build-on-aws.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-09-16T00:48:59.000Z","updated_at":"2025-03-08T12:12:07.000Z","dependencies_parsed_at":null,"dependency_job_id":"7b3d6d7d-ea97-48d7-ae5b-4fcf6377b40a","html_url":"https://github.com/build-on-aws/instrumenting-java-apps-using-opentelemetry","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/build-on-aws%2Finstrumenting-java-apps-using-opentelemetry","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/build-on-aws%2Finstrumenting-java-apps-using-opentelemetry/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/build-on-aws%2Finstrumenting-java-apps-using-opentelemetry/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/build-on-aws%2Finstrumenting-java-apps-using-opentelemetry/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/build-on-aws","download_url":"https://codeload.github.com/build-on-aws/instrumenting-java-apps-using-opentelemetry/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248281395,"owners_count":21077423,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aws-x-ray","cloud-watch","grafana","grafana-tempo","java","metrics","observability","opentelemetry","opentelemetry-collector","otlp","prometheus","tracing"],"created_at":"2024-11-07T02:10:22.047Z","updated_at":"2025-04-10T19:30:57.806Z","avatar_url":"https://github.com/build-on-aws.png","language":"Java","readme":"## Instrumenting Java Applications using OpenTelemetry\n\nThis project provides an example of microservice written in Java that produces telemetry data for traces and metrics using [OpenTelemetry](https://opentelemetry.io). It also shows how to de-couple the application from the observability backend using the [OpenTelemetry Collector](https://opentelemetry.io/docs/collector) and the [OTLP protocol](https://opentelemetry.io/docs/reference/specification/protocol), so you can be easily switch the observability backend for another without code changes.\n\n💡 If you want to learn how to build this code with a hands-on tutorial, you can watch the YouTube series below.\n\n[![Instrumenting Java Applications using OpenTelemetry](images/youtube.png)](https://www.youtube.com/watch?v=XvmicNH_4lc\u0026list=PLDqi6CuDzubz5viRapQ049TjJMOCCu9MJ\u0026index=1)\n\nAlternatively, you can also read the blog post: https://www.buildon.aws/posts/instrumenting-java-apps-using-opentelemetry\n\n### Requirements\n\n* [Java 17+](https://openjdk.org/install)\n* [Maven 3.8.6+](https://maven.apache.org/download.cgi)\n* [Docker](https://www.docker.com/get-started)\n\n## 🏢 Running the microservice with Grafana, Grafana Tempo, and Prometheus as observability backend.\n\nYou can have the microservice sending telemetry data to a local observability backend. Traces will be sent to [Grafana Tempo](https://grafana.com/traces) and the metrics to [Prometheus](https://prometheus.io). Then you can use [Grafana](https://grafana.com/grafana) to visualize the the generated telemetry data.\n\n1. Start the containers using Docker Compose.\n\n```bash\ndocker compose -f docker-compose.yaml up -d\n```\n\n2. Access the Grafana UI: http://localhost:3000\n\n## 🌩 Running the microservice with AWS X-Ray and Amazon CloudWatch as observability backend.\n\nYou can have the microservice sending telemetry data to AWS as observability backend. Traces will be sent to [AWS X-Ray](https://aws.amazon.com/xray) and the metrics to [Amazon CloudWatch](https://aws.amazon.com/cloudwatch). This is possible thanks to the [AWS Distro for OpenTelemetry](https://aws.amazon.com/otel) that provides out-of-the-box integration with AWS services. Before running the code; make sure to [configure your AWS credentials](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-quickstart.html) in your machine, as the code will use them to connect with the target services.\n\n1. Start the containers using Docker Compose.\n\n```bash\ndocker compose -f docker-compose-aws.yaml up -d\n```\n\n2. Access the AWS Console: https://console.aws.amazon.com\n\n## ⚡️ Invoke the Microservice API manually\n\nThe microservice expose an API over the port 8888 using HTTP.\n\n1. Invoke this API for testing purposes.\n\n```bash\ncurl -X GET http://localhost:8888/hello\n```\n\n## Security\n\nSee [CONTRIBUTING](CONTRIBUTING.md#security-issue-notifications) for more information.\n\n## Disclaimers\n\n```text\nThis package requires and may incorporate or retrieve a number of third-party\nsoftware packages (such as open source packages) at install-time or build-time\nor run-time (\"External Dependencies\"). The External Dependencies are subject to\nlicense terms that you must accept in order to use this package. If you do not\naccept all of the applicable license terms, you should not use this package. We\nrecommend that you consult your company's open source approval policy before\nproceeding.\n\nProvided below is a list of External Dependencies and the applicable license\nidentification as indicated by the documentation associated with the External\nDependencies as of Amazon's most recent review.\n\nTHIS INFORMATION IS PROVIDED FOR CONVENIENCE ONLY. AMAZON DOES NOT PROMISE THAT\nTHE LIST OR THE APPLICABLE TERMS AND CONDITIONS ARE COMPLETE, ACCURATE, OR\nUP-TO-DATE, AND AMAZON WILL HAVE NO LIABILITY FOR ANY INACCURACIES. YOU SHOULD\nCONSULT THE DOWNLOAD SITES FOR THE EXTERNAL DEPENDENCIES FOR THE MOST COMPLETE\nAND UP-TO-DATE LICENSING INFORMATION.\n\nYOUR USE OF THE EXTERNAL DEPENDENCIES IS AT YOUR SOLE RISK. IN NO EVENT WILL\nAMAZON BE LIABLE FOR ANY DAMAGES, INCLUDING WITHOUT LIMITATION ANY DIRECT,\nINDIRECT, CONSEQUENTIAL, SPECIAL, INCIDENTAL, OR PUNITIVE DAMAGES (INCLUDING\nFOR ANY LOSS OF GOODWILL, BUSINESS INTERRUPTION, LOST PROFITS OR DATA, OR\nCOMPUTER FAILURE OR MALFUNCTION) ARISING FROM OR RELATING TO THE EXTERNAL\nDEPENDENCIES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, EVEN\nIF AMAZON HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS\nAND DISCLAIMERS APPLY EXCEPT TO THE EXTENT PROHIBITED BY APPLICABLE LAW.\n\nGrafana (https://grafana.com) – Affero General Public License 3.0\n```\n\n## License\n\nThis library is licensed under the MIT-0 License. See the [LICENSE](./LICENSE) file.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbuild-on-aws%2Finstrumenting-java-apps-using-opentelemetry","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbuild-on-aws%2Finstrumenting-java-apps-using-opentelemetry","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbuild-on-aws%2Finstrumenting-java-apps-using-opentelemetry/lists"}