-
Notifications
You must be signed in to change notification settings - Fork 96
Add validation for tagkey & tagvalue. Fix issue #268 #280
Add validation for tagkey & tagvalue. Fix issue #268 #280
Conversation
Codecov Report
@@ Coverage Diff @@
## master #280 +/- ##
==========================================
- Coverage 94.81% 94.57% -0.24%
==========================================
Files 110 106 -4
Lines 7771 7434 -337
Branches 714 694 -20
==========================================
- Hits 7368 7031 -337
Misses 403 403
Continue to review full report at Codecov.
|
* @param tags The tags to be checked | ||
*/ | ||
private invalidTags(tags: Tags): boolean { | ||
return this.invalidPrintableCharacters(tags) || this.invalidLength(tags); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should log the warn or error, in case of invalid tags. WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about modifying the method like this:
private invalidTags(tags: Tags): boolean {
const result: boolean = this.invalidPrintableCharacters(tags) || this.invalidLength(tags);
if(result) {
console.log('Unable to create tagkey/tagvalue with the specified tags. Check Tag specifications here: https://github.com/census-instrumentation/opencensus-specs/blob/master/tags/TagMap.md');
}
return result;
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/console.log/this.logger.warn
and no need to add specs link.
Thanks @vigneshtdev for contribution... 👍 |
Validates tagkey & tagvalues as per the specification given in https://github.com/census-instrumentation/opencensus-specs/blob/master/tags/TagMap.md#tagkey
ran
npm test
&npm run complie
with no errors.