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

Add RemoteBaggageRestrictionManager #229

Merged
merged 5 commits into from
Aug 21, 2017
Merged

Add RemoteBaggageRestrictionManager #229

merged 5 commits into from
Aug 21, 2017

Conversation

black-adder
Copy link
Contributor

No description provided.

String jsonString;
try {
jsonString =
makeGetRequest("http://" + hostPort + "/baggageRestrictions?service=" + URLEncoder.encode(serviceName, "UTF-8"));
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not using URIbuilder here since it doesn't seem to be thread safe. (Albeit the usage pattern for this class is once a minute so we shouldn't be getting into situations where thread safety is required)

Metrics metrics,
boolean denyBaggageOnInitializationFailure,
int refreshIntervalMs,
int initialDelayMs
Copy link
Contributor Author

Choose a reason for hiding this comment

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

initialDelayMs is only exposed for testing purposes so I can determine when the first call to remote agent is made. Under normal operations, this class will start up and asynchronously fetch restrictions. If the user wants to know if restrictions are ready, they can check via isReady()

Copy link
Member

Choose a reason for hiding this comment

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

this makes more sense as code comment

@codecov-io
Copy link

codecov-io commented Aug 15, 2017

Codecov Report

Merging #229 into master will increase coverage by 0.49%.
The diff coverage is 96.59%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master     #229      +/-   ##
============================================
+ Coverage     81.39%   81.89%   +0.49%     
- Complexity      504      525      +21     
============================================
  Files            82       87       +5     
  Lines          1935     2005      +70     
  Branches        232      236       +4     
============================================
+ Hits           1575     1642      +67     
- Misses          261      263       +2     
- Partials         99      100       +1
Impacted Files Coverage Δ Complexity Δ
...ore/src/main/java/com/uber/jaeger/utils/Utils.java 78.94% <ø> (ø) 6 <0> (ø) ⬇️
...src/main/java/com/uber/jaeger/metrics/Metrics.java 77.5% <ø> (ø) 11 <0> (ø) ⬇️
...exceptions/BaggageRestrictionManagerException.java 100% <100%> (ø) 2 <2> (?)
.../com/uber/jaeger/samplers/HttpSamplingManager.java 93.33% <100%> (-3.34%) 4 <2> (-2)
...aeger/baggage/RemoteBaggageRestrictionManager.java 100% <100%> (ø) 12 <12> (?)
...in/java/com/uber/jaeger/baggage/BaggageSetter.java 100% <100%> (ø) 9 <3> (ø) ⬇️
...er/baggage/HttpBaggageRestrictionManagerProxy.java 100% <100%> (ø) 4 <4> (?)
...aeger-core/src/main/java/com/uber/jaeger/Span.java 80.39% <66.66%> (-0.42%) 38 <1> (+1)
...aeger/baggage/http/BaggageRestrictionResponse.java 66.66% <66.66%> (ø) 2 <2> (?)
...core/src/main/java/com/uber/jaeger/utils/Http.java 93.33% <93.33%> (ø) 2 <2> (?)
... and 5 more

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 a44f07f...db31b9c. Read the comment docs.

Copy link
Member

@yurishkuro yurishkuro left a comment

Choose a reason for hiding this comment

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

lgtm

Metrics metrics,
boolean denyBaggageOnInitializationFailure,
int refreshIntervalMs,
int initialDelayMs
Copy link
Member

Choose a reason for hiding this comment

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

this makes more sense as code comment

@@ -22,52 +22,27 @@

package com.uber.jaeger.samplers;

import static com.uber.jaeger.utils.Utils.makeGetRequest;
Copy link
Member

Choose a reason for hiding this comment

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

seems com.uber.jaeger.utils.HTTP would've been a better class name

conn.disconnect();
}
return result.toString();
this.hostPort = hostPort != null ? hostPort : DEFAULT_HOST_PORT;
}

SamplingStrategyResponse parseJson(String json) {
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 move this to util class as well, e.g.

class com.uber.jaeger.utils.HTTP

public <T> T getJSON(String url, Class<T> cls) throws ...;

@black-adder black-adder merged commit 912bfdb into master Aug 21, 2017
@black-adder black-adder deleted the Add_remotebaggage branch August 21, 2017 16:41
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.

None yet

3 participants