Skip to content

Properly handle displaying data for custom retention periods #1588

@Pokom

Description

@Pokom

What happened:

Timepoint explorer on the check overview page does not respect custom log retention policies(>31 days), resulting in an error being rendered instead of the data.

What you expected to happen:

Timepoint explorer to render data that is returned from Loki's datasource. Interestingly enough, if you view the network requests, Loki returns the data. The app makes the decision to not render anything, even if some data is returned.

How to reproduce it (as minimally and precisely as possible):

This came from an internal escalation, so please reach out and I can share the details from there. But generally speaking:

  1. Have an org with retention policy >31 days
  2. Have data >31 days old
  3. View a check with a timeframe that is between 31 days and the retention period

This code here(

const FREE_TRIAL_RETENTION_DAYS = 14;
const STANDARD_RETENTION_DAYS = 31;
// todo: this is a temporary solution to get the logs retention period.
// really we should get this from gcom or another endpoint
// some clients will have custom retention periods which makes this unreliable
export function useLogsRetentionPeriod(from: UnixTimestamp) {
// @ts-expect-error - Cloud Free is not defined in the config but it is what is present for Free trial accounts and free tier accounts
const isFree = config.buildInfo.edition === `Cloud Free`;
const days = isFree ? FREE_TRIAL_RETENTION_DAYS : STANDARD_RETENTION_DAYS;
const HOURS_IN_DAY = 24;
const MINUTES_IN_HOUR = 60;
const SECONDS_IN_MINUTE = 60;
const MILLISECONDS_IN_SECOND = 1000;
return days * HOURS_IN_DAY * MINUTES_IN_HOUR * SECONDS_IN_MINUTE * MILLISECONDS_IN_SECOND;
}
) implies that we need to make gcom calls. I don't speak with authority, but I would be curious as to whether or not we can simply make the Loki calls and render data if it's returned. That's what is happening today, but we chose to ignore returned data.

Anything else we need to know?:

Environment:

  • Grafana version (if running on prem):
  • SM plugin version:
  • OS Grafana is installed on:
  • User OS & Browser:
  • Others:

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions