Skip to content

Add mechanism to perform bulk imports #535

Closed

Description

@juliusv

Currently the only way to bulk-import data is a hacky one involving client-side timestamps and scrapes with multiple samples per time series. We should offer an API for bulk import. This relies on #481.

EDIT: It probably won't be an web-based API in Prometheus, but a command-line tool.

Activity

  1. changed the title [-]Add feature for bulk imports[/-] [+]Add API for bulk imports[/+] on Feb 17, 2015
  2. RichiH commented on Nov 17, 2015

    @RichiH
    Member

    Just as a random data point, I have several (I think valid) use cases for bulk imports.

  3. grypyrg commented on Jan 19, 2016

    @grypyrg

    +1

  4. foic commented on Feb 14, 2016

    @foic

    This would be very useful for me as well. I understand that this could be used to blur the line between a true time-series event store and prometheus' communicated focus as a representation of recent monitoring state.

    Its beneficial In the case where prometheus is the ingestion point for a fan out system involving influxdb or federated rollup prometheus nodes - this would allow me to just simply keep pumping all data through the prometheus entry points without having to have two input paths in the case where the data feed is delayed.

  5. brian-brazil commented on Feb 14, 2016

    @brian-brazil
    Contributor

    @foic I can't think of a sane Prometheus setup where that'd be useful. If you want to pump data to influxdb, it'd be best to do it without involving Prometheus as Prometheus is adding no value in such a setup. Similarly rollup depends on continuous pulling, and delayed data can't work with that.

    I'd generally adivse to run duplicates, and live with the odd gap. It's not worth the effort to try and get it perfect.

  6. foic commented on Feb 15, 2016

    @foic

    Thanks @brian-brazil - this is pretty much an expected response :-) Sounds like there is
    too much to change to make all the pieces work with historical data. Alert
    manager, rollup etc etc.

    Should this feature request be closed then if working with historical data
    is too difficult?

    On 15 February 2016 at 10:02, Brian Brazil [email protected] wrote:

    @foic https://github.com/foic I can't think of a sane Prometheus setup
    where that'd be useful. If you want to pump data to influxdb, it'd be best
    to do it without involving Prometheus as Prometheus is adding no value in
    such a setup. Similarly rollup depends on continuous pulling, and delayed
    data can't work with that.

    I'd generally adivse to run duplicates, and live with the odd gap. It's
    not worth the effort to try and get it perfect.

    —
    Reply to this email directly or view it on GitHub
    #535 (comment)
    .

  7. brian-brazil commented on Feb 15, 2016

    @brian-brazil
    Contributor

    @foic What you're requesting is different to what this feature request is mainly about.

  8. Baughn commented on Feb 15, 2016

    @Baughn

    There's some value to bulk import, even in a world where 'storage' isn't the intended purpose of Prometheus. For example...

    Recently I've been working on a Prometheus configuration for a certain forum. Although some of the metrics are from PHP, most of the really useful ones are being exported by an nginx logtailer I wrote.

    In order to quickly iterate on possible metrics, prior to putting it in production--that hasn't happened yet--I added code to the logtailer that lets it read logs with a time-offset, pausing between each record until it's "supposed" to happen. That's okay-ish, but it'd be much nicer if I could bulk import an entire day's worth of logs at once without actually waiting a day. Then I could look at the result, clear the DB, and try again.

    There's the timestamp hack, but none of the client libraries support timestamps, and it's ugly anyway. I haven't tried to use it.

  9. jinxcat commented on Feb 15, 2016

    @jinxcat

    @Baughn what do you mean by "timestamp hack"?

    I have use for a bulk import endpoint as well, and that's for back-filling data that was interrupted/unavailable on the normal time flow.

    Overall, I feel it might be somewhat on the border of what is the intended model of prometheus, but there will always be people with the need to diverge from the ideal setup or situation.

  10. brian-brazil commented on Feb 15, 2016

    @brian-brazil
    Contributor

    that's for back-filling data that was interrupted/unavailable on the normal time flow.

    That's also not what this issue is about. This issue covers brand new data, with nothing newer than it in the database. It's also not backfilling data, which is when there's nothing older than it in the database.

    We've never even discussed this variant.

  11. Baughn commented on Feb 15, 2016

    @Baughn

    @Baughn what do you mean by "timestamp hack"?

    The /metrics format allows specifying a timestamp in addition to the values. None of the clients support this, and Prometheus doesn't support adding values that are any older than than the newest one.

    There's a list of caveats as long as your arm, starting with the impossibility of reliably doing this with multiple tasks exporting metrics, but in theory it should be possible to use timestamps to simulate fast-forwarding through historical data, which would cover my specific scenario.

    I've never tried it, though.

  12. brian-brazil commented on Oct 26, 2016

    @brian-brazil
    Contributor

    Per post-Promcon discussions, the consensus was to have a API that can take in a time series at a time.

  13. 98 remaining items

  14. brian-brazil commented on Apr 20, 2020

    @brian-brazil
    Contributor

    @sam-mccall That sounds like you're looking for an ongoing push solution, which is not what this issue is about. This issue is about one-off bulk imports.

  15. xgfone commented on Apr 20, 2020

    @xgfone

    I understood! Prometheus told us one thing: it only supports the PULL mode, not PUSH, forever! For any proposal about PUSH, it will be rejected to accept.

    PULL or PUSH? I follow @RichiH .

  16. bwplotka commented on Apr 20, 2020

    @bwplotka
    Member

    I would not say rejected, but rather enabled somewhere else and letting Prometheus focus on what it is doing best, scraping/pulling metrics (:

    For push, you have tons of Prometheus-based systems like Thanos or Cortex both are reusing lots of code (e.g PromQL) of Prometheus and enabling almost the same HTTP read APIs. Both of those do not pull metrics but allows to push them e.g via Prometheus, but anyone else can push as well.

    So instead of having single projects being one-tool-for-everything (and thus for nothing, because it's almost impossible to make something efficient that is fully generic), you have others that integrate well with each other. 🤗

    Anyway, for this issue, we want to solve the exact case of "ups I forgot to add this data to Prometheus (or Thanos or Cortex)" or "let's migrate my old data from DB X to Prometheus/Thanos/Cortex)"

  17. MarkusTeufelberger commented on Apr 20, 2020

    @MarkusTeufelberger

    I don't think that pulling and scraping metrics is what prometheus is doing best, for the record. Most exporters don't even support authentication and prometheus is also relatively inflexible when it comes to scrape configuration (e.g. only fixed intervals instead of dynamic ones, only text format supported, no parameter support in official libraries...). The thing I like about prometheus is the data analysis and alerting part as well as the relative flexibility when it comes to labels etc. (but that comes with a price as well of course) making it more suitable for monitoring dynamic infrastructures or dynamic portions of static infra. I couldn't care less if these data were pushed or pulled into the server before they show up there, as long as they are somewhat reliably showing up.

    The minimal viable product I'd like to see is something (tsdb write ...?) to write a single metric at a single point in time with a single set of labels to a database file. As far as I understand it, prometheus compaction can take it from there. No need for sorting, no need for multiple metrics, no need for any custom format, just a couple of command line parameters in an existing tool. Probably won't be able to import second-by-second data of every rack in a datacenter of the past decades within fractions of a second, but for importing a few thousand measurements it should be plenty enough. Everything else (e.g. a format to encode value:timestamp mappings to import more than one value or a way to import different values into different sets of labels) can come later after discussions, design documents etc.

  18. bwplotka commented on Apr 20, 2020

    @bwplotka
    Member

    I don't think that pulling and scraping metrics is what prometheus is doing best, for the record. Most exporters don't even support authentication and prometheus is also relatively inflexible when it comes to scrape configuration (e.g. only fixed intervals instead of dynamic ones, only text format supported, no parameter support in official libraries...).

    Arguable, but anyone can have its own opinion, thanks for sharing. (:

    The minimal viable product I'd like to see is something (tsdb write ...?)

    Yea, that makes sense. Implementation-wise I can see a couple of problems, but overall generally it looks similar to what I would see as a client (or even embedded client) to promtool receive which would receive simple remote-write API requests. (:

    Overall our survey started at #7119 is finishing, and remote write is the highest voted requirement. The next one is CSV. I will sum up results and we will definitely have a large discussion among maintainers soon (dev summit) to decide what to do next, but looks like CSV and something like tsdb write and promtool receive are plausible solutions.

  19. sam-mccall commented on Apr 20, 2020

    @sam-mccall

    @sam-mccall That sounds like you're looking for an ongoing push solution, which is not what this issue is about. This issue is about one-off bulk imports.

    @brian-brazil Nope, we'd be happy with one-off bulk imports - run a session, import it, analyze it.

    Ongoing push would be nice-to-have and seems related, but certainly not needed.

  20. brian-brazil commented on Apr 20, 2020

    @brian-brazil
    Contributor

    I wouldn't consider it to be one off if you're doing it regularly after every session.

  21. shivakumargn commented on Apr 30, 2020

    @shivakumargn

    I have a set of devices that handle network traffic and generate counter information as traffic information with timestamp.
    This data becomes available periodically (once a few hours) to be able to provide to prometheus and not in real-time.

    Flexibiliy of labels and promql is the key reason to use prometheus.

    A means to feed these counters into prometheus with old timestamp is necessary to make such use-case work. I did go through the google doc that is referred to in the earlier discussions and the links referenced in it. I could not find a mechanism to address it.

    It is OK if it is via web api or cli, if all counters must be grouped for their timestamp or can be a mix OR directly in tsdb format. Having "some means" is what I am trying to figure out.

  22. kamazee commented on Apr 30, 2020

    @kamazee

    I've been recently looking for a solution to instrument a web application; I thought about using Prometheus and eventually stumbled upon this issue. I needed to put timers around certain pieces of code and was willing to push this data into a Prometheus-like system (multiple timers from each HTTP call). Having one value per scraping doesn't really help here; neither histogram nor summary look like a good fit, either: the former needs absolute boundaries, the latter can't be aggregated and is calculated on the client, I rather needed a way to have every point from all over the cluster on a server and run occasional aggregation there.

    I'll be considering VictoriaMetrics: at a glance it fills the gap for me. Maybe this hint will also help someone who goes down a similar path.

    Well, I hope it doesn't look offensive to post links to other solutions here 🙄 Even though the issue is about bulk loading, as I understood from the discussion here, I'm not the only one who got here looking for a way to push values into a time series.

  23. brian-brazil commented on Apr 30, 2020

    @brian-brazil
    Contributor

    @kamazee That is a general usage question, you'd be best asking it on the prometheus-users mailing list as it sounds like you're looking for something that is not a metrics system at all.

  24. codesome commented on Nov 26, 2020

    @codesome
    Member

    Closed by #8084

  25. locked as resolved and limited conversation to collaborators on Nov 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions