dd-trace-py
dd-trace-py copied to clipboard
feat(snowflake): add snowflake query id tag
Description
We are using snowflake as our database and wanted to add a tag that represents the "query id" so we will be able to look for it later in snowflake.
For example, the query id in snowflake is called "sfqid" and returned after the query executed. So in this example, I've added "sfqid" with value None to the Pin inside snowflake/patch.py, and then after the query execution I'm populating the value of this tag (inside dbapi/init.py)
Now I can take this sfqid and look for it in the Database
Checklist
- [ ] Title must conform to conventional commit.
- [ ] Add additional sections for
feat
andfix
pull requests. - [ ] Ensure tests are passing for affected code.
- [ ] Library documentation and/or Datadog's documentation site is updated. Link to doc PR in description.
Motivation
Add the ability to "inject" tags that are available only after the query done (like rows_count).
Design
I'm using the fact that Pin is a dictionary of tags that being passed to the dbapi, to inject tags with None value that will later be populated.
Testing strategy
The feature is working and currently snowflake spans gets "sfqid"'s.
Reviewer Checklist
- [ ] Title is accurate.
- [ ] Description motivates each change.
- [ ] No unnecessary changes were introduced in this PR.
- [ ] PR cannot be broken up into smaller PRs.
- [ ] Avoid breaking API changes unless absolutely necessary.
- [ ] Tests provided or description of manual testing performed is included in the code or PR.
- [ ] Release note has been added for fixes and features, or else
changelog/no-changelog
label added. - [ ] All relevant GitHub issues are correctly linked.
- [ ] Backports are identified and tagged with Mergifyio.
- [ ] Add to milestone.
@mabdinur I've tried to add changelog and merge from 1.x but I don't have permission to push to this repository. What should I do now?
@mabdinur I've tried to add changelog and merge from 1.x but I don't have permission to push to this repository. What should I do now?
Sorry I should've proposed these changes on your ddtrace fork. I added a release note and made some minor tweaks to the snapshots. This pull request looks good to me but you'll need one more approval before it can be merged.
So we are waiting for another approval? exciting :)
any news?
Codecov Report
Merging #4069 (935388b) into 1.x (a940ef1) will decrease coverage by
0.05%
. The diff coverage is44.80%
.
@@ Coverage Diff @@
## 1.x #4069 +/- ##
==========================================
- Coverage 78.86% 78.80% -0.06%
==========================================
Files 720 720
Lines 57386 57511 +125
==========================================
+ Hits 45255 45323 +68
- Misses 12131 12188 +57
Impacted Files | Coverage Δ | |
---|---|---|
ddtrace/contrib/flask/patch.py | 0.00% <0.00%> (ø) |
|
tests/contrib/django/django1_app/urls.py | 100.00% <ø> (ø) |
|
tests/contrib/django/django_app/urls.py | 92.59% <ø> (ø) |
|
tests/contrib/flask/app.py | 0.00% <0.00%> (ø) |
|
tests/contrib/flask/test_flask_appsec.py | 0.00% <0.00%> (ø) |
|
tests/contrib/snowflake/test_snowflake.py | 94.18% <ø> (ø) |
|
tests/internal/test_module.py | 0.00% <0.00%> (ø) |
|
tests/profiling/collector/test_threading.py | 0.00% <0.00%> (ø) |
|
tests/profiling/collector/test_traceback.py | 0.00% <0.00%> (ø) |
|
tests/tracer/test_forksafe.py | 69.76% <9.09%> (-11.01%) |
:arrow_down: |
... and 13 more |
:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more
@Mergifyio refresh
refresh