Skip to content

SNOW-1763555: OpenTelemetry integration utterly breaks driver if using DataDog #2084

Closed
@lattwood

Description

@lattwood

Python version

N/A

Operating system and processor architecture

N/A

Installed packages

ddtrace
opentelemetry-api

What did you do?

I used the driver w/ Datadog APM, which installs the opentelemetry packages that are used as the check to see if we can inject trace context.

With DataDog, this gets happens on every query, and it fails to run.

This is because the only exception caught is ModuleNotFoundError, and opentracing is throwing a ValueError which isn't getting caught.

(please forgive any typos, I copied the backtrace from a screenshot)

ValueError: Propagator tracecontext not found. It is either misspelled or not installed.
  File "/var/task/lambda_function.py", line 116, in lambda_handler
    process_scan(
  File "/var/task/store.py", line 92, in process_scan
    upload_file_to_snowflake(cursor, secrets, file_name=sv_file, table=snowflake_table)
  File "/var/task/store.py", line 55, in upload_file_to_snowflake
    cursor.execute (
  File "/var/task/snowflake/connector/cursor.py", line 984, in execute
    ret = self._execute_helper(query, **kwargs)
  File "/var/task/snowflake/connector/cursor.py", line 695, in _execute_helper
    ret = self._connection.cmd_query(
  File "/var/task/snowflake/connector/connection.py", line 1350, in cd_query
    ret = self. rest. request(
  File "/var/task/snowflake/connector/network.py", line 483, in request
    from opentelemetry.propagate import inject
  File "<frozen importlib._bootstrap»", line 1176, in _find_and_load
  File "<frozen importlib._bootstrap»", line 1147, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap»", Line 690, in _load_unlocked
  File "/var/task/ddtrace/internal/module.py", line 295, in _exec_module
    self.loader.exec_module (module)
  File "/var/task/opentelemetry/propagate/__init__.py", line 149, inmodule>
    raise ValueError(

What did you expect to see?

I would expect that opentelemetry integration would be done via this- https://github.com/open-telemetry/opentelemetry-python-contrib/tree/main/instrumentation

and not via a hack in the actual library that breaks the driver for anyone that has opentelemetry installed but not in-use.

I hope that this issue results in that change being reverted, and the original requestor of the feature gets this done properly in the open-telemetry project.

Can you set logging to DEBUG and collect the logs?

We already have it at DEBUG and that's the problem.

Metadata

Metadata

Labels

bugstatus-fixed_awaiting_releaseThe issue has been fixed, its PR merged, and now awaiting the next release cycle of the connector.status-triage_doneInitial triage done, will be further handled by the driver team

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions