@Path(value="metrics") @RolesAllowed(value="operator") @Singleton public class MetricsResource extends Object
| Constructor and Description |
|---|
MetricsResource(Duration defaultFromDuration) |
| Modifier and Type | Method and Description |
|---|---|
Collection<org.apache.avro.Schema> |
getMetrics() |
org.spf4j.base.avro.AvroCloseableIterable<org.spf4j.perf.TimeSeriesRecord> |
getMetrics(String metricName,
Instant pfrom,
Instant pto,
Duration agg) |
org.apache.avro.Schema |
getMetricSchema(String metricName) |
javax.ws.rs.core.StreamingOutput |
getMetricsTextPrometheus(Instant pfrom,
Instant pto,
Duration pagg)
Prometheus metrics endpoint tailored for prometheus-to-sd.
|
javax.ws.rs.core.StreamingOutput |
getMetricsTextPrometheus(String metricName,
Instant pfrom,
Instant pto,
Duration agg) |
String |
toString() |
public MetricsResource(Duration defaultFromDuration)
@GET
@Produces(value={"application/avro-x+json","application/json","application/avro+json","application/avro","application/octet-stream","text/csv"})
@Path(value="local")
@AvroSchema(value="{\"type\":\"array\",\"items\": {\"type\":\"string\", \"logicalType\":\"avsc\"}}")
public Collection<org.apache.avro.Schema> getMetrics()
throws IOException
IOException@GET @Produces(value="text/plain; version=0.0.4; charset=utf-8") public javax.ws.rs.core.StreamingOutput getMetricsTextPrometheus(@Nullable @QueryParam(value="from") Instant pfrom, @Nullable @QueryParam(value="to") Instant pto, @Nullable @QueryParam(value="aggDuration") Duration pagg) throws IOException
pfrom - when null will default to: now - metrics.fromDefaultDurationpto - when null it will default to now.pagg - when null it will default to metrics.fromDefaultDuration,
for no aggregation zero duration should be usedIOException@GET
@Path(value="local/{metric}")
@Produces(value="application/avsc+json;qs=0.9")
public org.apache.avro.Schema getMetricSchema(@PathParam(value="metric")
String metricName)
throws IOException
IOException@GET
@Path(value="local/{metric}")
@Produces(value={"application/avro-x+json","application/json","application/avro+json","application/avro","application/octet-stream","text/csv"})
public org.spf4j.base.avro.AvroCloseableIterable<org.spf4j.perf.TimeSeriesRecord> getMetrics(@PathParam(value="metric")
String metricName,
@Nullable @QueryParam(value="from")
Instant pfrom,
@Nullable @QueryParam(value="to")
Instant pto,
@Nullable @QueryParam(value="aggDuration")
Duration agg)
throws IOException
IOException@GET
@Path(value="local/{metric}")
@Produces(value="text/plain; version=0.0.4; charset=utf-8")
public javax.ws.rs.core.StreamingOutput getMetricsTextPrometheus(@PathParam(value="metric")
String metricName,
@Nullable @QueryParam(value="from")
Instant pfrom,
@Nullable @QueryParam(value="to")
Instant pto,
@Nullable @QueryParam(value="aggDuration")
Duration agg)
throws IOException
IOExceptionCopyright © 2020 SPF4J. All rights reserved.