UNPKG

@splunk/otel

Version:

The Splunk distribution of OpenTelemetry Node Instrumentation provides a Node agent that automatically instruments your Node application to capture and report distributed traces to Splunk APM.

851 lines 165 kB
/* istanbul ignore file */ /*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.perftools = (function () { /** * Namespace perftools. * @exports perftools * @namespace */ var perftools = {}; perftools.profiles = (function () { /** * Namespace profiles. * @memberof perftools * @namespace */ var profiles = {}; profiles.Profile = (function () { /** * Properties of a Profile. * @memberof perftools.profiles * @interface IProfile * @property {Array.<perftools.profiles.IValueType>|null} [sampleType] Profile sampleType * @property {Array.<perftools.profiles.ISample>|null} [sample] Profile sample * @property {Array.<perftools.profiles.IMapping>|null} [mapping] Profile mapping * @property {Array.<perftools.profiles.ILocation>|null} [location] Profile location * @property {Array.<perftools.profiles.IFunction>|null} ["function"] Profile function * @property {Array.<string>|null} [stringTable] Profile stringTable * @property {number|Long|null} [dropFrames] Profile dropFrames * @property {number|Long|null} [keepFrames] Profile keepFrames * @property {number|Long|null} [timeNanos] Profile timeNanos * @property {number|Long|null} [durationNanos] Profile durationNanos * @property {perftools.profiles.IValueType|null} [periodType] Profile periodType * @property {number|Long|null} [period] Profile period * @property {Array.<number|Long>|null} [comment] Profile comment * @property {number|Long|null} [defaultSampleType] Profile defaultSampleType */ /** * Constructs a new Profile. * @memberof perftools.profiles * @classdesc Represents a Profile. * @implements IProfile * @constructor * @param {perftools.profiles.IProfile=} [properties] Properties to set */ function Profile(properties) { this.sampleType = []; this.sample = []; this.mapping = []; this.location = []; this["function"] = []; this.stringTable = []; this.comment = []; 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]]; } /** * Profile sampleType. * @member {Array.<perftools.profiles.IValueType>} sampleType * @memberof perftools.profiles.Profile * @instance */ Profile.prototype.sampleType = $util.emptyArray; /** * Profile sample. * @member {Array.<perftools.profiles.ISample>} sample * @memberof perftools.profiles.Profile * @instance */ Profile.prototype.sample = $util.emptyArray; /** * Profile mapping. * @member {Array.<perftools.profiles.IMapping>} mapping * @memberof perftools.profiles.Profile * @instance */ Profile.prototype.mapping = $util.emptyArray; /** * Profile location. * @member {Array.<perftools.profiles.ILocation>} location * @memberof perftools.profiles.Profile * @instance */ Profile.prototype.location = $util.emptyArray; /** * Profile function. * @member {Array.<perftools.profiles.IFunction>} function * @memberof perftools.profiles.Profile * @instance */ Profile.prototype["function"] = $util.emptyArray; /** * Profile stringTable. * @member {Array.<string>} stringTable * @memberof perftools.profiles.Profile * @instance */ Profile.prototype.stringTable = $util.emptyArray; /** * Profile dropFrames. * @member {number|Long} dropFrames * @memberof perftools.profiles.Profile * @instance */ Profile.prototype.dropFrames = $util.Long ? $util.Long.fromBits(0, 0, false) : 0; /** * Profile keepFrames. * @member {number|Long} keepFrames * @memberof perftools.profiles.Profile * @instance */ Profile.prototype.keepFrames = $util.Long ? $util.Long.fromBits(0, 0, false) : 0; /** * Profile timeNanos. * @member {number|Long} timeNanos * @memberof perftools.profiles.Profile * @instance */ Profile.prototype.timeNanos = $util.Long ? $util.Long.fromBits(0, 0, false) : 0; /** * Profile durationNanos. * @member {number|Long} durationNanos * @memberof perftools.profiles.Profile * @instance */ Profile.prototype.durationNanos = $util.Long ? $util.Long.fromBits(0, 0, false) : 0; /** * Profile periodType. * @member {perftools.profiles.IValueType|null|undefined} periodType * @memberof perftools.profiles.Profile * @instance */ Profile.prototype.periodType = null; /** * Profile period. * @member {number|Long} period * @memberof perftools.profiles.Profile * @instance */ Profile.prototype.period = $util.Long ? $util.Long.fromBits(0, 0, false) : 0; /** * Profile comment. * @member {Array.<number|Long>} comment * @memberof perftools.profiles.Profile * @instance */ Profile.prototype.comment = $util.emptyArray; /** * Profile defaultSampleType. * @member {number|Long} defaultSampleType * @memberof perftools.profiles.Profile * @instance */ Profile.prototype.defaultSampleType = $util.Long ? $util.Long.fromBits(0, 0, false) : 0; /** * Creates a new Profile instance using the specified properties. * @function create * @memberof perftools.profiles.Profile * @static * @param {perftools.profiles.IProfile=} [properties] Properties to set * @returns {perftools.profiles.Profile} Profile instance */ Profile.create = function create(properties) { return new Profile(properties); }; /** * Encodes the specified Profile message. Does not implicitly {@link perftools.profiles.Profile.verify|verify} messages. * @function encode * @memberof perftools.profiles.Profile * @static * @param {perftools.profiles.IProfile} message Profile message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ Profile.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); if (message.sampleType != null && message.sampleType.length) for (var i = 0; i < message.sampleType.length; ++i) $root.perftools.profiles.ValueType.encode(message.sampleType[i], writer.uint32(/* id 1, wireType 2 =*/ 10).fork()).ldelim(); if (message.sample != null && message.sample.length) for (var i = 0; i < message.sample.length; ++i) $root.perftools.profiles.Sample.encode(message.sample[i], writer.uint32(/* id 2, wireType 2 =*/ 18).fork()).ldelim(); if (message.mapping != null && message.mapping.length) for (var i = 0; i < message.mapping.length; ++i) $root.perftools.profiles.Mapping.encode(message.mapping[i], writer.uint32(/* id 3, wireType 2 =*/ 26).fork()).ldelim(); if (message.location != null && message.location.length) for (var i = 0; i < message.location.length; ++i) $root.perftools.profiles.Location.encode(message.location[i], writer.uint32(/* id 4, wireType 2 =*/ 34).fork()).ldelim(); if (message["function"] != null && message["function"].length) for (var i = 0; i < message["function"].length; ++i) $root.perftools.profiles.Function.encode(message["function"][i], writer.uint32(/* id 5, wireType 2 =*/ 42).fork()).ldelim(); if (message.stringTable != null && message.stringTable.length) for (var i = 0; i < message.stringTable.length; ++i) writer.uint32(/* id 6, wireType 2 =*/ 50).string(message.stringTable[i]); if (message.dropFrames != null && Object.hasOwnProperty.call(message, "dropFrames")) writer.uint32(/* id 7, wireType 0 =*/ 56).int64(message.dropFrames); if (message.keepFrames != null && Object.hasOwnProperty.call(message, "keepFrames")) writer.uint32(/* id 8, wireType 0 =*/ 64).int64(message.keepFrames); if (message.timeNanos != null && Object.hasOwnProperty.call(message, "timeNanos")) writer.uint32(/* id 9, wireType 0 =*/ 72).int64(message.timeNanos); if (message.durationNanos != null && Object.hasOwnProperty.call(message, "durationNanos")) writer.uint32(/* id 10, wireType 0 =*/ 80).int64(message.durationNanos); if (message.periodType != null && Object.hasOwnProperty.call(message, "periodType")) $root.perftools.profiles.ValueType.encode(message.periodType, writer.uint32(/* id 11, wireType 2 =*/ 90).fork()).ldelim(); if (message.period != null && Object.hasOwnProperty.call(message, "period")) writer.uint32(/* id 12, wireType 0 =*/ 96).int64(message.period); if (message.comment != null && message.comment.length) { writer.uint32(/* id 13, wireType 2 =*/ 106).fork(); for (var i = 0; i < message.comment.length; ++i) writer.int64(message.comment[i]); writer.ldelim(); } if (message.defaultSampleType != null && Object.hasOwnProperty.call(message, "defaultSampleType")) writer.uint32(/* id 14, wireType 0 =*/ 112).int64(message.defaultSampleType); return writer; }; /** * Encodes the specified Profile message, length delimited. Does not implicitly {@link perftools.profiles.Profile.verify|verify} messages. * @function encodeDelimited * @memberof perftools.profiles.Profile * @static * @param {perftools.profiles.IProfile} message Profile message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ Profile.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** * Decodes a Profile message from the specified reader or buffer. * @function decode * @memberof perftools.profiles.Profile * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand * @returns {perftools.profiles.Profile} Profile * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ Profile.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.perftools.profiles.Profile(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: if (!(message.sampleType && message.sampleType.length)) message.sampleType = []; message.sampleType.push($root.perftools.profiles.ValueType.decode(reader, reader.uint32())); break; case 2: if (!(message.sample && message.sample.length)) message.sample = []; message.sample.push($root.perftools.profiles.Sample.decode(reader, reader.uint32())); break; case 3: if (!(message.mapping && message.mapping.length)) message.mapping = []; message.mapping.push($root.perftools.profiles.Mapping.decode(reader, reader.uint32())); break; case 4: if (!(message.location && message.location.length)) message.location = []; message.location.push($root.perftools.profiles.Location.decode(reader, reader.uint32())); break; case 5: if (!(message["function"] && message["function"].length)) message["function"] = []; message["function"].push($root.perftools.profiles.Function.decode(reader, reader.uint32())); break; case 6: if (!(message.stringTable && message.stringTable.length)) message.stringTable = []; message.stringTable.push(reader.string()); break; case 7: message.dropFrames = reader.int64(); break; case 8: message.keepFrames = reader.int64(); break; case 9: message.timeNanos = reader.int64(); break; case 10: message.durationNanos = reader.int64(); break; case 11: message.periodType = $root.perftools.profiles.ValueType.decode(reader, reader.uint32()); break; case 12: message.period = reader.int64(); break; case 13: if (!(message.comment && message.comment.length)) message.comment = []; if ((tag & 7) === 2) { var end2 = reader.uint32() + reader.pos; while (reader.pos < end2) message.comment.push(reader.int64()); } else message.comment.push(reader.int64()); break; case 14: message.defaultSampleType = reader.int64(); break; default: reader.skipType(tag & 7); break; } } return message; }; /** * Decodes a Profile message from the specified reader or buffer, length delimited. * @function decodeDelimited * @memberof perftools.profiles.Profile * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @returns {perftools.profiles.Profile} Profile * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ Profile.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** * Verifies a Profile message. * @function verify * @memberof perftools.profiles.Profile * @static * @param {Object.<string,*>} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ Profile.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; if (message.sampleType != null && message.hasOwnProperty("sampleType")) { if (!Array.isArray(message.sampleType)) return "sampleType: array expected"; for (var i = 0; i < message.sampleType.length; ++i) { var error = $root.perftools.profiles.ValueType.verify(message.sampleType[i]); if (error) return "sampleType." + error; } } if (message.sample != null && message.hasOwnProperty("sample")) { if (!Array.isArray(message.sample)) return "sample: array expected"; for (var i = 0; i < message.sample.length; ++i) { var error = $root.perftools.profiles.Sample.verify(message.sample[i]); if (error) return "sample." + error; } } if (message.mapping != null && message.hasOwnProperty("mapping")) { if (!Array.isArray(message.mapping)) return "mapping: array expected"; for (var i = 0; i < message.mapping.length; ++i) { var error = $root.perftools.profiles.Mapping.verify(message.mapping[i]); if (error) return "mapping." + error; } } if (message.location != null && message.hasOwnProperty("location")) { if (!Array.isArray(message.location)) return "location: array expected"; for (var i = 0; i < message.location.length; ++i) { var error = $root.perftools.profiles.Location.verify(message.location[i]); if (error) return "location." + error; } } if (message["function"] != null && message.hasOwnProperty("function")) { if (!Array.isArray(message["function"])) return "function: array expected"; for (var i = 0; i < message["function"].length; ++i) { var error = $root.perftools.profiles.Function.verify(message["function"][i]); if (error) return "function." + error; } } if (message.stringTable != null && message.hasOwnProperty("stringTable")) { if (!Array.isArray(message.stringTable)) return "stringTable: array expected"; for (var i = 0; i < message.stringTable.length; ++i) if (!$util.isString(message.stringTable[i])) return "stringTable: string[] expected"; } if (message.dropFrames != null && message.hasOwnProperty("dropFrames")) if (!$util.isInteger(message.dropFrames) && !(message.dropFrames && $util.isInteger(message.dropFrames.low) && $util.isInteger(message.dropFrames.high))) return "dropFrames: integer|Long expected"; if (message.keepFrames != null && message.hasOwnProperty("keepFrames")) if (!$util.isInteger(message.keepFrames) && !(message.keepFrames && $util.isInteger(message.keepFrames.low) && $util.isInteger(message.keepFrames.high))) return "keepFrames: integer|Long expected"; if (message.timeNanos != null && message.hasOwnProperty("timeNanos")) if (!$util.isInteger(message.timeNanos) && !(message.timeNanos && $util.isInteger(message.timeNanos.low) && $util.isInteger(message.timeNanos.high))) return "timeNanos: integer|Long expected"; if (message.durationNanos != null && message.hasOwnProperty("durationNanos")) if (!$util.isInteger(message.durationNanos) && !(message.durationNanos && $util.isInteger(message.durationNanos.low) && $util.isInteger(message.durationNanos.high))) return "durationNanos: integer|Long expected"; if (message.periodType != null && message.hasOwnProperty("periodType")) { var error = $root.perftools.profiles.ValueType.verify(message.periodType); if (error) return "periodType." + error; } if (message.period != null && message.hasOwnProperty("period")) if (!$util.isInteger(message.period) && !(message.period && $util.isInteger(message.period.low) && $util.isInteger(message.period.high))) return "period: integer|Long expected"; if (message.comment != null && message.hasOwnProperty("comment")) { if (!Array.isArray(message.comment)) return "comment: array expected"; for (var i = 0; i < message.comment.length; ++i) if (!$util.isInteger(message.comment[i]) && !(message.comment[i] && $util.isInteger(message.comment[i].low) && $util.isInteger(message.comment[i].high))) return "comment: integer|Long[] expected"; } if (message.defaultSampleType != null && message.hasOwnProperty("defaultSampleType")) if (!$util.isInteger(message.defaultSampleType) && !(message.defaultSampleType && $util.isInteger(message.defaultSampleType.low) && $util.isInteger(message.defaultSampleType.high))) return "defaultSampleType: integer|Long expected"; return null; }; /** * Creates a Profile message from a plain object. Also converts values to their respective internal types. * @function fromObject * @memberof perftools.profiles.Profile * @static * @param {Object.<string,*>} object Plain object * @returns {perftools.profiles.Profile} Profile */ Profile.fromObject = function fromObject(object) { if (object instanceof $root.perftools.profiles.Profile) return object; var message = new $root.perftools.profiles.Profile(); if (object.sampleType) { if (!Array.isArray(object.sampleType)) throw TypeError(".perftools.profiles.Profile.sampleType: array expected"); message.sampleType = []; for (var i = 0; i < object.sampleType.length; ++i) { if (typeof object.sampleType[i] !== "object") throw TypeError(".perftools.profiles.Profile.sampleType: object expected"); message.sampleType[i] = $root.perftools.profiles.ValueType.fromObject(object.sampleType[i]); } } if (object.sample) { if (!Array.isArray(object.sample)) throw TypeError(".perftools.profiles.Profile.sample: array expected"); message.sample = []; for (var i = 0; i < object.sample.length; ++i) { if (typeof object.sample[i] !== "object") throw TypeError(".perftools.profiles.Profile.sample: object expected"); message.sample[i] = $root.perftools.profiles.Sample.fromObject(object.sample[i]); } } if (object.mapping) { if (!Array.isArray(object.mapping)) throw TypeError(".perftools.profiles.Profile.mapping: array expected"); message.mapping = []; for (var i = 0; i < object.mapping.length; ++i) { if (typeof object.mapping[i] !== "object") throw TypeError(".perftools.profiles.Profile.mapping: object expected"); message.mapping[i] = $root.perftools.profiles.Mapping.fromObject(object.mapping[i]); } } if (object.location) { if (!Array.isArray(object.location)) throw TypeError(".perftools.profiles.Profile.location: array expected"); message.location = []; for (var i = 0; i < object.location.length; ++i) { if (typeof object.location[i] !== "object") throw TypeError(".perftools.profiles.Profile.location: object expected"); message.location[i] = $root.perftools.profiles.Location.fromObject(object.location[i]); } } if (object["function"]) { if (!Array.isArray(object["function"])) throw TypeError(".perftools.profiles.Profile.function: array expected"); message["function"] = []; for (var i = 0; i < object["function"].length; ++i) { if (typeof object["function"][i] !== "object") throw TypeError(".perftools.profiles.Profile.function: object expected"); message["function"][i] = $root.perftools.profiles.Function.fromObject(object["function"][i]); } } if (object.stringTable) { if (!Array.isArray(object.stringTable)) throw TypeError(".perftools.profiles.Profile.stringTable: array expected"); message.stringTable = []; for (var i = 0; i < object.stringTable.length; ++i) message.stringTable[i] = String(object.stringTable[i]); } if (object.dropFrames != null) if ($util.Long) (message.dropFrames = $util.Long.fromValue(object.dropFrames)).unsigned = false; else if (typeof object.dropFrames === "string") message.dropFrames = parseInt(object.dropFrames, 10); else if (typeof object.dropFrames === "number") message.dropFrames = object.dropFrames; else if (typeof object.dropFrames === "object") message.dropFrames = new $util.LongBits(object.dropFrames.low >>> 0, object.dropFrames.high >>> 0).toNumber(); if (object.keepFrames != null) if ($util.Long) (message.keepFrames = $util.Long.fromValue(object.keepFrames)).unsigned = false; else if (typeof object.keepFrames === "string") message.keepFrames = parseInt(object.keepFrames, 10); else if (typeof object.keepFrames === "number") message.keepFrames = object.keepFrames; else if (typeof object.keepFrames === "object") message.keepFrames = new $util.LongBits(object.keepFrames.low >>> 0, object.keepFrames.high >>> 0).toNumber(); if (object.timeNanos != null) if ($util.Long) (message.timeNanos = $util.Long.fromValue(object.timeNanos)).unsigned = false; else if (typeof object.timeNanos === "string") message.timeNanos = parseInt(object.timeNanos, 10); else if (typeof object.timeNanos === "number") message.timeNanos = object.timeNanos; else if (typeof object.timeNanos === "object") message.timeNanos = new $util.LongBits(object.timeNanos.low >>> 0, object.timeNanos.high >>> 0).toNumber(); if (object.durationNanos != null) if ($util.Long) (message.durationNanos = $util.Long.fromValue(object.durationNanos)).unsigned = false; else if (typeof object.durationNanos === "string") message.durationNanos = parseInt(object.durationNanos, 10); else if (typeof object.durationNanos === "number") message.durationNanos = object.durationNanos; else if (typeof object.durationNanos === "object") message.durationNanos = new $util.LongBits(object.durationNanos.low >>> 0, object.durationNanos.high >>> 0).toNumber(); if (object.periodType != null) { if (typeof object.periodType !== "object") throw TypeError(".perftools.profiles.Profile.periodType: object expected"); message.periodType = $root.perftools.profiles.ValueType.fromObject(object.periodType); } if (object.period != null) if ($util.Long) (message.period = $util.Long.fromValue(object.period)).unsigned = false; else if (typeof object.period === "string") message.period = parseInt(object.period, 10); else if (typeof object.period === "number") message.period = object.period; else if (typeof object.period === "object") message.period = new $util.LongBits(object.period.low >>> 0, object.period.high >>> 0).toNumber(); if (object.comment) { if (!Array.isArray(object.comment)) throw TypeError(".perftools.profiles.Profile.comment: array expected"); message.comment = []; for (var i = 0; i < object.comment.length; ++i) if ($util.Long) (message.comment[i] = $util.Long.fromValue(object.comment[i])).unsigned = false; else if (typeof object.comment[i] === "string") message.comment[i] = parseInt(object.comment[i], 10); else if (typeof object.comment[i] === "number") message.comment[i] = object.comment[i]; else if (typeof object.comment[i] === "object") message.comment[i] = new $util.LongBits(object.comment[i].low >>> 0, object.comment[i].high >>> 0).toNumber(); } if (object.defaultSampleType != null) if ($util.Long) (message.defaultSampleType = $util.Long.fromValue(object.defaultSampleType)).unsigned = false; else if (typeof object.defaultSampleType === "string") message.defaultSampleType = parseInt(object.defaultSampleType, 10); else if (typeof object.defaultSampleType === "number") message.defaultSampleType = object.defaultSampleType; else if (typeof object.defaultSampleType === "object") message.defaultSampleType = new $util.LongBits(object.defaultSampleType.low >>> 0, object.defaultSampleType.high >>> 0).toNumber(); return message; }; /** * Creates a plain object from a Profile message. Also converts values to other types if specified. * @function toObject * @memberof perftools.profiles.Profile * @static * @param {perftools.profiles.Profile} message Profile * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.<string,*>} Plain object */ Profile.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.arrays || options.defaults) { object.sampleType = []; object.sample = []; object.mapping = []; object.location = []; object["function"] = []; object.stringTable = []; object.comment = []; } if (options.defaults) { if ($util.Long) { var long = new $util.Long(0, 0, false); object.dropFrames = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; } else object.dropFrames = options.longs === String ? "0" : 0; if ($util.Long) { var long = new $util.Long(0, 0, false); object.keepFrames = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; } else object.keepFrames = options.longs === String ? "0" : 0; if ($util.Long) { var long = new $util.Long(0, 0, false); object.timeNanos = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; } else object.timeNanos = options.longs === String ? "0" : 0; if ($util.Long) { var long = new $util.Long(0, 0, false); object.durationNanos = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; } else object.durationNanos = options.longs === String ? "0" : 0; object.periodType = null; if ($util.Long) { var long = new $util.Long(0, 0, false); object.period = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; } else object.period = options.longs === String ? "0" : 0; if ($util.Long) { var long = new $util.Long(0, 0, false); object.defaultSampleType = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; } else object.defaultSampleType = options.longs === String ? "0" : 0; } if (message.sampleType && message.sampleType.length) { object.sampleType = []; for (var j = 0; j < message.sampleType.length; ++j) object.sampleType[j] = $root.perftools.profiles.ValueType.toObject(message.sampleType[j], options); } if (message.sample && message.sample.length) { object.sample = []; for (var j = 0; j < message.sample.length; ++j) object.sample[j] = $root.perftools.profiles.Sample.toObject(message.sample[j], options); } if (message.mapping && message.mapping.length) { object.mapping = []; for (var j = 0; j < message.mapping.length; ++j) object.mapping[j] = $root.perftools.profiles.Mapping.toObject(message.mapping[j], options); } if (message.location && message.location.length) { object.location = []; for (var j = 0; j < message.location.length; ++j) object.location[j] = $root.perftools.profiles.Location.toObject(message.location[j], options); } if (message["function"] && message["function"].length) { object["function"] = []; for (var j = 0; j < message["function"].length; ++j) object["function"][j] = $root.perftools.profiles.Function.toObject(message["function"][j], options); } if (message.stringTable && message.stringTable.length) { object.stringTable = []; for (var j = 0; j < message.stringTable.length; ++j) object.stringTable[j] = message.stringTable[j]; } if (message.dropFrames != null && message.hasOwnProperty("dropFrames")) if (typeof message.dropFrames === "number") object.dropFrames = options.longs === String ? String(message.dropFrames) : message.dropFrames; else object.dropFrames = options.longs === String ? $util.Long.prototype.toString.call(message.dropFrames) : options.longs === Number ? new $util.LongBits(message.dropFrames.low >>> 0, message.dropFrames.high >>> 0).toNumber() : message.dropFrames; if (message.keepFrames != null && message.hasOwnProperty("keepFrames")) if (typeof message.keepFrames === "number") object.keepFrames = options.longs === String ? String(message.keepFrames) : message.keepFrames; else object.keepFrames = options.longs === String ? $util.Long.prototype.toString.call(message.keepFrames) : options.longs === Number ? new $util.LongBits(message.keepFrames.low >>> 0, message.keepFrames.high >>> 0).toNumber() : message.keepFrames; if (message.timeNanos != null && message.hasOwnProperty("timeNanos")) if (typeof message.timeNanos === "number") object.timeNanos = options.longs === String ? String(message.timeNanos) : message.timeNanos; else object.timeNanos = options.longs === String ? $util.Long.prototype.toString.call(message.timeNanos) : options.longs === Number ? new $util.LongBits(message.timeNanos.low >>> 0, message.timeNanos.high >>> 0).toNumber() : message.timeNanos; if (message.durationNanos != null && message.hasOwnProperty("durationNanos")) if (typeof message.durationNanos === "number") object.durationNanos = options.longs === String ? String(message.durationNanos) : message.durationNanos; else object.durationNanos = options.longs === String ? $util.Long.prototype.toString.call(message.durationNanos) : options.longs === Number ? new $util.LongBits(message.durationNanos.low >>> 0, message.durationNanos.high >>> 0).toNumber() : message.durationNanos; if (message.periodType != null && message.hasOwnProperty("periodType")) object.periodType = $root.perftools.profiles.ValueType.toObject(message.periodType, options); if (message.period != null && message.hasOwnProperty("period")) if (typeof message.period === "number") object.period = options.longs === String ? String(message.period) : message.period; else object.period = options.longs === String ? $util.Long.prototype.toString.call(message.period) : options.longs === Number ? new $util.LongBits(message.period.low >>> 0, message.period.high >>> 0).toNumber() : message.period; if (message.comment && message.comment.length) { object.comment = []; for (var j = 0; j < message.comment.length; ++j) if (typeof message.comment[j] === "number") object.comment[j] = options.longs === String ? String(message.comment[j]) : message.comment[j]; else object.comment[j] = options.longs === String ? $util.Long.prototype.toString.call(message.comment[j]) : options.longs === Number ? new $util.LongBits(message.comment[j].low >>> 0, message.comment[j].high >>> 0).toNumber() : message.comment[j]; } if (message.defaultSampleType != null && message.hasOwnProperty("defaultSampleType")) if (typeof message.defaultSampleType === "number") object.defaultSampleType = options.longs === String ? String(message.defaultSampleType) : message.defaultSampleType; else object.defaultSampleType = options.longs === String ? $util.Long.prototype.toString.call(message.defaultSampleType) : options.longs === Number ? new $util.LongBits(message.defaultSampleType.low >>> 0, message.defaultSampleType.high >>> 0).toNumber() : message.defaultSampleType; return object; }; /** * Converts this Profile to JSON. * @function toJSON * @memberof perftools.profiles.Profile * @instance * @returns {Object.<string,*>} JSON object */ Profile.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; return Profile; })(); profiles.ValueType = (function () { /** * Properties of a ValueType. * @memberof perftools.profiles * @interface IValueType * @property {number|Long|null} [type] ValueType type * @property {number|Long|null} [unit] ValueType unit */ /** * Constructs a new ValueType. * @memberof perftools.profiles * @classdesc Represents a ValueType. * @implements IValueType * @constructor * @param {perftools.profiles.IValueType=} [properties] Properties to set */ function ValueType(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]]; } /** * ValueType type. * @member {number|Long} type * @memberof perftools.profiles.ValueType * @instance */ ValueType.prototype.type = $util.Long ? $util.Long.fromBits(0, 0, false) : 0; /** * ValueType unit. * @member {number|Long} unit * @memberof perftools.profiles.ValueType * @instance */ ValueType.prototype.unit = $util.Long ? $util.Long.fromBits(0, 0, false) : 0; /** * Creates a new ValueType instance using the specified properties. * @function create * @memberof perftools.profiles.ValueType * @static * @param {perftools.profiles.IValueType=} [properties] Properties to set * @returns {perftools.profiles.ValueType} ValueType instance */ ValueType.create = function create(properties) { return new ValueType(properties); }; /** * Encodes the specified ValueType message. Does not implicitly {@link perftools.profiles.ValueType.verify|verify} messages. * @function encode * @memberof perftools.profiles.ValueType * @static * @param {perftools.profiles.IValueType} message ValueType message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ ValueType.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); if (message.type != null && Object.hasOwnProperty.call(message, "type")) writer.uint32(/* id 1, wireType 0 =*/ 8).int64(message.type); if (message.unit != null && Object.hasOwnProperty.call(message, "unit")) writer.uint32(/* id 2, wireType 0 =*/ 16).int64(message.unit); return writer; }; /** * Encodes the specified ValueType message, length delimited. Does not implicitly {@link perftools.profiles.ValueType.verify|verify} messages. * @function encodeDelimited * @memberof perftools.profiles.ValueType * @static * @param {perftools.profiles.IValueType} message ValueType message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ ValueType.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** * Decodes a ValueType message from the specified reader or buffer. * @function decode * @memberof perftools.profiles.ValueType * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand * @returns {perftools.profiles.ValueType} ValueType * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ ValueType.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.perftools.profiles.ValueType(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: message.type = reader.int64(); break; case 2: message.unit = reader.int64(); break; default: reader.skipType(tag & 7); break; } } return message; }; /** * Decodes a ValueType message from the specified reader or buffer, length delimited. * @function decodeDelimited * @memberof perftools.profiles.ValueType * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @returns {perftools.profiles.ValueType} ValueType * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ ValueType.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** * Verifies a ValueType message. * @function verify * @memberof perftools.profiles.ValueType * @static * @param {Object.<string