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

Commit

Permalink
code review
Browse files Browse the repository at this point in the history
  • Loading branch information
black-adder committed Aug 21, 2017
1 parent fda00c4 commit a8f5a44
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/_flow/baggage_restriction_manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,5 @@ import Restriction from '../baggage/restriction.js'
* allowed and any other applicable restrictions on the baggage value.
*/
declare interface BaggageRestrictionManager {
getRestriction(key: string): Restriction;
getRestriction(service: string, key: string): Restriction;
}
2 changes: 1 addition & 1 deletion src/baggage/baggage_setter.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export default class BaggageSetter {
let value = baggageValue;
let truncated = false;
let prevItem = '';
let restriction = this._restrictionManager.getRestriction(key);
let restriction = this._restrictionManager.getRestriction(span.serviceName, key);
if (!restriction.keyAllowed) {
this._logFields(span, key, value, prevItem, truncated, restriction.keyAllowed);
this._metrics.baggageUpdateFailure.increment(1);
Expand Down
2 changes: 1 addition & 1 deletion src/baggage/default_baggage_restriction_manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export default class DefaultBaggageRestrictionManager {
this._restriction = new Restriction(true, length);
}

getRestriction(key: string): Restriction {
getRestriction(service: string, key: string): Restriction {
return this._restriction;
}
}
4 changes: 4 additions & 0 deletions src/span.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ export default class Span {
return this._operationName;
}

get serviceName(): string {
return this._tracer._serviceName;
}

static _getBaggageHeaderCache() {
if (!Span._baggageHeaderCache) {
Span._baggageHeaderCache = {};
Expand Down
3 changes: 2 additions & 1 deletion src/tracer.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ export default class Tracer {
this._reporter = reporter;
this._sampler = sampler;
this._logger = options.logger || new NullLogger();
this._baggageSetter = new BaggageSetter(options.baggageRestrictionManager || new DefaultBaggageRestrictionManager(),
this._baggageSetter = new BaggageSetter(
options.baggageRestrictionManager || new DefaultBaggageRestrictionManager(),
this._metrics);
this._injectors = {};
this._extractors = {};
Expand Down

0 comments on commit a8f5a44

Please sign in to comment.