Skip to content

Commit da8785b

Browse files
committed
add docs
Signed-off-by: Gregor Zeitlinger <[email protected]>
1 parent 038145c commit da8785b

File tree

3 files changed

+35
-10
lines changed

3 files changed

+35
-10
lines changed

docs/content/exporters/formats.md

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,35 @@ All exporters the following exposition formats:
1111

1212
Moreover, gzip encoding is supported for each of these formats.
1313

14-
Scraping with a Prometheus server
15-
---------------------------------
14+
## Scraping with a Prometheus server
1615

1716
The Prometheus server sends an `Accept` header to specify which format is requested. By default, the Prometheus server will scrape OpenMetrics text format with gzip encoding. If the Prometheus server is started with `--enable-feature=native-histograms`, it will scrape Prometheus protobuf format instead.
1817

19-
Viewing with a Web Browser
20-
--------------------------
18+
## Viewing with a Web Browser
2119

2220
If you view the `/metrics` endpoint with your Web browser you will see Prometheus text format. For quick debugging of the other formats, exporters provide a `debug` URL parameter:
2321

2422
* `/metrics?debug=openmetrics`: View OpenMetrics text format.
2523
* `/metrics?debug=text`: View Prometheus text format.
2624
* `/metrics?debug=prometheus-protobuf`: View a text representation of the Prometheus protobuf format.
25+
26+
## Exclude protobuf exposition format
27+
28+
You can exclude the protobuf exposition format by including the
29+
`prometheus-metrics-exposition-textformats` module and excluding the
30+
`prometheus-metrics-exposition-formats` module in your build file.
31+
32+
For example, in Maven:
33+
34+
```xml
35+
<dependency>
36+
<groupId>io.prometheus</groupId>
37+
<artifactId>prometheus-metrics-exporter-httpserver</artifactId>
38+
<exclusions>
39+
<exclusion>
40+
<groupId>io.prometheus</groupId>
41+
<artifactId>prometheus-metrics-exposition-formats</artifactId>
42+
</exclusion>
43+
</exclusions>
44+
</dependency>
45+
```

docs/content/getting-started/quickstart.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,14 @@ implementation 'io.prometheus:prometheus-metrics-exporter-httpserver:$version'
4545

4646
There are alternative exporters as well, for example if you are using a Servlet container like Tomcat or Undertow you might want to use `prometheus-exporter-servlet-jakarta` rather than a standalone HTTP server.
4747

48+
{{< hint type=note >}}
49+
50+
If you do not use the protobuf exposition format, you can
51+
[exclude](../../exporters/formats#exclude-protobuf-exposition-format)
52+
it from the dependencies.
53+
54+
{{< /hint >}}
55+
4856
# Dependency management
4957

5058
A Bill of Material

docs/content/internals/model.md

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,25 +7,23 @@ The illustration below shows the internal architecture of the Prometheus Java cl
77

88
![Internal architecture of the Prometheus Java client library](/client_java/images/model.png)
99

10-
prometheus-metrics-core
11-
-----------------------
10+
## prometheus-metrics-core
1211

1312
This is the user facing metrics library, implementing the core metric types, like [Counter](/client_java/api/io/prometheus/metrics/core/metrics/Counter.html), [Gauge](/client_java/api/io/prometheus/metrics/core/metrics/Gauge.html) [Histogram](/client_java/api/io/prometheus/metrics/core/metrics/Histogram.html), and so on.
1413

1514
All metric types implement the [Collector](/client_java/api/io/prometheus/metrics/model/registry/Collector.html) interface, i.e. they provide a [collect()](/client_java/api/io/prometheus/metrics/model/registry/Collector.html#collect()) method to produce snapshots.
1615

17-
prometheus-metrics-model
18-
------------------------
16+
## prometheus-metrics-model
1917

2018
The model is an internal library, implementing read-only immutable snapshots. These snapshots are returned by the [Collector.collect()](/client_java/api/io/prometheus/metrics/model/registry/Collector.html#collect()) method.
2119

2220
There is no need for users to use `prometheus-metrics-model` directly. Users should use the API provided by `prometheus-metrics-core`, which includes the core metrics as well as callback metrics.
2321

2422
However, maintainers of 3rd party metrics libraries might want to use `prometheus-metrics-model` if they want to add Prometheus exposition formats to their metrics library.
2523

26-
exporters and exposition formats
27-
--------------------------------
24+
## Exporters and exposition formats
2825

2926
The `prometheus-metrics-exposition-formats` module converts snapshots to Prometheus exposition formats, like text format, OpenMetrics text format, or Prometheus protobuf format.
3027

3128
The exporters like `prometheus-metrics-exporter-httpserver` or `prometheus-metrics-exporter-servlet-jakarta` use this to convert snapshots into the right format depending on the `Accept` header in the scrape request.
29+

0 commit comments

Comments
 (0)