Skip to content
This repository was archived by the owner on May 23, 2023. It is now read-only.

Fixes #210 : add support for multi reference and expose references co…#213

Merged
yurishkuro merged 1 commit intoopentracing:masterfrom
hypnoce:multi_reference_with_reference_type
Nov 7, 2017
Merged

Fixes #210 : add support for multi reference and expose references co…#213
yurishkuro merged 1 commit intoopentracing:masterfrom
hypnoce:multi_reference_with_reference_type

Conversation

@hypnoce
Copy link
Copy Markdown
Contributor

@hypnoce hypnoce commented Nov 5, 2017

…ntext and type from MockSpan.

import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

isn't this only available from 1.7+?

Copy link
Copy Markdown
Contributor Author

@hypnoce hypnoce Nov 5, 2017

Choose a reason for hiding this comment

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

Yes. I thought the compilation source and target were at least 1.7 since it is set in the pom file (set to 1.8 but main.java.version is set to 1.7). Let me know is this should be changed.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

ah, ok - the api module is 1.6, the rest are 1.7, so no new change is introduced here

@coveralls
Copy link
Copy Markdown

Coverage Status

Coverage increased (+1.8%) to 74.925% when pulling 9d694ef on hypnoce:multi_reference_with_reference_type into e000eb0 on opentracing:master.

Reference preferredReference = references.get(0);
for (Reference reference : references) {
// childOf takes precedence as a preferred parent
if (References.CHILD_OF.equals(reference.getReferenceType())
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

why not just return immediately in this case?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Indeed, I don't have a strong opinion on that. The control flow is the same. I find it more readable to have a single return at the end but I will change this.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

what I meant was this:

if list.isEmpty { return nil; }
for r in list {
  if r.isChildOf { return r.context() }
}
return list.get(0).context();

faster and simpler

@hypnoce hypnoce force-pushed the multi_reference_with_reference_type branch from 9d694ef to 4719773 Compare November 5, 2017 16:49
@coveralls
Copy link
Copy Markdown

Coverage Status

Coverage increased (+1.8%) to 74.85% when pulling 4719773 on hypnoce:multi_reference_with_reference_type into e000eb0 on opentracing:master.

@hypnoce hypnoce force-pushed the multi_reference_with_reference_type branch from 4719773 to c1adb9c Compare November 5, 2017 21:55
@coveralls
Copy link
Copy Markdown

Coverage Status

Coverage increased (+1.6%) to 74.699% when pulling c1adb9c on hypnoce:multi_reference_with_reference_type into e000eb0 on opentracing:master.

@yurishkuro
Copy link
Copy Markdown
Member

lgtm

cc @pavolloffay

@pavolloffay
Copy link
Copy Markdown
Member

LGTM,

Java doc in MockSpan.parentId() has to be changed: remove todo, make a note that it returns the first childOf reference and add link to MockSpan.references().

if (firstParent == null && (
referenceType.equals(References.CHILD_OF) || referenceType.equals(References.FOLLOWS_FROM))) {
this.firstParent = (MockSpan.MockContext)referencedContext;
if (referenceType.equals(References.CHILD_OF) || referenceType.equals(References.FOLLOWS_FROM)) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why this check? It can support arbitrary references.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Indeed, I just kept the current behaviour. I will change this.

…ferences context and type from MockSpan.
@hypnoce hypnoce force-pushed the multi_reference_with_reference_type branch from c1adb9c to 2ff3277 Compare November 6, 2017 21:39
@hypnoce
Copy link
Copy Markdown
Contributor Author

hypnoce commented Nov 6, 2017

@pavolloffay I made the required changes. Let me know if that looks good to you ! Thanks !

@coveralls
Copy link
Copy Markdown

Coverage Status

Coverage increased (+1.6%) to 74.699% when pulling 2ff3277 on hypnoce:multi_reference_with_reference_type into e000eb0 on opentracing:master.

@yurishkuro yurishkuro merged commit dd75c9d into opentracing:master Nov 7, 2017
carlosalberto added a commit to carlosalberto/opentracing-java that referenced this pull request Dec 17, 2017
* Code cleanup (opentracing#199)

- Propagate @deprecated annotation to implementations
- Remove redundant "static final" definition from interface
- Use Collections.emptyMap instead of Collections.EMPTY_MAP to preserve type

* Add support for multi reference and expose references context and type from MockSpan. (opentracing#213)

* Publish test artifact for Globaltracer testutil (opentracing#209)

* Fix MockTracer.ChildOf not fail if there is a null argument passed (opentracing#226)

* Make ChildOf not fail if there is a null argument passed

* Moved tracer test to where it belongs. Fixed typo.

* Use correct reference in Javadoc (opentracing#230)

* MockTracer use text map propag in the default constructor (opentracing#179)

* Implement a simpler Span propagation without lifetime handling. (opentracing#188)

- Scope replaces ActiveSpan, without sharing a common ancestor with Span.
- ScopeManager replaces ActiveSpanSource.
- No reference-count to handle Span's lifetime.
- A simple thread-local based ScopeManager.

* travis publish.sh allow releases from branches (opentracing#191)

* Travis allow release from non master branches (opentracing#192)

* Travis allow release from non master branches

Publis script compares remote branch with current checkout.
This passes travis_branch into git checkout command so
it will compare the same branches.

* Fix comments

* Travis publish script, remove -RC on git checkout (opentracing#193)

* Update the Travis script to allow publishing from v.0.0.0 branches. (opentracing#195)

Thing is, we cannot publish from 0.0.0-style branches as they are
excluded, based on the current global Travis configuration, thus
we try to publish from branches following a v.0.0.0 style, if any.

* Readme document release process for release candidates (opentracing#198)

* Readme document release process for release candidates

* Adjust publish.sh to work with release from master branch

* Add Examples for async use cases (opentracing#197)

* Add examples for async as test cases

This includes execution flow similar to:
* Actor ask/tell
* Promises with callbacks
* Work interleaved on a thread using suspend/resume.

The implementations of these execution models are obviously very simplistic, but intended to emphasize the tracing aspect.

* Update README files to reflect the Scope concept. (opentracing#217)

* Let Tracer.activeSpan() be a shorthand for ScopeManager's active Span. (opentracing#228)

* Let Tracer.activeSpan() be a shorthand for ScopeManager's active Span.

* Document the null case for Tracer.activeSpan().

* Have Tracer.activeSpan() return null.

* Remove @link for Tracer.activeSpan().

'Nested' links do not happen to exist under javadoc,
so Tracer.scopeManager().active().span() is now
not a link.

* Change BINARY to be resizable and stream-oriented. (opentracing#223)

* Change BINARY to be resizable and stream-oriented.

* Abstract the Binary adapter and have an Adapters class to return it.

* Remove the isInbound/isOutbound methods from BinaryAdapter.

* Make Binary use the Channel paradigm for injection/extraction

* Have binary methods in Adapters named after inject/extract.

* Add a BINARY propagator for MockTracer.

* Throw RuntimeException in case of errors during BINARY's injection.

* Put braces around if-blocks for Adapters/BinaryAdapter.

* Use verbose messages for null parameters in Adapters.

* SpanBuilder deprecate startManual (opentracing#225)

* SpanBuilder deprecate startManual

* Fix review comments

* Remove default finish behaviour for `activate()`  (opentracing#219)

* Do not auto finish on scope.close

* Fix review comments

* Fix review comments

* Add explanatory statement about not auto-finishing

* Define only activate(s, bool)

* Use the parameterless startActive() in a forgotten test in MockTracerTest.
carlosalberto added a commit that referenced this pull request Dec 18, 2017
* Code cleanup (#199)
- Propagate @deprecated annotation to implementations
- Remove redundant "static final" definition from interface
- Use Collections.emptyMap instead of Collections.EMPTY_MAP to preserve type

* Add support for multi reference and expose references context and type from MockSpan. (#213)

* Publish test artifact for Globaltracer testutil (#209)

* Fix MockTracer.ChildOf not fail if there is a null argument passed (#226)

* Make ChildOf not fail if there is a null argument passed

* Moved tracer test to where it belongs. Fixed typo.

* Use correct reference in Javadoc (#230)

* MockTracer use text map propag in the default constructor (#179)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants