I registered a Prometheus Counter using the following code segment.
public static final Counter requestsReceived = Counter.build("total_request_count_proxy_serv", "Total number of requests to a proxy service").labelNames("service", "method", "endpoint", "remoteAddress").register();
When I exposed the metrics and views them in the browser I got the following results where the timestamp is null.
Name: total_request_count_proxy_serv Type: COUNTER Help: Total number of requests to a proxy service Samples: [Name: total_request_count_proxy_serv LabelNames: [service, method, endpoint, remoteAddress] labelValues: [TestProxy, GET, /services/TestProxy, 127.0.0.1] Value: 2.0 **TimestampMs: null**]
Why the timestamp is shown as null?
Direct instrumentation doesn't have timestamps, so this is correct. Timestamps only come up in certain niche use cases for exporters.
Metric names should also go from least to most specific, avoid redundancy and counters end in _total
, so myproxy_requests_total
would be a clearer and more concise name.