Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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

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: prometheus

service:
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: prometheus

service:
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]))
```