Thanks Brian that was really helpful, 2. The use case I want this for doesn't need continuous ingestion. In that case is there a way for me to add time stamp to MetricFamilySample?
On Friday, August 4, 2023 at 12:54:12 AM UTC+5:30 Brian Candler wrote: > 1. Either drop the file into a directory for the node_exporter textfile > collector; or put the file into a webserver directory, and scrape it from > Prometheus > > 2. The timestamp is the time that the metric was scraped by Prometheus > > Note that Prometheus isn't a general-purpose database, and although you > can ingest historical data via "backfilling > <https://prometheus.io/docs/prometheus/latest/storage/#backfilling-from-openmetrics-format>", > > this isn't suitable for continuous ingestion. There is also the remote-write > protocol > <https://prometheus.io/docs/prometheus/latest/feature_flags/#remote-write-receiver>, > > but that's not something that's easy to integrate with for regular users. > > A normal exporter works on-demand: that is, when it receives a HTTP > request it collects data as of that instant in time, and returns it in the > HTTP response. Rather than fight against Prometheus, I think it's better to > swim with the flow. > > On Thursday, 3 August 2023 at 18:37:25 UTC+1 Moe wrote: > >> Hey, >> >> I am using JMXCollector >> <https://github.com/prometheus/jmx_exporter/blob/main/collector/src/main/java/io/prometheus/jmx/JmxCollector.java> >> >> to fetch metrics and writing it into a file using the TextFormat >> <https://github.com/prometheus/client_java/blob/98967b8367216f4107ad5621f260ed895c930262/simpleclient_common/src/main/java/io/prometheus/client/exporter/common/TextFormat.java#L66C27-L66C27> >> and >> the format looks like the sample below. >> >> # HELP kafka_server_socket_server_metrics_processor_queue_size_p99 >> >> kafka.server:name=null,type=socket-server-metrics,attribute=processor-queue-size-p99 >> # TYPE kafka_server_socket_server_metrics_processor_queue_size_p99 untyped >> kafka_server_socket_server_metrics_processor_queue_size_p99{listener="PLAINTEXT",} >> >> 0.0 >> >> I have two questions. >> 1. How do I load this file into Prometheus or grafana to visualise the >> metrics? >> 2. The metrics do not have the time stamp in them at the end. How do I >> get the timestamp? >> >> Thanks in advance! >> >> >> -- You received this message because you are subscribed to the Google Groups "Prometheus Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/6bf06428-507b-4954-b8e3-4b4ae8cb879fn%40googlegroups.com.

