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

TempoDB: Restrict Ingestion time range #1332

Merged
merged 5 commits into from
Mar 8, 2022

Conversation

joe-elliott
Copy link
Member

What this PR does:
Adds a new config option to restrict the time range around now that Tempo will honor when updating the current block start and end times. The new option defaults to 2m meaning that if a span is received outside of this time range it will be stored and findable by trace id, but the block's time range it is stored in will not reflect this. This will make it less likely to be found using a trace search query.

One gross corner is that during WAL replay we have to assume that we should adjust the block's time range based on the maximum time that a WAL file will be kept since we don't know when it was created.

Checklist

  • Tests updated
  • Documentation added
  • CHANGELOG.md updated - the order of entries should be [CHANGE], [FEATURE], [ENHANCEMENT], [BUGFIX]

Signed-off-by: Joe Elliott <number101010@gmail.com>
Signed-off-by: Joe Elliott <number101010@gmail.com>
Signed-off-by: Joe Elliott <number101010@gmail.com>
Copy link
Contributor

@zalegrala zalegrala left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, this looks reasonable to me. The 2 minute time window seems a little small to me as a default, but configuration is there to be adjusted.

@joe-elliott
Copy link
Member Author

The 2 minute time window seems a little small to me as a default, but configuration is there to be adjusted.

I'm concerned about a wide time window b/c the larger the window the more unnecessary data you're pulling in during search. Also, if something is just outside the window (say 30s) it will likely still be picked up during a search b/c the whole block will be scanned.


if start < startOfRange {
metricWarnings.WithLabelValues(a.meta.TenantID, reasonOutsideIngestionSlack).Inc()
start = uint32(now.Unix())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should these clip to the range instead of now?

Copy link
Member Author

@joe-elliott joe-elliott Mar 8, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reason I decided to do use time.Now() is b/c we know we are regularly receiving backdated spans from multiple weeks ago.

If we use start instead of time.Now() then every block's time range will always start ingestion_time_range_slack earlier than it actually does. Also, every replayed block's start time will always be replay time - max_block_duration - ingestion_time_range_slack.

tempodb/wal/append_block.go Outdated Show resolved Hide resolved
@@ -342,7 +342,7 @@ func (i *Ingester) replayWal() error {
return 0, 0, err
}
return start, end, nil
}, log.Logger)
}, i.cfg.MaxBlockDuration, log.Logger)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah agree this is a hard spot but understand the reasons, and this is reasonable. Maybe a comment ?

Signed-off-by: Joe Elliott <number101010@gmail.com>
Signed-off-by: Joe Elliott <number101010@gmail.com>
@joe-elliott joe-elliott merged commit 934642f into grafana:main Mar 8, 2022
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

Successfully merging this pull request may close these issues.

3 participants