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

chore: cache error tracking query longer #27555

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions posthog/hogql_queries/error_tracking_query_runner.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
import re
import structlog
from datetime import datetime

from posthog.hogql import ast
from posthog.hogql.constants import LimitContext
from posthog.hogql_queries.utils.query_date_range import QueryDateRange
from posthog.hogql_queries.insights.paginators import HogQLHasMorePaginator
from posthog.hogql_queries.query_runner import QueryRunner
from posthog.schema import (
IntervalType,
HogQLFilters,
ErrorTrackingQuery,
ErrorTrackingQueryResponse,
Expand Down Expand Up @@ -228,6 +231,15 @@ def error_tracking_issues(self, ids):
issues = queryset.values("id", "status", "name", "description")
return {item["id"]: item for item in issues}

@cached_property
def query_date_range(self):
return QueryDateRange(
date_range=self.query.dateRange,
team=self.team,
interval=IntervalType.HOUR,
now=datetime.now(),
)


def search_tokenizer(query: str) -> list[str]:
# parse the search query to split it into words, except for quoted strings. Strip quotes from quoted strings.
Expand Down
Loading