Skip to content
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

[mysql] fix: ensure span name is a string to avoid [object Object] as span name #208

Merged
merged 3 commits into from Oct 9, 2020

Conversation

naseemkullah
Copy link
Member

Which problem is this PR solving?

Short description of the changes

  • Ensured that the span name is always a string. The approach differs when the query is a string vs an object:

    • for string, use the verb
    • for an object, use the sql string without the templated variable
  • Also replaced deprecated equals method in tests

@naseemkullah naseemkullah requested a review from a team as a code owner September 17, 2020 02:57
@naseemkullah naseemkullah changed the title fix: ensure span name is a string to avoid [object Object] as span name [mysql] fix: ensure span name is a string to avoid [object Object] as span name Sep 17, 2020
@codecov
Copy link

codecov bot commented Sep 17, 2020

Codecov Report

Merging #208 into master will decrease coverage by 0.25%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##           master     #208      +/-   ##
==========================================
- Coverage   95.20%   94.94%   -0.26%     
==========================================
  Files          92       79      -13     
  Lines        4731     4236     -495     
  Branches      491      432      -59     
==========================================
- Hits         4504     4022     -482     
+ Misses        227      214      -13     
Impacted Files Coverage Δ
node/opentelemetry-plugin-mysql/src/utils.ts 100.00% <0.00%> (ø)
node/opentelemetry-plugin-express/.eslintrc.js
...lemetry-propagator-grpc-census-binary/.eslintrc.js
node/opentelemetry-plugin-express/src/version.ts
...grpc-census-binary/test/BinaryTraceContext.test.ts
node/opentelemetry-plugin-express/src/types.ts
node/opentelemetry-plugin-express/src/express.ts
...pc-census-binary/test/GrpcCensusPropagator.test.ts
...tor-grpc-census-binary/src/GrpcCensusPropagator.ts
...de/opentelemetry-plugin-express/test/utils.test.ts
... and 5 more

@@ -124,6 +124,34 @@ describe('mysql@2.x', () => {
assert.strictEqual(plugin.moduleName, 'mysql');
});

it('should name the span correctly when the query is a string', done => {
Copy link
Member

Choose a reason for hiding this comment

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

Nit: can you reverse the logic in test

describe('when the query is a string', ()=> {
  it('span should have correct name', ...) 
})

describe('when the query is a an object', ()=> {
  it('span should have correct name', ...) 
})

Copy link
Member Author

Choose a reason for hiding this comment

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

that does read better!

Copy link
Member

Choose a reason for hiding this comment

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

@naseemkullah just a gently ping on this :)

Copy link
Member Author

Choose a reason for hiding this comment

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

pong!

Sorry dropped the ball on this :)

Naseem added 2 commits October 5, 2020 20:06
Signed-off-by: Naseem <naseem@transit.app>
@obecny obecny merged commit cd24cdf into open-telemetry:master Oct 9, 2020
@obecny obecny added the bug Something isn't working label Oct 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants