Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ammbra/hidden-gems
Code sample for hidden gems
https://github.com/ammbra/hidden-gems
jaeger java opentelemetry prometheus sample-java-project tracing
Last synced: 3 months ago
JSON representation
Code sample for hidden gems
- Host: GitHub
- URL: https://github.com/ammbra/hidden-gems
- Owner: ammbra
- License: mit
- Created: 2022-03-13T11:14:59.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2023-01-27T11:40:54.000Z (almost 2 years ago)
- Last Synced: 2023-02-26T23:22:55.977Z (almost 2 years ago)
- Topics: jaeger, java, opentelemetry, prometheus, sample-java-project, tracing
- Language: Java
- Homepage:
- Size: 162 KB
- Stars: 11
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.adoc
- License: LICENSE
Awesome Lists containing this project
README
= How to use the examples in this repo
== Batch processing
The default processor config is set to batch:
```
processors:
batch:
spanmetrics:
metrics_exporter: prometheusservice:
pipelines:
traces:
receivers: [jaeger]
processors: [spanmetrics, batch]
```== Tail-sampling
To enable `tail_sampling`, make sure your _otel-collector-config.yml_ has the following configuration:
```processors:
tail_sampling:
decision_wait: 10s
num_traces: 100
expected_new_traces_per_sec: 10
policies:
[
{
name: latency-policy,
type: latency,
latency: { threshold_ms: 5000 }
},
{
name: status-code-policy,
type: status_code,
status_code: { status_codes: [ ERROR, OK ] }
},
{
name: string-policy,
type: string_attribute,
string_attribute: { key: alarm, values: [ unexpected ] }
}
]
spanmetrics:
metrics_exporter: prometheusservice:
pipelines:
traces:
receivers: [jaeger]
processors: [spanmetrics, tail_sampling]
```Also, use `quarkus.opentelemetry.tracer.sampler=on` in Quarkus configuration.
curl -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}'
== Rate of requests for a specific status in the 5 minutes
```
(sum by (job, uri, status)(rate(http_server_requests_seconds_sum{job="hobby", method="POST", uri="/api/send-request"}[5m])))
or
(sum by (job, uri, status)(rate(http_server_requests_seconds_sum{job="activity", method="GET", uri="/activity"}[5m])))
```== Using the trace-debug-id header
If you would like to use the extra attribute for debugging, you can try the following command:
```
curl -H 'trace-debug-id:local' http://localhost:8080/activity/
```=== Query for a cache hit rate graph with Prometheus
You can simulate some load using hey:
hey -n 20 -c 10 -H 'trace-debug-id:local' http://localhost:8080/activity
```
sum(delta(cache_gets_total{result="hit",cache="activity"}[1m]))/sum(delta(cache_gets_total{cache="activity"}[1m]))
```