Skip to content

Commit

Permalink
Merge pull request #41786 from brunobat/otel-metrics-part2
Browse files Browse the repository at this point in the history
Otel metrics part2 - Metrics documentation
  • Loading branch information
geoand authored Jul 12, 2024
2 parents 010a82d + 8ef35a8 commit 4f29520
Show file tree
Hide file tree
Showing 19 changed files with 1,709 additions and 641 deletions.
36 changes: 36 additions & 0 deletions docs/src/main/asciidoc/_includes/opentelemetry-config.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
There are no mandatory configurations for the extension to work.

By default, the exporters will send out data in batches, using the gRPC protocol and endpoint `http://localhost:4317`.

If you need to change any of the default property values, here is an example on how to configure the default OTLP gRPC Exporter within the application, using the `src/main/resources/application.properties` file:

[source,properties]
----
quarkus.application.name=myservice // <1>
quarkus.otel.exporter.otlp.endpoint=http://localhost:4317 // <2>
quarkus.otel.exporter.otlp.headers=authorization=Bearer my_secret // <3>
quarkus.log.console.format=%d{HH:mm:ss} %-5p traceId=%X{traceId}, parentId=%X{parentId}, spanId=%X{spanId}, sampled=%X{sampled} [%c{2.}] (%t) %s%e%n // <4>
# Alternative to the console log
quarkus.http.access-log.pattern="...traceId=%{X,traceId} spanId=%{X,spanId}" // <5>
----

<1> All telemetry created from the application will include an OpenTelemetry `Resource` attribute indicating the telemetry was created by the `myservice` application. If not set, it will default to the artifact id.
<2> gRPC endpoint to send the telemetry. If not set, it will default to `http://localhost:4317`.
<3> Optional gRPC headers commonly used for authentication
<4> Add tracing information into log messages.
<5> You can also only put the trace info into the access log. In this case you must omit the info in the console log format.

We provide signal agnostic configurations for the connection related properties, meaning that you can use the same properties for both tracing and metrics when you set:
[source,properties]
----
quarkus.otel.exporter.otlp.endpoint=http://localhost:4317
----
If you need different configurations for each signal, you can use the specific properties:
[source,properties]
----
quarkus.otel.exporter.otlp.traces.endpoint=http://trace-uri:4317 // <1>
quarkus.otel.exporter.otlp.metrics.endpoint=http://metrics-uri:4317 // <2>
----
<1> The endpoint for the traces exporter.
<2> The endpoint for the metrics exporter.
4 changes: 2 additions & 2 deletions docs/src/main/asciidoc/datasource.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -638,9 +638,9 @@ If the metrics collection for this datasource is disabled, all values result in
[[datasource-tracing]]
=== Datasource tracing

To use tracing with a datasource, you need to add the xref:opentelemetry.adoc[`quarkus-opentelemetry`] extension to your project.
To use tracing with a datasource, you need to add the xref:opentelemetry-tracing.adoc[`quarkus-opentelemetry`] extension to your project.

You don't need to declare a different driver because you need tracing. If you use a JDBC driver, you need to follow the instructions in the OpenTelemetry extension xref:opentelemetry.adoc#jdbc[here].
You don't need to declare a different driver because you need tracing. If you use a JDBC driver, you need to follow the instructions in the OpenTelemetry extension xref:opentelemetry-tracing.adoc#jdbc[here].

Even with all the tracing infrastructure in place the datasource tracing is not enabled by default, and you need to enable it by setting this property:
[source, properties]
Expand Down
Loading

0 comments on commit 4f29520

Please sign in to comment.