diff --git a/dev/.documenter-siteinfo.json b/dev/.documenter-siteinfo.json index 9aa545b..1a4eb44 100644 --- a/dev/.documenter-siteinfo.json +++ b/dev/.documenter-siteinfo.json @@ -1 +1 @@ -{"documenter":{"julia_version":"1.10.2","generation_timestamp":"2024-03-08T10:30:34","documenter_version":"1.1.2"}} \ No newline at end of file +{"documenter":{"julia_version":"1.10.2","generation_timestamp":"2024-03-08T10:40:51","documenter_version":"1.1.2"}} \ No newline at end of file diff --git a/dev/index.html b/dev/index.html index d506410..c87da74 100644 --- a/dev/index.html +++ b/dev/index.html @@ -65,4 +65,4 @@ counter_family = Prometheus.Family{Counter}( ) # Increment the counter for the labels `target="/api"` and `status_code=200` -Prometheus.inc(Prometheus.labels(counter_family, (target="/api", status_code=200)))source
Prometheus.labelsMethod
Prometheus.labels(family::Family{C}, label_values) where C

Get or create the collector of type C from the family corresponding to the labels given by label_values. If no collector exist for the input labels a new one is created by invoking the C constructor as C(name, help, args...; kwargs..., registry=nothing), where name, help, args..., and kwargs... are the arguments from the family constructor, see Family.

Similarly to when creating the Family, label_values can be given as either of the following:

  • a tuple, e.g. ("/api", 200)
  • a named tuple with names matching the label names, e.g.(target="/api", status_code=200)
  • a struct instance with field names matching the label names , e.g. RequestLabels("/api", 200)

All non-string values (e.g. 200 in the examples above) are stringified using string.

Tip

Base.getindex is overloaded to have the meaning of Prometheus.labels for the family collector: family[label_values] is equivalent to Prometheus.labels(family, label_values).

Note

This method does an acquire/release of a lock, and a dictionary lookup, to find the collector matching the label names. For typical applications this overhead does not matter (below 100ns for some basic benchmarks) but it is safe to cache the returned collector if required.

source
Prometheus.removeMethod
Prometheus.remove(family::Family, label_values)

Remove the collector corresponding to label_values. Effectively this resets the collector since Prometheus.labels will recreate the collector when called with the same label names.

Refer to Prometheus.labels for how to specify label_values.

Note

This method invalidates cached collectors for the label names.

source
Prometheus.clearMethod
Prometheus.clear(family::Family)

Remove all collectors in the family. Effectively this resets the collectors since Prometheus.labels will recreate them when needed.

Note

This method invalidates all cached collectors.

source

Registries

Default registry

Exposition

Prometheus support

Prometheus.exposeFunction
Prometheus.expose(file::String, reg::CollectorRegistry = DEFAULT_REGISTRY)

Export all metrics in reg by writing them to the file file.

source
expose(io::IO, reg::CollectorRegistry = DEFAULT_REGISTRY)

Export all metrics in reg by writing them to the I/O stream io.

source
expose(http::HTTP.Stream, reg::CollectorRegistry = DEFAULT_REGISTRY; kwargs...)

Export all metrics in reg by writing them to the HTTP stream http.

The caller is responsible for checking e.g. the HTTP method and URI target. For HEAD requests this method do not write a body, however.

source
+Prometheus.inc(Prometheus.labels(counter_family, (target="/api", status_code=200)))source
Prometheus.labelsMethod
Prometheus.labels(family::Family{C}, label_values) where C

Get or create the collector of type C from the family corresponding to the labels given by label_values. If no collector exist for the input labels a new one is created by invoking the C constructor as C(name, help, args...; kwargs..., registry=nothing), where name, help, args..., and kwargs... are the arguments from the family constructor, see Family.

Similarly to when creating the Family, label_values can be given as either of the following:

  • a tuple, e.g. ("/api", 200)
  • a named tuple with names matching the label names, e.g.(target="/api", status_code=200)
  • a struct instance with field names matching the label names , e.g. RequestLabels("/api", 200)

All non-string values (e.g. 200 in the examples above) are stringified using string.

Tip

Base.getindex is overloaded to have the meaning of Prometheus.labels for the family collector: family[label_values] is equivalent to Prometheus.labels(family, label_values).

Note

This method does an acquire/release of a lock, and a dictionary lookup, to find the collector matching the label names. For typical applications this overhead does not matter (below 100ns for some basic benchmarks) but it is safe to cache the returned collector if required.

source
Prometheus.removeMethod
Prometheus.remove(family::Family, label_values)

Remove the collector corresponding to label_values. Effectively this resets the collector since Prometheus.labels will recreate the collector when called with the same label names.

Refer to Prometheus.labels for how to specify label_values.

Note

This method invalidates cached collectors for the label names.

source
Prometheus.clearMethod
Prometheus.clear(family::Family)

Remove all collectors in the family. Effectively this resets the collectors since Prometheus.labels will recreate them when needed.

Note

This method invalidates all cached collectors.

source

Registries

Default registry

Exposition

Prometheus support

Prometheus.exposeFunction
Prometheus.expose(file::String, reg::CollectorRegistry = DEFAULT_REGISTRY)

Export all metrics in reg by writing them to the file file.

source
expose(io::IO, reg::CollectorRegistry = DEFAULT_REGISTRY)

Export all metrics in reg by writing them to the I/O stream io.

source
expose(http::HTTP.Stream, reg::CollectorRegistry = DEFAULT_REGISTRY; kwargs...)

Export all metrics in reg by writing them to the HTTP stream http.

The caller is responsible for checking e.g. the HTTP method and URI target. For HEAD requests this method do not write a body, however.

source