Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Time Series Rollups Should Always Be Available #12004

Open
jhancock4d opened this issue Apr 19, 2021 · 0 comments
Open

Time Series Rollups Should Always Be Available #12004

jhancock4d opened this issue Apr 19, 2021 · 0 comments
Assignees

Comments

@jhancock4d
Copy link

It appears right now, that time series rollups aren't created until the initial time period for the rollup is complete.

The rollup is still valid while not complete. It's today, and this is what you have today for a rollup by day thus far. Obviously, at the end of the day the rollup can't mutate further.

If it doesn't exist, you're forcing a ton of special logic that has to be created (which I'm pretty sure you can't actually do in an index) to get values from the time series because you're going to have to check that the rollup exists. If it doesn't, then you have to look at the entire time series and try and calculate what's in there for the given day and sum it, otherwise use the rollup.

Incidentally, the documentation is very not clear about this even if this is working as you think it should and is weak on the topic of rollups with regard to multiple rollups on multiple time series in the same collection etc. I've guessed at how it's supposed to work, but am not at all sure that I'm doing it right: (the constants are simply string values for consistency)

		public static Task CreateTimeSeriesRollUpAsync(IDocumentStore store, CancellationToken cancellationToken)
		{
			var rawRetention = new RawTimeSeriesPolicy(TimeValue.FromYears(10));
			var dailyRollupLike = new TimeSeriesPolicy(LIKE_TIME_SERIES_ROLLUP, TimeValue.FromDays(1), TimeValue.FromYears(5));
			var dailyRollupDislike = new TimeSeriesPolicy(DISLIKE_TIME_SERIES_ROLLUP, TimeValue.FromDays(1), TimeValue.FromYears(5));

			var timeSeriesLikeCollectionConfiguration = new TimeSeriesCollectionConfiguration
			{
				Policies = new List<TimeSeriesPolicy>
				{
					dailyRollupLike
				},
				RawPolicy = rawRetention
			};

			var timeSeriesDislikeCollectionConfiguration = new TimeSeriesCollectionConfiguration
			{
				Policies = new List<TimeSeriesPolicy>
				{
					dailyRollupDislike
				},
				RawPolicy = rawRetention
			};


			var databaseTsConfig = new TimeSeriesConfiguration()
			{
				Collections = new Dictionary<string, TimeSeriesCollectionConfiguration>(new[]
					{
						new KeyValuePair<string, TimeSeriesCollectionConfiguration>(LIKE_TIME_SERIES, timeSeriesLikeCollectionConfiguration),
						new KeyValuePair<string, TimeSeriesCollectionConfiguration>(DISLIKE_TIME_SERIES, timeSeriesDislikeCollectionConfiguration)
					}
				)
			};
			return store.Maintenance.SendAsync(new ConfigureTimeSeriesOperation(databaseTsConfig));
		}

I would expect that this would immediately create a rollup for the current day for each of the 2 time series listed, which I could then work against.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants