oncall-engine/engine/common/insight_log/insight_logs_enabled_check.py
Innokentii Konstantinov 15e7baad88
Insight logs format fixes (#1763)
# What this PR does
Minot fixes of insight logs formatting
2023-04-17 10:10:47 +00:00

20 lines
709 B
Python

import logging
from django.conf import settings
logger = logging.getLogger(__name__)
def is_insight_logs_enabled(organization):
"""
is_insight_logs_enabled checks if inside logs enabled for given organization.
Now it checks if oncall is deployed on same cluster that its grafana instance to be able to forward logs
to Loki through logs-forwarder.
"""
logger.info(
"is_insight_logs_enabled: "
f"IS_OPEN_SOURCE={settings.IS_OPEN_SOURCE} "
f"ONCALL_BACKEND_REGION={settings.ONCALL_BACKEND_REGION} "
f"cluster_slug={organization.cluster_slug}"
)
return not settings.IS_OPEN_SOURCE and settings.ONCALL_BACKEND_REGION == organization.cluster_slug