Remove 'component' span attribute in instrumentations (#301)

This commit is contained in:
Mario Jonke
2021-01-29 22:15:26 +01:00
committed by GitHub
parent f022385e37
commit f0adb23143
29 changed files with 77 additions and 166 deletions

View File

@ -6,6 +6,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased](https://github.com/open-telemetry/opentelemetry-python-contrib/compare/v0.17b0...HEAD)
### Changed
- Remove `component` span attribute in instrumentations.
`opentelemetry-instrumentation-aiopg`, `opentelemetry-instrumentation-dbapi` Remove unused `database_type` parameter from `trace_integration` function.
([#301](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/301))
## [0.17b0](https://github.com/open-telemetry/opentelemetry-python-contrib/releases/tag/v0.17b0) - 2021-01-20
### Added

View File

@ -169,7 +169,6 @@ def create_trace_config(
if trace_config_ctx.span.is_recording():
attributes = {
"component": "http",
"http.method": http_method,
"http.url": trace_config_ctx.url_filter(params.url)
if callable(trace_config_ctx.url_filter)

View File

@ -129,7 +129,6 @@ class TestAioHttpIntegration(TestBase):
"HTTP GET",
(span_status, None),
{
"component": "http",
"http.method": "GET",
"http.url": "http://{}:{}/test-path?query=param#foobar".format(
host, port
@ -187,7 +186,6 @@ class TestAioHttpIntegration(TestBase):
expected,
(StatusCode.UNSET, None),
{
"component": "http",
"http.method": method,
"http.url": "http://{}:{}{}".format(
host, port, path
@ -219,7 +217,6 @@ class TestAioHttpIntegration(TestBase):
"HTTP GET",
(StatusCode.UNSET, None),
{
"component": "http",
"http.method": "GET",
"http.url": "http://{}:{}/some/path".format(
host, port
@ -256,11 +253,7 @@ class TestAioHttpIntegration(TestBase):
(
"HTTP GET",
(expected_status, None),
{
"component": "http",
"http.method": "GET",
"http.url": url,
},
{"http.method": "GET", "http.url": url},
)
]
)
@ -285,7 +278,6 @@ class TestAioHttpIntegration(TestBase):
"HTTP GET",
(StatusCode.ERROR, None),
{
"component": "http",
"http.method": "GET",
"http.url": "http://{}:{}/test_timeout".format(
host, port
@ -315,7 +307,6 @@ class TestAioHttpIntegration(TestBase):
"HTTP GET",
(StatusCode.ERROR, None),
{
"component": "http",
"http.method": "GET",
"http.url": "http://{}:{}/test_too_many_redirects".format(
host, port
@ -364,7 +355,6 @@ class TestAioHttpClientInstrumentor(TestBase):
self.get_default_request(), self.URL, self.default_handler
)
span = self.assert_spans(1)
self.assertEqual("http", span.attributes["component"])
self.assertEqual("GET", span.attributes["http.method"])
self.assertEqual(
"http://{}:{}/test-path".format(host, port),

View File

@ -58,8 +58,7 @@ class AiopgInstrumentor(BaseInstrumentor):
"user": "info.user",
}
_DATABASE_COMPONENT = "postgresql"
_DATABASE_TYPE = "sql"
_DATABASE_SYSTEM = "postgresql"
def _instrument(self, **kwargs):
"""Integrate with PostgreSQL aiopg library.
@ -70,8 +69,7 @@ class AiopgInstrumentor(BaseInstrumentor):
wrappers.wrap_connect(
__name__,
self._DATABASE_COMPONENT,
self._DATABASE_TYPE,
self._DATABASE_SYSTEM,
self._CONNECTION_ATTRIBUTES,
version=__version__,
tracer_provider=tracer_provider,
@ -79,8 +77,7 @@ class AiopgInstrumentor(BaseInstrumentor):
wrappers.wrap_create_pool(
__name__,
self._DATABASE_COMPONENT,
self._DATABASE_TYPE,
self._DATABASE_SYSTEM,
self._CONNECTION_ATTRIBUTES,
version=__version__,
tracer_provider=tracer_provider,
@ -104,8 +101,7 @@ class AiopgInstrumentor(BaseInstrumentor):
return wrappers.instrument_connection(
__name__,
connection,
self._DATABASE_COMPONENT,
self._DATABASE_TYPE,
self._DATABASE_SYSTEM,
self._CONNECTION_ATTRIBUTES,
)

View File

@ -24,7 +24,7 @@ Usage
from opentelemetry import trace
from opentelemetry.instrumentation.aiopg import trace_integration
trace_integration(aiopg.connection, "_connect", "postgresql", "sql")
trace_integration(aiopg.connection, "_connect", "postgresql")
API
---
@ -48,8 +48,7 @@ logger = logging.getLogger(__name__)
def trace_integration(
database_component: str,
database_type: str = "",
database_system: str,
connection_attributes: typing.Dict = None,
tracer_provider: typing.Optional[TracerProvider] = None,
):
@ -57,19 +56,17 @@ def trace_integration(
based on dbapi integration, where replaced sync wrap methods to async
Args:
database_component: Database driver name or
database name "postgreSQL".
database_type: The Database type. For any SQL database, "sql".
database_system: An identifier for the database management system (DBMS)
product being used.
connection_attributes: Attribute names for database, port, host and
user in Connection object.
tracer_provider: The :class:`opentelemetry.trace.TracerProvider` to
use. If ommited the current configured one is used.
use. If omitted the current configured one is used.
"""
wrap_connect(
__name__,
database_component,
database_type,
database_system,
connection_attributes,
__version__,
tracer_provider,
@ -78,8 +75,7 @@ def trace_integration(
def wrap_connect(
name: str,
database_component: str,
database_type: str = "",
database_system: str,
connection_attributes: typing.Dict = None,
version: str = "",
tracer_provider: typing.Optional[TracerProvider] = None,
@ -89,14 +85,13 @@ def wrap_connect(
Args:
name: Name of opentelemetry extension for aiopg.
database_component: Database driver name
or database name "postgreSQL".
database_type: The Database type. For any SQL database, "sql".
database_system: An identifier for the database management system (DBMS)
product being used.
connection_attributes: Attribute names for database, port, host and
user in Connection object.
version: Version of opentelemetry extension for aiopg.
tracer_provider: The :class:`opentelemetry.trace.TracerProvider` to
use. If ommited the current configured one is used.
use. If omitted the current configured one is used.
"""
# pylint: disable=unused-argument
@ -108,8 +103,7 @@ def wrap_connect(
):
db_integration = AiopgIntegration(
name,
database_component,
database_type=database_type,
database_system,
connection_attributes=connection_attributes,
version=version,
tracer_provider=tracer_provider,
@ -135,8 +129,7 @@ def unwrap_connect():
def instrument_connection(
name: str,
connection,
database_component: str,
database_type: str = "",
database_system: str,
connection_attributes: typing.Dict = None,
version: str = "",
tracer_provider: typing.Optional[TracerProvider] = None,
@ -146,21 +139,20 @@ def instrument_connection(
Args:
name: Name of opentelemetry extension for aiopg.
connection: The connection to instrument.
database_component: Database driver name or database name "postgreSQL".
database_type: The Database type. For any SQL database, "sql".
database_system: An identifier for the database management system (DBMS)
product being used.
connection_attributes: Attribute names for database, port, host and
user in a connection object.
version: Version of opentelemetry extension for aiopg.
tracer_provider: The :class:`opentelemetry.trace.TracerProvider` to
use. If ommited the current configured one is used.
use. If omitted the current configured one is used.
Returns:
An instrumented connection.
"""
db_integration = AiopgIntegration(
name,
database_component,
database_type,
database_system,
connection_attributes=connection_attributes,
version=version,
tracer_provider=tracer_provider,
@ -187,8 +179,7 @@ def uninstrument_connection(connection):
def wrap_create_pool(
name: str,
database_component: str,
database_type: str = "",
database_system: str,
connection_attributes: typing.Dict = None,
version: str = "",
tracer_provider: typing.Optional[TracerProvider] = None,
@ -202,8 +193,7 @@ def wrap_create_pool(
):
db_integration = AiopgIntegration(
name,
database_component,
database_type,
database_system,
connection_attributes=connection_attributes,
version=version,
tracer_provider=tracer_provider,

View File

@ -242,7 +242,6 @@ class TestAiopgIntegration(TestBase):
db_integration = AiopgIntegration(
self.tracer,
"testcomponent",
"testtype",
connection_attributes,
capture_parameters=True,
)
@ -259,7 +258,6 @@ class TestAiopgIntegration(TestBase):
self.assertEqual(span.name, "Test")
self.assertIs(span.kind, trace_api.SpanKind.CLIENT)
self.assertEqual(span.attributes["component"], "testcomponent")
self.assertEqual(span.attributes["db.system"], "testcomponent")
self.assertEqual(span.attributes["db.name"], "testdatabase")
self.assertEqual(span.attributes["db.statement"], "Test query")
@ -294,7 +292,7 @@ class TestAiopgIntegration(TestBase):
mock_tracer.use_span.return_value.__enter__ = mock_span
mock_tracer.use_span.return_value.__exit__ = True
db_integration = AiopgIntegration(
mock_tracer, "testcomponent", "testtype", connection_attributes
mock_tracer, "testcomponent", connection_attributes
)
mock_connection = async_call(
db_integration.wrapped_connection(

View File

@ -72,7 +72,6 @@ def collect_request_attributes(scope):
http_url = http_url + ("?" + urllib.parse.unquote(query_string))
result = {
"component": scope["type"],
"http.scheme": scope.get("scheme"),
"http.host": server_host,
"net.host.port": port,

View File

@ -134,7 +134,6 @@ class TestAsgiApplication(AsgiTestBase):
"name": "GET asgi",
"kind": trace_api.SpanKind.SERVER,
"attributes": {
"component": "http",
"http.method": "GET",
"http.scheme": "http",
"net.host.port": 80,
@ -321,7 +320,6 @@ class TestAsgiAttributes(unittest.TestCase):
self.assertDictEqual(
attrs,
{
"component": "http",
"http.method": "GET",
"http.host": "127.0.0.1",
"http.target": "/",

View File

@ -29,9 +29,9 @@ Usage
# Ex: mysql.connector
trace_integration(mysql.connector, "connect", "mysql", "sql")
trace_integration(mysql.connector, "connect", "mysql")
# Ex: pyodbc
trace_integration(pyodbc, "Connection", "odbc", "sql")
trace_integration(pyodbc, "Connection", "odbc")
API
---
@ -55,8 +55,7 @@ logger = logging.getLogger(__name__)
def trace_integration(
connect_module: typing.Callable[..., typing.Any],
connect_method_name: str,
database_component: str,
database_type: str = "",
database_system: str,
connection_attributes: typing.Dict = None,
tracer_provider: typing.Optional[TracerProvider] = None,
capture_parameters: bool = False,
@ -68,21 +67,19 @@ def trace_integration(
Args:
connect_module: Module name where connect method is available.
connect_method_name: The connect method name.
database_component: Database driver name or database name "JDBI",
"jdbc", "odbc", "postgreSQL".
database_type: The Database type. For any SQL database, "sql".
database_system: An identifier for the database management system (DBMS)
product being used.
connection_attributes: Attribute names for database, port, host and
user in Connection object.
tracer_provider: The :class:`opentelemetry.trace.TracerProvider` to
use. If ommited the current configured one is used.
use. If omitted the current configured one is used.
capture_parameters: Configure if db.statement.parameters should be captured.
"""
wrap_connect(
__name__,
connect_module,
connect_method_name,
database_component,
database_type,
database_system,
connection_attributes,
version=__version__,
tracer_provider=tracer_provider,
@ -95,8 +92,7 @@ def wrap_connect(
name: str,
connect_module: typing.Callable[..., typing.Any],
connect_method_name: str,
database_component: str,
database_type: str = "",
database_system: str,
connection_attributes: typing.Dict = None,
version: str = "",
tracer_provider: typing.Optional[TracerProvider] = None,
@ -107,14 +103,14 @@ def wrap_connect(
https://www.python.org/dev/peps/pep-0249/
Args:
tracer: The :class:`opentelemetry.trace.Tracer` to use.
connect_module: Module name where connect method is available.
connect_method_name: The connect method name.
database_component: Database driver name or database name "JDBI",
"jdbc", "odbc", "postgreSQL".
database_type: The Database type. For any SQL database, "sql".
database_system: An identifier for the database management system (DBMS)
product being used.
connection_attributes: Attribute names for database, port, host and
user in Connection object.
tracer_provider: The :class:`opentelemetry.trace.TracerProvider` to
use. If omitted the current configured one is used.
capture_parameters: Configure if db.statement.parameters should be captured.
"""
@ -131,8 +127,7 @@ def wrap_connect(
):
db_integration = db_api_integration_factory(
name,
database_component,
database_type=database_type,
database_system,
connection_attributes=connection_attributes,
version=version,
tracer_provider=tracer_provider,
@ -164,8 +159,7 @@ def unwrap_connect(
def instrument_connection(
name: str,
connection,
database_component: str,
database_type: str = "",
database_system: str,
connection_attributes: typing.Dict = None,
version: str = "",
tracer_provider: typing.Optional[TracerProvider] = None,
@ -174,21 +168,20 @@ def instrument_connection(
"""Enable instrumentation in a database connection.
Args:
tracer: The :class:`opentelemetry.trace.Tracer` to use.
connection: The connection to instrument.
database_component: Database driver name or database name "JDBI",
"jdbc", "odbc", "postgreSQL".
database_type: The Database type. For any SQL database, "sql".
database_system: An identifier for the database management system (DBMS)
product being used.
connection_attributes: Attribute names for database, port, host and
user in a connection object.
tracer_provider: The :class:`opentelemetry.trace.TracerProvider` to
use. If omitted the current configured one is used.
capture_parameters: Configure if db.statement.parameters should be captured.
Returns:
An instrumented connection.
"""
db_integration = DatabaseApiIntegration(
name,
database_component,
database_type,
database_system,
connection_attributes=connection_attributes,
version=version,
tracer_provider=tracer_provider,
@ -218,8 +211,7 @@ class DatabaseApiIntegration:
def __init__(
self,
name: str,
database_component: str,
database_type: str = "sql",
database_system: str,
connection_attributes=None,
version: str = "",
tracer_provider: typing.Optional[TracerProvider] = None,
@ -237,8 +229,7 @@ class DatabaseApiIntegration:
self._version = version
self._tracer_provider = tracer_provider
self.capture_parameters = capture_parameters
self.database_component = database_component
self.database_type = database_type
self.database_system = database_system
self.connection_props = {}
self.span_attributes = {}
self.name = ""
@ -275,7 +266,7 @@ class DatabaseApiIntegration:
)
if attribute:
self.connection_props[key] = attribute
self.name = self.database_component
self.name = self.database_system
self.database = self.connection_props.get("database", "")
if self.database:
# PyMySQL encodes names with utf-8
@ -334,10 +325,7 @@ class CursorTracer:
return
statement = self.get_statement(cursor, args)
span.set_attribute(
"component", self._db_api_integration.database_component
)
span.set_attribute(
"db.system", self._db_api_integration.database_component
"db.system", self._db_api_integration.database_system
)
span.set_attribute("db.name", self._db_api_integration.database)
span.set_attribute("db.statement", statement)

View File

@ -40,7 +40,7 @@ class TestDBApiIntegration(TestBase):
"user": "user",
}
db_integration = dbapi.DatabaseApiIntegration(
self.tracer, "testcomponent", "testtype", connection_attributes
self.tracer, "testcomponent", connection_attributes
)
mock_connection = db_integration.wrapped_connection(
mock_connect, {}, connection_props
@ -53,7 +53,6 @@ class TestDBApiIntegration(TestBase):
self.assertEqual(span.name, "Test")
self.assertIs(span.kind, trace_api.SpanKind.CLIENT)
self.assertEqual(span.attributes["component"], "testcomponent")
self.assertEqual(span.attributes["db.system"], "testcomponent")
self.assertEqual(span.attributes["db.name"], "testdatabase")
self.assertEqual(span.attributes["db.statement"], "Test query")
@ -67,7 +66,7 @@ class TestDBApiIntegration(TestBase):
def test_span_name(self):
db_integration = dbapi.DatabaseApiIntegration(
self.tracer, "testcomponent", "testtype", {}
self.tracer, "testcomponent", {}
)
mock_connection = db_integration.wrapped_connection(
mock_connect, {}, {}
@ -102,7 +101,6 @@ class TestDBApiIntegration(TestBase):
db_integration = dbapi.DatabaseApiIntegration(
self.tracer,
"testcomponent",
"testtype",
connection_attributes,
capture_parameters=True,
)
@ -117,7 +115,6 @@ class TestDBApiIntegration(TestBase):
self.assertEqual(span.name, "Test")
self.assertIs(span.kind, trace_api.SpanKind.CLIENT)
self.assertEqual(span.attributes["component"], "testcomponent")
self.assertEqual(span.attributes["db.system"], "testcomponent")
self.assertEqual(span.attributes["db.name"], "testdatabase")
self.assertEqual(span.attributes["db.statement"], "Test query")
@ -152,7 +149,7 @@ class TestDBApiIntegration(TestBase):
mock_tracer.use_span.return_value.__enter__ = mock_span
mock_tracer.use_span.return_value.__exit__ = True
db_integration = dbapi.DatabaseApiIntegration(
mock_tracer, "testcomponent", "testtype", connection_attributes
mock_tracer, "testcomponent", connection_attributes
)
mock_connection = db_integration.wrapped_connection(
mock_connect, {}, connection_props

View File

@ -128,8 +128,7 @@ def _wrap_perform_request(tracer, span_name_prefix):
) as span:
if span.is_recording():
attributes = {
"component": "elasticsearch-py",
"db.type": "elasticsearch",
"db.system": "elasticsearch",
}
if url:
attributes["elasticsearch.url"] = url

View File

@ -248,8 +248,7 @@ class TestElasticsearchIntegration(TestBase):
self.assertEqual(
span.attributes,
{
"component": "elasticsearch-py",
"db.type": "elasticsearch",
"db.system": "elasticsearch",
"elasticsearch.url": "/test-index/_search",
"elasticsearch.method": helpers.dsl_search_method,
"db.statement": str(
@ -276,8 +275,7 @@ class TestElasticsearchIntegration(TestBase):
self.assertEqual(
span1.attributes,
{
"component": "elasticsearch-py",
"db.type": "elasticsearch",
"db.system": "elasticsearch",
"elasticsearch.url": "/test-index",
"elasticsearch.method": "HEAD",
},
@ -285,8 +283,7 @@ class TestElasticsearchIntegration(TestBase):
self.assertEqual(span2.name, "Elasticsearch/test-index")
attributes = {
"component": "elasticsearch-py",
"db.type": "elasticsearch",
"db.system": "elasticsearch",
"elasticsearch.url": "/test-index",
"elasticsearch.method": "PUT",
}
@ -312,8 +309,7 @@ class TestElasticsearchIntegration(TestBase):
span = spans[0]
self.assertEqual(span.name, helpers.dsl_index_span_name)
attributes = {
"component": "elasticsearch-py",
"db.type": "elasticsearch",
"db.system": "elasticsearch",
"elasticsearch.url": helpers.dsl_index_url,
"elasticsearch.method": "PUT",
}

View File

@ -95,7 +95,6 @@ class TestFalconInstrumentation(TestBase):
self.assert_span_has_attributes(
span,
{
"component": "http",
"http.method": method,
"http.server_name": "falconframework.org",
"http.scheme": "http",
@ -122,7 +121,6 @@ class TestFalconInstrumentation(TestBase):
self.assert_span_has_attributes(
span,
{
"component": "http",
"http.method": "GET",
"http.server_name": "falconframework.org",
"http.scheme": "http",
@ -155,7 +153,6 @@ class TestFalconInstrumentation(TestBase):
self.assert_span_has_attributes(
span,
{
"component": "http",
"http.method": "GET",
"http.server_name": "falconframework.org",
"http.scheme": "http",

View File

@ -28,7 +28,6 @@ from .base_test import InstrumentationTest
def expected_attributes(override_attributes):
default_attributes = {
"component": "http",
"http.method": "GET",
"http.server_name": "localhost",
"http.scheme": "http",

View File

@ -54,8 +54,7 @@ class MySQLInstrumentor(BaseInstrumentor):
"user": "user",
}
_DATABASE_COMPONENT = "mysql"
_DATABASE_TYPE = "sql"
_DATABASE_SYSTEM = "mysql"
def _instrument(self, **kwargs):
"""Integrate with MySQL Connector/Python library.
@ -67,8 +66,7 @@ class MySQLInstrumentor(BaseInstrumentor):
__name__,
mysql.connector,
"connect",
self._DATABASE_COMPONENT,
self._DATABASE_TYPE,
self._DATABASE_SYSTEM,
self._CONNECTION_ATTRIBUTES,
version=__version__,
tracer_provider=tracer_provider,
@ -93,8 +91,7 @@ class MySQLInstrumentor(BaseInstrumentor):
return dbapi.instrument_connection(
tracer,
connection,
self._DATABASE_COMPONENT,
self._DATABASE_TYPE,
self._DATABASE_SYSTEM,
self._CONNECTION_ATTRIBUTES,
)

View File

@ -62,8 +62,7 @@ class Psycopg2Instrumentor(BaseInstrumentor):
"user": "info.user",
}
_DATABASE_COMPONENT = "postgresql"
_DATABASE_TYPE = "sql"
_DATABASE_SYSTEM = "postgresql"
def _instrument(self, **kwargs):
"""Integrate with PostgreSQL Psycopg library.
@ -75,8 +74,7 @@ class Psycopg2Instrumentor(BaseInstrumentor):
__name__,
psycopg2,
"connect",
self._DATABASE_COMPONENT,
self._DATABASE_TYPE,
self._DATABASE_SYSTEM,
self._CONNECTION_ATTRIBUTES,
version=__version__,
tracer_provider=tracer_provider,
@ -152,8 +150,7 @@ def _new_cursor_factory(db_api=None, base_factory=None):
if not db_api:
db_api = DatabaseApiIntegration(
__name__,
Psycopg2Instrumentor._DATABASE_COMPONENT,
database_type=Psycopg2Instrumentor._DATABASE_TYPE,
Psycopg2Instrumentor._DATABASE_SYSTEM,
connection_attributes=Psycopg2Instrumentor._CONNECTION_ATTRIBUTES,
version=__version__,
)

View File

@ -45,7 +45,7 @@ from opentelemetry.instrumentation.pymongo.version import __version__
from opentelemetry.trace import SpanKind, get_tracer
from opentelemetry.trace.status import Status, StatusCode
DATABASE_TYPE = "mongodb"
DATABASE_SYSTEM = "mongodb"
class CommandTracer(monitoring.CommandListener):
@ -68,7 +68,7 @@ class CommandTracer(monitoring.CommandListener):
try:
span = self._tracer.start_span(name, kind=SpanKind.CLIENT)
if span.is_recording():
span.set_attribute("db.system", DATABASE_TYPE)
span.set_attribute("db.system", DATABASE_SYSTEM)
span.set_attribute("db.name", event.database_name)
span.set_attribute("db.statement", statement)
if event.connection_id is not None:

View File

@ -55,8 +55,7 @@ class PyMySQLInstrumentor(BaseInstrumentor):
"user": "user",
}
_DATABASE_COMPONENT = "mysql"
_DATABASE_TYPE = "sql"
_DATABASE_SYSTEM = "mysql"
def _instrument(self, **kwargs):
"""Integrate with the PyMySQL library.
@ -68,8 +67,7 @@ class PyMySQLInstrumentor(BaseInstrumentor):
__name__,
pymysql,
"connect",
self._DATABASE_COMPONENT,
self._DATABASE_TYPE,
self._DATABASE_SYSTEM,
self._CONNECTION_ATTRIBUTES,
version=__version__,
tracer_provider=tracer_provider,
@ -93,8 +91,7 @@ class PyMySQLInstrumentor(BaseInstrumentor):
return dbapi.instrument_connection(
__name__,
connection,
self._DATABASE_COMPONENT,
self._DATABASE_TYPE,
self._DATABASE_SYSTEM,
self._CONNECTION_ATTRIBUTES,
version=__version__,
)

View File

@ -28,7 +28,6 @@ from .pyramid_base_test import InstrumentationTest
def expected_attributes(override_attributes):
default_attributes = {
"component": "http",
"http.method": "GET",
"http.server_name": "localhost",
"http.scheme": "http",

View File

@ -139,7 +139,6 @@ def _instrument(tracer_provider=None, span_callback=None, name_callback=None):
exception = None
with recorder.record_client_duration(labels):
if span.is_recording():
span.set_attribute("component", "http")
span.set_attribute("http.method", method)
span.set_attribute("http.url", url)

View File

@ -79,7 +79,6 @@ class RequestsIntegrationTestBase(abc.ABC):
self.assertEqual(
span.attributes,
{
"component": "http",
"http.method": "GET",
"http.url": self.URL,
"http.status_code": 200,
@ -255,7 +254,6 @@ class RequestsIntegrationTestBase(abc.ABC):
self.assertEqual(
span.attributes,
{
"component": "http",
"http.method": "GET",
"http.url": self.URL,
"http.status_code": 200,
@ -287,8 +285,7 @@ class RequestsIntegrationTestBase(abc.ABC):
span = self.assert_span()
self.assertEqual(
span.attributes,
{"component": "http", "http.method": "GET", "http.url": self.URL},
span.attributes, {"http.method": "GET", "http.url": self.URL}
)
self.assertEqual(span.status.status_code, StatusCode.ERROR)
@ -323,8 +320,7 @@ class RequestsIntegrationTestBase(abc.ABC):
span = self.assert_span()
self.assertEqual(
span.attributes,
{"component": "http", "http.method": "GET", "http.url": self.URL},
span.attributes, {"http.method": "GET", "http.url": self.URL}
)
self.assertEqual(span.status.status_code, StatusCode.ERROR)
@ -361,7 +357,6 @@ class RequestsIntegrationTestBase(abc.ABC):
self.assertEqual(
span.attributes,
{
"component": "http",
"http.method": "GET",
"http.url": self.URL,
"http.status_code": 500,
@ -423,8 +418,7 @@ class TestRequestsIntegration(RequestsIntegrationTestBase, TestBase):
self.assertEqual(span.name, "HTTP POST")
self.assertEqual(
span.attributes,
{"component": "http", "http.method": "POST", "http.url": url},
span.attributes, {"http.method": "POST", "http.url": url}
)
self.assertEqual(span.status.status_code, StatusCode.ERROR)

View File

@ -51,8 +51,7 @@ class SQLite3Instrumentor(BaseInstrumentor):
# No useful attributes of sqlite3 connection object
_CONNECTION_ATTRIBUTES = {}
_DATABASE_COMPONENT = "sqlite"
_DATABASE_TYPE = "sql"
_DATABASE_SYSTEM = "sqlite"
def _instrument(self, **kwargs):
"""Integrate with SQLite3 Python library.
@ -64,8 +63,7 @@ class SQLite3Instrumentor(BaseInstrumentor):
__name__,
sqlite3,
"connect",
self._DATABASE_COMPONENT,
self._DATABASE_TYPE,
self._DATABASE_SYSTEM,
self._CONNECTION_ATTRIBUTES,
version=__version__,
tracer_provider=tracer_provider,
@ -90,8 +88,7 @@ class SQLite3Instrumentor(BaseInstrumentor):
return dbapi.instrument_connection(
tracer,
connection,
self._DATABASE_COMPONENT,
self._DATABASE_TYPE,
self._DATABASE_SYSTEM,
self._CONNECTION_ATTRIBUTES,
)

View File

@ -174,7 +174,6 @@ def _log_exception(tracer, func, handler, args, kwargs):
def _get_attributes_from_request(request):
attrs = {
"component": "tornado",
"http.method": request.method,
"http.scheme": request.protocol,
"http.host": request.host,

View File

@ -43,7 +43,6 @@ def fetch_async(tracer, func, _, args, kwargs):
if span.is_recording():
attributes = {
"component": "tornado",
"http.url": request.url,
"http.method": request.method,
}

View File

@ -128,7 +128,6 @@ class TestTornadoInstrumentation(TornadoTest):
self.assert_span_has_attributes(
server,
{
"component": "tornado",
"http.method": method,
"http.scheme": "http",
"http.host": "127.0.0.1:" + str(self.get_http_port()),
@ -146,7 +145,6 @@ class TestTornadoInstrumentation(TornadoTest):
self.assert_span_has_attributes(
client,
{
"component": "tornado",
"http.url": self.get_url("/"),
"http.method": method,
"http.status_code": 201,
@ -205,7 +203,6 @@ class TestTornadoInstrumentation(TornadoTest):
self.assert_span_has_attributes(
server,
{
"component": "tornado",
"http.method": "GET",
"http.scheme": "http",
"http.host": "127.0.0.1:" + str(self.get_http_port()),
@ -223,7 +220,6 @@ class TestTornadoInstrumentation(TornadoTest):
self.assert_span_has_attributes(
client,
{
"component": "tornado",
"http.url": self.get_url(url),
"http.method": "GET",
"http.status_code": 201,
@ -243,7 +239,6 @@ class TestTornadoInstrumentation(TornadoTest):
self.assert_span_has_attributes(
server,
{
"component": "tornado",
"http.method": "GET",
"http.scheme": "http",
"http.host": "127.0.0.1:" + str(self.get_http_port()),
@ -258,7 +253,6 @@ class TestTornadoInstrumentation(TornadoTest):
self.assert_span_has_attributes(
client,
{
"component": "tornado",
"http.url": self.get_url("/error"),
"http.method": "GET",
"http.status_code": 500,
@ -278,7 +272,6 @@ class TestTornadoInstrumentation(TornadoTest):
self.assert_span_has_attributes(
server,
{
"component": "tornado",
"http.method": "GET",
"http.scheme": "http",
"http.host": "127.0.0.1:" + str(self.get_http_port()),
@ -294,7 +287,6 @@ class TestTornadoInstrumentation(TornadoTest):
self.assert_span_has_attributes(
client,
{
"component": "tornado",
"http.url": self.get_url("/missing-url"),
"http.method": "GET",
"http.status_code": 404,
@ -324,7 +316,6 @@ class TestTornadoInstrumentation(TornadoTest):
self.assert_span_has_attributes(
server,
{
"component": "tornado",
"http.method": "GET",
"http.scheme": "http",
"http.host": "127.0.0.1:" + str(self.get_http_port()),
@ -342,7 +333,6 @@ class TestTornadoInstrumentation(TornadoTest):
self.assert_span_has_attributes(
client,
{
"component": "tornado",
"http.url": self.get_url("/dyna"),
"http.method": "GET",
"http.status_code": 202,
@ -362,7 +352,6 @@ class TestTornadoInstrumentation(TornadoTest):
self.assert_span_has_attributes(
client,
{
"component": "tornado",
"http.url": self.get_url(path),
"http.method": "GET",
"http.status_code": 200,

View File

@ -163,7 +163,6 @@ def _instrument(tracer_provider=None, span_callback=None, name_callback=None):
exception = None
with recorder.record_client_duration(labels):
if span.is_recording():
span.set_attribute("component", "http")
span.set_attribute("http.method", method)
span.set_attribute("http.url", url)

View File

@ -104,7 +104,6 @@ class RequestsIntegrationTestBase(abc.ABC):
self.assertEqual(
span.attributes,
{
"component": "http",
"http.method": "GET",
"http.url": self.URL,
"http.status_code": 200,
@ -289,7 +288,6 @@ class RequestsIntegrationTestBase(abc.ABC):
self.assertEqual(
span.attributes,
{
"component": "http",
"http.method": "GET",
"http.url": self.URL,
"http.status_code": 200,
@ -320,7 +318,6 @@ class RequestsIntegrationTestBase(abc.ABC):
self.assertEqual(
dict(span.attributes),
{
"component": "http",
"http.method": "GET",
"http.url": "http://httpbin.org/status/500",
"http.status_code": 500,

View File

@ -104,7 +104,6 @@ def collect_request_attributes(environ):
WSGI environ and returns a dictionary to be used as span creation attributes."""
result = {
"component": "http",
"http.method": environ.get("REQUEST_METHOD"),
"http.server_name": environ.get("SERVER_NAME"),
"http.scheme": environ.get("wsgi.url_scheme"),

View File

@ -106,7 +106,6 @@ class TestWsgiApplication(WsgiTestBase):
self.assertEqual(span_list[0].name, span_name)
self.assertEqual(span_list[0].kind, trace_api.SpanKind.SERVER)
expected_attributes = {
"component": "http",
"http.server_name": "127.0.0.1",
"http.scheme": "http",
"net.host.port": 80,
@ -215,7 +214,6 @@ class TestWsgiAttributes(unittest.TestCase):
self.assertDictEqual(
attrs,
{
"component": "http",
"http.method": "GET",
"http.host": "127.0.0.1",
"http.url": "http://127.0.0.1/?foo=bar",