Skip to content
This repository has been archived by the owner on Jul 1, 2022. It is now read-only.

Change return types from Jaeger Span/Tracer/Context to Jaeger types #469

Merged

Conversation

jpkrohling
Copy link
Collaborator

Signed-off-by: Juraci Paixão Kröhling juraci@kroehling.de

Which problem is this PR solving?

Short description of the changes

  • Where it was previously returning OpenTracing types, we are now returning Jaeger types.
  • Changed the tests to use the Jaeger types, to signal that those are the types we expect the methods to return and to avoid casts

@ghost ghost assigned jpkrohling Jun 28, 2018
@ghost ghost added the review label Jun 28, 2018
@@ -119,7 +119,7 @@ public static JaegerSpanContext contextFromString(String value)
}

/*
TODO(oibe) because java doesn't like to convert large hex strings to longs
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I removed the TODO marker here because it doesn't sounds like it's a TODO...

@jpkrohling jpkrohling force-pushed the 468-Change-return-types-to-Jaegers branch from ce717bf to fb05e97 Compare June 28, 2018 12:52
@codecov
Copy link

codecov bot commented Jun 28, 2018

Codecov Report

Merging #469 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff            @@
##             master     #469   +/-   ##
=========================================
  Coverage     88.12%   88.12%           
  Complexity      493      493           
=========================================
  Files            63       63           
  Lines          1852     1852           
  Branches        241      241           
=========================================
  Hits           1632     1632           
  Misses          142      142           
  Partials         78       78
Impacted Files Coverage Δ Complexity Δ
.../src/main/java/io/jaegertracing/Configuration.java 94.14% <ø> (ø) 39 <0> (ø) ⬇️
...ertracing/tracerresolver/JaegerTracerResolver.java 100% <ø> (ø) 2 <0> (ø) ⬇️
.../main/java/io/jaegertracing/JaegerSpanContext.java 89.79% <ø> (ø) 25 <0> (ø) ⬇️
.../java/io/jaegertracing/zipkin/V2SpanConverter.java 87.83% <100%> (ø) 21 <0> (ø) ⬇️
...gertracing/senders/zipkin/ThriftSpanConverter.java 85.55% <100%> (ø) 21 <0> (ø) ⬇️
.../io/jaegertracing/senders/zipkin/ZipkinSender.java 65.67% <100%> (ø) 17 <3> (ø) ⬇️
...e/src/main/java/io/jaegertracing/JaegerTracer.java 89.71% <100%> (ø) 23 <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 4a235f1...46b64d5. Read the comment docs.

Copy link
Contributor

@objectiser objectiser left a comment

Choose a reason for hiding this comment

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

Looks much cleaner - main comment is about not changing activeSpan return type.

@@ -168,13 +168,15 @@ public ScopeManager scopeManager() {
}

@Override
public Span activeSpan() {
public JaegerSpan activeSpan() {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this will need to remain Span, to allow other Spans to be stored in the ScopeManager - e.g. java-metrics (using api-extensions lib). Don't think this should be a problem - we can focus on returning Jaeger specific implementations based on the fluent api - from build span -> start. It would be the apps responsibility to then return the Jaeger impl if they needed to continue using it

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Do you have an example that I could test this? I could then add a new test based on the example.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think the following test should be sufficient:

    // prepare
    Span activeSpan = mock(Span.class);
    ScopeManager scopeManager = tracer.scopeManager();

    // test
    scopeManager.activate(activeSpan, false);

    // check
    assertEquals(activeSpan, tracer.activeSpan());

Copy link
Contributor

Choose a reason for hiding this comment

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

+1

@@ -218,24 +219,24 @@ public void close() {
private final Map<String, Object> tags = new HashMap<String, Object>();
private boolean ignoreActiveSpan = false;

SpanBuilder(String operationName) {
public SpanBuilder(String operationName) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why does this need to change?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Looks like it doesn't :)

Resolves jaegertracing#468

Signed-off-by: Juraci Paixão Kröhling <juraci@kroehling.de>
@jpkrohling jpkrohling force-pushed the 468-Change-return-types-to-Jaegers branch from 65d9c3a to 46b64d5 Compare June 28, 2018 14:29
@jpkrohling jpkrohling merged commit 46b64d5 into jaegertracing:master Jun 28, 2018
@ghost ghost removed the review label Jun 28, 2018
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.

3 participants