{"id":27972062,"url":"https://github.com/hyperdxio/sample-java-app","last_synced_at":"2025-05-07T22:37:25.331Z","repository":{"id":289711800,"uuid":"972159714","full_name":"hyperdxio/sample-java-app","owner":"hyperdxio","description":null,"archived":false,"fork":false,"pushed_at":"2025-04-24T16:44:44.000Z","size":13,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-24T17:44:23.923Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hyperdxio.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"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,"zenodo":null}},"created_at":"2025-04-24T16:17:49.000Z","updated_at":"2025-04-24T16:44:48.000Z","dependencies_parsed_at":"2025-04-24T17:44:25.821Z","dependency_job_id":"40828b85-202b-44ba-8799-4aa935994918","html_url":"https://github.com/hyperdxio/sample-java-app","commit_stats":null,"previous_names":["hyperdxio/sample-java-app"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hyperdxio%2Fsample-java-app","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hyperdxio%2Fsample-java-app/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hyperdxio%2Fsample-java-app/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hyperdxio%2Fsample-java-app/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hyperdxio","download_url":"https://codeload.github.com/hyperdxio/sample-java-app/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252967972,"owners_count":21833241,"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":[],"created_at":"2025-05-07T22:37:24.751Z","updated_at":"2025-05-07T22:37:25.319Z","avatar_url":"https://github.com/hyperdxio.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# HyperDX Java Otel Demo\n\nThis is a minimal Java application that demonstrates how to send logs and distributed traces to [HyperDX](https://www.hyperdx.io) using the [OpenTelemetry Java Agent](https://github.com/open-telemetry/opentelemetry-java-instrumentation).\n\nThe app:\n- Starts an embedded HTTP server on `localhost:8080`\n- Exposes several endpoints that simulate workflows, internal processing, and external calls\n- Uses the OpenTelemetry Java agent to auto-instrument traces and logs\n- Sends all observability data to HyperDX with minimal setup\n\n---\n\n## ✨ Features\n\n- ✅ Auto-instrumented HTTP server with SLF4J (Logback)\n- ✅ Rich logs with `trace_id` and `span_id` included\n- ✅ Simulated internal and external requests (e.g., `httpbin.org`)\n- ✅ A `/full-run` route that triggers all endpoints in sequence to showcase full trace trees\n- ✅ One-command setup via `./build.sh`\n\n---\n\n## 🛠 Requirements\n\n- Java 21+\n- Maven 3.8+\n- [HyperDX account](https://www.hyperdx.io) and API key\n- Internet access to download the OpenTelemetry Java agent\n\n---\n\n## 🚀 Quick Start\n\n### 1. Clone the Repository\n\n```bash\ngit clone https://github.com/hyperdxio/sample-java-app.git\ncd hyperdx-java-demo\n```\n\n### 2. Set Your API Key\n\n```bash\nexport API_KEY=\"your-hyperdx-api-key\"\n```\n\n### 3. Run the Project (build, download agent, launch)\n\n```bash\n./build.sh\n```\n\n\u003e ☝️ This script:\n\u003e - Compiles the app with Maven\n\u003e - Downloads the OpenTelemetry Java agent\n\u003e - Sets the required environment variables\n\u003e - Runs the app with instrumentation enabled\n\n---\n\n## 🔍 Endpoints\n\n| Route              | Description                            |\n|-------------------|----------------------------------------|\n| `/hello`          | Basic response with traceable log      |\n| `/user?id=123`    | Simulates a DB-like operation          |\n| `/order?id=999`   | Simulates an external HTTP call        |\n| `/workflow`       | Calls `/user` and `/order` internally  |\n| `/full-run`       | Calls all the above to simulate a full trace |\n\n---\n\n## 📈 What You'll See in HyperDX\n\n- Each route generates a trace with logs and spans\n- `/full-run` builds a full nested trace tree like this:\n\n```\n/full-run\n├── /hello\n├── /user?id=123\n├── /order?id=999\n│   └── https://httpbin.org/delay/1\n└── /workflow\n    ├── /user?id=123\n    └── /order?id=999\n        └── https://httpbin.org/delay/1\n```\n\n- Logs attached to each span contain `trace_id` and `span_id`\n\n---\n\n## 🧩 Customization Ideas\n\n- Add error handling or latency simulation\n- Add custom span attributes (e.g. `user.id`)\n- Build a second service to simulate cross-service traces\n- Add metrics using OTEL SDK\n\n---\n\n## 📄 License\n\nMIT – feel free to use, fork, modify, and contribute.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhyperdxio%2Fsample-java-app","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhyperdxio%2Fsample-java-app","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhyperdxio%2Fsample-java-app/lists"}