Skip to content

exporter/datadog: Issue 1684 fix, update status code handling #1691

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

Merged
merged 5 commits into from
Nov 25, 2020

Conversation

ericmustin
Copy link
Contributor

Description:

This PR addresses the status code handling issue described in this open issue: #1684

There were recently some changes made to Span Status Code, and while otel-collector-contrib exporters were updated to reflect those changes here #1489, the datadog exporter was not included as it was only recently added to the repository. This PR brings the datadog exporter up to date with how Span Status Code's are handled by Otel and generally simplifies the logic of setting a DatadogSpan error.

Link to tracking Issue: #1684

Testing: Beside updating the unit tests, I reproduced the issue highlighted in #1684 using the latest otel-collector-contrib and opentelemetry-go, and then confirmed that the above change resolves the issue.

@ericmustin ericmustin requested a review from a team November 24, 2020 13:13
@codecov
Copy link

codecov bot commented Nov 24, 2020

Codecov Report

Merging #1691 (0c93a51) into master (0bf5215) will decrease coverage by 0.00%.
The diff coverage is 75.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1691      +/-   ##
==========================================
- Coverage   89.41%   89.40%   -0.01%     
==========================================
  Files         370      370              
  Lines       18141    18150       +9     
==========================================
+ Hits        16220    16227       +7     
- Misses       1431     1433       +2     
  Partials      490      490              
Flag Coverage Δ
integration 70.97% <ø> (-0.07%) ⬇️
unit 88.09% <75.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
exporter/datadogexporter/translate_traces.go 81.06% <75.00%> (+0.35%) ⬆️
receiver/carbonreceiver/transport/tcp_server.go 66.00% <0.00%> (-1.00%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0bf5215...0c93a51. Read the comment docs.

status: http.StatusInternalServerError,
}
if status := s.Status(); !status.IsNil() {
isError := 0
Copy link
Member

Choose a reason for hiding this comment

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

Why not use a boolean value for isError?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

datadog Span.Error has to be a 32bit int of either 1/0, so i tried to combine some things here. I've updated this to use constants so that it's a bit easier to read and the if statements are cleaner

Copy link
Member

@mx-psi mx-psi left a comment

Choose a reason for hiding this comment

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

LGTM! we could add test cases for the StatusCodeOk and StatusCodeUnset situations too to ensure that no error is reported in those cases.

@ericmustin
Copy link
Contributor Author

@owais lmk if any questions, this should be good to go i believe

@bogdandrutu bogdandrutu merged commit fbd481c into open-telemetry:master Nov 25, 2020
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.

4 participants