You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
promtool: Add Data Importers for the most requested formats. #7119
As per discussions here, here and here we would love to clarify what format we need to enable on promtool to solve most of backfilling use cases Prometheus Ecosystem users have! 🤗
EDIT: The 7-days vote on Twitter finished with the following results:
Thanks all for voting!
It's worth to note that there was some "secret unknown" contributor who proposed JSON, but it did not get much attention. Maybe if it would part of the poll it would get bit higher. 🙃
Based on that we could form some kind of priority:
Priority
Remote-write
CSV file (potentially TSV)
Streaming API with Open Metrics / Prometheus TEXT format
Streaming APIs and remote write would be push, which we should never add to Prometheus. I don't think we should be inventing new formats via CSV, and instead focus on existing exposition formats.
We never said it should be part of Prometheus or not. We are just talking what to enable. We can totally add promtool command that accepts remote write or streaming OpenMetrics and creates vertical blocks 🤷 (: So this one is just implementation detail. However for anything we need to know what would be the facing API / format.
Also I added this topic for our Prometheus Dev Summit 🤗
CSV could be simple, but it seems complicated to import unstructured data. Metrics could arbitrary have labels, so I have no ideas for a simple CSV import.
For "remote-write" feature, (as you already know) Thanos cluster could be a good source of inspiration. They implement a receiver component (in beta status actually), which is understanding remote-write from another prometheus (thanos-io/thanos#811). But I'm a little according with @brian-brazil Streaming API should be avoided to not encourage "push" and lot of new issues... "Push" should be limited to promtool cli.
OpenMetrics is the native format of prometheus (modulo timestamp formats...). It is not optimised for huge volumes and could be very heavy but it's a good starting point.
Other "compacted" format should be very appreciables to ingest massively old metrics. Anyone has ideas ?
We can totally add promtool command that accepts remote write or streaming OpenMetrics and creates vertical blocks
As I've stated in other discussions promtool should only ever be a CLI tool, not a daemon.
It is not optimised for huge volumes and could be very heavy
I'm not sure where you're getting that idea, a Prometheus server can already ingest millions of samples per second in the text formats and it's not the parser that's the bottleneck.
Reacted by Bartlomiej Plotka and Aliaksandr Valialkin
It is not optimised for huge volumes and could be very heavy
I'm not sure where you're getting that idea, a Prometheus server can already ingest millions of samples per second in the text formats and it's not the parser that's the bottleneck.
I don't speak about capacity to ingest data, but about import data manipulation. In my tests, one OpenMetrics file must be sorted by timestamps and weight 20Go for 137 021 241 samples. It's not easy to build this uniq text file, sort it, manipulate it. I have no better ideas for now, but it's a perfectible point. For example a compacted format gziped with a set of sorted files instead of a huge uniq text file.
That's not quite the case, metrics must be grouped and within that for duplicate childs they must be sorted by time - however sorting on time is required for everything as the tsdb requires data to be ingested in-order.
Updated the description of this issue with following:
The 7-days vote on Twitter finished with the following results:
Thanks all for voting!
It's worth to note that there was some "secret unknown" contributor who proposed JSON, but it did not get much attention. Maybe if it would part of the poll it would get bit higher. 🙃
Based on that we could form some kind of priority:
Priority
Remote-write
CSV file (potentially TSV)
Streaming API with Open Metrics / Prometheus TEXT format
I think this is the way we should go. Added as a topic for DevSummit.
As remote write will be hard to add, starting with CSV would make sense. This will be quite easy in context of #5887 to just switch format, or add CSV on top of open metrics which is already (done?). I leave that decision to @krasi-georgiev and @dipack95
I happy to attack remote write potential backfilling via some remote tool, in my free time will work adapting my design doc for that. Anyone is welcome to take it from me anytime as well 🤗
That would be push and it's unclear to me how you'd go from e.g. an existing Graphite setup to this - you'd have to basically write Go code to speak remote write at which point you may aswell produce tsdb blocks more directly. The Thanos receiver also already does this.
Streaming API with Open Metrics
There is no such thing, OpenMetrics is not streaming.
just switch format, or add CSV on top of open metrics which is already
I'd rather not end up in a position where we support N different formats.
JSON
I think the point here is more that there should be an easy way to backfill recording rules, how that's actually done would hopefully be more of an implementation detail.
That would be push and it's unclear to me how you'd go from e.g. an existing Graphite setup to this - you'd have to basically write Go code to speak remote write at which point you may aswell produce tsdb blocks more directly. The Thanos receiver also already does this.
Yea, the idea would be essentially small CLI Thanos Receive with some snapshot technique on exit which will put block in Prometheus dir / Thanos object storage.
There is no such thing, OpenMetrics is not streaming.
Sure, the same with just "OpenMetrics" - it does not exist in the form of old "pages" gathered up.
I'd rather not end up in a position where we support N different formats.
I think the point here is more that there should be an easy way to backfill recording rules, how that's actually done would hopefully be more of an implementation detail.
Yea, the idea would be essentially small CLI Thanos Receive with some snapshot technique on exit which will put block in Prometheus dir / Thanos object storage.
My question is, is this actually a useful way to backfill? I don't see why you'd need to hit the network in order to write a file to disk. If you can write Go to import the remote write encoder and speak http, you can write Go to import the tsdb appender - which is already possible today.
I've also gone over the original issue, and no one ever requested such an architecture as a way to do backfill - nor do I recall it coming up prior to this poll. The mentions are all about files. This makes me question how much weight should be put on the poll.
For [backfilling recording rules], I planned to have totally separate component,
I've always felt that this should be part of promtool, possibly with a little bit of scripting around it depending on how the implementation works out.
Cool, this means you suggest we should have CSV?
That's a possibility, but I'd also prefer that we don't proliferate formats. What's the actual workflow we're aiming for here for say the use case of migrating an old Graphite database?
Keep in mind that "CSV" is not one format but a family of variously well defined formats, whereas we have formats like the text exposition format which are fully defined including things like escaping.
I would see this as promethues-community project 🤗 any thoughts @yeya24 ?
Thank you for mentioning me here. However, I have some concerns.
The recording rules backfilling is one of the gsoc projects this year. Does any student work on this project now?
I agree with Brian that this feature should be part of promtool. Since #5887 is still WIP, and my project uses part of that PR's code, I think it is better to get #5887 merged first. Then it is quite easy to add recording rules backfilling to promtool. WDYT @bwplotka ?
But anyway, that project is just a toy/demo, it lacks tests. And it might not be correct since I didn't get any feedback about it. It would be very appreciated if anyone could help review it
Regarding #5887, like I've said earlier, adding a CSV parser is something that can be done independent of the actual logic (as the PR uses a textparse in Prometheus, and does not have its own parser), and I suggest we merge the PR first, before we add support for alternative formats to import data.
Hi all, I needed to implement a back-filling job to import data from different sources (parquet files and mysql databases). I released it as a Golang library that can be easily used by providing (1) model structs with specific tags to convert them into TSDB and (2) a Go routing to send slices of models instances to a channel in order to be processed by the job. Here a link, if anyone is interested: https://github.com/aleskandro/go-prometheus-backfiller/tree/master
This means we delivered some data importers, but not the remote write.
Doing this via remote write is controversial as it's streaming vs here we talk about bulk import. I would say let's close this issue as it's satisfies a lot of import cases. If anyone want to have a full backfilling/bulk filling capable remote write APIs we can create another issue, but we need to talk about similar capability for client(senders) too, which is not trivial (:
Activity
brian-brazil commentedon Apr 14, 2020
Streaming APIs and remote write would be push, which we should never add to Prometheus. I don't think we should be inventing new formats via CSV, and instead focus on existing exposition formats.
bwplotka commentedon Apr 14, 2020
We never said it should be part of Prometheus or not. We are just talking what to enable. We can totally add
promtoolcommand that accepts remote write or streaming OpenMetrics and creates vertical blocks 🤷 (: So this one is just implementation detail. However for anything we need to know what would be the facing API / format.Also I added this topic for our Prometheus Dev Summit 🤗
gillg commentedon Apr 14, 2020
CSV could be simple, but it seems complicated to import unstructured data. Metrics could arbitrary have labels, so I have no ideas for a simple CSV import.
For "remote-write" feature, (as you already know) Thanos cluster could be a good source of inspiration. They implement a receiver component (in beta status actually), which is understanding remote-write from another prometheus (thanos-io/thanos#811). But I'm a little according with @brian-brazil Streaming API should be avoided to not encourage "push" and lot of new issues... "Push" should be limited to promtool cli.
OpenMetrics is the native format of prometheus (modulo timestamp formats...). It is not optimised for huge volumes and could be very heavy but it's a good starting point.
Other "compacted" format should be very appreciables to ingest massively old metrics. Anyone has ideas ?
brian-brazil commentedon Apr 14, 2020
As I've stated in other discussions promtool should only ever be a CLI tool, not a daemon.
I'm not sure where you're getting that idea, a Prometheus server can already ingest millions of samples per second in the text formats and it's not the parser that's the bottleneck.
gillg commentedon Apr 14, 2020
I don't speak about capacity to ingest data, but about import data manipulation. In my tests, one OpenMetrics file must be sorted by timestamps and weight 20Go for 137 021 241 samples. It's not easy to build this uniq text file, sort it, manipulate it. I have no better ideas for now, but it's a perfectible point. For example a compacted format gziped with a set of sorted files instead of a huge uniq text file.
brian-brazil commentedon Apr 14, 2020
That's not quite the case, metrics must be grouped and within that for duplicate childs they must be sorted by time - however sorting on time is required for everything as the tsdb requires data to be ingested in-order.
bwplotka commentedon Apr 22, 2020
Updated the description of this issue with following:
The 7-days vote on Twitter finished with the following results:
Thanks all for voting!
It's worth to note that there was some "secret unknown" contributor who proposed JSON, but it did not get much attention. Maybe if it would part of the poll it would get bit higher. 🙃
Based on that we could form some kind of priority:
Priority
I think this is the way we should go. Added as a topic for DevSummit.
As remote write will be hard to add, starting with CSV would make sense. This will be quite easy in context of #5887 to just switch format, or add CSV on top of open metrics which is already (done?). I leave that decision to @krasi-georgiev and @dipack95
I happy to attack remote write potential backfilling via some remote tool, in my free time will work adapting my design doc for that. Anyone is welcome to take it from me anytime as well 🤗
brian-brazil commentedon Apr 22, 2020
That would be push and it's unclear to me how you'd go from e.g. an existing Graphite setup to this - you'd have to basically write Go code to speak remote write at which point you may aswell produce tsdb blocks more directly. The Thanos receiver also already does this.
There is no such thing, OpenMetrics is not streaming.
I'd rather not end up in a position where we support N different formats.
I think the point here is more that there should be an easy way to backfill recording rules, how that's actually done would hopefully be more of an implementation detail.
bwplotka commentedon Apr 22, 2020
Yea, the idea would be essentially small CLI Thanos Receive with some snapshot technique on exit which will put block in Prometheus dir / Thanos object storage.
Sure, the same with just "OpenMetrics" - it does not exist in the form of old "pages" gathered up.
Cool, this means you suggest we should have CSV?
bwplotka commentedon Apr 22, 2020
For this, I planned to have totally separate component, which actually already exists: https://github.com/yeya24/backfiller We should start another ticket / discussion on how to embed it and if we want to.
I would see this as promethues-community project 🤗 any thoughts @yeya24 ?
brian-brazil commentedon Apr 22, 2020
My question is, is this actually a useful way to backfill? I don't see why you'd need to hit the network in order to write a file to disk. If you can write Go to import the remote write encoder and speak http, you can write Go to import the tsdb appender - which is already possible today.
I've also gone over the original issue, and no one ever requested such an architecture as a way to do backfill - nor do I recall it coming up prior to this poll. The mentions are all about files. This makes me question how much weight should be put on the poll.
I've always felt that this should be part of promtool, possibly with a little bit of scripting around it depending on how the implementation works out.
That's a possibility, but I'd also prefer that we don't proliferate formats. What's the actual workflow we're aiming for here for say the use case of migrating an old Graphite database?
Keep in mind that "CSV" is not one format but a family of variously well defined formats, whereas we have formats like the text exposition format which are fully defined including things like escaping.
yeya24 commentedon Apr 22, 2020
Thank you for mentioning me here. However, I have some concerns.
The recording rules backfilling is one of the gsoc projects this year. Does any student work on this project now?
I agree with Brian that this feature should be part of promtool. Since #5887 is still WIP, and my project uses part of that PR's code, I think it is better to get #5887 merged first. Then it is quite easy to add recording rules backfilling to promtool. WDYT @bwplotka ?
But anyway, that project is just a toy/demo, it lacks tests. And it might not be correct since I didn't get any feedback about it. It would be very appreciated if anyone could help review it
dipack95 commentedon Apr 22, 2020
Regarding #5887, like I've said earlier, adding a CSV parser is something that can be done independent of the actual logic (as the PR uses a
textparsein Prometheus, and does not have its own parser), and I suggest we merge the PR first, before we add support for alternative formats to import data.aleskandro commentedon Mar 27, 2021
Hi all, I needed to implement a back-filling job to import data from different sources (parquet files and mysql databases). I released it as a Golang library that can be easily used by providing (1) model structs with specific tags to convert them into TSDB and (2) a Go routing to send slices of models instances to a channel in order to be processed by the job. Here a link, if anyone is interested: https://github.com/aleskandro/go-prometheus-backfiller/tree/master
jrab66b commentedon Jul 21, 2022
@aleskandro looks great, I believe I have a use case for your library 🤘
bwplotka commentedon Apr 23, 2024
Hello from the bug scrub!
We added backfilling options in the past:
This means we delivered some data importers, but not the remote write.
Doing this via remote write is controversial as it's streaming vs here we talk about bulk import. I would say let's close this issue as it's satisfies a lot of import cases. If anyone want to have a full backfilling/bulk filling capable remote write APIs we can create another issue, but we need to talk about similar capability for client(senders) too, which is not trivial (:
There is indeed a 3rd party exporter that allows you to code in your format (?) https://github.com/aleskandro/go-prometheus-backfiller/tree/master
Thanks everyone!