Skip to content
This repository has been archived by the owner on Oct 3, 2023. It is now read-only.

Add support for child span count #332

Merged
merged 3 commits into from
Feb 28, 2019

Conversation

mayurkale22
Copy link
Member

@mayurkale22 mayurkale22 commented Feb 7, 2019

@codecov-io
Copy link

Codecov Report

Merging #332 into master will increase coverage by <.01%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #332      +/-   ##
==========================================
+ Coverage   94.95%   94.96%   +<.01%     
==========================================
  Files         120      120              
  Lines        8213     8229      +16     
  Branches      732      732              
==========================================
+ Hits         7799     7815      +16     
  Misses        414      414
Impacted Files Coverage Δ
test/test-root-span.ts 100% <0%> (ø) ⬆️
src/trace/model/root-span.ts 100% <0%> (ø) ⬆️

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 923148a...1efaa33. Read the comment docs.

@codecov-io
Copy link

codecov-io commented Feb 7, 2019

Codecov Report

Merging #332 into master will increase coverage by <.01%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #332      +/-   ##
==========================================
+ Coverage   94.98%   94.99%   +<.01%     
==========================================
  Files         120      120              
  Lines        8332     8345      +13     
  Branches      741      741              
==========================================
+ Hits         7914     7927      +13     
  Misses        418      418
Impacted Files Coverage Δ
test/test-root-span.ts 100% <0%> (ø) ⬆️
src/trace/model/root-span.ts 100% <0%> (ø) ⬆️

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 95be16e...67ab8a9. Read the comment docs.

@@ -169,6 +184,7 @@ describe('RootSpan', () => {
for (const span of root.spans) {
assert.ok(span.ended);
}
assert.equal(root.numberOfChildren, 1);
Copy link

Choose a reason for hiding this comment

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

there is no need to check for child count in other test case unless the test case affects the logic.

Copy link
Member Author

Choose a reason for hiding this comment

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

Sure, Done.

@@ -206,6 +222,7 @@ describe('RootSpan', () => {
rootSpan.addAnnotation('description test', {} as Attributes, Date.now());

assert.ok(rootSpan.annotations.length > 0);
assert.equal(rootSpan.numberOfChildren, 0);
Copy link

Choose a reason for hiding this comment

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

ditto.

Copy link
Contributor

@draffensperger draffensperger left a comment

Choose a reason for hiding this comment

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

What would you think about making the child count a core property of the Span type? That would then enable situations where there is a larger operation root span with sub-operations as child spans and those child spans then make RPC calls.

@mayurkale22
Copy link
Member Author

What would you think about making the child count a core property of the Span type? That would then enable situations where there is a larger operation root span with sub-operations as child spans and those child spans then make RPC calls.

AFAIK there isn't a notion of grandchild spans in node (all child spans are direct children of a root span). #105

@draffensperger
Copy link
Contributor

AFAIK there isn't a notion of grandchild spans in node (all child spans are direct children of a root span). #105

Is that by design based on the specs / other language implementations? Or is that more of a specific limitation of OpenCensus Node at this time?

@mayurkale22
Copy link
Member Author

@draffensperger allow me to rephrase my previous sentence #332 (comment).

AFAIK in terms of single process or server, there will be only two types of requests (incoming and outgoing). Root spans corresponds to incoming requests and child span for outgoing. There is only in and out (no grand out). So, if there are multiple micro services running we connect all these spans through common traceId (which is propagated through context).

What would you think about making the child count a core property of the Span type?

I think it makes sense to have child count property of the RootSpan type, as there is no way to create child from child (nested child).

@draffensperger
Copy link
Contributor

I agree that for RPCs you typically only have in and out, but if we allow for other types of spans, I think we can get the grandchild case. I'm thinking of custom intermediate spans that represent larger conceptual things like "process middleware" or "load recommendations" and similar, that each may have multiple RPCs or other custom spans in them. As a user views a trace, they could then see which high level operation in the request is slow and then drill down to the subcalls of that operation. This of course requires that the user sets up those custom spans, but ideally I would think we would let them do that.

@draffensperger
Copy link
Contributor

I think the work I'm suggesting is captured well in a previous issue that I just commented on: #105 (comment)

So I'm fine with merging this and then adding support for nested child spans at a later time.

@mayurkale22
Copy link
Member Author

I think the work I'm suggesting is captured well in a previous issue that I just commented on: #105 (comment)

So I'm fine with merging this and then adding support for nested child spans at a later time.

Ok cool, thanks.

@mayurkale22 mayurkale22 merged commit 608943d into census-instrumentation:master Feb 28, 2019
@mayurkale22 mayurkale22 deleted the child_count branch February 28, 2019 18:05
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants