-
Notifications
You must be signed in to change notification settings - Fork 469
Add mariadb #2570
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add mariadb #2570
Conversation
…SAMPLING=false is set, not just when an older tracer version is being used
… __init__.py file for mariadb correct
tests/snapshots/tests.contrib.mariadb.test_mariadb.test_simple_query_snapshot.snap
Show resolved
Hide resolved
ddtrace/contrib/mariadb/patch.py
Outdated
|
|
||
| def _connect(func, instance, args, kwargs): | ||
| conn = func(*args, **kwargs) | ||
| ##need to pull from args as well at some point |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have the helper get_argument_value for this in ddtrace.utils
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like mariadb's connect function only supports kwargs: https://mariadb-corporation.github.io/mariadb-connector-python/module.html#mariadb.connect
Co-authored-by: Brett Langdon <brett.langdon@datadoghq.com>
…ching and unpatching, used black formatter
| @@ -0,0 +1,22 @@ | |||
| [[{"name" "mariadb.query" | |||
| "service" "mariadb" | |||
| "resource" "sp_sum" | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting that the resource for a procedure ends up getting truncated to this... @brettlangdon any thoughts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is probably why:
dd-trace-py/ddtrace/contrib/dbapi/__init__.py
Line 115 in 0dc356f
| return self._trace_method(self.__wrapped__.callproc, self._self_datadog_name, proc, {}, proc, *args) |
because it is cursor.callproc("proc_name") we don't have the query, that is stored on the server
I am surprised we only have 1 span here since this snapshot tests has two executes and the callproc ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Kyle-Verhoog any further thoughts on this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah for some reason i didn't realize that sp_sum was the given name of the stored procedure.. seems totally fine to me 👍
I am surprised we only have 1 span here since this snapshot tests has two executes and the callproc ?
lol yeah the test for some reason disables the tracer for the two executes: https://github.com/DataDog/dd-trace-py/pull/2570/files#diff-b5666b23f77bb419456af9d9b0a778a1a787fafbee39303612e5de24e4960500R264
Co-authored-by: Kyle Verhoog <kyle@verhoog.ca>
Co-authored-by: Kyle Verhoog <kyle@verhoog.ca>
Co-authored-by: Kyle Verhoog <kyle@verhoog.ca>
Co-authored-by: Kyle Verhoog <kyle@verhoog.ca>
…_mariadb Pulling changes
Co-authored-by: Kyle Verhoog <kyle@verhoog.ca>
Co-authored-by: Kyle Verhoog <kyle@verhoog.ca>
brettlangdon
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
previous comments I'd like to see resolved, otherwise lgtm
| @@ -0,0 +1,22 @@ | |||
| [[{"name" "mariadb.query" | |||
| "service" "mariadb" | |||
| "resource" "sp_sum" | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Kyle-Verhoog any further thoughts on this?
majorgreys
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
small nit
|
|
||
| @snapshot(include_tracer=True) | ||
| def test_simple_query_snapshot(tracer): | ||
| with get_connection(tracer) as connection: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you could just use your connection fixture right? should do the same thing
Co-authored-by: Kyle Verhoog <kyle@verhoog.ca>
Kyle-Verhoog
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Literally just one thing left and we're good to go!
Kyle-Verhoog
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🙌 🙌 🙌
Integration
This PR adds support for
mariadb.Links
Added the PR to make changes to the test docker container. This will need to be merged before mariadb tests will pass in CircleCI: #2584
Checklist
__init__.py,docs/index.rstanddocs/integrations.rst.int_serviceorext_service).ddtrace.configentry is specified.pytestfixtures found intests/conftest.pyor the test helpers onTracerTestCaseifwriting
unitteststyle test cases..circleci/config.yml).test_django_patch.pyfor an example).