Fixes https://github.com/prometheus/prometheus/issues/14218 and https://github.com/prometheus/prometheus/issues/14220
Rebased version of https://github.com/prometheus/prometheus/pull/15254 with improvements.
This change does the following:
- Change appender interface to be CT aware (optional CT)
- Add created-timestamp-per-sample feature flag
- Add new sample record used only if CT is appended with the sample.
- Remote Write awareness of CT.
Signed-off-by: Ridwan Sharif <ridwanmsharif@google.com>
Signed-off-by: bwplotka <bwplotka@gmail.com>
# Conflicts:
# cmd/prometheus/main.go
# scrape/helpers_test.go
# storage/remote/write_handler_test.go
logger.Info("Experimental out-of-order native histogram ingestion enabled. This will only take effect if OutOfOrderTimeWindow is > 0 and if EnableNativeHistograms = true")
case"created-timestamp-per-sample":
c.scrape.EnableCreatedTimestampPerSample=true
// TODO(bwplotka): Add support for CT per sample in:
// * Native histogram WAL records.
// * PRW and OTLP receiving
// * PromQL engine (accessing from WAL)
// * TSDB storage
// Change relevant global variables. Hacky, but it's hard to pass a new option or default to unmarshallers.
logger.Info("Experimental created timestamp per sample enabled. Changed default scrape_protocols to prefer PrometheusProto format.","global.scrape_protocols",fmt.Sprintf("%v",config.DefaultGlobalConfig.ScrapeProtocols))
case"created-timestamp-zero-ingestion":
c.scrape.EnableCreatedTimestampZeroIngestion=true
c.web.CTZeroIngestionEnabled=true
// Change relevant global variables. Hacky, but it's hard to pass a new option or default to unmarshallers.
Enables ingestion of created timestamp. Created timestamps are injected as 0 valued samples when appropriate. See [PromCon talk](https://youtu.be/nWf0BfQ5EEA) for details.
Currently Prometheus supports created timestamps only on the traditional Prometheus Protobuf protocol (WIP for other protocols). As a result, when enabling this feature, the Prometheus protobuf scrape protocol will be prioritized (See `scrape_config.scrape_protocols` settings for more details).
Enables ingestion of created timestamp (CT). Created timestamps are injected as
0 valued samples when appropriate. See [PromCon talk](https://youtu.be/nWf0BfQ5EEA) for details.
Besides enabling this feature in Prometheus, created timestamps need to be exposed by the application being scraped.
The [client considerations for CTs](#client-considerations) also applies here.