@opentelemetry/otlp-transformer
Version:
Transform OpenTelemetry SDK data into OTLP
828 lines • 825 kB
JavaScript
/*eslint-disable block-scoped-var, id-length, no-control-regex, no-magic-numbers, no-prototype-builtins, no-redeclare, no-shadow, no-var, sort-vars*/
"use strict";
var $protobuf = require("protobufjs/minimal");
// Common aliases
var $Reader = $protobuf.Reader, $Writer = $protobuf.Writer, $util = $protobuf.util;
// Exported root namespace
var $root = $protobuf.roots["default"] || ($protobuf.roots["default"] = {});
$root.opentelemetry = (function () {
/**
* Namespace opentelemetry.
* @exports opentelemetry
* @namespace
*/
var opentelemetry = {};
opentelemetry.proto = (function () {
/**
* Namespace proto.
* @memberof opentelemetry
* @namespace
*/
var proto = {};
proto.common = (function () {
/**
* Namespace common.
* @memberof opentelemetry.proto
* @namespace
*/
var common = {};
common.v1 = (function () {
/**
* Namespace v1.
* @memberof opentelemetry.proto.common
* @namespace
*/
var v1 = {};
v1.AnyValue = (function () {
/**
* Properties of an AnyValue.
* @memberof opentelemetry.proto.common.v1
* @interface IAnyValue
* @property {string|null} [stringValue] AnyValue stringValue
* @property {boolean|null} [boolValue] AnyValue boolValue
* @property {number|Long|null} [intValue] AnyValue intValue
* @property {number|null} [doubleValue] AnyValue doubleValue
* @property {opentelemetry.proto.common.v1.IArrayValue|null} [arrayValue] AnyValue arrayValue
* @property {opentelemetry.proto.common.v1.IKeyValueList|null} [kvlistValue] AnyValue kvlistValue
* @property {Uint8Array|null} [bytesValue] AnyValue bytesValue
*/
/**
* Constructs a new AnyValue.
* @memberof opentelemetry.proto.common.v1
* @classdesc Represents an AnyValue.
* @implements IAnyValue
* @constructor
* @param {opentelemetry.proto.common.v1.IAnyValue=} [properties] Properties to set
*/
function AnyValue(properties) {
if (properties)
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
if (properties[keys[i]] != null)
this[keys[i]] = properties[keys[i]];
}
/**
* AnyValue stringValue.
* @member {string|null|undefined} stringValue
* @memberof opentelemetry.proto.common.v1.AnyValue
* @instance
*/
AnyValue.prototype.stringValue = null;
/**
* AnyValue boolValue.
* @member {boolean|null|undefined} boolValue
* @memberof opentelemetry.proto.common.v1.AnyValue
* @instance
*/
AnyValue.prototype.boolValue = null;
/**
* AnyValue intValue.
* @member {number|Long|null|undefined} intValue
* @memberof opentelemetry.proto.common.v1.AnyValue
* @instance
*/
AnyValue.prototype.intValue = null;
/**
* AnyValue doubleValue.
* @member {number|null|undefined} doubleValue
* @memberof opentelemetry.proto.common.v1.AnyValue
* @instance
*/
AnyValue.prototype.doubleValue = null;
/**
* AnyValue arrayValue.
* @member {opentelemetry.proto.common.v1.IArrayValue|null|undefined} arrayValue
* @memberof opentelemetry.proto.common.v1.AnyValue
* @instance
*/
AnyValue.prototype.arrayValue = null;
/**
* AnyValue kvlistValue.
* @member {opentelemetry.proto.common.v1.IKeyValueList|null|undefined} kvlistValue
* @memberof opentelemetry.proto.common.v1.AnyValue
* @instance
*/
AnyValue.prototype.kvlistValue = null;
/**
* AnyValue bytesValue.
* @member {Uint8Array|null|undefined} bytesValue
* @memberof opentelemetry.proto.common.v1.AnyValue
* @instance
*/
AnyValue.prototype.bytesValue = null;
// OneOf field names bound to virtual getters and setters
var $oneOfFields;
/**
* AnyValue value.
* @member {"stringValue"|"boolValue"|"intValue"|"doubleValue"|"arrayValue"|"kvlistValue"|"bytesValue"|undefined} value
* @memberof opentelemetry.proto.common.v1.AnyValue
* @instance
*/
Object.defineProperty(AnyValue.prototype, "value", {
get: $util.oneOfGetter($oneOfFields = ["stringValue", "boolValue", "intValue", "doubleValue", "arrayValue", "kvlistValue", "bytesValue"]),
set: $util.oneOfSetter($oneOfFields)
});
/**
* Creates a new AnyValue instance using the specified properties.
* @function create
* @memberof opentelemetry.proto.common.v1.AnyValue
* @static
* @param {opentelemetry.proto.common.v1.IAnyValue=} [properties] Properties to set
* @returns {opentelemetry.proto.common.v1.AnyValue} AnyValue instance
*/
AnyValue.create = function create(properties) {
return new AnyValue(properties);
};
/**
* Encodes the specified AnyValue message. Does not implicitly {@link opentelemetry.proto.common.v1.AnyValue.verify|verify} messages.
* @function encode
* @memberof opentelemetry.proto.common.v1.AnyValue
* @static
* @param {opentelemetry.proto.common.v1.IAnyValue} message AnyValue message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
AnyValue.encode = function encode(message, writer) {
if (!writer)
writer = $Writer.create();
if (message.stringValue != null && Object.hasOwnProperty.call(message, "stringValue"))
writer.uint32(/* id 1, wireType 2 =*/ 10).string(message.stringValue);
if (message.boolValue != null && Object.hasOwnProperty.call(message, "boolValue"))
writer.uint32(/* id 2, wireType 0 =*/ 16).bool(message.boolValue);
if (message.intValue != null && Object.hasOwnProperty.call(message, "intValue"))
writer.uint32(/* id 3, wireType 0 =*/ 24).int64(message.intValue);
if (message.doubleValue != null && Object.hasOwnProperty.call(message, "doubleValue"))
writer.uint32(/* id 4, wireType 1 =*/ 33).double(message.doubleValue);
if (message.arrayValue != null && Object.hasOwnProperty.call(message, "arrayValue"))
$root.opentelemetry.proto.common.v1.ArrayValue.encode(message.arrayValue, writer.uint32(/* id 5, wireType 2 =*/ 42).fork()).ldelim();
if (message.kvlistValue != null && Object.hasOwnProperty.call(message, "kvlistValue"))
$root.opentelemetry.proto.common.v1.KeyValueList.encode(message.kvlistValue, writer.uint32(/* id 6, wireType 2 =*/ 50).fork()).ldelim();
if (message.bytesValue != null && Object.hasOwnProperty.call(message, "bytesValue"))
writer.uint32(/* id 7, wireType 2 =*/ 58).bytes(message.bytesValue);
return writer;
};
/**
* Encodes the specified AnyValue message, length delimited. Does not implicitly {@link opentelemetry.proto.common.v1.AnyValue.verify|verify} messages.
* @function encodeDelimited
* @memberof opentelemetry.proto.common.v1.AnyValue
* @static
* @param {opentelemetry.proto.common.v1.IAnyValue} message AnyValue message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
AnyValue.encodeDelimited = function encodeDelimited(message, writer) {
return this.encode(message, writer).ldelim();
};
/**
* Decodes an AnyValue message from the specified reader or buffer.
* @function decode
* @memberof opentelemetry.proto.common.v1.AnyValue
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @param {number} [length] Message length if known beforehand
* @returns {opentelemetry.proto.common.v1.AnyValue} AnyValue
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
AnyValue.decode = function decode(reader, length) {
if (!(reader instanceof $Reader))
reader = $Reader.create(reader);
var end = length === undefined ? reader.len : reader.pos + length, message = new $root.opentelemetry.proto.common.v1.AnyValue();
while (reader.pos < end) {
var tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
message.stringValue = reader.string();
break;
}
case 2: {
message.boolValue = reader.bool();
break;
}
case 3: {
message.intValue = reader.int64();
break;
}
case 4: {
message.doubleValue = reader.double();
break;
}
case 5: {
message.arrayValue = $root.opentelemetry.proto.common.v1.ArrayValue.decode(reader, reader.uint32());
break;
}
case 6: {
message.kvlistValue = $root.opentelemetry.proto.common.v1.KeyValueList.decode(reader, reader.uint32());
break;
}
case 7: {
message.bytesValue = reader.bytes();
break;
}
default:
reader.skipType(tag & 7);
break;
}
}
return message;
};
/**
* Decodes an AnyValue message from the specified reader or buffer, length delimited.
* @function decodeDelimited
* @memberof opentelemetry.proto.common.v1.AnyValue
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @returns {opentelemetry.proto.common.v1.AnyValue} AnyValue
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
AnyValue.decodeDelimited = function decodeDelimited(reader) {
if (!(reader instanceof $Reader))
reader = new $Reader(reader);
return this.decode(reader, reader.uint32());
};
/**
* Verifies an AnyValue message.
* @function verify
* @memberof opentelemetry.proto.common.v1.AnyValue
* @static
* @param {Object.<string,*>} message Plain object to verify
* @returns {string|null} `null` if valid, otherwise the reason why it is not
*/
AnyValue.verify = function verify(message) {
if (typeof message !== "object" || message === null)
return "object expected";
var properties = {};
if (message.stringValue != null && message.hasOwnProperty("stringValue")) {
properties.value = 1;
if (!$util.isString(message.stringValue))
return "stringValue: string expected";
}
if (message.boolValue != null && message.hasOwnProperty("boolValue")) {
if (properties.value === 1)
return "value: multiple values";
properties.value = 1;
if (typeof message.boolValue !== "boolean")
return "boolValue: boolean expected";
}
if (message.intValue != null && message.hasOwnProperty("intValue")) {
if (properties.value === 1)
return "value: multiple values";
properties.value = 1;
if (!$util.isInteger(message.intValue) && !(message.intValue && $util.isInteger(message.intValue.low) && $util.isInteger(message.intValue.high)))
return "intValue: integer|Long expected";
}
if (message.doubleValue != null && message.hasOwnProperty("doubleValue")) {
if (properties.value === 1)
return "value: multiple values";
properties.value = 1;
if (typeof message.doubleValue !== "number")
return "doubleValue: number expected";
}
if (message.arrayValue != null && message.hasOwnProperty("arrayValue")) {
if (properties.value === 1)
return "value: multiple values";
properties.value = 1;
{
var error = $root.opentelemetry.proto.common.v1.ArrayValue.verify(message.arrayValue);
if (error)
return "arrayValue." + error;
}
}
if (message.kvlistValue != null && message.hasOwnProperty("kvlistValue")) {
if (properties.value === 1)
return "value: multiple values";
properties.value = 1;
{
var error = $root.opentelemetry.proto.common.v1.KeyValueList.verify(message.kvlistValue);
if (error)
return "kvlistValue." + error;
}
}
if (message.bytesValue != null && message.hasOwnProperty("bytesValue")) {
if (properties.value === 1)
return "value: multiple values";
properties.value = 1;
if (!(message.bytesValue && typeof message.bytesValue.length === "number" || $util.isString(message.bytesValue)))
return "bytesValue: buffer expected";
}
return null;
};
/**
* Creates an AnyValue message from a plain object. Also converts values to their respective internal types.
* @function fromObject
* @memberof opentelemetry.proto.common.v1.AnyValue
* @static
* @param {Object.<string,*>} object Plain object
* @returns {opentelemetry.proto.common.v1.AnyValue} AnyValue
*/
AnyValue.fromObject = function fromObject(object) {
if (object instanceof $root.opentelemetry.proto.common.v1.AnyValue)
return object;
var message = new $root.opentelemetry.proto.common.v1.AnyValue();
if (object.stringValue != null)
message.stringValue = String(object.stringValue);
if (object.boolValue != null)
message.boolValue = Boolean(object.boolValue);
if (object.intValue != null)
if ($util.Long)
(message.intValue = $util.Long.fromValue(object.intValue)).unsigned = false;
else if (typeof object.intValue === "string")
message.intValue = parseInt(object.intValue, 10);
else if (typeof object.intValue === "number")
message.intValue = object.intValue;
else if (typeof object.intValue === "object")
message.intValue = new $util.LongBits(object.intValue.low >>> 0, object.intValue.high >>> 0).toNumber();
if (object.doubleValue != null)
message.doubleValue = Number(object.doubleValue);
if (object.arrayValue != null) {
if (typeof object.arrayValue !== "object")
throw TypeError(".opentelemetry.proto.common.v1.AnyValue.arrayValue: object expected");
message.arrayValue = $root.opentelemetry.proto.common.v1.ArrayValue.fromObject(object.arrayValue);
}
if (object.kvlistValue != null) {
if (typeof object.kvlistValue !== "object")
throw TypeError(".opentelemetry.proto.common.v1.AnyValue.kvlistValue: object expected");
message.kvlistValue = $root.opentelemetry.proto.common.v1.KeyValueList.fromObject(object.kvlistValue);
}
if (object.bytesValue != null)
if (typeof object.bytesValue === "string")
$util.base64.decode(object.bytesValue, message.bytesValue = $util.newBuffer($util.base64.length(object.bytesValue)), 0);
else if (object.bytesValue.length >= 0)
message.bytesValue = object.bytesValue;
return message;
};
/**
* Creates a plain object from an AnyValue message. Also converts values to other types if specified.
* @function toObject
* @memberof opentelemetry.proto.common.v1.AnyValue
* @static
* @param {opentelemetry.proto.common.v1.AnyValue} message AnyValue
* @param {$protobuf.IConversionOptions} [options] Conversion options
* @returns {Object.<string,*>} Plain object
*/
AnyValue.toObject = function toObject(message, options) {
if (!options)
options = {};
var object = {};
if (message.stringValue != null && message.hasOwnProperty("stringValue")) {
object.stringValue = message.stringValue;
if (options.oneofs)
object.value = "stringValue";
}
if (message.boolValue != null && message.hasOwnProperty("boolValue")) {
object.boolValue = message.boolValue;
if (options.oneofs)
object.value = "boolValue";
}
if (message.intValue != null && message.hasOwnProperty("intValue")) {
if (typeof message.intValue === "number")
object.intValue = options.longs === String ? String(message.intValue) : message.intValue;
else
object.intValue = options.longs === String ? $util.Long.prototype.toString.call(message.intValue) : options.longs === Number ? new $util.LongBits(message.intValue.low >>> 0, message.intValue.high >>> 0).toNumber() : message.intValue;
if (options.oneofs)
object.value = "intValue";
}
if (message.doubleValue != null && message.hasOwnProperty("doubleValue")) {
object.doubleValue = options.json && !isFinite(message.doubleValue) ? String(message.doubleValue) : message.doubleValue;
if (options.oneofs)
object.value = "doubleValue";
}
if (message.arrayValue != null && message.hasOwnProperty("arrayValue")) {
object.arrayValue = $root.opentelemetry.proto.common.v1.ArrayValue.toObject(message.arrayValue, options);
if (options.oneofs)
object.value = "arrayValue";
}
if (message.kvlistValue != null && message.hasOwnProperty("kvlistValue")) {
object.kvlistValue = $root.opentelemetry.proto.common.v1.KeyValueList.toObject(message.kvlistValue, options);
if (options.oneofs)
object.value = "kvlistValue";
}
if (message.bytesValue != null && message.hasOwnProperty("bytesValue")) {
object.bytesValue = options.bytes === String ? $util.base64.encode(message.bytesValue, 0, message.bytesValue.length) : options.bytes === Array ? Array.prototype.slice.call(message.bytesValue) : message.bytesValue;
if (options.oneofs)
object.value = "bytesValue";
}
return object;
};
/**
* Converts this AnyValue to JSON.
* @function toJSON
* @memberof opentelemetry.proto.common.v1.AnyValue
* @instance
* @returns {Object.<string,*>} JSON object
*/
AnyValue.prototype.toJSON = function toJSON() {
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
};
/**
* Gets the default type url for AnyValue
* @function getTypeUrl
* @memberof opentelemetry.proto.common.v1.AnyValue
* @static
* @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
* @returns {string} The default type url
*/
AnyValue.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
if (typeUrlPrefix === undefined) {
typeUrlPrefix = "type.googleapis.com";
}
return typeUrlPrefix + "/opentelemetry.proto.common.v1.AnyValue";
};
return AnyValue;
})();
v1.ArrayValue = (function () {
/**
* Properties of an ArrayValue.
* @memberof opentelemetry.proto.common.v1
* @interface IArrayValue
* @property {Array.<opentelemetry.proto.common.v1.IAnyValue>|null} [values] ArrayValue values
*/
/**
* Constructs a new ArrayValue.
* @memberof opentelemetry.proto.common.v1
* @classdesc Represents an ArrayValue.
* @implements IArrayValue
* @constructor
* @param {opentelemetry.proto.common.v1.IArrayValue=} [properties] Properties to set
*/
function ArrayValue(properties) {
this.values = [];
if (properties)
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
if (properties[keys[i]] != null)
this[keys[i]] = properties[keys[i]];
}
/**
* ArrayValue values.
* @member {Array.<opentelemetry.proto.common.v1.IAnyValue>} values
* @memberof opentelemetry.proto.common.v1.ArrayValue
* @instance
*/
ArrayValue.prototype.values = $util.emptyArray;
/**
* Creates a new ArrayValue instance using the specified properties.
* @function create
* @memberof opentelemetry.proto.common.v1.ArrayValue
* @static
* @param {opentelemetry.proto.common.v1.IArrayValue=} [properties] Properties to set
* @returns {opentelemetry.proto.common.v1.ArrayValue} ArrayValue instance
*/
ArrayValue.create = function create(properties) {
return new ArrayValue(properties);
};
/**
* Encodes the specified ArrayValue message. Does not implicitly {@link opentelemetry.proto.common.v1.ArrayValue.verify|verify} messages.
* @function encode
* @memberof opentelemetry.proto.common.v1.ArrayValue
* @static
* @param {opentelemetry.proto.common.v1.IArrayValue} message ArrayValue message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
ArrayValue.encode = function encode(message, writer) {
if (!writer)
writer = $Writer.create();
if (message.values != null && message.values.length)
for (var i = 0; i < message.values.length; ++i)
$root.opentelemetry.proto.common.v1.AnyValue.encode(message.values[i], writer.uint32(/* id 1, wireType 2 =*/ 10).fork()).ldelim();
return writer;
};
/**
* Encodes the specified ArrayValue message, length delimited. Does not implicitly {@link opentelemetry.proto.common.v1.ArrayValue.verify|verify} messages.
* @function encodeDelimited
* @memberof opentelemetry.proto.common.v1.ArrayValue
* @static
* @param {opentelemetry.proto.common.v1.IArrayValue} message ArrayValue message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
ArrayValue.encodeDelimited = function encodeDelimited(message, writer) {
return this.encode(message, writer).ldelim();
};
/**
* Decodes an ArrayValue message from the specified reader or buffer.
* @function decode
* @memberof opentelemetry.proto.common.v1.ArrayValue
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @param {number} [length] Message length if known beforehand
* @returns {opentelemetry.proto.common.v1.ArrayValue} ArrayValue
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
ArrayValue.decode = function decode(reader, length) {
if (!(reader instanceof $Reader))
reader = $Reader.create(reader);
var end = length === undefined ? reader.len : reader.pos + length, message = new $root.opentelemetry.proto.common.v1.ArrayValue();
while (reader.pos < end) {
var tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (!(message.values && message.values.length))
message.values = [];
message.values.push($root.opentelemetry.proto.common.v1.AnyValue.decode(reader, reader.uint32()));
break;
}
default:
reader.skipType(tag & 7);
break;
}
}
return message;
};
/**
* Decodes an ArrayValue message from the specified reader or buffer, length delimited.
* @function decodeDelimited
* @memberof opentelemetry.proto.common.v1.ArrayValue
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @returns {opentelemetry.proto.common.v1.ArrayValue} ArrayValue
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
ArrayValue.decodeDelimited = function decodeDelimited(reader) {
if (!(reader instanceof $Reader))
reader = new $Reader(reader);
return this.decode(reader, reader.uint32());
};
/**
* Verifies an ArrayValue message.
* @function verify
* @memberof opentelemetry.proto.common.v1.ArrayValue
* @static
* @param {Object.<string,*>} message Plain object to verify
* @returns {string|null} `null` if valid, otherwise the reason why it is not
*/
ArrayValue.verify = function verify(message) {
if (typeof message !== "object" || message === null)
return "object expected";
if (message.values != null && message.hasOwnProperty("values")) {
if (!Array.isArray(message.values))
return "values: array expected";
for (var i = 0; i < message.values.length; ++i) {
var error = $root.opentelemetry.proto.common.v1.AnyValue.verify(message.values[i]);
if (error)
return "values." + error;
}
}
return null;
};
/**
* Creates an ArrayValue message from a plain object. Also converts values to their respective internal types.
* @function fromObject
* @memberof opentelemetry.proto.common.v1.ArrayValue
* @static
* @param {Object.<string,*>} object Plain object
* @returns {opentelemetry.proto.common.v1.ArrayValue} ArrayValue
*/
ArrayValue.fromObject = function fromObject(object) {
if (object instanceof $root.opentelemetry.proto.common.v1.ArrayValue)
return object;
var message = new $root.opentelemetry.proto.common.v1.ArrayValue();
if (object.values) {
if (!Array.isArray(object.values))
throw TypeError(".opentelemetry.proto.common.v1.ArrayValue.values: array expected");
message.values = [];
for (var i = 0; i < object.values.length; ++i) {
if (typeof object.values[i] !== "object")
throw TypeError(".opentelemetry.proto.common.v1.ArrayValue.values: object expected");
message.values[i] = $root.opentelemetry.proto.common.v1.AnyValue.fromObject(object.values[i]);
}
}
return message;
};
/**
* Creates a plain object from an ArrayValue message. Also converts values to other types if specified.
* @function toObject
* @memberof opentelemetry.proto.common.v1.ArrayValue
* @static
* @param {opentelemetry.proto.common.v1.ArrayValue} message ArrayValue
* @param {$protobuf.IConversionOptions} [options] Conversion options
* @returns {Object.<string,*>} Plain object
*/
ArrayValue.toObject = function toObject(message, options) {
if (!options)
options = {};
var object = {};
if (options.arrays || options.defaults)
object.values = [];
if (message.values && message.values.length) {
object.values = [];
for (var j = 0; j < message.values.length; ++j)
object.values[j] = $root.opentelemetry.proto.common.v1.AnyValue.toObject(message.values[j], options);
}
return object;
};
/**
* Converts this ArrayValue to JSON.
* @function toJSON
* @memberof opentelemetry.proto.common.v1.ArrayValue
* @instance
* @returns {Object.<string,*>} JSON object
*/
ArrayValue.prototype.toJSON = function toJSON() {
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
};
/**
* Gets the default type url for ArrayValue
* @function getTypeUrl
* @memberof opentelemetry.proto.common.v1.ArrayValue
* @static
* @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
* @returns {string} The default type url
*/
ArrayValue.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
if (typeUrlPrefix === undefined) {
typeUrlPrefix = "type.googleapis.com";
}
return typeUrlPrefix + "/opentelemetry.proto.common.v1.ArrayValue";
};
return ArrayValue;
})();
v1.KeyValueList = (function () {
/**
* Properties of a KeyValueList.
* @memberof opentelemetry.proto.common.v1
* @interface IKeyValueList
* @property {Array.<opentelemetry.proto.common.v1.IKeyValue>|null} [values] KeyValueList values
*/
/**
* Constructs a new KeyValueList.
* @memberof opentelemetry.proto.common.v1
* @classdesc Represents a KeyValueList.
* @implements IKeyValueList
* @constructor
* @param {opentelemetry.proto.common.v1.IKeyValueList=} [properties] Properties to set
*/
function KeyValueList(properties) {
this.values = [];
if (properties)
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
if (properties[keys[i]] != null)
this[keys[i]] = properties[keys[i]];
}
/**
* KeyValueList values.
* @member {Array.<opentelemetry.proto.common.v1.IKeyValue>} values
* @memberof opentelemetry.proto.common.v1.KeyValueList
* @instance
*/
KeyValueList.prototype.values = $util.emptyArray;
/**
* Creates a new KeyValueList instance using the specified properties.
* @function create
* @memberof opentelemetry.proto.common.v1.KeyValueList
* @static
* @param {opentelemetry.proto.common.v1.IKeyValueList=} [properties] Properties to set
* @returns {opentelemetry.proto.common.v1.KeyValueList} KeyValueList instance
*/
KeyValueList.create = function create(properties) {
return new KeyValueList(properties);
};
/**
* Encodes the specified KeyValueList message. Does not implicitly {@link opentelemetry.proto.common.v1.KeyValueList.verify|verify} messages.
* @function encode
* @memberof opentelemetry.proto.common.v1.KeyValueList
* @static
* @param {opentelemetry.proto.common.v1.IKeyValueList} message KeyValueList message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
KeyValueList.encode = function encode(message, writer) {
if (!writer)
writer = $Writer.create();
if (message.values != null && message.values.length)
for (var i = 0; i < message.values.length; ++i)
$root.opentelemetry.proto.common.v1.KeyValue.encode(message.values[i], writer.uint32(/* id 1, wireType 2 =*/ 10).fork()).ldelim();
return writer;
};
/**
* Encodes the specified KeyValueList message, length delimited. Does not implicitly {@link opentelemetry.proto.common.v1.KeyValueList.verify|verify} messages.
* @function encodeDelimited
* @memberof opentelemetry.proto.common.v1.KeyValueList
* @static
* @param {opentelemetry.proto.common.v1.IKeyValueList} message KeyValueList message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
KeyValueList.encodeDelimited = function encodeDelimited(message, writer) {
return this.encode(message, writer).ldelim();
};
/**
* Decodes a KeyValueList message from the specified reader or buffer.
* @function decode
* @memberof opentelemetry.proto.common.v1.KeyValueList
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @param {number} [length] Message length if known beforehand
* @returns {opentelemetry.proto.common.v1.KeyValueList} KeyValueList
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
KeyValueList.decode = function decode(reader, length) {
if (!(reader instanceof $Reader))
reader = $Reader.create(reader);
var end = length === undefined ? reader.len : reader.pos + length, message = new $root.opentelemetry.proto.common.v1.KeyValueList();
while (reader.pos < end) {
var tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (!(message.values && message.values.length))
message.values = [];
message.values.push($root.opentelemetry.proto.common.v1.KeyValue.decode(reader, reader.uint32()));
break;
}
default:
reader.skipType(tag & 7);
break;
}
}
return message;
};
/**
* Decodes a KeyValueList message from the specified reader or buffer, length delimited.
* @function decodeDelimited
* @memberof opentelemetry.proto.common.v1.KeyValueList
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @returns {opentelemetry.proto.common.v1.KeyValueList} KeyValueList
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
KeyValueList.decodeDelimited = function decodeDelimited(reader) {
if (!(reader instanceof $Reader))
reader = new $Reader(reader);
return this.decode(reader, reader.uint32());
};
/**
* Verifies a KeyValueList message.
* @function verify
* @memberof opentelemetry.proto.common.v1.KeyValueList
* @static
* @param {Object.<string,*>} message Plain object to verify
* @returns {string|null} `null` if valid, otherwise the reason why it is not
*/
KeyValueList.verify = function verify(message) {
if (typeof message !== "object" || message === null)
return "object expected";
if (message.values != null && message.hasOwnProperty("values")) {
if (!Array.isArray(message.values))
return "values: array expected";
for (var i = 0; i < message.values.length; ++i) {
var error = $root.opentelemetry.proto.common.v1.KeyValue.verify(message.values[i]);
if (error)
return "values." + error;
}
}
return null;
};
/**
* Creates a KeyValueList message from a plain object. Also converts values to their respective internal types.
* @function fromObject
* @memberof opentelemetry.proto.common.v1.KeyValueList
* @static
* @param {Object.<string,*>} object Plain object
* @returns {opentelemetry.proto.common.v1.KeyValueList} KeyValueList
*/
KeyValueList.fromObject = function fromObject(object) {
if (object instanceof $root.opentelemetry.proto.common.v1.KeyValueList)
return object;
var message = new $root.opentelemetry.proto.common.v1.KeyValueList();
if (object.values) {
if (!Array.isArray(object.values))
throw TypeError(".opentelemetry.proto.common.v1.KeyValueList.values: array expected");
message.values = [];
for (var i = 0; i < object.values.length; ++i) {
if (typeof object.values[i] !== "object")
throw TypeError(".opentelemetry.proto.common.v1.KeyValueList.values: object expected");
message.values[i] = $root.opentelemetry.proto.common.v1.KeyValue.fromObject(object.values[i]);
}
}
return message;
};
/**
* Creates a plain object from a KeyValueList message. Also converts values to other types if specified.
* @function toObject
* @memberof opentelemetry.proto.common.v1.KeyValueList
* @static
* @param {opentelemetry.proto.common.v1.KeyValueList} message KeyValueList
* @param {$protobuf.IConversionOptions} [options] Conversion options
* @returns {Object.<string,*>} Plain object
*/
KeyValueList.toObject = function toObject(message, options) {
if (!options)
options = {};
var object = {};
if (options.arrays || options.defaults)
object.values = [];
if (message.values && message.values.length) {
object.values = [];
for (var j = 0; j < message.values.length; ++j)
object.values[j] = $root.opentelemetry.proto.common.v1.KeyValue.toObject(message.values[j], options);
}
return object;
};
/**
* Converts this KeyValueList to JSON.
* @function toJSON
* @memberof opentelemetry.proto.c