{"id":30984388,"url":"https://github.com/nimalank7/spring-boot-observability","last_synced_at":"2026-05-19T14:34:40.605Z","repository":{"id":282929745,"uuid":"950108073","full_name":"nimalank7/spring-boot-observability","owner":"nimalank7","description":"Repository to learn about integration with Prometheus","archived":false,"fork":false,"pushed_at":"2025-08-19T19:02:06.000Z","size":38,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-08-19T20:40:24.819Z","etag":null,"topics":["java","learning","spring"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nimalank7.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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-03-17T16:36:01.000Z","updated_at":"2025-08-19T19:02:09.000Z","dependencies_parsed_at":"2025-08-12T17:17:41.192Z","dependency_job_id":"6ec415ae-f112-4c93-bad7-7857b8a10035","html_url":"https://github.com/nimalank7/spring-boot-observability","commit_stats":null,"previous_names":["nimalank7/spring-boot-prometheus","nimalank7/spring-boot-observability"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/nimalank7/spring-boot-observability","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nimalank7%2Fspring-boot-observability","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nimalank7%2Fspring-boot-observability/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nimalank7%2Fspring-boot-observability/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nimalank7%2Fspring-boot-observability/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nimalank7","download_url":"https://codeload.github.com/nimalank7/spring-boot-observability/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nimalank7%2Fspring-boot-observability/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274813735,"owners_count":25354903,"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","status":"online","status_checked_at":"2025-09-12T02:00:09.324Z","response_time":60,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["java","learning","spring"],"created_at":"2025-09-12T12:33:46.020Z","updated_at":"2026-05-19T14:34:35.566Z","avatar_url":"https://github.com/nimalank7.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Spring Boot Observability\n\nSpring Boot microservice application consisting of a client and server which returns \"Hello from spring-boot-server!\" when a user visits\n`GET /message`. The application is instrumented with logs, metrics and traces.\n\nThis is largely based off https://spring.io/blog/2022/10/12/observability-with-spring-boot-3.\n\n# How it works\n## Build and run the application\n\n1. Build the application\n\n```\ndocker compose build\n```\n\n2. Run the application\n\n```\ndocker compose run --detach\n```\n\n3. Receive a message\n\n```\nlocalhost:8080/message\n```\n\n# Instrumentation\n## Logging\n\nLogs are sent to STDOUT and to Loki. `logback-spring.xml` is the Logback appender that sends logs to Loki and automatically \nadds `traceId` and `spanID` as labels for Loki to search on.\n\nTo view the Docker logs:\n\n```\ndocker logs -f \u003ccontainer name\u003e\n```\n\nTo view Loki logs navigate to Grafana:\n\n```\nlocalhost:3100\n```\n\nAdd Loki as data source to Grafana with the URL as `http://loki:3100`\n\nNavigate to `Explore`, select `Loki`, then select the code view and choose `Last 1 hour`. Run the following query to \nsee all logs:\n\n```\n{app=~\".+\"}\n```\n\nTo see logs from the application (e.g. `spring-boot-client`) run:\n\n```\n{app=\"spring-boot-client\"}\n```\n\n## Metrics \n### Counter\nSpring Boot Actuator configures Micrometer which is a instrumentation facade.\n\n- Both `spring-boot-client` and `spring-boot-server` have metrics exposed on `/actuator/prometheus` which Prometheus consumes\n- Both set up a counter metric (`http_server_requests_seconds_count`) that increments on each message endpoint\n- To see metrics in Prometheus navigate to:\n\n```\nlocalhost:9091\n```\n\n### Prometheus\n\n- Prometheus exposes its own metrics on port `/metrics` with job name as `prometheus`\n\n## Tracing:\n\n- Micrometer is a facade for tracing libraries (e.g. OpenTelemetry)\n- Spring Boot Actuator and Micrometer are configured using `management.zipkin.tracing.endpoint` to use the Open Telemetry Zipkin exporter \nwhich sends traces to Zipkin on `http://zipkin:9411/api/v2/spans`\n- `spring-boot-client` creates its spans and adds a `traceId` which is propagated across to `spring-boot-server`. \n- `spring-boot-server` creates its spans and adds the `traceId` which it received\n- Both emit their spans to Zipkin which uses the `traceID` to put them together into a trace.\n- `@Observed` annotation adds a custom span to surface both `MessageService.getMessage()` and `MessageService.retrieveMessage()` in the trace\n- To see all traces in Zipkin navigate to:\n\n```\nlocalhost:9411\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnimalank7%2Fspring-boot-observability","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnimalank7%2Fspring-boot-observability","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnimalank7%2Fspring-boot-observability/lists"}