How does ttl work in kairosdb?

402 views
Skip to first unread message

swetha kasireddy

unread,
Aug 3, 2016, 6:13:20 PM8/3/16
to KairosDB
Hi,

If I set a ttl for 4 months for a metric in initial insertion and its updated till 2 months after that. The metric would stay till 6 months after it's initially inserted or is the ttl for the datapoint?

Thanks,
Swetha

Noorul Islam K M

unread,
Aug 3, 2016, 10:21:47 PM8/3/16
to swetha kasireddy, KairosDB
How are you updating a datapoint?

Regards,
Noorul

swetha kasireddy

unread,
Aug 3, 2016, 11:31:11 PM8/3/16
to KairosDB
The data point add is an insert/update. Each time I insert a datapoint into kairos, I do this:

 Metric metric = builder.addMetric(metricArray[1]);

 
metric.addTag(tag, tag );
 
metric.addTtl(ttl);

 
metric.addDataPoint(timeStamp, value);

Noorul Islam K M

unread,
Aug 4, 2016, 2:26:21 AM8/4/16
to swetha kasireddy, KairosDB
swetha kasireddy <swethak...@gmail.com> writes:

> The data point add is an insert/update. Each time I insert a datapoint into
> kairos, I do this:
>
> Metric metric = builder.addMetric(metricArray[1]);
>
> metric.addTag(tag, tag );
> metric.addTtl(ttl);
>
> metric.addDataPoint(timeStamp, value);
>

Are you saying that for the same timeStamp you are storing different
values?

Regards,
Noorul

swetha kasireddy

unread,
Aug 4, 2016, 12:53:53 PM8/4/16
to KairosDB
There are 2 cases. For the same timestamp, I am storing different values with a ttl of 4 months. Also, for a different timeStamp, values are stored.
So, what would be the ttl of the metric in this case? I think in the case of a datapoint it just takes the last updated ttl value and expire in 4 months from the time it was last updated?


On Wednesday, August 3, 2016 at 3:13:20 PM UTC-7, swetha kasireddy wrote:

Brian Hawkins

unread,
Aug 4, 2016, 5:31:18 PM8/4/16
to KairosDB
The ttl is per data point.  if you update the exact same data point then the ttl will be reset, but that is a bit of an odd case.

In your case the ttl is set for 4 months then 6 months from now you should have 4 months of data, etc.

Brian

swetha kasireddy

unread,
Aug 4, 2016, 5:40:28 PM8/4/16
to KairosDB
So the metric would still be there even if all the datapoints are expired?


On Wednesday, August 3, 2016 at 3:13:20 PM UTC-7, swetha kasireddy wrote:

Brian Hawkins

unread,
Aug 4, 2016, 6:39:49 PM8/4/16
to KairosDB
The metric name would still be there but, the data will go away.

Brian

Noorul Islam Kamal Malmiyoda

unread,
Aug 4, 2016, 11:55:32 PM8/4/16
to swetha kasireddy, KairosDB
It seems to be a strange use case for time series data.

I think Brian's answer will help to understand more about ttl in KairosDB.

Charan Kumar Cheemanapalli

unread,
Jun 16, 2023, 2:56:35 AM6/16/23
to KairosDB
Hi Brian & all,

We have a scenario where we had set the TTL as the default configuration (365 days), and now we want to remove the TTL for all data points.

The data is huge, and we couldn't get it done by copying it to CSV files and copying it back to Cassandra.

Is there a way to copy data with a time filter ? like exporting data day by day to files and importing back

Could someone suggest any other better approach we can take?

Thanks

Brian Hawkins

unread,
Sep 14, 2023, 12:35:41 PM9/14/23
to KairosDB
Not sure if you have seen this option: https://kairosdb.github.io/docs/ImportExport.html

Not sure how much coding experience you have but modifying the export to take a time frame wouldn't be too hard.  The code to export is in Main.java.

Brian

Reply all
Reply to author
Forward
0 new messages