mirror of
https://github.com/open-telemetry/opentelemetry-python-contrib.git
synced 2025-07-30 05:32:30 +08:00
Ensure SQLAlchemy spans have kind set to CLIENT (#278)
SQLAlchemy spans were missing kind field and it was being set to internal instead of client. This commit changes sqlalchemy spans to have kind set to "client" instead.
This commit is contained in:
@ -15,6 +15,7 @@ from unittest import mock
|
||||
|
||||
from sqlalchemy import create_engine
|
||||
|
||||
from opentelemetry import trace
|
||||
from opentelemetry.instrumentation.sqlalchemy import SQLAlchemyInstrumentor
|
||||
from opentelemetry.test.test_base import TestBase
|
||||
|
||||
@ -35,6 +36,7 @@ class TestSqlalchemyInstrumentation(TestBase):
|
||||
|
||||
self.assertEqual(len(spans), 1)
|
||||
self.assertEqual(spans[0].name, "SELECT 1 + 1;")
|
||||
self.assertEqual(spans[0].kind, trace.SpanKind.CLIENT)
|
||||
|
||||
def test_not_recording(self):
|
||||
mock_tracer = mock.Mock()
|
||||
@ -67,3 +69,4 @@ class TestSqlalchemyInstrumentation(TestBase):
|
||||
|
||||
self.assertEqual(len(spans), 1)
|
||||
self.assertEqual(spans[0].name, "SELECT 1 + 1;")
|
||||
self.assertEqual(spans[0].kind, trace.SpanKind.CLIENT)
|
||||
|
Reference in New Issue
Block a user