Skip to content

Commit

Permalink
fixup! fix some quality failures
Browse files Browse the repository at this point in the history
  • Loading branch information
robrap committed Oct 24, 2024
1 parent 4908ac8 commit ce0a75e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
7 changes: 6 additions & 1 deletion edx_arch_experiments/datadog_monitoring/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,12 @@ class DatadogMonitoringSpanProcessor:
"""Datadog span processor that adds custom monitoring (e.g. code owner tags)."""

def on_span_start(self, span):
if not span or not getattr(span, 'name') or not getattr(span, 'resource'):
"""
Adds custom monitoring at span creation time.
Specifically, adds code owner span tag for celery run spans.
"""
if not span or not getattr(span, 'name') or not getattr(span, 'resource'):
return

if span.name == 'celery.run':
Expand Down
8 changes: 5 additions & 3 deletions edx_arch_experiments/datadog_monitoring/tests/test_app.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
"""
Tests for plugin app.
"""
from unittest.mock import call, patch
from unittest.mock import patch

from ddtrace import tracer
from django.test import TestCase, override_settings
from django.test import TestCase

from .. import apps

Expand All @@ -22,7 +22,9 @@ class TestDatadogMonitoringApp(TestCase):
def setUp(self):
# Remove custom span processor from previous runs.
# pylint: disable=protected-access
tracer._span_processors = [sp for sp in tracer._span_processors if type(sp).__name__ != 'DatadogMonitoringSpanProcessor']
tracer._span_processors = [
sp for sp in tracer._span_processors if type(sp).__name__ != 'DatadogMonitoringSpanProcessor'
]

def test_add_processor(self):
def initialize():
Expand Down

0 comments on commit ce0a75e

Please sign in to comment.