def process_view(self, request, view_func, view_args, view_kwargs): from raven.contrib.django.raven_compat.models import client if getattr(request, 'couch_user', None): client.extra_context({'couch_user_id': request.couch_user.get_id}) if getattr(request, 'domain', None): client.tags_context({'domain': request.domain})
def process_view(self, request, view_func, view_args, view_kwargs): from raven.contrib.django.raven_compat.models import client if getattr(request, 'couch_user', None): client.extra_context({ 'couch_user_id': request.couch_user.get_id }) if getattr(request, 'domain', None): client.tags_context({ 'domain': request.domain })
def wrapper(event, context): tracing_id = get_tracing_id(event) if tracing else "" os.environ["TRACING_REQUEST_ID"] = tracing_id if sentry: # Provide additional metadata to sentry in case the exception # gets trapped and reported within the function. cloudwatch_url = build_cloudwatch_url( context.log_group_name, context.log_stream_name ) # Tags context can be used to group exceptions sentry.tags_context({ "aws_function_name": context.function_name }) # Extra context is just attached to the exception in Sentry sentry.extra_context({ "aws_log_group_name": context.log_group_name, "aws_log_stream_name": context.log_stream_name, "aws_cloudwatch_url": cloudwatch_url, "admin_url": build_admin_url(tracing_id), "tracing_id": tracing_id }) try: measurement = "%s_duration_ms" % (func.__name__) with influx_timer( measurement, timestamp=now(), cloudwatch_url=cloudwatch_url ): return func(event, context) except Exception as e: log.exception("Got an exception: %r", e) if sentry: sentry.captureException() else: log.info("Sentry is not available.") if not trap_exceptions: raise finally: from django import db db.connections.close_all()
def wrapper(event, context): cloudwatch_url = get_cloudwatch_url(context) # Provide additional metadata to sentry in case the exception # gets trapped and reported within the function. # Tags context can be used to group exceptions sentry.tags_context({"aws_function_name": context.function_name}) # Extra context is just attached to the exception in Sentry extra_context = { "aws_log_group_name": context.log_group_name, "aws_log_stream_name": context.log_stream_name, "aws_cloudwatch_url": get_cloudwatch_url(context), "event": event, } if tracing: extra_context["shortid"] = get_shortid(event) extra_context[ "upload_url"] = "https://hsreplay.net/uploads/upload/%s/" % ( extra_context["shortid"]) sentry.extra_context(extra_context) try: measurement = "%s_duration_ms" % (func.__name__) with influx_timer(measurement, timestamp=now(), cloudwatch_url=cloudwatch_url): return func(event, context) except Exception as e: log.exception("Got an exception: %r", e) sentry.captureException() if not trap_exceptions: raise finally: from django import db db.connections.close_all()
def wrapper(event, context): tracing_id = get_tracing_id(event) if tracing else "" os.environ["TRACING_REQUEST_ID"] = tracing_id if sentry: # Provide additional metadata to sentry in case the exception # gets trapped and reported within the function. cloudwatch_url = build_cloudwatch_url(context.log_group_name, context.log_stream_name) # Tags context can be used to group exceptions sentry.tags_context( {"aws_function_name": context.function_name}) # Extra context is just attached to the exception in Sentry sentry.extra_context({ "aws_log_group_name": context.log_group_name, "aws_log_stream_name": context.log_stream_name, "aws_cloudwatch_url": cloudwatch_url, "admin_url": build_admin_url(tracing_id), "tracing_id": tracing_id }) try: measurement = "%s_duration_ms" % (func.__name__) with influx_timer(measurement, timestamp=now(), cloudwatch_url=cloudwatch_url): return func(event, context) except Exception as e: log.exception("Got an exception: %r", e) if sentry: sentry.captureException() else: log.info("Sentry is not available.") if not trap_exceptions: raise finally: from django import db db.connections.close_all()
def process_request(self, request): client.tags_context({ 'release': settings.RELEASE, # add any additional tags here })