-
Notifications
You must be signed in to change notification settings - Fork 98
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Limit span names/labels to service limits #345
Conversation
PTAL. |
var val = '' + value; | ||
// The official limit imposed by the service is 16k per label value. | ||
// We truncate smaller than that to keep requests small. | ||
if (val.length > 5000) { |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
TRACE_SERVICE_LABEL_KEY_LIMIT: 128, | ||
|
||
/** Maximum size of a label value in bytes. */ | ||
TRACE_SERVICE_LABEL_VALUE_LIMIT: 16 * 1000, |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
/** | ||
* Creates a trace span object. | ||
* @constructor | ||
*/ | ||
function TraceSpan(name, spanId, parentSpanId) { | ||
this.name = name; | ||
if (name.length > constants.TRACE_SERVICE_SPAN_NAME_LIMIT) { |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
@@ -37,7 +43,14 @@ function TraceSpan(name, spanId, parentSpanId) { | |||
* @param {string} value The new value of the label. | |||
*/ | |||
TraceSpan.prototype.setLabel = function(key, value) { | |||
this.labels[key] = '' + value; | |||
if (key.length > constants.TRACE_SERVICE_LABEL_KEY_LIMIT) { |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
@@ -17,13 +17,26 @@ | |||
'use strict'; | |||
|
|||
var util = require('util'); | |||
var constants = require('./constants.js'); | |||
|
|||
function truncate(string, length) { |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
TRACE_OPTIONS_TRACE_ENABLED: 1 << 0, | ||
|
||
/** See: cloud.google.com/trace/api/reference/rest/v1/projects.traces for limits. */ | ||
/** Maximum size of a span name in bytes. */ |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
No description provided.