{"id":18646507,"url":"https://github.com/ammbra/hidden-gems","last_synced_at":"2025-06-27T21:36:32.760Z","repository":{"id":46145667,"uuid":"469348072","full_name":"ammbra/hidden-gems","owner":"ammbra","description":"Code sample for hidden gems","archived":false,"fork":false,"pushed_at":"2023-01-27T11:40:54.000Z","size":166,"stargazers_count":10,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-06-24T06:58:26.126Z","etag":null,"topics":["jaeger","java","opentelemetry","prometheus","sample-java-project","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","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ammbra.png","metadata":{"files":{"readme":"README.adoc","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}},"created_at":"2022-03-13T11:14:59.000Z","updated_at":"2023-08-21T20:35:26.000Z","dependencies_parsed_at":"2023-02-15T08:46:21.268Z","dependency_job_id":null,"html_url":"https://github.com/ammbra/hidden-gems","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ammbra/hidden-gems","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ammbra%2Fhidden-gems","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ammbra%2Fhidden-gems/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ammbra%2Fhidden-gems/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ammbra%2Fhidden-gems/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ammbra","download_url":"https://codeload.github.com/ammbra/hidden-gems/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ammbra%2Fhidden-gems/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262337154,"owners_count":23296031,"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":["jaeger","java","opentelemetry","prometheus","sample-java-project","tracing"],"created_at":"2024-11-07T06:20:38.322Z","updated_at":"2025-06-27T21:36:32.729Z","avatar_url":"https://github.com/ammbra.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"= How to use the examples in this repo\n\n== Batch processing\n\nThe default processor config is set to batch:\n\n```\nprocessors:\n  batch:\n  spanmetrics:\n    metrics_exporter: prometheus\n\nservice:\n  pipelines:\n    traces:\n      receivers: [jaeger]\n      processors: [spanmetrics, batch]\n```\n\n== Tail-sampling\n\nTo enable `tail_sampling`, make sure your _otel-collector-config.yml_ has the following configuration:\n\n```processors:\n  tail_sampling:\n    decision_wait: 10s\n    num_traces: 100\n    expected_new_traces_per_sec: 10\n    policies:\n      [\n        {\n          name: latency-policy,\n          type: latency,\n          latency: { threshold_ms: 5000 }\n        },\n        {\n          name: status-code-policy,\n          type: status_code,\n          status_code: { status_codes: [ ERROR, OK ] }\n        },\n        {\n          name: string-policy,\n          type: string_attribute,\n          string_attribute: { key: alarm, values: [ unexpected ] }\n        }\n      ]\n  spanmetrics:\n    metrics_exporter: prometheus\n\nservice:\n  pipelines:\n    traces:\n      receivers: [jaeger]\n      processors: [spanmetrics, tail_sampling]\n```\n\nAlso, use `quarkus.opentelemetry.tracer.sampler=on` in Quarkus configuration.\n\ncurl -X 'POST' 'http://activity:80/api/send-request' -H 'trace-debug-id:local' -H 'accept: */*' -H 'Content-Type: application/json' -d '{\"uppercase\": true,\"reverse\": true}'\n\n== Rate of requests for a specific status in the 5 minutes\n\n```\n(sum by (job, uri, status)(rate(http_server_requests_seconds_sum{job=\"hobby\", method=\"POST\", uri=\"/api/send-request\"}[5m])))\nor\n(sum by (job, uri, status)(rate(http_server_requests_seconds_sum{job=\"activity\", method=\"GET\", uri=\"/activity\"}[5m])))\n```\n\n== Using the trace-debug-id header\n\nIf you would like to use the extra attribute for debugging, you can try the following command:\n\n```\ncurl -H 'trace-debug-id:local' http://localhost:8080/activity/\n```\n\n\n=== Query for a cache hit rate graph with Prometheus\n\nYou can simulate some load using hey:\n\nhey -n 20 -c 10  -H 'trace-debug-id:local' http://localhost:8080/activity\n\n```\nsum(delta(cache_gets_total{result=\"hit\",cache=\"activity\"}[1m]))/sum(delta(cache_gets_total{cache=\"activity\"}[1m])) \n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fammbra%2Fhidden-gems","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fammbra%2Fhidden-gems","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fammbra%2Fhidden-gems/lists"}