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

fix(example): fix koa example #1088

Merged
merged 4 commits into from
Aug 9, 2022
Merged

Conversation

umuoy1
Copy link
Contributor

@umuoy1 umuoy1 commented Jul 13, 2022

Which problem is this PR solving?

  • koa example wasn't to be able to run correctly.

Short description of the changes

  • fixes the status code for spans
  • sets the serviceName for the example

@umuoy1 umuoy1 requested a review from a team July 13, 2022 07:35
@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Jul 13, 2022

CLA Signed

The committers listed above are authorized under a signed CLA.

  • ✅ login: umuoy1 / name: Umuoy (2989d4e)

@codecov
Copy link

codecov bot commented Jul 14, 2022

Codecov Report

Merging #1088 (b39dba2) into main (845f50c) will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##             main    #1088   +/-   ##
=======================================
  Coverage   95.91%   95.91%           
=======================================
  Files          13       13           
  Lines         856      856           
  Branches      178      178           
=======================================
  Hits          821      821           
  Misses         35       35           

@umuoy1 umuoy1 force-pushed the fix-koa-example branch from a7b4837 to 98eb31f Compare July 18, 2022 04:29
@umuoy1 umuoy1 force-pushed the fix-koa-example branch from f2fad60 to 2989d4e Compare July 18, 2022 04:41
@@ -13,10 +13,10 @@ function makeRequest() {
api.context.with(api.trace.setSpan(api.ROOT_CONTEXT, span), async () => {
try {
const res = await axios.get('http://localhost:8081/run_test');
span.setStatus({ code: api.StatusCode.OK });
span.setStatus({ code: api.SpanStatusCode.OK });
Copy link
Member

Choose a reason for hiding this comment

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

mmm, I think that we should actually delete this line.
span status code should be UNSET which is the default.

from the spec:

Generally, Instrumentation Libraries SHOULD NOT set the status code to Ok, unless explicitly configured to do so. Instrumentation Libraries SHOULD leave the status code as Unset unless there is an error, as described above.

Copy link
Member

Choose a reason for hiding this comment

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

Isn't this example an end-user example?

Copy link
Member

Choose a reason for hiding this comment

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

@blumamir would you mind shedding your light on this again? I believe this is an end-user example so setting the status code here should be fine.

Copy link
Member

Choose a reason for hiding this comment

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

@legendecas is correct the end user should set the span status and this example is fine IMO

examples/koa/tracer.js Outdated Show resolved Hide resolved
Copy link
Member

@legendecas legendecas left a comment

Choose a reason for hiding this comment

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

Thank you for your contribution! LGTM % the style nits mentioned by @blumamir.

@umuoy1 umuoy1 force-pushed the fix-koa-example branch from 60b9c0e to 05dcb97 Compare July 20, 2022 03:08
@legendecas legendecas merged commit d358c1c into open-telemetry:main Aug 9, 2022
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