Skip to content

Conversation

@ZStriker19
Copy link
Collaborator

@ZStriker19 ZStriker19 commented Jun 21, 2021

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

  • Usage and configuration documentation added in __init__.py, docs/index.rst and docs/integrations.rst.
  • Corp docs PR to add new integration to documentation.
  • Span metadata
  • Global configuration
    • ddtrace.config entry is specified.
    • Environment variables are provided for config options.
  • Instance configuration
    • Pin overriding.
    • Service name override (if applicable).
  • Tests
    • Use pytest fixtures found in tests/conftest.py or the test helpers on TracerTestCase if
      writing unittest style test cases.
    • Tests are provided for all the above.
    • Tests are added to CI (.circleci/config.yml).
    • Functionality is maintained from original library.
    • Patch test cases are added (see test_django_patch.py for an example).
    • All Python versions that the library supports are tested.
    • All significant library versions (including the latest) are tested. This typically includes every minor release going back a few years.


def _connect(func, instance, args, kwargs):
conn = func(*args, **kwargs)
##need to pull from args as well at some point
Copy link
Contributor

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

Copy link
Collaborator Author

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

@Kyle-Verhoog Kyle-Verhoog self-requested a review July 8, 2021 16:39
@@ -0,0 +1,22 @@
[[{"name" "mariadb.query"
"service" "mariadb"
"resource" "sp_sum"
Copy link
Member

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?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is probably why:

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 ?

Copy link
Member

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?

Copy link
Member

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

ZStriker19 and others added 4 commits July 13, 2021 15:37
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>
brettlangdon
brettlangdon previously approved these changes Jul 20, 2021
Copy link
Member

@brettlangdon brettlangdon left a 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"
Copy link
Member

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?

Copy link
Contributor

@majorgreys majorgreys left a 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:
Copy link
Member

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

Copy link
Member

@Kyle-Verhoog Kyle-Verhoog left a 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!

Copy link
Member

@Kyle-Verhoog Kyle-Verhoog left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🙌 🙌 🙌

@Kyle-Verhoog Kyle-Verhoog requested a review from majorgreys July 21, 2021 11:56
@brettlangdon brettlangdon dismissed majorgreys’s stale review July 21, 2021 13:20

comments have been addressed

@mergify mergify bot merged commit c44c1b4 into master Jul 21, 2021
@mergify mergify bot deleted the add_mariadb branch July 21, 2021 13:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants