0
0
mirror of https://github.com/PostHog/posthog.git synced 2024-11-24 18:07:17 +01:00

chore: log message too large error (#16182)

* chore: log message too large error

* send data to loki not sentry, they rhyme
This commit is contained in:
Paul D'Ambra 2023-06-22 12:41:40 +01:00 committed by GitHub
parent 3b1da81ea3
commit 892d829cbe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 18 deletions

View File

@ -47,4 +47,4 @@
<option name="customRunCommand" value="" />
<method v="2" />
</configuration>
</component>
</component>

View File

@ -12,10 +12,9 @@ from django.conf import settings
from django.http import JsonResponse
from django.utils import timezone
from django.views.decorators.csrf import csrf_exempt
from kafka.errors import KafkaError
from kafka.errors import KafkaError, MessageSizeTooLargeError
from kafka.producer.future import FutureRecordMetadata
from prometheus_client import Counter, Histogram
from prometheus_client.utils import INF
from prometheus_client import Counter
from rest_framework import status
from sentry_sdk import configure_scope
from sentry_sdk.api import capture_exception, start_span
@ -88,19 +87,6 @@ TOKEN_SHAPE_INVALID_COUNTER = Counter(
labelnames=["reason"],
)
REPLAY_INGESTION_COUNTER = Counter(
"capture_replay_ingestion_total",
"Events processed for replay ingestion.",
labelnames=["method"],
)
REPLAY_INGESTION_BATCH_COMPRESSION_RATIO_HISTOGRAM = Histogram(
"session_recordings_chunks_length",
"We chunk session recordings to fit them into kafka, how often do we chunk and by how much?",
buckets=(0.05, 0.1, 0.25, 0.5, 0.75, 1, 1.1, 2, 5, 10, INF),
labelnames=["method"],
)
# This is a heuristic of ids we have seen used as anonymous. As they frequently
# have significantly more traffic than non-anonymous distinct_ids, and likely
# don't refer to the same underlying person we prefer to partition them randomly
@ -440,7 +426,15 @@ def get_event(request):
# errors, and set Retry-After header accordingly.
# TODO: return 400 error for non-retriable errors that require the
# client to change their request.
logger.error("kafka_produce_failure", exc_info=exc)
logger.error(
"kafka_produce_failure",
exc_info=exc,
name=exc.__class__.__name__,
# data could be large, so we don't always want to include it,
# but we do want to include it for some errors to aid debugging
data=data if isinstance(exc, MessageSizeTooLargeError) else None,
)
return cors_response(
request,
generate_exception_response(