From 6b4b7f7c43f7f450b615bf46635a817df708517e Mon Sep 17 00:00:00 2001 From: Gal Kleinman <33281963+galkleinman@users.noreply.github.com> Date: Sat, 18 Feb 2023 20:55:18 -0800 Subject: [PATCH] fix(integration): integration test dsl with test servers (#4) --- .github/workflows/README | 2 +- .prettierignore | 1 + package.json | 2 +- packages/expect-opentelemetry/src/index.js | 28 +- ...-request.ts => to-receive-http-request.ts} | 13 +- .../matchers/service/to-send-http-request.ts | 13 +- .../src/{options.js => options.ts} | 4 +- .../src/resources/http-request.ts | 33 +- .../src/resources/microservice.ts | 8 - .../src/resources/service.ts | 8 + .../expect-opentelemetry/src/trace.test.ts | 16 +- packages/expect-opentelemetry/src/trace.ts | 30 +- packages/expect-opentelemetry/src/utils.js | 38 - packages/expect-opentelemetry/src/utils.ts | 74 + packages/jest-environment-otel/src/global.ts | 2 +- packages/test-servers/src/tracing.ts | 2 +- proto/index.d.ts | 3269 +++--- proto/index.js | 9222 +++++++++-------- 18 files changed, 7019 insertions(+), 5746 deletions(-) create mode 100644 .prettierignore rename packages/expect-opentelemetry/src/matchers/service/{to-recieve-http-request.ts => to-receive-http-request.ts} (51%) rename packages/expect-opentelemetry/src/{options.js => options.ts} (65%) delete mode 100644 packages/expect-opentelemetry/src/resources/microservice.ts create mode 100644 packages/expect-opentelemetry/src/resources/service.ts delete mode 100644 packages/expect-opentelemetry/src/utils.js create mode 100644 packages/expect-opentelemetry/src/utils.ts diff --git a/.github/workflows/README b/.github/workflows/README index 1bc7320..90def46 100644 --- a/.github/workflows/README +++ b/.github/workflows/README @@ -14,4 +14,4 @@ If you get an error like: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running? ``` -Run `export DOCKER_HOST=$(docker context inspect --format '{{.Endpoints.docker.Host}}')` and then re-run `act` as written above. \ No newline at end of file +Run `export DOCKER_HOST=$(docker context inspect --format '{{.Endpoints.docker.Host}}')` and then re-run `act` as written above. diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 0000000..880b22f --- /dev/null +++ b/.prettierignore @@ -0,0 +1 @@ +*.proto \ No newline at end of file diff --git a/package.json b/package.json index 0b475f8..138835d 100644 --- a/package.json +++ b/package.json @@ -38,8 +38,8 @@ "@opentelemetry/semantic-conventions": "^1.9.1", "@opentelemetry/tracing": "^0.24.0", "@swc/jest": "^0.2.24", - "deep-equal": "^2.2.0", "axios": "^1.3.3", + "deep-equal": "^2.2.0", "eslint-config-prettier": "^8.6.0", "prettier": "^2.8.4" } diff --git a/packages/expect-opentelemetry/src/index.js b/packages/expect-opentelemetry/src/index.js index a929eb1..2f8d22f 100644 --- a/packages/expect-opentelemetry/src/index.js +++ b/packages/expect-opentelemetry/src/index.js @@ -1,15 +1,18 @@ /* eslint-disable no-use-before-define, no-restricted-syntax, no-await-in-loop */ import { getInstanceType } from './utils'; -import { toRecieveHttpRequest } from './matchers/toRecieveHttpRequest'; -import { toSendHttpRequest } from './matchers/toSendHttpRequest'; +import { toReceiveHttpRequest } from './matchers/service/to-receive-http-request'; +import { toSendHttpRequest } from './matchers/service/to-send-http-request'; export { setDefaultOptions, getDefaultOptions } from './options'; -const spanMatchers = {}; +const spanMatchers = { + not: {}, +}; const serviceMatchers = { - toRecieveHttpRequest, + toReceiveHttpRequest, toSendHttpRequest, + not: {}, }; function createMatcher(matcher, page) { @@ -32,14 +35,16 @@ function internalExpect(type, matchers) { not: {}, }; - Object.keys(matchers).forEach((key) => { - if (key === 'not') return; - expectation[key] = createMatcher(matchers[key], type); - }); + matchers && + Object.keys(matchers).forEach((key) => { + if (key === 'not') return; + expectation[key] = createMatcher(matchers[key], type); + }); - Object.keys(matchers.not).forEach((key) => { - expectation.not[key] = createMatcher(matchers.not[key], type); - }); + matchers?.not && + Object.keys(matchers.not).forEach((key) => { + expectation.not[key] = createMatcher(matchers.not[key], type); + }); return expectation; } @@ -60,6 +65,7 @@ if (typeof global.expect !== 'undefined') { const originalExpect = global.expect; global.expect = (actual, ...args) => { const type = getInstanceType(actual); + if (type) { const matchers = expectOpenTelemetry(actual); const jestMatchers = originalExpect(actual, ...args); diff --git a/packages/expect-opentelemetry/src/matchers/service/to-recieve-http-request.ts b/packages/expect-opentelemetry/src/matchers/service/to-receive-http-request.ts similarity index 51% rename from packages/expect-opentelemetry/src/matchers/service/to-recieve-http-request.ts rename to packages/expect-opentelemetry/src/matchers/service/to-receive-http-request.ts index 5f21306..2e21d69 100644 --- a/packages/expect-opentelemetry/src/matchers/service/to-recieve-http-request.ts +++ b/packages/expect-opentelemetry/src/matchers/service/to-receive-http-request.ts @@ -1,15 +1,18 @@ -import { SpanKind } from '@opentelemetry/api'; import { SemanticAttributes } from '@opentelemetry/semantic-conventions'; import { HttpRequest } from '../../resources/http-request'; -import { Microservice } from '../../resources/microservice'; +import { Service } from '../../resources/service'; +import { opentelemetry } from '../../../../../proto'; -export function toRecieveHttpCall(service: Microservice): HttpRequest { +export function toReceiveHttpRequest(service: Service): HttpRequest { const { name: serviceName, spans } = service; - const spanKind = SpanKind.SERVER; + const spanKind = opentelemetry.proto.trace.v1.Span.SpanKind.SPAN_KIND_SERVER; const filteredSpans = spans.filter((span) => { return ( - span.kind === spanKind && span.attributes[SemanticAttributes.HTTP_METHOD] + span.kind === spanKind && + span.attributes?.find((attribute) => { + return attribute.key === SemanticAttributes.HTTP_METHOD; + }) ); }); diff --git a/packages/expect-opentelemetry/src/matchers/service/to-send-http-request.ts b/packages/expect-opentelemetry/src/matchers/service/to-send-http-request.ts index 98fc9dd..1a001ad 100644 --- a/packages/expect-opentelemetry/src/matchers/service/to-send-http-request.ts +++ b/packages/expect-opentelemetry/src/matchers/service/to-send-http-request.ts @@ -1,15 +1,18 @@ -import { SpanKind } from '@opentelemetry/api'; import { SemanticAttributes } from '@opentelemetry/semantic-conventions'; import { HttpRequest } from '../../resources/http-request'; -import { Microservice } from '../../resources/microservice'; +import { Service } from '../../resources/service'; +import { opentelemetry } from '../../../../../proto'; -export function toRecieveHttpCall(service: Microservice): HttpRequest { +export function toSendHttpRequest(service: Service): HttpRequest { const { name: serviceName, spans } = service; - const spanKind = SpanKind.CLIENT; + const spanKind = opentelemetry.proto.trace.v1.Span.SpanKind.SPAN_KIND_CLIENT; const filteredSpans = spans.filter((span) => { return ( - span.kind === spanKind && span.attributes[SemanticAttributes.HTTP_METHOD] + span.kind === spanKind && + span.attributes?.find((attribute) => { + return attribute.key === SemanticAttributes.HTTP_METHOD; + }) ); }); diff --git a/packages/expect-opentelemetry/src/options.js b/packages/expect-opentelemetry/src/options.ts similarity index 65% rename from packages/expect-opentelemetry/src/options.js rename to packages/expect-opentelemetry/src/options.ts index 9f1026f..5368587 100644 --- a/packages/expect-opentelemetry/src/options.js +++ b/packages/expect-opentelemetry/src/options.ts @@ -1,6 +1,6 @@ let defaultOptionsValue = { timeout: 500 }; -export const setDefaultOptions = (options) => { +export const setDefaultOptions = (options: any) => { defaultOptionsValue = options; }; @@ -8,7 +8,7 @@ export const getDefaultOptions = () => { return defaultOptionsValue; }; -export const defaultOptions = (options) => ({ +export const defaultOptions = (options: any) => ({ ...getDefaultOptions(), ...options, }); diff --git a/packages/expect-opentelemetry/src/resources/http-request.ts b/packages/expect-opentelemetry/src/resources/http-request.ts index 065c5e3..c09506e 100644 --- a/packages/expect-opentelemetry/src/resources/http-request.ts +++ b/packages/expect-opentelemetry/src/resources/http-request.ts @@ -1,19 +1,20 @@ -import { SpanKind } from '@opentelemetry/api'; import { SemanticAttributes } from '@opentelemetry/semantic-conventions'; -import { ReadableSpan } from '@opentelemetry/tracing'; import deepEqual from 'deep-equal'; +import { opentelemetry } from '../../../../proto'; export class HttpRequest { constructor( - readonly spans: ReadableSpan[], + readonly spans: opentelemetry.proto.trace.v1.ISpan[], private readonly serviceName: string, - private readonly spanKind: SpanKind, + private readonly spanKind: opentelemetry.proto.trace.v1.Span.SpanKind, ) {} withBody(body: object) { const filteredSpans = this.spans.filter((span) => { const jsonBody = JSON.parse( - span.attributes['http.request.body'] as string, + span.attributes?.find( + (attribute) => attribute.key === 'http.request.body', + )?.value?.stringValue || '', ); return deepEqual(jsonBody, body); @@ -30,7 +31,11 @@ export class HttpRequest { withHeader(key: string, value: string) { const filteredSpans = this.spans.filter((span) => { - return span.attributes[`http.request.header.${key}`] === value; + return span.attributes?.find( + (attribute) => + attribute.key === `http.request.header.${key}` && + attribute.value?.stringValue === value, + ); }); if (filteredSpans.length === 0) { @@ -44,7 +49,11 @@ export class HttpRequest { ofMethod(method: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH') { const filteredSpans = this.spans.filter((span) => { - return span.attributes[SemanticAttributes.HTTP_METHOD] === method; + return span.attributes?.find( + (attribute) => + attribute.key === SemanticAttributes.HTTP_METHOD && + attribute.value?.stringValue === method, + ); }); if (filteredSpans.length === 0) { @@ -58,7 +67,11 @@ export class HttpRequest { withStatusCode(code: number) { const filteredSpans = this.spans.filter((span) => { - return span.attributes[SemanticAttributes.HTTP_STATUS_CODE] === code; + return span.attributes?.find( + (attribute) => + attribute.key === SemanticAttributes.HTTP_STATUS_CODE && + attribute.value?.intValue === code, + ); }); if (filteredSpans.length === 0) { @@ -72,9 +85,9 @@ export class HttpRequest { private serviceErrorBySpanKind() { switch (this.spanKind) { - case SpanKind.CLIENT: + case opentelemetry.proto.trace.v1.Span.SpanKind.SPAN_KIND_CLIENT: return `was sent by ${this.serviceName}`; - case SpanKind.SERVER: + case opentelemetry.proto.trace.v1.Span.SpanKind.SPAN_KIND_SERVER: return `was received by ${this.serviceName}`; default: return `was found for ${this.serviceName}`; diff --git a/packages/expect-opentelemetry/src/resources/microservice.ts b/packages/expect-opentelemetry/src/resources/microservice.ts deleted file mode 100644 index 99785ef..0000000 --- a/packages/expect-opentelemetry/src/resources/microservice.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { ReadableSpan } from '@opentelemetry/tracing'; - -export class Microservice { - constructor( - public readonly name: string, - public readonly spans: ReadableSpan[], - ) {} -} diff --git a/packages/expect-opentelemetry/src/resources/service.ts b/packages/expect-opentelemetry/src/resources/service.ts new file mode 100644 index 0000000..0c8c136 --- /dev/null +++ b/packages/expect-opentelemetry/src/resources/service.ts @@ -0,0 +1,8 @@ +import { opentelemetry } from '../../../../proto'; + +export class Service { + constructor( + public readonly name: string, + public readonly spans: opentelemetry.proto.trace.v1.ISpan[], + ) {} +} diff --git a/packages/expect-opentelemetry/src/trace.test.ts b/packages/expect-opentelemetry/src/trace.test.ts index a8ab41c..d60550e 100644 --- a/packages/expect-opentelemetry/src/trace.test.ts +++ b/packages/expect-opentelemetry/src/trace.test.ts @@ -1,14 +1,14 @@ import axios from 'axios'; -import { trace } from './trace'; +import { traces } from './trace'; + +jest.setTimeout(30000); describe('trace', () => { it('should see orders-service calling emails-service', async () => { - const sequence = await trace(async () => - axios.post('http://localhost:3000/orders/create'), - ); - expect(1).toBe(1); - // expect(sequence.service('orders-service')) - // .toCall('emails-service') - // .withHttpBody({}); + const sequence = await traces(async () => { + await axios.post('http://localhost:3000/orders/create'); + }); + + expect(sequence.service('orders-service')).toSendHttpRequest(); }); }); diff --git a/packages/expect-opentelemetry/src/trace.ts b/packages/expect-opentelemetry/src/trace.ts index b17ebf1..0253d1b 100644 --- a/packages/expect-opentelemetry/src/trace.ts +++ b/packages/expect-opentelemetry/src/trace.ts @@ -1,16 +1,36 @@ import axios from 'axios'; import { setTimeout } from 'timers/promises'; +import { Service } from './resources/service'; +import { opentelemetry } from '../../../proto'; -export async function trace(fn: () => Promise) { +export async function traces(fn: () => Promise) { + await setTimeout(5000); await fn(); + await setTimeout(20000); const t = new Trace(); - await t.getTraces(); + await t.init(); return t; } export class Trace { - async getTraces() { - await setTimeout(2000); - return axios.get('http://localhost:4123/v1/traces'); + private tracesData: opentelemetry.proto.trace.v1.ITracesData | undefined; + + async init() { + const response = (await axios.get('http://localhost:4123/v1/traces')).data; + + this.tracesData = opentelemetry.proto.trace.v1.TracesData.decode(response); + } + + service(name: string): Service { + const serviceResourceSpans = this.tracesData?.resourceSpans?.find((rs) => + rs.resource?.attributes?.find( + (a) => a.key === 'service.name' && a.value?.stringValue === name, + ), + ); + + const serviceSpans = + serviceResourceSpans?.scopeSpans?.flatMap((ss) => ss.spans || []) || []; + + return new Service(name, serviceSpans); } } diff --git a/packages/expect-opentelemetry/src/utils.js b/packages/expect-opentelemetry/src/utils.js deleted file mode 100644 index 72a9ca0..0000000 --- a/packages/expect-opentelemetry/src/utils.js +++ /dev/null @@ -1,38 +0,0 @@ -export const getInstanceType = (instance) => { - if ( - instance?.constructor?.name && - ['Span', 'Service'].includes(instance.constructor.name) && - instance.$ - ) { - return instance.constructor.name; - } - - return null; -}; - -export const getContext = async (instance, pageFunction) => { - const type = getInstanceType(instance); - switch (type) { - case 'Span': - case 'Service': - return { - instance, - }; - default: - throw new Error(`${type} is not implemented`); - } -}; - -export const enhanceError = (error, message) => { - error.message = `${message}\n${error.message}`; - return error; -}; - -const isRegExp = (input) => - Object.prototype.toString.call(input) === '[object RegExp]'; - -export const expandSearchExpr = (expr) => { - if (isRegExp(expr)) return { text: null, regexp: expr.toString() }; - if (typeof expr === 'string') return { text: expr, regexp: null }; - return { text: null, regexp: null }; -}; diff --git a/packages/expect-opentelemetry/src/utils.ts b/packages/expect-opentelemetry/src/utils.ts new file mode 100644 index 0000000..6bb8412 --- /dev/null +++ b/packages/expect-opentelemetry/src/utils.ts @@ -0,0 +1,74 @@ +import { opentelemetry } from './../../../proto'; + +export const getInstanceType = (instance: any) => { + if ( + instance?.constructor?.name && + ['Span', 'Service'].includes(instance.constructor.name) + ) { + return instance.constructor.name; + } + + return null; +}; + +export const enhanceError = (error: any, message: string) => { + error.message = `${message}\n${error.message}`; + return error; +}; + +export function parseServerResponse( + data: any, +): opentelemetry.proto.trace.v1.TracesData { + const tracesBinary = Buffer.from(data.traces, 'base64'); + + return opentelemetry.proto.trace.v1.TracesData.decode(tracesBinary); +} + +export const generateStubData = () => { + const tracesData = opentelemetry.proto.trace.v1.TracesData.create(); + + tracesData.resourceSpans.push( + opentelemetry.proto.trace.v1.ResourceSpans.create({ + resource: opentelemetry.proto.resource.v1.Resource.create({ + attributes: [ + opentelemetry.proto.common.v1.KeyValue.create({ + key: 'service.name', + value: opentelemetry.proto.common.v1.AnyValue.create({ + stringValue: 'orders-service', + }), + }), + ], + }), + scopeSpans: [ + opentelemetry.proto.trace.v1.ScopeSpans.create({ + spans: [ + opentelemetry.proto.trace.v1.Span.create({ + traceId: Uint8Array.from(Buffer.from('AAAAAAAAAAAAAAAA', 'hex')), + spanId: Uint8Array.from(Buffer.from('BBBBBBBBBBBBBBBB', 'hex')), + name: 'orders-service', + kind: opentelemetry.proto.trace.v1.Span.SpanKind.SPAN_KIND_CLIENT, + startTimeUnixNano: 1630000000000000000, + endTimeUnixNano: 1630000000000000000, + attributes: [ + opentelemetry.proto.common.v1.KeyValue.create({ + key: 'http.method', + value: opentelemetry.proto.common.v1.AnyValue.create({ + stringValue: 'GET', + }), + }), + opentelemetry.proto.common.v1.KeyValue.create({ + key: 'http.url', + value: opentelemetry.proto.common.v1.AnyValue.create({ + stringValue: 'http://localhost:3000/orders', + }), + }), + ], + }), + ], + }), + ], + }), + ); + + return opentelemetry.proto.trace.v1.TracesData.encode(tracesData).finish(); +}; diff --git a/packages/jest-environment-otel/src/global.ts b/packages/jest-environment-otel/src/global.ts index ef9fdd3..d975749 100644 --- a/packages/jest-environment-otel/src/global.ts +++ b/packages/jest-environment-otel/src/global.ts @@ -19,7 +19,7 @@ export async function setup(jestConfig: JestConfig = {}) { } try { - await setupServer({ command: 'npm run start-otel-receiver' }); + await setupServer({ command: 'npm run start:otel-receiver' }); } catch (error: any) { if (error.code === ERROR_TIMEOUT) { console.log(''); diff --git a/packages/test-servers/src/tracing.ts b/packages/test-servers/src/tracing.ts index bd753a2..bb2e866 100644 --- a/packages/test-servers/src/tracing.ts +++ b/packages/test-servers/src/tracing.ts @@ -4,7 +4,7 @@ import { Resource } from '@opentelemetry/resources'; import { SemanticResourceAttributes } from '@opentelemetry/semantic-conventions'; import { httpInstrumentationConfig } from './otel-custom/http'; import { expressInstrumentationConfig } from './otel-custom/express'; -import { OTLPTraceExporter } from '@opentelemetry/exporter-trace-otlp-http'; +import { OTLPTraceExporter } from '@opentelemetry/exporter-trace-otlp-proto'; const traceExporter = new OTLPTraceExporter({ url: 'http://localhost:4123/v1/traces', diff --git a/proto/index.d.ts b/proto/index.d.ts index ec42411..6123ead 100644 --- a/proto/index.d.ts +++ b/proto/index.d.ts @@ -1,1542 +1,1749 @@ -import * as $protobuf from "protobufjs"; -import Long = require("long"); +import * as $protobuf from 'protobufjs'; +import Long = require('long'); /** Namespace opentelemetry. */ export namespace opentelemetry { + /** Namespace proto. */ + namespace proto { + /** Namespace trace. */ + namespace trace { + /** Namespace v1. */ + namespace v1 { + /** Properties of a TracesData. */ + interface ITracesData { + /** TracesData resourceSpans */ + resourceSpans?: opentelemetry.proto.trace.v1.IResourceSpans[] | null; + } + + /** Represents a TracesData. */ + class TracesData implements ITracesData { + /** + * Constructs a new TracesData. + * @param [properties] Properties to set + */ + constructor(properties?: opentelemetry.proto.trace.v1.ITracesData); + + /** TracesData resourceSpans. */ + public resourceSpans: opentelemetry.proto.trace.v1.IResourceSpans[]; + + /** + * Creates a new TracesData instance using the specified properties. + * @param [properties] Properties to set + * @returns TracesData instance + */ + public static create( + properties?: opentelemetry.proto.trace.v1.ITracesData, + ): opentelemetry.proto.trace.v1.TracesData; + + /** + * Encodes the specified TracesData message. Does not implicitly {@link opentelemetry.proto.trace.v1.TracesData.verify|verify} messages. + * @param message TracesData message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode( + message: opentelemetry.proto.trace.v1.ITracesData, + writer?: $protobuf.Writer, + ): $protobuf.Writer; + + /** + * Encodes the specified TracesData message, length delimited. Does not implicitly {@link opentelemetry.proto.trace.v1.TracesData.verify|verify} messages. + * @param message TracesData message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited( + message: opentelemetry.proto.trace.v1.ITracesData, + writer?: $protobuf.Writer, + ): $protobuf.Writer; + + /** + * Decodes a TracesData message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns TracesData + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode( + reader: $protobuf.Reader | Uint8Array, + length?: number, + ): opentelemetry.proto.trace.v1.TracesData; + + /** + * Decodes a TracesData message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns TracesData + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited( + reader: $protobuf.Reader | Uint8Array, + ): opentelemetry.proto.trace.v1.TracesData; + + /** + * Verifies a TracesData message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): string | null; + + /** + * Creates a TracesData message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns TracesData + */ + public static fromObject(object: { + [k: string]: any; + }): opentelemetry.proto.trace.v1.TracesData; + + /** + * Creates a plain object from a TracesData message. Also converts values to other types if specified. + * @param message TracesData + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject( + message: opentelemetry.proto.trace.v1.TracesData, + options?: $protobuf.IConversionOptions, + ): { [k: string]: any }; + + /** + * Converts this TracesData to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for TracesData + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ResourceSpans. */ + interface IResourceSpans { + /** ResourceSpans resource */ + resource?: opentelemetry.proto.resource.v1.IResource | null; + + /** ResourceSpans scopeSpans */ + scopeSpans?: opentelemetry.proto.trace.v1.IScopeSpans[] | null; + + /** ResourceSpans schemaUrl */ + schemaUrl?: string | null; + } + + /** Represents a ResourceSpans. */ + class ResourceSpans implements IResourceSpans { + /** + * Constructs a new ResourceSpans. + * @param [properties] Properties to set + */ + constructor(properties?: opentelemetry.proto.trace.v1.IResourceSpans); + + /** ResourceSpans resource. */ + public resource?: opentelemetry.proto.resource.v1.IResource | null; + + /** ResourceSpans scopeSpans. */ + public scopeSpans: opentelemetry.proto.trace.v1.IScopeSpans[]; + + /** ResourceSpans schemaUrl. */ + public schemaUrl: string; + + /** + * Creates a new ResourceSpans instance using the specified properties. + * @param [properties] Properties to set + * @returns ResourceSpans instance + */ + public static create( + properties?: opentelemetry.proto.trace.v1.IResourceSpans, + ): opentelemetry.proto.trace.v1.ResourceSpans; + + /** + * Encodes the specified ResourceSpans message. Does not implicitly {@link opentelemetry.proto.trace.v1.ResourceSpans.verify|verify} messages. + * @param message ResourceSpans message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode( + message: opentelemetry.proto.trace.v1.IResourceSpans, + writer?: $protobuf.Writer, + ): $protobuf.Writer; + + /** + * Encodes the specified ResourceSpans message, length delimited. Does not implicitly {@link opentelemetry.proto.trace.v1.ResourceSpans.verify|verify} messages. + * @param message ResourceSpans message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited( + message: opentelemetry.proto.trace.v1.IResourceSpans, + writer?: $protobuf.Writer, + ): $protobuf.Writer; + + /** + * Decodes a ResourceSpans message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ResourceSpans + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode( + reader: $protobuf.Reader | Uint8Array, + length?: number, + ): opentelemetry.proto.trace.v1.ResourceSpans; + + /** + * Decodes a ResourceSpans message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ResourceSpans + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited( + reader: $protobuf.Reader | Uint8Array, + ): opentelemetry.proto.trace.v1.ResourceSpans; + + /** + * Verifies a ResourceSpans message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): string | null; + + /** + * Creates a ResourceSpans message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ResourceSpans + */ + public static fromObject(object: { + [k: string]: any; + }): opentelemetry.proto.trace.v1.ResourceSpans; + + /** + * Creates a plain object from a ResourceSpans message. Also converts values to other types if specified. + * @param message ResourceSpans + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject( + message: opentelemetry.proto.trace.v1.ResourceSpans, + options?: $protobuf.IConversionOptions, + ): { [k: string]: any }; + + /** + * Converts this ResourceSpans to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ResourceSpans + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ScopeSpans. */ + interface IScopeSpans { + /** ScopeSpans scope */ + scope?: opentelemetry.proto.common.v1.IInstrumentationScope | null; + + /** ScopeSpans spans */ + spans?: opentelemetry.proto.trace.v1.ISpan[] | null; + + /** ScopeSpans schemaUrl */ + schemaUrl?: string | null; + } + + /** Represents a ScopeSpans. */ + class ScopeSpans implements IScopeSpans { + /** + * Constructs a new ScopeSpans. + * @param [properties] Properties to set + */ + constructor(properties?: opentelemetry.proto.trace.v1.IScopeSpans); + + /** ScopeSpans scope. */ + public scope?: opentelemetry.proto.common.v1.IInstrumentationScope | null; + + /** ScopeSpans spans. */ + public spans: opentelemetry.proto.trace.v1.ISpan[]; + + /** ScopeSpans schemaUrl. */ + public schemaUrl: string; + + /** + * Creates a new ScopeSpans instance using the specified properties. + * @param [properties] Properties to set + * @returns ScopeSpans instance + */ + public static create( + properties?: opentelemetry.proto.trace.v1.IScopeSpans, + ): opentelemetry.proto.trace.v1.ScopeSpans; + + /** + * Encodes the specified ScopeSpans message. Does not implicitly {@link opentelemetry.proto.trace.v1.ScopeSpans.verify|verify} messages. + * @param message ScopeSpans message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode( + message: opentelemetry.proto.trace.v1.IScopeSpans, + writer?: $protobuf.Writer, + ): $protobuf.Writer; + + /** + * Encodes the specified ScopeSpans message, length delimited. Does not implicitly {@link opentelemetry.proto.trace.v1.ScopeSpans.verify|verify} messages. + * @param message ScopeSpans message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited( + message: opentelemetry.proto.trace.v1.IScopeSpans, + writer?: $protobuf.Writer, + ): $protobuf.Writer; + + /** + * Decodes a ScopeSpans message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ScopeSpans + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode( + reader: $protobuf.Reader | Uint8Array, + length?: number, + ): opentelemetry.proto.trace.v1.ScopeSpans; + + /** + * Decodes a ScopeSpans message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ScopeSpans + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited( + reader: $protobuf.Reader | Uint8Array, + ): opentelemetry.proto.trace.v1.ScopeSpans; + + /** + * Verifies a ScopeSpans message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): string | null; + + /** + * Creates a ScopeSpans message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ScopeSpans + */ + public static fromObject(object: { + [k: string]: any; + }): opentelemetry.proto.trace.v1.ScopeSpans; + + /** + * Creates a plain object from a ScopeSpans message. Also converts values to other types if specified. + * @param message ScopeSpans + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject( + message: opentelemetry.proto.trace.v1.ScopeSpans, + options?: $protobuf.IConversionOptions, + ): { [k: string]: any }; + + /** + * Converts this ScopeSpans to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ScopeSpans + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a Span. */ + interface ISpan { + /** Span traceId */ + traceId?: Uint8Array | null; + + /** Span spanId */ + spanId?: Uint8Array | null; + + /** Span traceState */ + traceState?: string | null; + + /** Span parentSpanId */ + parentSpanId?: Uint8Array | null; + + /** Span name */ + name?: string | null; + + /** Span kind */ + kind?: opentelemetry.proto.trace.v1.Span.SpanKind | null; + + /** Span startTimeUnixNano */ + startTimeUnixNano?: number | Long | null; + + /** Span endTimeUnixNano */ + endTimeUnixNano?: number | Long | null; + + /** Span attributes */ + attributes?: opentelemetry.proto.common.v1.IKeyValue[] | null; + + /** Span droppedAttributesCount */ + droppedAttributesCount?: number | null; + + /** Span events */ + events?: opentelemetry.proto.trace.v1.Span.IEvent[] | null; + + /** Span droppedEventsCount */ + droppedEventsCount?: number | null; + + /** Span links */ + links?: opentelemetry.proto.trace.v1.Span.ILink[] | null; + + /** Span droppedLinksCount */ + droppedLinksCount?: number | null; + + /** Span status */ + status?: opentelemetry.proto.trace.v1.IStatus | null; + } + + /** Represents a Span. */ + class Span implements ISpan { + /** + * Constructs a new Span. + * @param [properties] Properties to set + */ + constructor(properties?: opentelemetry.proto.trace.v1.ISpan); + + /** Span traceId. */ + public traceId: Uint8Array; + + /** Span spanId. */ + public spanId: Uint8Array; + + /** Span traceState. */ + public traceState: string; + + /** Span parentSpanId. */ + public parentSpanId: Uint8Array; + + /** Span name. */ + public name: string; + + /** Span kind. */ + public kind: opentelemetry.proto.trace.v1.Span.SpanKind; + + /** Span startTimeUnixNano. */ + public startTimeUnixNano: number | Long; + + /** Span endTimeUnixNano. */ + public endTimeUnixNano: number | Long; + + /** Span attributes. */ + public attributes: opentelemetry.proto.common.v1.IKeyValue[]; + + /** Span droppedAttributesCount. */ + public droppedAttributesCount: number; + + /** Span events. */ + public events: opentelemetry.proto.trace.v1.Span.IEvent[]; + + /** Span droppedEventsCount. */ + public droppedEventsCount: number; + + /** Span links. */ + public links: opentelemetry.proto.trace.v1.Span.ILink[]; + + /** Span droppedLinksCount. */ + public droppedLinksCount: number; + + /** Span status. */ + public status?: opentelemetry.proto.trace.v1.IStatus | null; + + /** + * Creates a new Span instance using the specified properties. + * @param [properties] Properties to set + * @returns Span instance + */ + public static create( + properties?: opentelemetry.proto.trace.v1.ISpan, + ): opentelemetry.proto.trace.v1.Span; + + /** + * Encodes the specified Span message. Does not implicitly {@link opentelemetry.proto.trace.v1.Span.verify|verify} messages. + * @param message Span message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode( + message: opentelemetry.proto.trace.v1.ISpan, + writer?: $protobuf.Writer, + ): $protobuf.Writer; + + /** + * Encodes the specified Span message, length delimited. Does not implicitly {@link opentelemetry.proto.trace.v1.Span.verify|verify} messages. + * @param message Span message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited( + message: opentelemetry.proto.trace.v1.ISpan, + writer?: $protobuf.Writer, + ): $protobuf.Writer; + + /** + * Decodes a Span message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Span + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode( + reader: $protobuf.Reader | Uint8Array, + length?: number, + ): opentelemetry.proto.trace.v1.Span; + + /** + * Decodes a Span message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Span + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited( + reader: $protobuf.Reader | Uint8Array, + ): opentelemetry.proto.trace.v1.Span; + + /** + * Verifies a Span message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): string | null; + + /** + * Creates a Span message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Span + */ + public static fromObject(object: { + [k: string]: any; + }): opentelemetry.proto.trace.v1.Span; + + /** + * Creates a plain object from a Span message. Also converts values to other types if specified. + * @param message Span + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject( + message: opentelemetry.proto.trace.v1.Span, + options?: $protobuf.IConversionOptions, + ): { [k: string]: any }; + + /** + * Converts this Span to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Span + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace Span { + /** SpanKind enum. */ + enum SpanKind { + SPAN_KIND_UNSPECIFIED = 0, + SPAN_KIND_INTERNAL = 1, + SPAN_KIND_SERVER = 2, + SPAN_KIND_CLIENT = 3, + SPAN_KIND_PRODUCER = 4, + SPAN_KIND_CONSUMER = 5, + } + + /** Properties of an Event. */ + interface IEvent { + /** Event timeUnixNano */ + timeUnixNano?: number | Long | null; + + /** Event name */ + name?: string | null; + + /** Event attributes */ + attributes?: opentelemetry.proto.common.v1.IKeyValue[] | null; + + /** Event droppedAttributesCount */ + droppedAttributesCount?: number | null; + } + + /** Represents an Event. */ + class Event implements IEvent { + /** + * Constructs a new Event. + * @param [properties] Properties to set + */ + constructor(properties?: opentelemetry.proto.trace.v1.Span.IEvent); + + /** Event timeUnixNano. */ + public timeUnixNano: number | Long; + + /** Event name. */ + public name: string; + + /** Event attributes. */ + public attributes: opentelemetry.proto.common.v1.IKeyValue[]; + + /** Event droppedAttributesCount. */ + public droppedAttributesCount: number; + + /** + * Creates a new Event instance using the specified properties. + * @param [properties] Properties to set + * @returns Event instance + */ + public static create( + properties?: opentelemetry.proto.trace.v1.Span.IEvent, + ): opentelemetry.proto.trace.v1.Span.Event; + + /** + * Encodes the specified Event message. Does not implicitly {@link opentelemetry.proto.trace.v1.Span.Event.verify|verify} messages. + * @param message Event message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode( + message: opentelemetry.proto.trace.v1.Span.IEvent, + writer?: $protobuf.Writer, + ): $protobuf.Writer; + + /** + * Encodes the specified Event message, length delimited. Does not implicitly {@link opentelemetry.proto.trace.v1.Span.Event.verify|verify} messages. + * @param message Event message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited( + message: opentelemetry.proto.trace.v1.Span.IEvent, + writer?: $protobuf.Writer, + ): $protobuf.Writer; + + /** + * Decodes an Event message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Event + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode( + reader: $protobuf.Reader | Uint8Array, + length?: number, + ): opentelemetry.proto.trace.v1.Span.Event; + + /** + * Decodes an Event message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Event + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited( + reader: $protobuf.Reader | Uint8Array, + ): opentelemetry.proto.trace.v1.Span.Event; + + /** + * Verifies an Event message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): string | null; + + /** + * Creates an Event message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Event + */ + public static fromObject(object: { + [k: string]: any; + }): opentelemetry.proto.trace.v1.Span.Event; + + /** + * Creates a plain object from an Event message. Also converts values to other types if specified. + * @param message Event + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject( + message: opentelemetry.proto.trace.v1.Span.Event, + options?: $protobuf.IConversionOptions, + ): { [k: string]: any }; + + /** + * Converts this Event to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Event + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a Link. */ + interface ILink { + /** Link traceId */ + traceId?: Uint8Array | null; + + /** Link spanId */ + spanId?: Uint8Array | null; + + /** Link traceState */ + traceState?: string | null; + + /** Link attributes */ + attributes?: opentelemetry.proto.common.v1.IKeyValue[] | null; + + /** Link droppedAttributesCount */ + droppedAttributesCount?: number | null; + } + + /** Represents a Link. */ + class Link implements ILink { + /** + * Constructs a new Link. + * @param [properties] Properties to set + */ + constructor(properties?: opentelemetry.proto.trace.v1.Span.ILink); + + /** Link traceId. */ + public traceId: Uint8Array; + + /** Link spanId. */ + public spanId: Uint8Array; + + /** Link traceState. */ + public traceState: string; + + /** Link attributes. */ + public attributes: opentelemetry.proto.common.v1.IKeyValue[]; + + /** Link droppedAttributesCount. */ + public droppedAttributesCount: number; + + /** + * Creates a new Link instance using the specified properties. + * @param [properties] Properties to set + * @returns Link instance + */ + public static create( + properties?: opentelemetry.proto.trace.v1.Span.ILink, + ): opentelemetry.proto.trace.v1.Span.Link; + + /** + * Encodes the specified Link message. Does not implicitly {@link opentelemetry.proto.trace.v1.Span.Link.verify|verify} messages. + * @param message Link message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode( + message: opentelemetry.proto.trace.v1.Span.ILink, + writer?: $protobuf.Writer, + ): $protobuf.Writer; + + /** + * Encodes the specified Link message, length delimited. Does not implicitly {@link opentelemetry.proto.trace.v1.Span.Link.verify|verify} messages. + * @param message Link message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited( + message: opentelemetry.proto.trace.v1.Span.ILink, + writer?: $protobuf.Writer, + ): $protobuf.Writer; + + /** + * Decodes a Link message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Link + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode( + reader: $protobuf.Reader | Uint8Array, + length?: number, + ): opentelemetry.proto.trace.v1.Span.Link; + + /** + * Decodes a Link message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Link + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited( + reader: $protobuf.Reader | Uint8Array, + ): opentelemetry.proto.trace.v1.Span.Link; + + /** + * Verifies a Link message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): string | null; + + /** + * Creates a Link message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Link + */ + public static fromObject(object: { + [k: string]: any; + }): opentelemetry.proto.trace.v1.Span.Link; + + /** + * Creates a plain object from a Link message. Also converts values to other types if specified. + * @param message Link + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject( + message: opentelemetry.proto.trace.v1.Span.Link, + options?: $protobuf.IConversionOptions, + ): { [k: string]: any }; + + /** + * Converts this Link to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Link + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } + + /** Properties of a Status. */ + interface IStatus { + /** Status message */ + message?: string | null; - /** Namespace proto. */ - namespace proto { - - /** Namespace trace. */ - namespace trace { - - /** Namespace v1. */ - namespace v1 { - - /** Properties of a TracesData. */ - interface ITracesData { - - /** TracesData resourceSpans */ - resourceSpans?: (opentelemetry.proto.trace.v1.IResourceSpans[]|null); - } - - /** Represents a TracesData. */ - class TracesData implements ITracesData { - - /** - * Constructs a new TracesData. - * @param [properties] Properties to set - */ - constructor(properties?: opentelemetry.proto.trace.v1.ITracesData); - - /** TracesData resourceSpans. */ - public resourceSpans: opentelemetry.proto.trace.v1.IResourceSpans[]; - - /** - * Creates a new TracesData instance using the specified properties. - * @param [properties] Properties to set - * @returns TracesData instance - */ - public static create(properties?: opentelemetry.proto.trace.v1.ITracesData): opentelemetry.proto.trace.v1.TracesData; - - /** - * Encodes the specified TracesData message. Does not implicitly {@link opentelemetry.proto.trace.v1.TracesData.verify|verify} messages. - * @param message TracesData message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: opentelemetry.proto.trace.v1.ITracesData, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified TracesData message, length delimited. Does not implicitly {@link opentelemetry.proto.trace.v1.TracesData.verify|verify} messages. - * @param message TracesData message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: opentelemetry.proto.trace.v1.ITracesData, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a TracesData message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns TracesData - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): opentelemetry.proto.trace.v1.TracesData; - - /** - * Decodes a TracesData message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns TracesData - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): opentelemetry.proto.trace.v1.TracesData; - - /** - * Verifies a TracesData message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a TracesData message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns TracesData - */ - public static fromObject(object: { [k: string]: any }): opentelemetry.proto.trace.v1.TracesData; - - /** - * Creates a plain object from a TracesData message. Also converts values to other types if specified. - * @param message TracesData - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: opentelemetry.proto.trace.v1.TracesData, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this TracesData to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for TracesData - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a ResourceSpans. */ - interface IResourceSpans { - - /** ResourceSpans resource */ - resource?: (opentelemetry.proto.resource.v1.IResource|null); - - /** ResourceSpans scopeSpans */ - scopeSpans?: (opentelemetry.proto.trace.v1.IScopeSpans[]|null); - - /** ResourceSpans schemaUrl */ - schemaUrl?: (string|null); - } - - /** Represents a ResourceSpans. */ - class ResourceSpans implements IResourceSpans { - - /** - * Constructs a new ResourceSpans. - * @param [properties] Properties to set - */ - constructor(properties?: opentelemetry.proto.trace.v1.IResourceSpans); - - /** ResourceSpans resource. */ - public resource?: (opentelemetry.proto.resource.v1.IResource|null); - - /** ResourceSpans scopeSpans. */ - public scopeSpans: opentelemetry.proto.trace.v1.IScopeSpans[]; - - /** ResourceSpans schemaUrl. */ - public schemaUrl: string; - - /** - * Creates a new ResourceSpans instance using the specified properties. - * @param [properties] Properties to set - * @returns ResourceSpans instance - */ - public static create(properties?: opentelemetry.proto.trace.v1.IResourceSpans): opentelemetry.proto.trace.v1.ResourceSpans; - - /** - * Encodes the specified ResourceSpans message. Does not implicitly {@link opentelemetry.proto.trace.v1.ResourceSpans.verify|verify} messages. - * @param message ResourceSpans message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: opentelemetry.proto.trace.v1.IResourceSpans, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified ResourceSpans message, length delimited. Does not implicitly {@link opentelemetry.proto.trace.v1.ResourceSpans.verify|verify} messages. - * @param message ResourceSpans message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: opentelemetry.proto.trace.v1.IResourceSpans, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a ResourceSpans message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns ResourceSpans - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): opentelemetry.proto.trace.v1.ResourceSpans; - - /** - * Decodes a ResourceSpans message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns ResourceSpans - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): opentelemetry.proto.trace.v1.ResourceSpans; - - /** - * Verifies a ResourceSpans message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a ResourceSpans message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ResourceSpans - */ - public static fromObject(object: { [k: string]: any }): opentelemetry.proto.trace.v1.ResourceSpans; - - /** - * Creates a plain object from a ResourceSpans message. Also converts values to other types if specified. - * @param message ResourceSpans - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: opentelemetry.proto.trace.v1.ResourceSpans, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this ResourceSpans to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for ResourceSpans - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a ScopeSpans. */ - interface IScopeSpans { - - /** ScopeSpans scope */ - scope?: (opentelemetry.proto.common.v1.IInstrumentationScope|null); - - /** ScopeSpans spans */ - spans?: (opentelemetry.proto.trace.v1.ISpan[]|null); - - /** ScopeSpans schemaUrl */ - schemaUrl?: (string|null); - } - - /** Represents a ScopeSpans. */ - class ScopeSpans implements IScopeSpans { - - /** - * Constructs a new ScopeSpans. - * @param [properties] Properties to set - */ - constructor(properties?: opentelemetry.proto.trace.v1.IScopeSpans); - - /** ScopeSpans scope. */ - public scope?: (opentelemetry.proto.common.v1.IInstrumentationScope|null); - - /** ScopeSpans spans. */ - public spans: opentelemetry.proto.trace.v1.ISpan[]; - - /** ScopeSpans schemaUrl. */ - public schemaUrl: string; - - /** - * Creates a new ScopeSpans instance using the specified properties. - * @param [properties] Properties to set - * @returns ScopeSpans instance - */ - public static create(properties?: opentelemetry.proto.trace.v1.IScopeSpans): opentelemetry.proto.trace.v1.ScopeSpans; - - /** - * Encodes the specified ScopeSpans message. Does not implicitly {@link opentelemetry.proto.trace.v1.ScopeSpans.verify|verify} messages. - * @param message ScopeSpans message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: opentelemetry.proto.trace.v1.IScopeSpans, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified ScopeSpans message, length delimited. Does not implicitly {@link opentelemetry.proto.trace.v1.ScopeSpans.verify|verify} messages. - * @param message ScopeSpans message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: opentelemetry.proto.trace.v1.IScopeSpans, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a ScopeSpans message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns ScopeSpans - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): opentelemetry.proto.trace.v1.ScopeSpans; - - /** - * Decodes a ScopeSpans message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns ScopeSpans - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): opentelemetry.proto.trace.v1.ScopeSpans; - - /** - * Verifies a ScopeSpans message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a ScopeSpans message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ScopeSpans - */ - public static fromObject(object: { [k: string]: any }): opentelemetry.proto.trace.v1.ScopeSpans; - - /** - * Creates a plain object from a ScopeSpans message. Also converts values to other types if specified. - * @param message ScopeSpans - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: opentelemetry.proto.trace.v1.ScopeSpans, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this ScopeSpans to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for ScopeSpans - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a Span. */ - interface ISpan { - - /** Span traceId */ - traceId?: (Uint8Array|null); - - /** Span spanId */ - spanId?: (Uint8Array|null); - - /** Span traceState */ - traceState?: (string|null); - - /** Span parentSpanId */ - parentSpanId?: (Uint8Array|null); - - /** Span name */ - name?: (string|null); - - /** Span kind */ - kind?: (opentelemetry.proto.trace.v1.Span.SpanKind|null); - - /** Span startTimeUnixNano */ - startTimeUnixNano?: (number|Long|null); - - /** Span endTimeUnixNano */ - endTimeUnixNano?: (number|Long|null); - - /** Span attributes */ - attributes?: (opentelemetry.proto.common.v1.IKeyValue[]|null); - - /** Span droppedAttributesCount */ - droppedAttributesCount?: (number|null); - - /** Span events */ - events?: (opentelemetry.proto.trace.v1.Span.IEvent[]|null); - - /** Span droppedEventsCount */ - droppedEventsCount?: (number|null); - - /** Span links */ - links?: (opentelemetry.proto.trace.v1.Span.ILink[]|null); - - /** Span droppedLinksCount */ - droppedLinksCount?: (number|null); - - /** Span status */ - status?: (opentelemetry.proto.trace.v1.IStatus|null); - } - - /** Represents a Span. */ - class Span implements ISpan { - - /** - * Constructs a new Span. - * @param [properties] Properties to set - */ - constructor(properties?: opentelemetry.proto.trace.v1.ISpan); - - /** Span traceId. */ - public traceId: Uint8Array; - - /** Span spanId. */ - public spanId: Uint8Array; - - /** Span traceState. */ - public traceState: string; - - /** Span parentSpanId. */ - public parentSpanId: Uint8Array; - - /** Span name. */ - public name: string; - - /** Span kind. */ - public kind: opentelemetry.proto.trace.v1.Span.SpanKind; - - /** Span startTimeUnixNano. */ - public startTimeUnixNano: (number|Long); - - /** Span endTimeUnixNano. */ - public endTimeUnixNano: (number|Long); - - /** Span attributes. */ - public attributes: opentelemetry.proto.common.v1.IKeyValue[]; - - /** Span droppedAttributesCount. */ - public droppedAttributesCount: number; - - /** Span events. */ - public events: opentelemetry.proto.trace.v1.Span.IEvent[]; - - /** Span droppedEventsCount. */ - public droppedEventsCount: number; - - /** Span links. */ - public links: opentelemetry.proto.trace.v1.Span.ILink[]; - - /** Span droppedLinksCount. */ - public droppedLinksCount: number; - - /** Span status. */ - public status?: (opentelemetry.proto.trace.v1.IStatus|null); - - /** - * Creates a new Span instance using the specified properties. - * @param [properties] Properties to set - * @returns Span instance - */ - public static create(properties?: opentelemetry.proto.trace.v1.ISpan): opentelemetry.proto.trace.v1.Span; - - /** - * Encodes the specified Span message. Does not implicitly {@link opentelemetry.proto.trace.v1.Span.verify|verify} messages. - * @param message Span message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: opentelemetry.proto.trace.v1.ISpan, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified Span message, length delimited. Does not implicitly {@link opentelemetry.proto.trace.v1.Span.verify|verify} messages. - * @param message Span message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: opentelemetry.proto.trace.v1.ISpan, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a Span message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns Span - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): opentelemetry.proto.trace.v1.Span; - - /** - * Decodes a Span message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns Span - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): opentelemetry.proto.trace.v1.Span; - - /** - * Verifies a Span message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a Span message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns Span - */ - public static fromObject(object: { [k: string]: any }): opentelemetry.proto.trace.v1.Span; - - /** - * Creates a plain object from a Span message. Also converts values to other types if specified. - * @param message Span - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: opentelemetry.proto.trace.v1.Span, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this Span to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for Span - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - namespace Span { - - /** SpanKind enum. */ - enum SpanKind { - SPAN_KIND_UNSPECIFIED = 0, - SPAN_KIND_INTERNAL = 1, - SPAN_KIND_SERVER = 2, - SPAN_KIND_CLIENT = 3, - SPAN_KIND_PRODUCER = 4, - SPAN_KIND_CONSUMER = 5 - } - - /** Properties of an Event. */ - interface IEvent { - - /** Event timeUnixNano */ - timeUnixNano?: (number|Long|null); - - /** Event name */ - name?: (string|null); - - /** Event attributes */ - attributes?: (opentelemetry.proto.common.v1.IKeyValue[]|null); - - /** Event droppedAttributesCount */ - droppedAttributesCount?: (number|null); - } - - /** Represents an Event. */ - class Event implements IEvent { - - /** - * Constructs a new Event. - * @param [properties] Properties to set - */ - constructor(properties?: opentelemetry.proto.trace.v1.Span.IEvent); - - /** Event timeUnixNano. */ - public timeUnixNano: (number|Long); - - /** Event name. */ - public name: string; - - /** Event attributes. */ - public attributes: opentelemetry.proto.common.v1.IKeyValue[]; - - /** Event droppedAttributesCount. */ - public droppedAttributesCount: number; - - /** - * Creates a new Event instance using the specified properties. - * @param [properties] Properties to set - * @returns Event instance - */ - public static create(properties?: opentelemetry.proto.trace.v1.Span.IEvent): opentelemetry.proto.trace.v1.Span.Event; - - /** - * Encodes the specified Event message. Does not implicitly {@link opentelemetry.proto.trace.v1.Span.Event.verify|verify} messages. - * @param message Event message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: opentelemetry.proto.trace.v1.Span.IEvent, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified Event message, length delimited. Does not implicitly {@link opentelemetry.proto.trace.v1.Span.Event.verify|verify} messages. - * @param message Event message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: opentelemetry.proto.trace.v1.Span.IEvent, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes an Event message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns Event - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): opentelemetry.proto.trace.v1.Span.Event; - - /** - * Decodes an Event message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns Event - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): opentelemetry.proto.trace.v1.Span.Event; - - /** - * Verifies an Event message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates an Event message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns Event - */ - public static fromObject(object: { [k: string]: any }): opentelemetry.proto.trace.v1.Span.Event; - - /** - * Creates a plain object from an Event message. Also converts values to other types if specified. - * @param message Event - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: opentelemetry.proto.trace.v1.Span.Event, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this Event to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for Event - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a Link. */ - interface ILink { - - /** Link traceId */ - traceId?: (Uint8Array|null); - - /** Link spanId */ - spanId?: (Uint8Array|null); - - /** Link traceState */ - traceState?: (string|null); - - /** Link attributes */ - attributes?: (opentelemetry.proto.common.v1.IKeyValue[]|null); - - /** Link droppedAttributesCount */ - droppedAttributesCount?: (number|null); - } - - /** Represents a Link. */ - class Link implements ILink { - - /** - * Constructs a new Link. - * @param [properties] Properties to set - */ - constructor(properties?: opentelemetry.proto.trace.v1.Span.ILink); - - /** Link traceId. */ - public traceId: Uint8Array; - - /** Link spanId. */ - public spanId: Uint8Array; - - /** Link traceState. */ - public traceState: string; - - /** Link attributes. */ - public attributes: opentelemetry.proto.common.v1.IKeyValue[]; - - /** Link droppedAttributesCount. */ - public droppedAttributesCount: number; - - /** - * Creates a new Link instance using the specified properties. - * @param [properties] Properties to set - * @returns Link instance - */ - public static create(properties?: opentelemetry.proto.trace.v1.Span.ILink): opentelemetry.proto.trace.v1.Span.Link; - - /** - * Encodes the specified Link message. Does not implicitly {@link opentelemetry.proto.trace.v1.Span.Link.verify|verify} messages. - * @param message Link message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: opentelemetry.proto.trace.v1.Span.ILink, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified Link message, length delimited. Does not implicitly {@link opentelemetry.proto.trace.v1.Span.Link.verify|verify} messages. - * @param message Link message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: opentelemetry.proto.trace.v1.Span.ILink, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a Link message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns Link - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): opentelemetry.proto.trace.v1.Span.Link; - - /** - * Decodes a Link message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns Link - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): opentelemetry.proto.trace.v1.Span.Link; - - /** - * Verifies a Link message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a Link message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns Link - */ - public static fromObject(object: { [k: string]: any }): opentelemetry.proto.trace.v1.Span.Link; - - /** - * Creates a plain object from a Link message. Also converts values to other types if specified. - * @param message Link - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: opentelemetry.proto.trace.v1.Span.Link, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this Link to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for Link - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - } - - /** Properties of a Status. */ - interface IStatus { - - /** Status message */ - message?: (string|null); - - /** Status code */ - code?: (opentelemetry.proto.trace.v1.Status.StatusCode|null); - } - - /** Represents a Status. */ - class Status implements IStatus { - - /** - * Constructs a new Status. - * @param [properties] Properties to set - */ - constructor(properties?: opentelemetry.proto.trace.v1.IStatus); - - /** Status message. */ - public message: string; - - /** Status code. */ - public code: opentelemetry.proto.trace.v1.Status.StatusCode; - - /** - * Creates a new Status instance using the specified properties. - * @param [properties] Properties to set - * @returns Status instance - */ - public static create(properties?: opentelemetry.proto.trace.v1.IStatus): opentelemetry.proto.trace.v1.Status; - - /** - * Encodes the specified Status message. Does not implicitly {@link opentelemetry.proto.trace.v1.Status.verify|verify} messages. - * @param message Status message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: opentelemetry.proto.trace.v1.IStatus, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified Status message, length delimited. Does not implicitly {@link opentelemetry.proto.trace.v1.Status.verify|verify} messages. - * @param message Status message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: opentelemetry.proto.trace.v1.IStatus, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a Status message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns Status - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): opentelemetry.proto.trace.v1.Status; - - /** - * Decodes a Status message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns Status - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): opentelemetry.proto.trace.v1.Status; - - /** - * Verifies a Status message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a Status message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns Status - */ - public static fromObject(object: { [k: string]: any }): opentelemetry.proto.trace.v1.Status; - - /** - * Creates a plain object from a Status message. Also converts values to other types if specified. - * @param message Status - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: opentelemetry.proto.trace.v1.Status, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this Status to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for Status - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - namespace Status { - - /** StatusCode enum. */ - enum StatusCode { - STATUS_CODE_UNSET = 0, - STATUS_CODE_OK = 1, - STATUS_CODE_ERROR = 2 - } - } - } + /** Status code */ + code?: opentelemetry.proto.trace.v1.Status.StatusCode | null; } - /** Namespace resource. */ - namespace resource { - - /** Namespace v1. */ - namespace v1 { - - /** Properties of a Resource. */ - interface IResource { - - /** Resource attributes */ - attributes?: (opentelemetry.proto.common.v1.IKeyValue[]|null); - - /** Resource droppedAttributesCount */ - droppedAttributesCount?: (number|null); - } - - /** Represents a Resource. */ - class Resource implements IResource { - - /** - * Constructs a new Resource. - * @param [properties] Properties to set - */ - constructor(properties?: opentelemetry.proto.resource.v1.IResource); - - /** Resource attributes. */ - public attributes: opentelemetry.proto.common.v1.IKeyValue[]; - - /** Resource droppedAttributesCount. */ - public droppedAttributesCount: number; - - /** - * Creates a new Resource instance using the specified properties. - * @param [properties] Properties to set - * @returns Resource instance - */ - public static create(properties?: opentelemetry.proto.resource.v1.IResource): opentelemetry.proto.resource.v1.Resource; - - /** - * Encodes the specified Resource message. Does not implicitly {@link opentelemetry.proto.resource.v1.Resource.verify|verify} messages. - * @param message Resource message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: opentelemetry.proto.resource.v1.IResource, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified Resource message, length delimited. Does not implicitly {@link opentelemetry.proto.resource.v1.Resource.verify|verify} messages. - * @param message Resource message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: opentelemetry.proto.resource.v1.IResource, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a Resource message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns Resource - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): opentelemetry.proto.resource.v1.Resource; - - /** - * Decodes a Resource message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns Resource - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): opentelemetry.proto.resource.v1.Resource; - - /** - * Verifies a Resource message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a Resource message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns Resource - */ - public static fromObject(object: { [k: string]: any }): opentelemetry.proto.resource.v1.Resource; - - /** - * Creates a plain object from a Resource message. Also converts values to other types if specified. - * @param message Resource - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: opentelemetry.proto.resource.v1.Resource, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this Resource to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for Resource - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - } + /** Represents a Status. */ + class Status implements IStatus { + /** + * Constructs a new Status. + * @param [properties] Properties to set + */ + constructor(properties?: opentelemetry.proto.trace.v1.IStatus); + + /** Status message. */ + public message: string; + + /** Status code. */ + public code: opentelemetry.proto.trace.v1.Status.StatusCode; + + /** + * Creates a new Status instance using the specified properties. + * @param [properties] Properties to set + * @returns Status instance + */ + public static create( + properties?: opentelemetry.proto.trace.v1.IStatus, + ): opentelemetry.proto.trace.v1.Status; + + /** + * Encodes the specified Status message. Does not implicitly {@link opentelemetry.proto.trace.v1.Status.verify|verify} messages. + * @param message Status message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode( + message: opentelemetry.proto.trace.v1.IStatus, + writer?: $protobuf.Writer, + ): $protobuf.Writer; + + /** + * Encodes the specified Status message, length delimited. Does not implicitly {@link opentelemetry.proto.trace.v1.Status.verify|verify} messages. + * @param message Status message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited( + message: opentelemetry.proto.trace.v1.IStatus, + writer?: $protobuf.Writer, + ): $protobuf.Writer; + + /** + * Decodes a Status message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Status + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode( + reader: $protobuf.Reader | Uint8Array, + length?: number, + ): opentelemetry.proto.trace.v1.Status; + + /** + * Decodes a Status message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Status + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited( + reader: $protobuf.Reader | Uint8Array, + ): opentelemetry.proto.trace.v1.Status; + + /** + * Verifies a Status message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): string | null; + + /** + * Creates a Status message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Status + */ + public static fromObject(object: { + [k: string]: any; + }): opentelemetry.proto.trace.v1.Status; + + /** + * Creates a plain object from a Status message. Also converts values to other types if specified. + * @param message Status + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject( + message: opentelemetry.proto.trace.v1.Status, + options?: $protobuf.IConversionOptions, + ): { [k: string]: any }; + + /** + * Converts this Status to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Status + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } - /** Namespace common. */ - namespace common { - - /** Namespace v1. */ - namespace v1 { + namespace Status { + /** StatusCode enum. */ + enum StatusCode { + STATUS_CODE_UNSET = 0, + STATUS_CODE_OK = 1, + STATUS_CODE_ERROR = 2, + } + } + } + } + + /** Namespace resource. */ + namespace resource { + /** Namespace v1. */ + namespace v1 { + /** Properties of a Resource. */ + interface IResource { + /** Resource attributes */ + attributes?: opentelemetry.proto.common.v1.IKeyValue[] | null; + + /** Resource droppedAttributesCount */ + droppedAttributesCount?: number | null; + } + + /** Represents a Resource. */ + class Resource implements IResource { + /** + * Constructs a new Resource. + * @param [properties] Properties to set + */ + constructor(properties?: opentelemetry.proto.resource.v1.IResource); + + /** Resource attributes. */ + public attributes: opentelemetry.proto.common.v1.IKeyValue[]; + + /** Resource droppedAttributesCount. */ + public droppedAttributesCount: number; + + /** + * Creates a new Resource instance using the specified properties. + * @param [properties] Properties to set + * @returns Resource instance + */ + public static create( + properties?: opentelemetry.proto.resource.v1.IResource, + ): opentelemetry.proto.resource.v1.Resource; + + /** + * Encodes the specified Resource message. Does not implicitly {@link opentelemetry.proto.resource.v1.Resource.verify|verify} messages. + * @param message Resource message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode( + message: opentelemetry.proto.resource.v1.IResource, + writer?: $protobuf.Writer, + ): $protobuf.Writer; + + /** + * Encodes the specified Resource message, length delimited. Does not implicitly {@link opentelemetry.proto.resource.v1.Resource.verify|verify} messages. + * @param message Resource message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited( + message: opentelemetry.proto.resource.v1.IResource, + writer?: $protobuf.Writer, + ): $protobuf.Writer; + + /** + * Decodes a Resource message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Resource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode( + reader: $protobuf.Reader | Uint8Array, + length?: number, + ): opentelemetry.proto.resource.v1.Resource; + + /** + * Decodes a Resource message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Resource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited( + reader: $protobuf.Reader | Uint8Array, + ): opentelemetry.proto.resource.v1.Resource; + + /** + * Verifies a Resource message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): string | null; + + /** + * Creates a Resource message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Resource + */ + public static fromObject(object: { + [k: string]: any; + }): opentelemetry.proto.resource.v1.Resource; + + /** + * Creates a plain object from a Resource message. Also converts values to other types if specified. + * @param message Resource + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject( + message: opentelemetry.proto.resource.v1.Resource, + options?: $protobuf.IConversionOptions, + ): { [k: string]: any }; + + /** + * Converts this Resource to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Resource + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } + } + + /** Namespace common. */ + namespace common { + /** Namespace v1. */ + namespace v1 { + /** Properties of an AnyValue. */ + interface IAnyValue { + /** AnyValue stringValue */ + stringValue?: string | null; + + /** AnyValue boolValue */ + boolValue?: boolean | null; + + /** AnyValue intValue */ + intValue?: number | Long | null; + + /** AnyValue doubleValue */ + doubleValue?: number | null; + + /** AnyValue arrayValue */ + arrayValue?: opentelemetry.proto.common.v1.IArrayValue | null; + + /** AnyValue kvlistValue */ + kvlistValue?: opentelemetry.proto.common.v1.IKeyValueList | null; + + /** AnyValue bytesValue */ + bytesValue?: Uint8Array | null; + } + + /** Represents an AnyValue. */ + class AnyValue implements IAnyValue { + /** + * Constructs a new AnyValue. + * @param [properties] Properties to set + */ + constructor(properties?: opentelemetry.proto.common.v1.IAnyValue); + + /** AnyValue stringValue. */ + public stringValue?: string | null; + + /** AnyValue boolValue. */ + public boolValue?: boolean | null; + + /** AnyValue intValue. */ + public intValue?: number | Long | null; + + /** AnyValue doubleValue. */ + public doubleValue?: number | null; + + /** AnyValue arrayValue. */ + public arrayValue?: opentelemetry.proto.common.v1.IArrayValue | null; + + /** AnyValue kvlistValue. */ + public kvlistValue?: opentelemetry.proto.common.v1.IKeyValueList | null; + + /** AnyValue bytesValue. */ + public bytesValue?: Uint8Array | null; + + /** AnyValue value. */ + public value?: + | 'stringValue' + | 'boolValue' + | 'intValue' + | 'doubleValue' + | 'arrayValue' + | 'kvlistValue' + | 'bytesValue'; + + /** + * Creates a new AnyValue instance using the specified properties. + * @param [properties] Properties to set + * @returns AnyValue instance + */ + public static create( + properties?: opentelemetry.proto.common.v1.IAnyValue, + ): opentelemetry.proto.common.v1.AnyValue; + + /** + * Encodes the specified AnyValue message. Does not implicitly {@link opentelemetry.proto.common.v1.AnyValue.verify|verify} messages. + * @param message AnyValue message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode( + message: opentelemetry.proto.common.v1.IAnyValue, + writer?: $protobuf.Writer, + ): $protobuf.Writer; + + /** + * Encodes the specified AnyValue message, length delimited. Does not implicitly {@link opentelemetry.proto.common.v1.AnyValue.verify|verify} messages. + * @param message AnyValue message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited( + message: opentelemetry.proto.common.v1.IAnyValue, + writer?: $protobuf.Writer, + ): $protobuf.Writer; + + /** + * Decodes an AnyValue message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns AnyValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode( + reader: $protobuf.Reader | Uint8Array, + length?: number, + ): opentelemetry.proto.common.v1.AnyValue; + + /** + * Decodes an AnyValue message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns AnyValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited( + reader: $protobuf.Reader | Uint8Array, + ): opentelemetry.proto.common.v1.AnyValue; + + /** + * Verifies an AnyValue message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): string | null; + + /** + * Creates an AnyValue message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns AnyValue + */ + public static fromObject(object: { + [k: string]: any; + }): opentelemetry.proto.common.v1.AnyValue; + + /** + * Creates a plain object from an AnyValue message. Also converts values to other types if specified. + * @param message AnyValue + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject( + message: opentelemetry.proto.common.v1.AnyValue, + options?: $protobuf.IConversionOptions, + ): { [k: string]: any }; + + /** + * Converts this AnyValue to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for AnyValue + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an ArrayValue. */ + interface IArrayValue { + /** ArrayValue values */ + values?: opentelemetry.proto.common.v1.IAnyValue[] | null; + } + + /** Represents an ArrayValue. */ + class ArrayValue implements IArrayValue { + /** + * Constructs a new ArrayValue. + * @param [properties] Properties to set + */ + constructor(properties?: opentelemetry.proto.common.v1.IArrayValue); + + /** ArrayValue values. */ + public values: opentelemetry.proto.common.v1.IAnyValue[]; + + /** + * Creates a new ArrayValue instance using the specified properties. + * @param [properties] Properties to set + * @returns ArrayValue instance + */ + public static create( + properties?: opentelemetry.proto.common.v1.IArrayValue, + ): opentelemetry.proto.common.v1.ArrayValue; + + /** + * Encodes the specified ArrayValue message. Does not implicitly {@link opentelemetry.proto.common.v1.ArrayValue.verify|verify} messages. + * @param message ArrayValue message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode( + message: opentelemetry.proto.common.v1.IArrayValue, + writer?: $protobuf.Writer, + ): $protobuf.Writer; + + /** + * Encodes the specified ArrayValue message, length delimited. Does not implicitly {@link opentelemetry.proto.common.v1.ArrayValue.verify|verify} messages. + * @param message ArrayValue message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited( + message: opentelemetry.proto.common.v1.IArrayValue, + writer?: $protobuf.Writer, + ): $protobuf.Writer; + + /** + * Decodes an ArrayValue message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ArrayValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode( + reader: $protobuf.Reader | Uint8Array, + length?: number, + ): opentelemetry.proto.common.v1.ArrayValue; + + /** + * Decodes an ArrayValue message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ArrayValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited( + reader: $protobuf.Reader | Uint8Array, + ): opentelemetry.proto.common.v1.ArrayValue; + + /** + * Verifies an ArrayValue message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): string | null; + + /** + * Creates an ArrayValue message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ArrayValue + */ + public static fromObject(object: { + [k: string]: any; + }): opentelemetry.proto.common.v1.ArrayValue; + + /** + * Creates a plain object from an ArrayValue message. Also converts values to other types if specified. + * @param message ArrayValue + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject( + message: opentelemetry.proto.common.v1.ArrayValue, + options?: $protobuf.IConversionOptions, + ): { [k: string]: any }; + + /** + * Converts this ArrayValue to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ArrayValue + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a KeyValueList. */ + interface IKeyValueList { + /** KeyValueList values */ + values?: opentelemetry.proto.common.v1.IKeyValue[] | null; + } + + /** Represents a KeyValueList. */ + class KeyValueList implements IKeyValueList { + /** + * Constructs a new KeyValueList. + * @param [properties] Properties to set + */ + constructor(properties?: opentelemetry.proto.common.v1.IKeyValueList); + + /** KeyValueList values. */ + public values: opentelemetry.proto.common.v1.IKeyValue[]; + + /** + * Creates a new KeyValueList instance using the specified properties. + * @param [properties] Properties to set + * @returns KeyValueList instance + */ + public static create( + properties?: opentelemetry.proto.common.v1.IKeyValueList, + ): opentelemetry.proto.common.v1.KeyValueList; + + /** + * Encodes the specified KeyValueList message. Does not implicitly {@link opentelemetry.proto.common.v1.KeyValueList.verify|verify} messages. + * @param message KeyValueList message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode( + message: opentelemetry.proto.common.v1.IKeyValueList, + writer?: $protobuf.Writer, + ): $protobuf.Writer; + + /** + * Encodes the specified KeyValueList message, length delimited. Does not implicitly {@link opentelemetry.proto.common.v1.KeyValueList.verify|verify} messages. + * @param message KeyValueList message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited( + message: opentelemetry.proto.common.v1.IKeyValueList, + writer?: $protobuf.Writer, + ): $protobuf.Writer; + + /** + * Decodes a KeyValueList message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns KeyValueList + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode( + reader: $protobuf.Reader | Uint8Array, + length?: number, + ): opentelemetry.proto.common.v1.KeyValueList; + + /** + * Decodes a KeyValueList message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns KeyValueList + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited( + reader: $protobuf.Reader | Uint8Array, + ): opentelemetry.proto.common.v1.KeyValueList; + + /** + * Verifies a KeyValueList message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): string | null; + + /** + * Creates a KeyValueList message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns KeyValueList + */ + public static fromObject(object: { + [k: string]: any; + }): opentelemetry.proto.common.v1.KeyValueList; + + /** + * Creates a plain object from a KeyValueList message. Also converts values to other types if specified. + * @param message KeyValueList + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject( + message: opentelemetry.proto.common.v1.KeyValueList, + options?: $protobuf.IConversionOptions, + ): { [k: string]: any }; + + /** + * Converts this KeyValueList to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for KeyValueList + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a KeyValue. */ + interface IKeyValue { + /** KeyValue key */ + key?: string | null; + + /** KeyValue value */ + value?: opentelemetry.proto.common.v1.IAnyValue | null; + } + + /** Represents a KeyValue. */ + class KeyValue implements IKeyValue { + /** + * Constructs a new KeyValue. + * @param [properties] Properties to set + */ + constructor(properties?: opentelemetry.proto.common.v1.IKeyValue); + + /** KeyValue key. */ + public key: string; + + /** KeyValue value. */ + public value?: opentelemetry.proto.common.v1.IAnyValue | null; + + /** + * Creates a new KeyValue instance using the specified properties. + * @param [properties] Properties to set + * @returns KeyValue instance + */ + public static create( + properties?: opentelemetry.proto.common.v1.IKeyValue, + ): opentelemetry.proto.common.v1.KeyValue; + + /** + * Encodes the specified KeyValue message. Does not implicitly {@link opentelemetry.proto.common.v1.KeyValue.verify|verify} messages. + * @param message KeyValue message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode( + message: opentelemetry.proto.common.v1.IKeyValue, + writer?: $protobuf.Writer, + ): $protobuf.Writer; + + /** + * Encodes the specified KeyValue message, length delimited. Does not implicitly {@link opentelemetry.proto.common.v1.KeyValue.verify|verify} messages. + * @param message KeyValue message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited( + message: opentelemetry.proto.common.v1.IKeyValue, + writer?: $protobuf.Writer, + ): $protobuf.Writer; + + /** + * Decodes a KeyValue message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns KeyValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode( + reader: $protobuf.Reader | Uint8Array, + length?: number, + ): opentelemetry.proto.common.v1.KeyValue; + + /** + * Decodes a KeyValue message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns KeyValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited( + reader: $protobuf.Reader | Uint8Array, + ): opentelemetry.proto.common.v1.KeyValue; + + /** + * Verifies a KeyValue message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): string | null; + + /** + * Creates a KeyValue message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns KeyValue + */ + public static fromObject(object: { + [k: string]: any; + }): opentelemetry.proto.common.v1.KeyValue; + + /** + * Creates a plain object from a KeyValue message. Also converts values to other types if specified. + * @param message KeyValue + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject( + message: opentelemetry.proto.common.v1.KeyValue, + options?: $protobuf.IConversionOptions, + ): { [k: string]: any }; + + /** + * Converts this KeyValue to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for KeyValue + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an InstrumentationScope. */ + interface IInstrumentationScope { + /** InstrumentationScope name */ + name?: string | null; + + /** InstrumentationScope version */ + version?: string | null; + + /** InstrumentationScope attributes */ + attributes?: opentelemetry.proto.common.v1.IKeyValue[] | null; + + /** InstrumentationScope droppedAttributesCount */ + droppedAttributesCount?: number | null; + } - /** Properties of an AnyValue. */ - interface IAnyValue { - - /** AnyValue stringValue */ - stringValue?: (string|null); - - /** AnyValue boolValue */ - boolValue?: (boolean|null); - - /** AnyValue intValue */ - intValue?: (number|Long|null); - - /** AnyValue doubleValue */ - doubleValue?: (number|null); - - /** AnyValue arrayValue */ - arrayValue?: (opentelemetry.proto.common.v1.IArrayValue|null); - - /** AnyValue kvlistValue */ - kvlistValue?: (opentelemetry.proto.common.v1.IKeyValueList|null); - - /** AnyValue bytesValue */ - bytesValue?: (Uint8Array|null); - } - - /** Represents an AnyValue. */ - class AnyValue implements IAnyValue { - - /** - * Constructs a new AnyValue. - * @param [properties] Properties to set - */ - constructor(properties?: opentelemetry.proto.common.v1.IAnyValue); - - /** AnyValue stringValue. */ - public stringValue?: (string|null); - - /** AnyValue boolValue. */ - public boolValue?: (boolean|null); - - /** AnyValue intValue. */ - public intValue?: (number|Long|null); - - /** AnyValue doubleValue. */ - public doubleValue?: (number|null); - - /** AnyValue arrayValue. */ - public arrayValue?: (opentelemetry.proto.common.v1.IArrayValue|null); - - /** AnyValue kvlistValue. */ - public kvlistValue?: (opentelemetry.proto.common.v1.IKeyValueList|null); - - /** AnyValue bytesValue. */ - public bytesValue?: (Uint8Array|null); - - /** AnyValue value. */ - public value?: ("stringValue"|"boolValue"|"intValue"|"doubleValue"|"arrayValue"|"kvlistValue"|"bytesValue"); - - /** - * Creates a new AnyValue instance using the specified properties. - * @param [properties] Properties to set - * @returns AnyValue instance - */ - public static create(properties?: opentelemetry.proto.common.v1.IAnyValue): opentelemetry.proto.common.v1.AnyValue; - - /** - * Encodes the specified AnyValue message. Does not implicitly {@link opentelemetry.proto.common.v1.AnyValue.verify|verify} messages. - * @param message AnyValue message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: opentelemetry.proto.common.v1.IAnyValue, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified AnyValue message, length delimited. Does not implicitly {@link opentelemetry.proto.common.v1.AnyValue.verify|verify} messages. - * @param message AnyValue message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: opentelemetry.proto.common.v1.IAnyValue, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes an AnyValue message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns AnyValue - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): opentelemetry.proto.common.v1.AnyValue; - - /** - * Decodes an AnyValue message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns AnyValue - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): opentelemetry.proto.common.v1.AnyValue; - - /** - * Verifies an AnyValue message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates an AnyValue message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns AnyValue - */ - public static fromObject(object: { [k: string]: any }): opentelemetry.proto.common.v1.AnyValue; - - /** - * Creates a plain object from an AnyValue message. Also converts values to other types if specified. - * @param message AnyValue - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: opentelemetry.proto.common.v1.AnyValue, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this AnyValue to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for AnyValue - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an ArrayValue. */ - interface IArrayValue { - - /** ArrayValue values */ - values?: (opentelemetry.proto.common.v1.IAnyValue[]|null); - } - - /** Represents an ArrayValue. */ - class ArrayValue implements IArrayValue { - - /** - * Constructs a new ArrayValue. - * @param [properties] Properties to set - */ - constructor(properties?: opentelemetry.proto.common.v1.IArrayValue); - - /** ArrayValue values. */ - public values: opentelemetry.proto.common.v1.IAnyValue[]; - - /** - * Creates a new ArrayValue instance using the specified properties. - * @param [properties] Properties to set - * @returns ArrayValue instance - */ - public static create(properties?: opentelemetry.proto.common.v1.IArrayValue): opentelemetry.proto.common.v1.ArrayValue; - - /** - * Encodes the specified ArrayValue message. Does not implicitly {@link opentelemetry.proto.common.v1.ArrayValue.verify|verify} messages. - * @param message ArrayValue message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: opentelemetry.proto.common.v1.IArrayValue, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified ArrayValue message, length delimited. Does not implicitly {@link opentelemetry.proto.common.v1.ArrayValue.verify|verify} messages. - * @param message ArrayValue message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: opentelemetry.proto.common.v1.IArrayValue, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes an ArrayValue message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns ArrayValue - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): opentelemetry.proto.common.v1.ArrayValue; - - /** - * Decodes an ArrayValue message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns ArrayValue - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): opentelemetry.proto.common.v1.ArrayValue; - - /** - * Verifies an ArrayValue message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates an ArrayValue message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ArrayValue - */ - public static fromObject(object: { [k: string]: any }): opentelemetry.proto.common.v1.ArrayValue; - - /** - * Creates a plain object from an ArrayValue message. Also converts values to other types if specified. - * @param message ArrayValue - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: opentelemetry.proto.common.v1.ArrayValue, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this ArrayValue to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for ArrayValue - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a KeyValueList. */ - interface IKeyValueList { - - /** KeyValueList values */ - values?: (opentelemetry.proto.common.v1.IKeyValue[]|null); - } - - /** Represents a KeyValueList. */ - class KeyValueList implements IKeyValueList { - - /** - * Constructs a new KeyValueList. - * @param [properties] Properties to set - */ - constructor(properties?: opentelemetry.proto.common.v1.IKeyValueList); - - /** KeyValueList values. */ - public values: opentelemetry.proto.common.v1.IKeyValue[]; - - /** - * Creates a new KeyValueList instance using the specified properties. - * @param [properties] Properties to set - * @returns KeyValueList instance - */ - public static create(properties?: opentelemetry.proto.common.v1.IKeyValueList): opentelemetry.proto.common.v1.KeyValueList; - - /** - * Encodes the specified KeyValueList message. Does not implicitly {@link opentelemetry.proto.common.v1.KeyValueList.verify|verify} messages. - * @param message KeyValueList message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: opentelemetry.proto.common.v1.IKeyValueList, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified KeyValueList message, length delimited. Does not implicitly {@link opentelemetry.proto.common.v1.KeyValueList.verify|verify} messages. - * @param message KeyValueList message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: opentelemetry.proto.common.v1.IKeyValueList, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a KeyValueList message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns KeyValueList - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): opentelemetry.proto.common.v1.KeyValueList; - - /** - * Decodes a KeyValueList message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns KeyValueList - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): opentelemetry.proto.common.v1.KeyValueList; - - /** - * Verifies a KeyValueList message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a KeyValueList message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns KeyValueList - */ - public static fromObject(object: { [k: string]: any }): opentelemetry.proto.common.v1.KeyValueList; - - /** - * Creates a plain object from a KeyValueList message. Also converts values to other types if specified. - * @param message KeyValueList - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: opentelemetry.proto.common.v1.KeyValueList, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this KeyValueList to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for KeyValueList - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a KeyValue. */ - interface IKeyValue { - - /** KeyValue key */ - key?: (string|null); - - /** KeyValue value */ - value?: (opentelemetry.proto.common.v1.IAnyValue|null); - } - - /** Represents a KeyValue. */ - class KeyValue implements IKeyValue { - - /** - * Constructs a new KeyValue. - * @param [properties] Properties to set - */ - constructor(properties?: opentelemetry.proto.common.v1.IKeyValue); - - /** KeyValue key. */ - public key: string; - - /** KeyValue value. */ - public value?: (opentelemetry.proto.common.v1.IAnyValue|null); - - /** - * Creates a new KeyValue instance using the specified properties. - * @param [properties] Properties to set - * @returns KeyValue instance - */ - public static create(properties?: opentelemetry.proto.common.v1.IKeyValue): opentelemetry.proto.common.v1.KeyValue; - - /** - * Encodes the specified KeyValue message. Does not implicitly {@link opentelemetry.proto.common.v1.KeyValue.verify|verify} messages. - * @param message KeyValue message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: opentelemetry.proto.common.v1.IKeyValue, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified KeyValue message, length delimited. Does not implicitly {@link opentelemetry.proto.common.v1.KeyValue.verify|verify} messages. - * @param message KeyValue message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: opentelemetry.proto.common.v1.IKeyValue, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a KeyValue message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns KeyValue - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): opentelemetry.proto.common.v1.KeyValue; - - /** - * Decodes a KeyValue message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns KeyValue - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): opentelemetry.proto.common.v1.KeyValue; - - /** - * Verifies a KeyValue message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a KeyValue message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns KeyValue - */ - public static fromObject(object: { [k: string]: any }): opentelemetry.proto.common.v1.KeyValue; - - /** - * Creates a plain object from a KeyValue message. Also converts values to other types if specified. - * @param message KeyValue - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: opentelemetry.proto.common.v1.KeyValue, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this KeyValue to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for KeyValue - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an InstrumentationScope. */ - interface IInstrumentationScope { - - /** InstrumentationScope name */ - name?: (string|null); - - /** InstrumentationScope version */ - version?: (string|null); - - /** InstrumentationScope attributes */ - attributes?: (opentelemetry.proto.common.v1.IKeyValue[]|null); - - /** InstrumentationScope droppedAttributesCount */ - droppedAttributesCount?: (number|null); - } - - /** Represents an InstrumentationScope. */ - class InstrumentationScope implements IInstrumentationScope { - - /** - * Constructs a new InstrumentationScope. - * @param [properties] Properties to set - */ - constructor(properties?: opentelemetry.proto.common.v1.IInstrumentationScope); - - /** InstrumentationScope name. */ - public name: string; - - /** InstrumentationScope version. */ - public version: string; - - /** InstrumentationScope attributes. */ - public attributes: opentelemetry.proto.common.v1.IKeyValue[]; - - /** InstrumentationScope droppedAttributesCount. */ - public droppedAttributesCount: number; - - /** - * Creates a new InstrumentationScope instance using the specified properties. - * @param [properties] Properties to set - * @returns InstrumentationScope instance - */ - public static create(properties?: opentelemetry.proto.common.v1.IInstrumentationScope): opentelemetry.proto.common.v1.InstrumentationScope; - - /** - * Encodes the specified InstrumentationScope message. Does not implicitly {@link opentelemetry.proto.common.v1.InstrumentationScope.verify|verify} messages. - * @param message InstrumentationScope message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: opentelemetry.proto.common.v1.IInstrumentationScope, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified InstrumentationScope message, length delimited. Does not implicitly {@link opentelemetry.proto.common.v1.InstrumentationScope.verify|verify} messages. - * @param message InstrumentationScope message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: opentelemetry.proto.common.v1.IInstrumentationScope, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes an InstrumentationScope message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns InstrumentationScope - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): opentelemetry.proto.common.v1.InstrumentationScope; - - /** - * Decodes an InstrumentationScope message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns InstrumentationScope - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): opentelemetry.proto.common.v1.InstrumentationScope; - - /** - * Verifies an InstrumentationScope message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates an InstrumentationScope message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns InstrumentationScope - */ - public static fromObject(object: { [k: string]: any }): opentelemetry.proto.common.v1.InstrumentationScope; - - /** - * Creates a plain object from an InstrumentationScope message. Also converts values to other types if specified. - * @param message InstrumentationScope - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: opentelemetry.proto.common.v1.InstrumentationScope, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this InstrumentationScope to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for InstrumentationScope - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - } + /** Represents an InstrumentationScope. */ + class InstrumentationScope implements IInstrumentationScope { + /** + * Constructs a new InstrumentationScope. + * @param [properties] Properties to set + */ + constructor( + properties?: opentelemetry.proto.common.v1.IInstrumentationScope, + ); + + /** InstrumentationScope name. */ + public name: string; + + /** InstrumentationScope version. */ + public version: string; + + /** InstrumentationScope attributes. */ + public attributes: opentelemetry.proto.common.v1.IKeyValue[]; + + /** InstrumentationScope droppedAttributesCount. */ + public droppedAttributesCount: number; + + /** + * Creates a new InstrumentationScope instance using the specified properties. + * @param [properties] Properties to set + * @returns InstrumentationScope instance + */ + public static create( + properties?: opentelemetry.proto.common.v1.IInstrumentationScope, + ): opentelemetry.proto.common.v1.InstrumentationScope; + + /** + * Encodes the specified InstrumentationScope message. Does not implicitly {@link opentelemetry.proto.common.v1.InstrumentationScope.verify|verify} messages. + * @param message InstrumentationScope message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode( + message: opentelemetry.proto.common.v1.IInstrumentationScope, + writer?: $protobuf.Writer, + ): $protobuf.Writer; + + /** + * Encodes the specified InstrumentationScope message, length delimited. Does not implicitly {@link opentelemetry.proto.common.v1.InstrumentationScope.verify|verify} messages. + * @param message InstrumentationScope message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited( + message: opentelemetry.proto.common.v1.IInstrumentationScope, + writer?: $protobuf.Writer, + ): $protobuf.Writer; + + /** + * Decodes an InstrumentationScope message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns InstrumentationScope + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode( + reader: $protobuf.Reader | Uint8Array, + length?: number, + ): opentelemetry.proto.common.v1.InstrumentationScope; + + /** + * Decodes an InstrumentationScope message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns InstrumentationScope + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited( + reader: $protobuf.Reader | Uint8Array, + ): opentelemetry.proto.common.v1.InstrumentationScope; + + /** + * Verifies an InstrumentationScope message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): string | null; + + /** + * Creates an InstrumentationScope message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns InstrumentationScope + */ + public static fromObject(object: { + [k: string]: any; + }): opentelemetry.proto.common.v1.InstrumentationScope; + + /** + * Creates a plain object from an InstrumentationScope message. Also converts values to other types if specified. + * @param message InstrumentationScope + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject( + message: opentelemetry.proto.common.v1.InstrumentationScope, + options?: $protobuf.IConversionOptions, + ): { [k: string]: any }; + + /** + * Converts this InstrumentationScope to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for InstrumentationScope + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } + } } + } } diff --git a/proto/index.js b/proto/index.js index 83dbc8a..d854b7e 100644 --- a/proto/index.js +++ b/proto/index.js @@ -1,4153 +1,5137 @@ /*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"; +'use strict'; -var $protobuf = require("protobufjs/minimal"); +var $protobuf = require('protobufjs/minimal'); // Common aliases -const $Reader = $protobuf.Reader, $Writer = $protobuf.Writer, $util = $protobuf.util; +const $Reader = $protobuf.Reader, + $Writer = $protobuf.Writer, + $util = $protobuf.util; // Exported root namespace -const $root = $protobuf.roots["default"] || ($protobuf.roots["default"] = {}); +const $root = $protobuf.roots['default'] || ($protobuf.roots['default'] = {}); -export const opentelemetry = $root.opentelemetry = (() => { +export const opentelemetry = ($root.opentelemetry = (() => { + /** + * Namespace opentelemetry. + * @exports opentelemetry + * @namespace + */ + const opentelemetry = {}; + opentelemetry.proto = (function () { /** - * Namespace opentelemetry. - * @exports opentelemetry + * Namespace proto. + * @memberof opentelemetry * @namespace */ - const opentelemetry = {}; + const proto = {}; - opentelemetry.proto = (function() { + proto.trace = (function () { + /** + * Namespace trace. + * @memberof opentelemetry.proto + * @namespace + */ + const trace = {}; + trace.v1 = (function () { /** - * Namespace proto. - * @memberof opentelemetry + * Namespace v1. + * @memberof opentelemetry.proto.trace * @namespace */ - const proto = {}; + const v1 = {}; + + v1.TracesData = (function () { + /** + * Properties of a TracesData. + * @memberof opentelemetry.proto.trace.v1 + * @interface ITracesData + * @property {Array.|null} [resourceSpans] TracesData resourceSpans + */ + + /** + * Constructs a new TracesData. + * @memberof opentelemetry.proto.trace.v1 + * @classdesc Represents a TracesData. + * @implements ITracesData + * @constructor + * @param {opentelemetry.proto.trace.v1.ITracesData=} [properties] Properties to set + */ + function TracesData(properties) { + this.resourceSpans = []; + if (properties) + for ( + let keys = Object.keys(properties), i = 0; + i < keys.length; + ++i + ) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * TracesData resourceSpans. + * @member {Array.} resourceSpans + * @memberof opentelemetry.proto.trace.v1.TracesData + * @instance + */ + TracesData.prototype.resourceSpans = $util.emptyArray; + + /** + * Creates a new TracesData instance using the specified properties. + * @function create + * @memberof opentelemetry.proto.trace.v1.TracesData + * @static + * @param {opentelemetry.proto.trace.v1.ITracesData=} [properties] Properties to set + * @returns {opentelemetry.proto.trace.v1.TracesData} TracesData instance + */ + TracesData.create = function create(properties) { + return new TracesData(properties); + }; + + /** + * Encodes the specified TracesData message. Does not implicitly {@link opentelemetry.proto.trace.v1.TracesData.verify|verify} messages. + * @function encode + * @memberof opentelemetry.proto.trace.v1.TracesData + * @static + * @param {opentelemetry.proto.trace.v1.ITracesData} message TracesData message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TracesData.encode = function encode(message, writer) { + if (!writer) writer = $Writer.create(); + if (message.resourceSpans != null && message.resourceSpans.length) + for (let i = 0; i < message.resourceSpans.length; ++i) + $root.opentelemetry.proto.trace.v1.ResourceSpans.encode( + message.resourceSpans[i], + writer.uint32(/* id 1, wireType 2 =*/ 10).fork(), + ).ldelim(); + return writer; + }; + + /** + * Encodes the specified TracesData message, length delimited. Does not implicitly {@link opentelemetry.proto.trace.v1.TracesData.verify|verify} messages. + * @function encodeDelimited + * @memberof opentelemetry.proto.trace.v1.TracesData + * @static + * @param {opentelemetry.proto.trace.v1.ITracesData} message TracesData message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TracesData.encodeDelimited = function encodeDelimited( + message, + writer, + ) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a TracesData message from the specified reader or buffer. + * @function decode + * @memberof opentelemetry.proto.trace.v1.TracesData + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {opentelemetry.proto.trace.v1.TracesData} TracesData + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TracesData.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, + message = new $root.opentelemetry.proto.trace.v1.TracesData(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.resourceSpans && message.resourceSpans.length)) + message.resourceSpans = []; + message.resourceSpans.push( + $root.opentelemetry.proto.trace.v1.ResourceSpans.decode( + reader, + reader.uint32(), + ), + ); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a TracesData message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof opentelemetry.proto.trace.v1.TracesData + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {opentelemetry.proto.trace.v1.TracesData} TracesData + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TracesData.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a TracesData message. + * @function verify + * @memberof opentelemetry.proto.trace.v1.TracesData + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + TracesData.verify = function verify(message) { + if (typeof message !== 'object' || message === null) + return 'object expected'; + if ( + message.resourceSpans != null && + message.hasOwnProperty('resourceSpans') + ) { + if (!Array.isArray(message.resourceSpans)) + return 'resourceSpans: array expected'; + for (let i = 0; i < message.resourceSpans.length; ++i) { + let error = + $root.opentelemetry.proto.trace.v1.ResourceSpans.verify( + message.resourceSpans[i], + ); + if (error) return 'resourceSpans.' + error; + } + } + return null; + }; + + /** + * Creates a TracesData message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof opentelemetry.proto.trace.v1.TracesData + * @static + * @param {Object.} object Plain object + * @returns {opentelemetry.proto.trace.v1.TracesData} TracesData + */ + TracesData.fromObject = function fromObject(object) { + if (object instanceof $root.opentelemetry.proto.trace.v1.TracesData) + return object; + let message = new $root.opentelemetry.proto.trace.v1.TracesData(); + if (object.resourceSpans) { + if (!Array.isArray(object.resourceSpans)) + throw TypeError( + '.opentelemetry.proto.trace.v1.TracesData.resourceSpans: array expected', + ); + message.resourceSpans = []; + for (let i = 0; i < object.resourceSpans.length; ++i) { + if (typeof object.resourceSpans[i] !== 'object') + throw TypeError( + '.opentelemetry.proto.trace.v1.TracesData.resourceSpans: object expected', + ); + message.resourceSpans[i] = + $root.opentelemetry.proto.trace.v1.ResourceSpans.fromObject( + object.resourceSpans[i], + ); + } + } + return message; + }; + + /** + * Creates a plain object from a TracesData message. Also converts values to other types if specified. + * @function toObject + * @memberof opentelemetry.proto.trace.v1.TracesData + * @static + * @param {opentelemetry.proto.trace.v1.TracesData} message TracesData + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + TracesData.toObject = function toObject(message, options) { + if (!options) options = {}; + let object = {}; + if (options.arrays || options.defaults) object.resourceSpans = []; + if (message.resourceSpans && message.resourceSpans.length) { + object.resourceSpans = []; + for (let j = 0; j < message.resourceSpans.length; ++j) + object.resourceSpans[j] = + $root.opentelemetry.proto.trace.v1.ResourceSpans.toObject( + message.resourceSpans[j], + options, + ); + } + return object; + }; + + /** + * Converts this TracesData to JSON. + * @function toJSON + * @memberof opentelemetry.proto.trace.v1.TracesData + * @instance + * @returns {Object.} JSON object + */ + TracesData.prototype.toJSON = function toJSON() { + return this.constructor.toObject( + this, + $protobuf.util.toJSONOptions, + ); + }; + + /** + * Gets the default type url for TracesData + * @function getTypeUrl + * @memberof opentelemetry.proto.trace.v1.TracesData + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + TracesData.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = 'type.googleapis.com'; + } + return typeUrlPrefix + '/opentelemetry.proto.trace.v1.TracesData'; + }; + + return TracesData; + })(); + + v1.ResourceSpans = (function () { + /** + * Properties of a ResourceSpans. + * @memberof opentelemetry.proto.trace.v1 + * @interface IResourceSpans + * @property {opentelemetry.proto.resource.v1.IResource|null} [resource] ResourceSpans resource + * @property {Array.|null} [scopeSpans] ResourceSpans scopeSpans + * @property {string|null} [schemaUrl] ResourceSpans schemaUrl + */ + + /** + * Constructs a new ResourceSpans. + * @memberof opentelemetry.proto.trace.v1 + * @classdesc Represents a ResourceSpans. + * @implements IResourceSpans + * @constructor + * @param {opentelemetry.proto.trace.v1.IResourceSpans=} [properties] Properties to set + */ + function ResourceSpans(properties) { + this.scopeSpans = []; + if (properties) + for ( + let keys = Object.keys(properties), i = 0; + i < keys.length; + ++i + ) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ResourceSpans resource. + * @member {opentelemetry.proto.resource.v1.IResource|null|undefined} resource + * @memberof opentelemetry.proto.trace.v1.ResourceSpans + * @instance + */ + ResourceSpans.prototype.resource = null; + + /** + * ResourceSpans scopeSpans. + * @member {Array.} scopeSpans + * @memberof opentelemetry.proto.trace.v1.ResourceSpans + * @instance + */ + ResourceSpans.prototype.scopeSpans = $util.emptyArray; + + /** + * ResourceSpans schemaUrl. + * @member {string} schemaUrl + * @memberof opentelemetry.proto.trace.v1.ResourceSpans + * @instance + */ + ResourceSpans.prototype.schemaUrl = ''; + + /** + * Creates a new ResourceSpans instance using the specified properties. + * @function create + * @memberof opentelemetry.proto.trace.v1.ResourceSpans + * @static + * @param {opentelemetry.proto.trace.v1.IResourceSpans=} [properties] Properties to set + * @returns {opentelemetry.proto.trace.v1.ResourceSpans} ResourceSpans instance + */ + ResourceSpans.create = function create(properties) { + return new ResourceSpans(properties); + }; + + /** + * Encodes the specified ResourceSpans message. Does not implicitly {@link opentelemetry.proto.trace.v1.ResourceSpans.verify|verify} messages. + * @function encode + * @memberof opentelemetry.proto.trace.v1.ResourceSpans + * @static + * @param {opentelemetry.proto.trace.v1.IResourceSpans} message ResourceSpans message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ResourceSpans.encode = function encode(message, writer) { + if (!writer) writer = $Writer.create(); + if ( + message.resource != null && + Object.hasOwnProperty.call(message, 'resource') + ) + $root.opentelemetry.proto.resource.v1.Resource.encode( + message.resource, + writer.uint32(/* id 1, wireType 2 =*/ 10).fork(), + ).ldelim(); + if (message.scopeSpans != null && message.scopeSpans.length) + for (let i = 0; i < message.scopeSpans.length; ++i) + $root.opentelemetry.proto.trace.v1.ScopeSpans.encode( + message.scopeSpans[i], + writer.uint32(/* id 2, wireType 2 =*/ 18).fork(), + ).ldelim(); + if ( + message.schemaUrl != null && + Object.hasOwnProperty.call(message, 'schemaUrl') + ) + writer + .uint32(/* id 3, wireType 2 =*/ 26) + .string(message.schemaUrl); + return writer; + }; + + /** + * Encodes the specified ResourceSpans message, length delimited. Does not implicitly {@link opentelemetry.proto.trace.v1.ResourceSpans.verify|verify} messages. + * @function encodeDelimited + * @memberof opentelemetry.proto.trace.v1.ResourceSpans + * @static + * @param {opentelemetry.proto.trace.v1.IResourceSpans} message ResourceSpans message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ResourceSpans.encodeDelimited = function encodeDelimited( + message, + writer, + ) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ResourceSpans message from the specified reader or buffer. + * @function decode + * @memberof opentelemetry.proto.trace.v1.ResourceSpans + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {opentelemetry.proto.trace.v1.ResourceSpans} ResourceSpans + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ResourceSpans.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, + message = new $root.opentelemetry.proto.trace.v1.ResourceSpans(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.resource = + $root.opentelemetry.proto.resource.v1.Resource.decode( + reader, + reader.uint32(), + ); + break; + } + case 2: { + if (!(message.scopeSpans && message.scopeSpans.length)) + message.scopeSpans = []; + message.scopeSpans.push( + $root.opentelemetry.proto.trace.v1.ScopeSpans.decode( + reader, + reader.uint32(), + ), + ); + break; + } + case 3: { + message.schemaUrl = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ResourceSpans message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof opentelemetry.proto.trace.v1.ResourceSpans + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {opentelemetry.proto.trace.v1.ResourceSpans} ResourceSpans + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ResourceSpans.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ResourceSpans message. + * @function verify + * @memberof opentelemetry.proto.trace.v1.ResourceSpans + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ResourceSpans.verify = function verify(message) { + if (typeof message !== 'object' || message === null) + return 'object expected'; + if ( + message.resource != null && + message.hasOwnProperty('resource') + ) { + let error = $root.opentelemetry.proto.resource.v1.Resource.verify( + message.resource, + ); + if (error) return 'resource.' + error; + } + if ( + message.scopeSpans != null && + message.hasOwnProperty('scopeSpans') + ) { + if (!Array.isArray(message.scopeSpans)) + return 'scopeSpans: array expected'; + for (let i = 0; i < message.scopeSpans.length; ++i) { + let error = + $root.opentelemetry.proto.trace.v1.ScopeSpans.verify( + message.scopeSpans[i], + ); + if (error) return 'scopeSpans.' + error; + } + } + if ( + message.schemaUrl != null && + message.hasOwnProperty('schemaUrl') + ) + if (!$util.isString(message.schemaUrl)) + return 'schemaUrl: string expected'; + return null; + }; + + /** + * Creates a ResourceSpans message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof opentelemetry.proto.trace.v1.ResourceSpans + * @static + * @param {Object.} object Plain object + * @returns {opentelemetry.proto.trace.v1.ResourceSpans} ResourceSpans + */ + ResourceSpans.fromObject = function fromObject(object) { + if ( + object instanceof $root.opentelemetry.proto.trace.v1.ResourceSpans + ) + return object; + let message = + new $root.opentelemetry.proto.trace.v1.ResourceSpans(); + if (object.resource != null) { + if (typeof object.resource !== 'object') + throw TypeError( + '.opentelemetry.proto.trace.v1.ResourceSpans.resource: object expected', + ); + message.resource = + $root.opentelemetry.proto.resource.v1.Resource.fromObject( + object.resource, + ); + } + if (object.scopeSpans) { + if (!Array.isArray(object.scopeSpans)) + throw TypeError( + '.opentelemetry.proto.trace.v1.ResourceSpans.scopeSpans: array expected', + ); + message.scopeSpans = []; + for (let i = 0; i < object.scopeSpans.length; ++i) { + if (typeof object.scopeSpans[i] !== 'object') + throw TypeError( + '.opentelemetry.proto.trace.v1.ResourceSpans.scopeSpans: object expected', + ); + message.scopeSpans[i] = + $root.opentelemetry.proto.trace.v1.ScopeSpans.fromObject( + object.scopeSpans[i], + ); + } + } + if (object.schemaUrl != null) + message.schemaUrl = String(object.schemaUrl); + return message; + }; + + /** + * Creates a plain object from a ResourceSpans message. Also converts values to other types if specified. + * @function toObject + * @memberof opentelemetry.proto.trace.v1.ResourceSpans + * @static + * @param {opentelemetry.proto.trace.v1.ResourceSpans} message ResourceSpans + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ResourceSpans.toObject = function toObject(message, options) { + if (!options) options = {}; + let object = {}; + if (options.arrays || options.defaults) object.scopeSpans = []; + if (options.defaults) { + object.resource = null; + object.schemaUrl = ''; + } + if (message.resource != null && message.hasOwnProperty('resource')) + object.resource = + $root.opentelemetry.proto.resource.v1.Resource.toObject( + message.resource, + options, + ); + if (message.scopeSpans && message.scopeSpans.length) { + object.scopeSpans = []; + for (let j = 0; j < message.scopeSpans.length; ++j) + object.scopeSpans[j] = + $root.opentelemetry.proto.trace.v1.ScopeSpans.toObject( + message.scopeSpans[j], + options, + ); + } + if ( + message.schemaUrl != null && + message.hasOwnProperty('schemaUrl') + ) + object.schemaUrl = message.schemaUrl; + return object; + }; + + /** + * Converts this ResourceSpans to JSON. + * @function toJSON + * @memberof opentelemetry.proto.trace.v1.ResourceSpans + * @instance + * @returns {Object.} JSON object + */ + ResourceSpans.prototype.toJSON = function toJSON() { + return this.constructor.toObject( + this, + $protobuf.util.toJSONOptions, + ); + }; + + /** + * Gets the default type url for ResourceSpans + * @function getTypeUrl + * @memberof opentelemetry.proto.trace.v1.ResourceSpans + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ResourceSpans.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = 'type.googleapis.com'; + } + return ( + typeUrlPrefix + '/opentelemetry.proto.trace.v1.ResourceSpans' + ); + }; + + return ResourceSpans; + })(); - proto.trace = (function() { + v1.ScopeSpans = (function () { + /** + * Properties of a ScopeSpans. + * @memberof opentelemetry.proto.trace.v1 + * @interface IScopeSpans + * @property {opentelemetry.proto.common.v1.IInstrumentationScope|null} [scope] ScopeSpans scope + * @property {Array.|null} [spans] ScopeSpans spans + * @property {string|null} [schemaUrl] ScopeSpans schemaUrl + */ + + /** + * Constructs a new ScopeSpans. + * @memberof opentelemetry.proto.trace.v1 + * @classdesc Represents a ScopeSpans. + * @implements IScopeSpans + * @constructor + * @param {opentelemetry.proto.trace.v1.IScopeSpans=} [properties] Properties to set + */ + function ScopeSpans(properties) { + this.spans = []; + if (properties) + for ( + let keys = Object.keys(properties), i = 0; + i < keys.length; + ++i + ) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ScopeSpans scope. + * @member {opentelemetry.proto.common.v1.IInstrumentationScope|null|undefined} scope + * @memberof opentelemetry.proto.trace.v1.ScopeSpans + * @instance + */ + ScopeSpans.prototype.scope = null; + + /** + * ScopeSpans spans. + * @member {Array.} spans + * @memberof opentelemetry.proto.trace.v1.ScopeSpans + * @instance + */ + ScopeSpans.prototype.spans = $util.emptyArray; + + /** + * ScopeSpans schemaUrl. + * @member {string} schemaUrl + * @memberof opentelemetry.proto.trace.v1.ScopeSpans + * @instance + */ + ScopeSpans.prototype.schemaUrl = ''; + + /** + * Creates a new ScopeSpans instance using the specified properties. + * @function create + * @memberof opentelemetry.proto.trace.v1.ScopeSpans + * @static + * @param {opentelemetry.proto.trace.v1.IScopeSpans=} [properties] Properties to set + * @returns {opentelemetry.proto.trace.v1.ScopeSpans} ScopeSpans instance + */ + ScopeSpans.create = function create(properties) { + return new ScopeSpans(properties); + }; + + /** + * Encodes the specified ScopeSpans message. Does not implicitly {@link opentelemetry.proto.trace.v1.ScopeSpans.verify|verify} messages. + * @function encode + * @memberof opentelemetry.proto.trace.v1.ScopeSpans + * @static + * @param {opentelemetry.proto.trace.v1.IScopeSpans} message ScopeSpans message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ScopeSpans.encode = function encode(message, writer) { + if (!writer) writer = $Writer.create(); + if ( + message.scope != null && + Object.hasOwnProperty.call(message, 'scope') + ) + $root.opentelemetry.proto.common.v1.InstrumentationScope.encode( + message.scope, + writer.uint32(/* id 1, wireType 2 =*/ 10).fork(), + ).ldelim(); + if (message.spans != null && message.spans.length) + for (let i = 0; i < message.spans.length; ++i) + $root.opentelemetry.proto.trace.v1.Span.encode( + message.spans[i], + writer.uint32(/* id 2, wireType 2 =*/ 18).fork(), + ).ldelim(); + if ( + message.schemaUrl != null && + Object.hasOwnProperty.call(message, 'schemaUrl') + ) + writer + .uint32(/* id 3, wireType 2 =*/ 26) + .string(message.schemaUrl); + return writer; + }; + + /** + * Encodes the specified ScopeSpans message, length delimited. Does not implicitly {@link opentelemetry.proto.trace.v1.ScopeSpans.verify|verify} messages. + * @function encodeDelimited + * @memberof opentelemetry.proto.trace.v1.ScopeSpans + * @static + * @param {opentelemetry.proto.trace.v1.IScopeSpans} message ScopeSpans message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ScopeSpans.encodeDelimited = function encodeDelimited( + message, + writer, + ) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ScopeSpans message from the specified reader or buffer. + * @function decode + * @memberof opentelemetry.proto.trace.v1.ScopeSpans + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {opentelemetry.proto.trace.v1.ScopeSpans} ScopeSpans + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ScopeSpans.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, + message = new $root.opentelemetry.proto.trace.v1.ScopeSpans(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.scope = + $root.opentelemetry.proto.common.v1.InstrumentationScope.decode( + reader, + reader.uint32(), + ); + break; + } + case 2: { + if (!(message.spans && message.spans.length)) + message.spans = []; + message.spans.push( + $root.opentelemetry.proto.trace.v1.Span.decode( + reader, + reader.uint32(), + ), + ); + break; + } + case 3: { + message.schemaUrl = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ScopeSpans message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof opentelemetry.proto.trace.v1.ScopeSpans + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {opentelemetry.proto.trace.v1.ScopeSpans} ScopeSpans + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ScopeSpans.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ScopeSpans message. + * @function verify + * @memberof opentelemetry.proto.trace.v1.ScopeSpans + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ScopeSpans.verify = function verify(message) { + if (typeof message !== 'object' || message === null) + return 'object expected'; + if (message.scope != null && message.hasOwnProperty('scope')) { + let error = + $root.opentelemetry.proto.common.v1.InstrumentationScope.verify( + message.scope, + ); + if (error) return 'scope.' + error; + } + if (message.spans != null && message.hasOwnProperty('spans')) { + if (!Array.isArray(message.spans)) return 'spans: array expected'; + for (let i = 0; i < message.spans.length; ++i) { + let error = $root.opentelemetry.proto.trace.v1.Span.verify( + message.spans[i], + ); + if (error) return 'spans.' + error; + } + } + if ( + message.schemaUrl != null && + message.hasOwnProperty('schemaUrl') + ) + if (!$util.isString(message.schemaUrl)) + return 'schemaUrl: string expected'; + return null; + }; + + /** + * Creates a ScopeSpans message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof opentelemetry.proto.trace.v1.ScopeSpans + * @static + * @param {Object.} object Plain object + * @returns {opentelemetry.proto.trace.v1.ScopeSpans} ScopeSpans + */ + ScopeSpans.fromObject = function fromObject(object) { + if (object instanceof $root.opentelemetry.proto.trace.v1.ScopeSpans) + return object; + let message = new $root.opentelemetry.proto.trace.v1.ScopeSpans(); + if (object.scope != null) { + if (typeof object.scope !== 'object') + throw TypeError( + '.opentelemetry.proto.trace.v1.ScopeSpans.scope: object expected', + ); + message.scope = + $root.opentelemetry.proto.common.v1.InstrumentationScope.fromObject( + object.scope, + ); + } + if (object.spans) { + if (!Array.isArray(object.spans)) + throw TypeError( + '.opentelemetry.proto.trace.v1.ScopeSpans.spans: array expected', + ); + message.spans = []; + for (let i = 0; i < object.spans.length; ++i) { + if (typeof object.spans[i] !== 'object') + throw TypeError( + '.opentelemetry.proto.trace.v1.ScopeSpans.spans: object expected', + ); + message.spans[i] = + $root.opentelemetry.proto.trace.v1.Span.fromObject( + object.spans[i], + ); + } + } + if (object.schemaUrl != null) + message.schemaUrl = String(object.schemaUrl); + return message; + }; + + /** + * Creates a plain object from a ScopeSpans message. Also converts values to other types if specified. + * @function toObject + * @memberof opentelemetry.proto.trace.v1.ScopeSpans + * @static + * @param {opentelemetry.proto.trace.v1.ScopeSpans} message ScopeSpans + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ScopeSpans.toObject = function toObject(message, options) { + if (!options) options = {}; + let object = {}; + if (options.arrays || options.defaults) object.spans = []; + if (options.defaults) { + object.scope = null; + object.schemaUrl = ''; + } + if (message.scope != null && message.hasOwnProperty('scope')) + object.scope = + $root.opentelemetry.proto.common.v1.InstrumentationScope.toObject( + message.scope, + options, + ); + if (message.spans && message.spans.length) { + object.spans = []; + for (let j = 0; j < message.spans.length; ++j) + object.spans[j] = + $root.opentelemetry.proto.trace.v1.Span.toObject( + message.spans[j], + options, + ); + } + if ( + message.schemaUrl != null && + message.hasOwnProperty('schemaUrl') + ) + object.schemaUrl = message.schemaUrl; + return object; + }; + + /** + * Converts this ScopeSpans to JSON. + * @function toJSON + * @memberof opentelemetry.proto.trace.v1.ScopeSpans + * @instance + * @returns {Object.} JSON object + */ + ScopeSpans.prototype.toJSON = function toJSON() { + return this.constructor.toObject( + this, + $protobuf.util.toJSONOptions, + ); + }; + + /** + * Gets the default type url for ScopeSpans + * @function getTypeUrl + * @memberof opentelemetry.proto.trace.v1.ScopeSpans + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ScopeSpans.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = 'type.googleapis.com'; + } + return typeUrlPrefix + '/opentelemetry.proto.trace.v1.ScopeSpans'; + }; + + return ScopeSpans; + })(); + v1.Span = (function () { + /** + * Properties of a Span. + * @memberof opentelemetry.proto.trace.v1 + * @interface ISpan + * @property {Uint8Array|null} [traceId] Span traceId + * @property {Uint8Array|null} [spanId] Span spanId + * @property {string|null} [traceState] Span traceState + * @property {Uint8Array|null} [parentSpanId] Span parentSpanId + * @property {string|null} [name] Span name + * @property {opentelemetry.proto.trace.v1.Span.SpanKind|null} [kind] Span kind + * @property {number|Long|null} [startTimeUnixNano] Span startTimeUnixNano + * @property {number|Long|null} [endTimeUnixNano] Span endTimeUnixNano + * @property {Array.|null} [attributes] Span attributes + * @property {number|null} [droppedAttributesCount] Span droppedAttributesCount + * @property {Array.|null} [events] Span events + * @property {number|null} [droppedEventsCount] Span droppedEventsCount + * @property {Array.|null} [links] Span links + * @property {number|null} [droppedLinksCount] Span droppedLinksCount + * @property {opentelemetry.proto.trace.v1.IStatus|null} [status] Span status + */ + + /** + * Constructs a new Span. + * @memberof opentelemetry.proto.trace.v1 + * @classdesc Represents a Span. + * @implements ISpan + * @constructor + * @param {opentelemetry.proto.trace.v1.ISpan=} [properties] Properties to set + */ + function Span(properties) { + this.attributes = []; + this.events = []; + this.links = []; + if (properties) + for ( + let keys = Object.keys(properties), i = 0; + i < keys.length; + ++i + ) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Span traceId. + * @member {Uint8Array} traceId + * @memberof opentelemetry.proto.trace.v1.Span + * @instance + */ + Span.prototype.traceId = $util.newBuffer([]); + + /** + * Span spanId. + * @member {Uint8Array} spanId + * @memberof opentelemetry.proto.trace.v1.Span + * @instance + */ + Span.prototype.spanId = $util.newBuffer([]); + + /** + * Span traceState. + * @member {string} traceState + * @memberof opentelemetry.proto.trace.v1.Span + * @instance + */ + Span.prototype.traceState = ''; + + /** + * Span parentSpanId. + * @member {Uint8Array} parentSpanId + * @memberof opentelemetry.proto.trace.v1.Span + * @instance + */ + Span.prototype.parentSpanId = $util.newBuffer([]); + + /** + * Span name. + * @member {string} name + * @memberof opentelemetry.proto.trace.v1.Span + * @instance + */ + Span.prototype.name = ''; + + /** + * Span kind. + * @member {opentelemetry.proto.trace.v1.Span.SpanKind} kind + * @memberof opentelemetry.proto.trace.v1.Span + * @instance + */ + Span.prototype.kind = 0; + + /** + * Span startTimeUnixNano. + * @member {number|Long} startTimeUnixNano + * @memberof opentelemetry.proto.trace.v1.Span + * @instance + */ + Span.prototype.startTimeUnixNano = $util.Long + ? $util.Long.fromBits(0, 0, false) + : 0; + + /** + * Span endTimeUnixNano. + * @member {number|Long} endTimeUnixNano + * @memberof opentelemetry.proto.trace.v1.Span + * @instance + */ + Span.prototype.endTimeUnixNano = $util.Long + ? $util.Long.fromBits(0, 0, false) + : 0; + + /** + * Span attributes. + * @member {Array.} attributes + * @memberof opentelemetry.proto.trace.v1.Span + * @instance + */ + Span.prototype.attributes = $util.emptyArray; + + /** + * Span droppedAttributesCount. + * @member {number} droppedAttributesCount + * @memberof opentelemetry.proto.trace.v1.Span + * @instance + */ + Span.prototype.droppedAttributesCount = 0; + + /** + * Span events. + * @member {Array.} events + * @memberof opentelemetry.proto.trace.v1.Span + * @instance + */ + Span.prototype.events = $util.emptyArray; + + /** + * Span droppedEventsCount. + * @member {number} droppedEventsCount + * @memberof opentelemetry.proto.trace.v1.Span + * @instance + */ + Span.prototype.droppedEventsCount = 0; + + /** + * Span links. + * @member {Array.} links + * @memberof opentelemetry.proto.trace.v1.Span + * @instance + */ + Span.prototype.links = $util.emptyArray; + + /** + * Span droppedLinksCount. + * @member {number} droppedLinksCount + * @memberof opentelemetry.proto.trace.v1.Span + * @instance + */ + Span.prototype.droppedLinksCount = 0; + + /** + * Span status. + * @member {opentelemetry.proto.trace.v1.IStatus|null|undefined} status + * @memberof opentelemetry.proto.trace.v1.Span + * @instance + */ + Span.prototype.status = null; + + /** + * Creates a new Span instance using the specified properties. + * @function create + * @memberof opentelemetry.proto.trace.v1.Span + * @static + * @param {opentelemetry.proto.trace.v1.ISpan=} [properties] Properties to set + * @returns {opentelemetry.proto.trace.v1.Span} Span instance + */ + Span.create = function create(properties) { + return new Span(properties); + }; + + /** + * Encodes the specified Span message. Does not implicitly {@link opentelemetry.proto.trace.v1.Span.verify|verify} messages. + * @function encode + * @memberof opentelemetry.proto.trace.v1.Span + * @static + * @param {opentelemetry.proto.trace.v1.ISpan} message Span message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Span.encode = function encode(message, writer) { + if (!writer) writer = $Writer.create(); + if ( + message.traceId != null && + Object.hasOwnProperty.call(message, 'traceId') + ) + writer.uint32(/* id 1, wireType 2 =*/ 10).bytes(message.traceId); + if ( + message.spanId != null && + Object.hasOwnProperty.call(message, 'spanId') + ) + writer.uint32(/* id 2, wireType 2 =*/ 18).bytes(message.spanId); + if ( + message.traceState != null && + Object.hasOwnProperty.call(message, 'traceState') + ) + writer + .uint32(/* id 3, wireType 2 =*/ 26) + .string(message.traceState); + if ( + message.parentSpanId != null && + Object.hasOwnProperty.call(message, 'parentSpanId') + ) + writer + .uint32(/* id 4, wireType 2 =*/ 34) + .bytes(message.parentSpanId); + if ( + message.name != null && + Object.hasOwnProperty.call(message, 'name') + ) + writer.uint32(/* id 5, wireType 2 =*/ 42).string(message.name); + if ( + message.kind != null && + Object.hasOwnProperty.call(message, 'kind') + ) + writer.uint32(/* id 6, wireType 0 =*/ 48).int32(message.kind); + if ( + message.startTimeUnixNano != null && + Object.hasOwnProperty.call(message, 'startTimeUnixNano') + ) + writer + .uint32(/* id 7, wireType 1 =*/ 57) + .fixed64(message.startTimeUnixNano); + if ( + message.endTimeUnixNano != null && + Object.hasOwnProperty.call(message, 'endTimeUnixNano') + ) + writer + .uint32(/* id 8, wireType 1 =*/ 65) + .fixed64(message.endTimeUnixNano); + if (message.attributes != null && message.attributes.length) + for (let i = 0; i < message.attributes.length; ++i) + $root.opentelemetry.proto.common.v1.KeyValue.encode( + message.attributes[i], + writer.uint32(/* id 9, wireType 2 =*/ 74).fork(), + ).ldelim(); + if ( + message.droppedAttributesCount != null && + Object.hasOwnProperty.call(message, 'droppedAttributesCount') + ) + writer + .uint32(/* id 10, wireType 0 =*/ 80) + .uint32(message.droppedAttributesCount); + if (message.events != null && message.events.length) + for (let i = 0; i < message.events.length; ++i) + $root.opentelemetry.proto.trace.v1.Span.Event.encode( + message.events[i], + writer.uint32(/* id 11, wireType 2 =*/ 90).fork(), + ).ldelim(); + if ( + message.droppedEventsCount != null && + Object.hasOwnProperty.call(message, 'droppedEventsCount') + ) + writer + .uint32(/* id 12, wireType 0 =*/ 96) + .uint32(message.droppedEventsCount); + if (message.links != null && message.links.length) + for (let i = 0; i < message.links.length; ++i) + $root.opentelemetry.proto.trace.v1.Span.Link.encode( + message.links[i], + writer.uint32(/* id 13, wireType 2 =*/ 106).fork(), + ).ldelim(); + if ( + message.droppedLinksCount != null && + Object.hasOwnProperty.call(message, 'droppedLinksCount') + ) + writer + .uint32(/* id 14, wireType 0 =*/ 112) + .uint32(message.droppedLinksCount); + if ( + message.status != null && + Object.hasOwnProperty.call(message, 'status') + ) + $root.opentelemetry.proto.trace.v1.Status.encode( + message.status, + writer.uint32(/* id 15, wireType 2 =*/ 122).fork(), + ).ldelim(); + return writer; + }; + + /** + * Encodes the specified Span message, length delimited. Does not implicitly {@link opentelemetry.proto.trace.v1.Span.verify|verify} messages. + * @function encodeDelimited + * @memberof opentelemetry.proto.trace.v1.Span + * @static + * @param {opentelemetry.proto.trace.v1.ISpan} message Span message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Span.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Span message from the specified reader or buffer. + * @function decode + * @memberof opentelemetry.proto.trace.v1.Span + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {opentelemetry.proto.trace.v1.Span} Span + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Span.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, + message = new $root.opentelemetry.proto.trace.v1.Span(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.traceId = reader.bytes(); + break; + } + case 2: { + message.spanId = reader.bytes(); + break; + } + case 3: { + message.traceState = reader.string(); + break; + } + case 4: { + message.parentSpanId = reader.bytes(); + break; + } + case 5: { + message.name = reader.string(); + break; + } + case 6: { + message.kind = reader.int32(); + break; + } + case 7: { + message.startTimeUnixNano = reader.fixed64(); + break; + } + case 8: { + message.endTimeUnixNano = reader.fixed64(); + break; + } + case 9: { + if (!(message.attributes && message.attributes.length)) + message.attributes = []; + message.attributes.push( + $root.opentelemetry.proto.common.v1.KeyValue.decode( + reader, + reader.uint32(), + ), + ); + break; + } + case 10: { + message.droppedAttributesCount = reader.uint32(); + break; + } + case 11: { + if (!(message.events && message.events.length)) + message.events = []; + message.events.push( + $root.opentelemetry.proto.trace.v1.Span.Event.decode( + reader, + reader.uint32(), + ), + ); + break; + } + case 12: { + message.droppedEventsCount = reader.uint32(); + break; + } + case 13: { + if (!(message.links && message.links.length)) + message.links = []; + message.links.push( + $root.opentelemetry.proto.trace.v1.Span.Link.decode( + reader, + reader.uint32(), + ), + ); + break; + } + case 14: { + message.droppedLinksCount = reader.uint32(); + break; + } + case 15: { + message.status = + $root.opentelemetry.proto.trace.v1.Status.decode( + reader, + reader.uint32(), + ); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Span message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof opentelemetry.proto.trace.v1.Span + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {opentelemetry.proto.trace.v1.Span} Span + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Span.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Span message. + * @function verify + * @memberof opentelemetry.proto.trace.v1.Span + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Span.verify = function verify(message) { + if (typeof message !== 'object' || message === null) + return 'object expected'; + if (message.traceId != null && message.hasOwnProperty('traceId')) + if ( + !( + (message.traceId && + typeof message.traceId.length === 'number') || + $util.isString(message.traceId) + ) + ) + return 'traceId: buffer expected'; + if (message.spanId != null && message.hasOwnProperty('spanId')) + if ( + !( + (message.spanId && + typeof message.spanId.length === 'number') || + $util.isString(message.spanId) + ) + ) + return 'spanId: buffer expected'; + if ( + message.traceState != null && + message.hasOwnProperty('traceState') + ) + if (!$util.isString(message.traceState)) + return 'traceState: string expected'; + if ( + message.parentSpanId != null && + message.hasOwnProperty('parentSpanId') + ) + if ( + !( + (message.parentSpanId && + typeof message.parentSpanId.length === 'number') || + $util.isString(message.parentSpanId) + ) + ) + return 'parentSpanId: buffer expected'; + if (message.name != null && message.hasOwnProperty('name')) + if (!$util.isString(message.name)) return 'name: string expected'; + if (message.kind != null && message.hasOwnProperty('kind')) + switch (message.kind) { + default: + return 'kind: enum value expected'; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + break; + } + if ( + message.startTimeUnixNano != null && + message.hasOwnProperty('startTimeUnixNano') + ) + if ( + !$util.isInteger(message.startTimeUnixNano) && + !( + message.startTimeUnixNano && + $util.isInteger(message.startTimeUnixNano.low) && + $util.isInteger(message.startTimeUnixNano.high) + ) + ) + return 'startTimeUnixNano: integer|Long expected'; + if ( + message.endTimeUnixNano != null && + message.hasOwnProperty('endTimeUnixNano') + ) + if ( + !$util.isInteger(message.endTimeUnixNano) && + !( + message.endTimeUnixNano && + $util.isInteger(message.endTimeUnixNano.low) && + $util.isInteger(message.endTimeUnixNano.high) + ) + ) + return 'endTimeUnixNano: integer|Long expected'; + if ( + message.attributes != null && + message.hasOwnProperty('attributes') + ) { + if (!Array.isArray(message.attributes)) + return 'attributes: array expected'; + for (let i = 0; i < message.attributes.length; ++i) { + let error = $root.opentelemetry.proto.common.v1.KeyValue.verify( + message.attributes[i], + ); + if (error) return 'attributes.' + error; + } + } + if ( + message.droppedAttributesCount != null && + message.hasOwnProperty('droppedAttributesCount') + ) + if (!$util.isInteger(message.droppedAttributesCount)) + return 'droppedAttributesCount: integer expected'; + if (message.events != null && message.hasOwnProperty('events')) { + if (!Array.isArray(message.events)) + return 'events: array expected'; + for (let i = 0; i < message.events.length; ++i) { + let error = + $root.opentelemetry.proto.trace.v1.Span.Event.verify( + message.events[i], + ); + if (error) return 'events.' + error; + } + } + if ( + message.droppedEventsCount != null && + message.hasOwnProperty('droppedEventsCount') + ) + if (!$util.isInteger(message.droppedEventsCount)) + return 'droppedEventsCount: integer expected'; + if (message.links != null && message.hasOwnProperty('links')) { + if (!Array.isArray(message.links)) return 'links: array expected'; + for (let i = 0; i < message.links.length; ++i) { + let error = $root.opentelemetry.proto.trace.v1.Span.Link.verify( + message.links[i], + ); + if (error) return 'links.' + error; + } + } + if ( + message.droppedLinksCount != null && + message.hasOwnProperty('droppedLinksCount') + ) + if (!$util.isInteger(message.droppedLinksCount)) + return 'droppedLinksCount: integer expected'; + if (message.status != null && message.hasOwnProperty('status')) { + let error = $root.opentelemetry.proto.trace.v1.Status.verify( + message.status, + ); + if (error) return 'status.' + error; + } + return null; + }; + + /** + * Creates a Span message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof opentelemetry.proto.trace.v1.Span + * @static + * @param {Object.} object Plain object + * @returns {opentelemetry.proto.trace.v1.Span} Span + */ + Span.fromObject = function fromObject(object) { + if (object instanceof $root.opentelemetry.proto.trace.v1.Span) + return object; + let message = new $root.opentelemetry.proto.trace.v1.Span(); + if (object.traceId != null) + if (typeof object.traceId === 'string') + $util.base64.decode( + object.traceId, + (message.traceId = $util.newBuffer( + $util.base64.length(object.traceId), + )), + 0, + ); + else if (object.traceId.length >= 0) + message.traceId = object.traceId; + if (object.spanId != null) + if (typeof object.spanId === 'string') + $util.base64.decode( + object.spanId, + (message.spanId = $util.newBuffer( + $util.base64.length(object.spanId), + )), + 0, + ); + else if (object.spanId.length >= 0) + message.spanId = object.spanId; + if (object.traceState != null) + message.traceState = String(object.traceState); + if (object.parentSpanId != null) + if (typeof object.parentSpanId === 'string') + $util.base64.decode( + object.parentSpanId, + (message.parentSpanId = $util.newBuffer( + $util.base64.length(object.parentSpanId), + )), + 0, + ); + else if (object.parentSpanId.length >= 0) + message.parentSpanId = object.parentSpanId; + if (object.name != null) message.name = String(object.name); + switch (object.kind) { + default: + if (typeof object.kind === 'number') { + message.kind = object.kind; + break; + } + break; + case 'SPAN_KIND_UNSPECIFIED': + case 0: + message.kind = 0; + break; + case 'SPAN_KIND_INTERNAL': + case 1: + message.kind = 1; + break; + case 'SPAN_KIND_SERVER': + case 2: + message.kind = 2; + break; + case 'SPAN_KIND_CLIENT': + case 3: + message.kind = 3; + break; + case 'SPAN_KIND_PRODUCER': + case 4: + message.kind = 4; + break; + case 'SPAN_KIND_CONSUMER': + case 5: + message.kind = 5; + break; + } + if (object.startTimeUnixNano != null) + if ($util.Long) + (message.startTimeUnixNano = $util.Long.fromValue( + object.startTimeUnixNano, + )).unsigned = false; + else if (typeof object.startTimeUnixNano === 'string') + message.startTimeUnixNano = parseInt( + object.startTimeUnixNano, + 10, + ); + else if (typeof object.startTimeUnixNano === 'number') + message.startTimeUnixNano = object.startTimeUnixNano; + else if (typeof object.startTimeUnixNano === 'object') + message.startTimeUnixNano = new $util.LongBits( + object.startTimeUnixNano.low >>> 0, + object.startTimeUnixNano.high >>> 0, + ).toNumber(); + if (object.endTimeUnixNano != null) + if ($util.Long) + (message.endTimeUnixNano = $util.Long.fromValue( + object.endTimeUnixNano, + )).unsigned = false; + else if (typeof object.endTimeUnixNano === 'string') + message.endTimeUnixNano = parseInt(object.endTimeUnixNano, 10); + else if (typeof object.endTimeUnixNano === 'number') + message.endTimeUnixNano = object.endTimeUnixNano; + else if (typeof object.endTimeUnixNano === 'object') + message.endTimeUnixNano = new $util.LongBits( + object.endTimeUnixNano.low >>> 0, + object.endTimeUnixNano.high >>> 0, + ).toNumber(); + if (object.attributes) { + if (!Array.isArray(object.attributes)) + throw TypeError( + '.opentelemetry.proto.trace.v1.Span.attributes: array expected', + ); + message.attributes = []; + for (let i = 0; i < object.attributes.length; ++i) { + if (typeof object.attributes[i] !== 'object') + throw TypeError( + '.opentelemetry.proto.trace.v1.Span.attributes: object expected', + ); + message.attributes[i] = + $root.opentelemetry.proto.common.v1.KeyValue.fromObject( + object.attributes[i], + ); + } + } + if (object.droppedAttributesCount != null) + message.droppedAttributesCount = + object.droppedAttributesCount >>> 0; + if (object.events) { + if (!Array.isArray(object.events)) + throw TypeError( + '.opentelemetry.proto.trace.v1.Span.events: array expected', + ); + message.events = []; + for (let i = 0; i < object.events.length; ++i) { + if (typeof object.events[i] !== 'object') + throw TypeError( + '.opentelemetry.proto.trace.v1.Span.events: object expected', + ); + message.events[i] = + $root.opentelemetry.proto.trace.v1.Span.Event.fromObject( + object.events[i], + ); + } + } + if (object.droppedEventsCount != null) + message.droppedEventsCount = object.droppedEventsCount >>> 0; + if (object.links) { + if (!Array.isArray(object.links)) + throw TypeError( + '.opentelemetry.proto.trace.v1.Span.links: array expected', + ); + message.links = []; + for (let i = 0; i < object.links.length; ++i) { + if (typeof object.links[i] !== 'object') + throw TypeError( + '.opentelemetry.proto.trace.v1.Span.links: object expected', + ); + message.links[i] = + $root.opentelemetry.proto.trace.v1.Span.Link.fromObject( + object.links[i], + ); + } + } + if (object.droppedLinksCount != null) + message.droppedLinksCount = object.droppedLinksCount >>> 0; + if (object.status != null) { + if (typeof object.status !== 'object') + throw TypeError( + '.opentelemetry.proto.trace.v1.Span.status: object expected', + ); + message.status = + $root.opentelemetry.proto.trace.v1.Status.fromObject( + object.status, + ); + } + return message; + }; + + /** + * Creates a plain object from a Span message. Also converts values to other types if specified. + * @function toObject + * @memberof opentelemetry.proto.trace.v1.Span + * @static + * @param {opentelemetry.proto.trace.v1.Span} message Span + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Span.toObject = function toObject(message, options) { + if (!options) options = {}; + let object = {}; + if (options.arrays || options.defaults) { + object.attributes = []; + object.events = []; + object.links = []; + } + if (options.defaults) { + if (options.bytes === String) object.traceId = ''; + else { + object.traceId = []; + if (options.bytes !== Array) + object.traceId = $util.newBuffer(object.traceId); + } + if (options.bytes === String) object.spanId = ''; + else { + object.spanId = []; + if (options.bytes !== Array) + object.spanId = $util.newBuffer(object.spanId); + } + object.traceState = ''; + if (options.bytes === String) object.parentSpanId = ''; + else { + object.parentSpanId = []; + if (options.bytes !== Array) + object.parentSpanId = $util.newBuffer(object.parentSpanId); + } + object.name = ''; + object.kind = + options.enums === String ? 'SPAN_KIND_UNSPECIFIED' : 0; + if ($util.Long) { + let long = new $util.Long(0, 0, false); + object.startTimeUnixNano = + options.longs === String + ? long.toString() + : options.longs === Number + ? long.toNumber() + : long; + } else + object.startTimeUnixNano = options.longs === String ? '0' : 0; + if ($util.Long) { + let long = new $util.Long(0, 0, false); + object.endTimeUnixNano = + options.longs === String + ? long.toString() + : options.longs === Number + ? long.toNumber() + : long; + } else + object.endTimeUnixNano = options.longs === String ? '0' : 0; + object.droppedAttributesCount = 0; + object.droppedEventsCount = 0; + object.droppedLinksCount = 0; + object.status = null; + } + if (message.traceId != null && message.hasOwnProperty('traceId')) + object.traceId = + options.bytes === String + ? $util.base64.encode( + message.traceId, + 0, + message.traceId.length, + ) + : options.bytes === Array + ? Array.prototype.slice.call(message.traceId) + : message.traceId; + if (message.spanId != null && message.hasOwnProperty('spanId')) + object.spanId = + options.bytes === String + ? $util.base64.encode( + message.spanId, + 0, + message.spanId.length, + ) + : options.bytes === Array + ? Array.prototype.slice.call(message.spanId) + : message.spanId; + if ( + message.traceState != null && + message.hasOwnProperty('traceState') + ) + object.traceState = message.traceState; + if ( + message.parentSpanId != null && + message.hasOwnProperty('parentSpanId') + ) + object.parentSpanId = + options.bytes === String + ? $util.base64.encode( + message.parentSpanId, + 0, + message.parentSpanId.length, + ) + : options.bytes === Array + ? Array.prototype.slice.call(message.parentSpanId) + : message.parentSpanId; + if (message.name != null && message.hasOwnProperty('name')) + object.name = message.name; + if (message.kind != null && message.hasOwnProperty('kind')) + object.kind = + options.enums === String + ? $root.opentelemetry.proto.trace.v1.Span.SpanKind[ + message.kind + ] === undefined + ? message.kind + : $root.opentelemetry.proto.trace.v1.Span.SpanKind[ + message.kind + ] + : message.kind; + if ( + message.startTimeUnixNano != null && + message.hasOwnProperty('startTimeUnixNano') + ) + if (typeof message.startTimeUnixNano === 'number') + object.startTimeUnixNano = + options.longs === String + ? String(message.startTimeUnixNano) + : message.startTimeUnixNano; + else + object.startTimeUnixNano = + options.longs === String + ? $util.Long.prototype.toString.call( + message.startTimeUnixNano, + ) + : options.longs === Number + ? new $util.LongBits( + message.startTimeUnixNano.low >>> 0, + message.startTimeUnixNano.high >>> 0, + ).toNumber() + : message.startTimeUnixNano; + if ( + message.endTimeUnixNano != null && + message.hasOwnProperty('endTimeUnixNano') + ) + if (typeof message.endTimeUnixNano === 'number') + object.endTimeUnixNano = + options.longs === String + ? String(message.endTimeUnixNano) + : message.endTimeUnixNano; + else + object.endTimeUnixNano = + options.longs === String + ? $util.Long.prototype.toString.call( + message.endTimeUnixNano, + ) + : options.longs === Number + ? new $util.LongBits( + message.endTimeUnixNano.low >>> 0, + message.endTimeUnixNano.high >>> 0, + ).toNumber() + : message.endTimeUnixNano; + if (message.attributes && message.attributes.length) { + object.attributes = []; + for (let j = 0; j < message.attributes.length; ++j) + object.attributes[j] = + $root.opentelemetry.proto.common.v1.KeyValue.toObject( + message.attributes[j], + options, + ); + } + if ( + message.droppedAttributesCount != null && + message.hasOwnProperty('droppedAttributesCount') + ) + object.droppedAttributesCount = message.droppedAttributesCount; + if (message.events && message.events.length) { + object.events = []; + for (let j = 0; j < message.events.length; ++j) + object.events[j] = + $root.opentelemetry.proto.trace.v1.Span.Event.toObject( + message.events[j], + options, + ); + } + if ( + message.droppedEventsCount != null && + message.hasOwnProperty('droppedEventsCount') + ) + object.droppedEventsCount = message.droppedEventsCount; + if (message.links && message.links.length) { + object.links = []; + for (let j = 0; j < message.links.length; ++j) + object.links[j] = + $root.opentelemetry.proto.trace.v1.Span.Link.toObject( + message.links[j], + options, + ); + } + if ( + message.droppedLinksCount != null && + message.hasOwnProperty('droppedLinksCount') + ) + object.droppedLinksCount = message.droppedLinksCount; + if (message.status != null && message.hasOwnProperty('status')) + object.status = + $root.opentelemetry.proto.trace.v1.Status.toObject( + message.status, + options, + ); + return object; + }; + + /** + * Converts this Span to JSON. + * @function toJSON + * @memberof opentelemetry.proto.trace.v1.Span + * @instance + * @returns {Object.} JSON object + */ + Span.prototype.toJSON = function toJSON() { + return this.constructor.toObject( + this, + $protobuf.util.toJSONOptions, + ); + }; + + /** + * Gets the default type url for Span + * @function getTypeUrl + * @memberof opentelemetry.proto.trace.v1.Span + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Span.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = 'type.googleapis.com'; + } + return typeUrlPrefix + '/opentelemetry.proto.trace.v1.Span'; + }; + + /** + * SpanKind enum. + * @name opentelemetry.proto.trace.v1.Span.SpanKind + * @enum {number} + * @property {number} SPAN_KIND_UNSPECIFIED=0 SPAN_KIND_UNSPECIFIED value + * @property {number} SPAN_KIND_INTERNAL=1 SPAN_KIND_INTERNAL value + * @property {number} SPAN_KIND_SERVER=2 SPAN_KIND_SERVER value + * @property {number} SPAN_KIND_CLIENT=3 SPAN_KIND_CLIENT value + * @property {number} SPAN_KIND_PRODUCER=4 SPAN_KIND_PRODUCER value + * @property {number} SPAN_KIND_CONSUMER=5 SPAN_KIND_CONSUMER value + */ + Span.SpanKind = (function () { + const valuesById = {}, + values = Object.create(valuesById); + values[(valuesById[0] = 'SPAN_KIND_UNSPECIFIED')] = 0; + values[(valuesById[1] = 'SPAN_KIND_INTERNAL')] = 1; + values[(valuesById[2] = 'SPAN_KIND_SERVER')] = 2; + values[(valuesById[3] = 'SPAN_KIND_CLIENT')] = 3; + values[(valuesById[4] = 'SPAN_KIND_PRODUCER')] = 4; + values[(valuesById[5] = 'SPAN_KIND_CONSUMER')] = 5; + return values; + })(); + + Span.Event = (function () { /** - * Namespace trace. - * @memberof opentelemetry.proto - * @namespace + * Properties of an Event. + * @memberof opentelemetry.proto.trace.v1.Span + * @interface IEvent + * @property {number|Long|null} [timeUnixNano] Event timeUnixNano + * @property {string|null} [name] Event name + * @property {Array.|null} [attributes] Event attributes + * @property {number|null} [droppedAttributesCount] Event droppedAttributesCount */ - const trace = {}; - - trace.v1 = (function() { - - /** - * Namespace v1. - * @memberof opentelemetry.proto.trace - * @namespace - */ - const v1 = {}; - - v1.TracesData = (function() { - - /** - * Properties of a TracesData. - * @memberof opentelemetry.proto.trace.v1 - * @interface ITracesData - * @property {Array.|null} [resourceSpans] TracesData resourceSpans - */ - - /** - * Constructs a new TracesData. - * @memberof opentelemetry.proto.trace.v1 - * @classdesc Represents a TracesData. - * @implements ITracesData - * @constructor - * @param {opentelemetry.proto.trace.v1.ITracesData=} [properties] Properties to set - */ - function TracesData(properties) { - this.resourceSpans = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * TracesData resourceSpans. - * @member {Array.} resourceSpans - * @memberof opentelemetry.proto.trace.v1.TracesData - * @instance - */ - TracesData.prototype.resourceSpans = $util.emptyArray; - - /** - * Creates a new TracesData instance using the specified properties. - * @function create - * @memberof opentelemetry.proto.trace.v1.TracesData - * @static - * @param {opentelemetry.proto.trace.v1.ITracesData=} [properties] Properties to set - * @returns {opentelemetry.proto.trace.v1.TracesData} TracesData instance - */ - TracesData.create = function create(properties) { - return new TracesData(properties); - }; - - /** - * Encodes the specified TracesData message. Does not implicitly {@link opentelemetry.proto.trace.v1.TracesData.verify|verify} messages. - * @function encode - * @memberof opentelemetry.proto.trace.v1.TracesData - * @static - * @param {opentelemetry.proto.trace.v1.ITracesData} message TracesData message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - TracesData.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.resourceSpans != null && message.resourceSpans.length) - for (let i = 0; i < message.resourceSpans.length; ++i) - $root.opentelemetry.proto.trace.v1.ResourceSpans.encode(message.resourceSpans[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified TracesData message, length delimited. Does not implicitly {@link opentelemetry.proto.trace.v1.TracesData.verify|verify} messages. - * @function encodeDelimited - * @memberof opentelemetry.proto.trace.v1.TracesData - * @static - * @param {opentelemetry.proto.trace.v1.ITracesData} message TracesData message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - TracesData.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a TracesData message from the specified reader or buffer. - * @function decode - * @memberof opentelemetry.proto.trace.v1.TracesData - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {opentelemetry.proto.trace.v1.TracesData} TracesData - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - TracesData.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.opentelemetry.proto.trace.v1.TracesData(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (!(message.resourceSpans && message.resourceSpans.length)) - message.resourceSpans = []; - message.resourceSpans.push($root.opentelemetry.proto.trace.v1.ResourceSpans.decode(reader, reader.uint32())); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a TracesData message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof opentelemetry.proto.trace.v1.TracesData - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {opentelemetry.proto.trace.v1.TracesData} TracesData - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - TracesData.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a TracesData message. - * @function verify - * @memberof opentelemetry.proto.trace.v1.TracesData - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - TracesData.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.resourceSpans != null && message.hasOwnProperty("resourceSpans")) { - if (!Array.isArray(message.resourceSpans)) - return "resourceSpans: array expected"; - for (let i = 0; i < message.resourceSpans.length; ++i) { - let error = $root.opentelemetry.proto.trace.v1.ResourceSpans.verify(message.resourceSpans[i]); - if (error) - return "resourceSpans." + error; - } - } - return null; - }; - - /** - * Creates a TracesData message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof opentelemetry.proto.trace.v1.TracesData - * @static - * @param {Object.} object Plain object - * @returns {opentelemetry.proto.trace.v1.TracesData} TracesData - */ - TracesData.fromObject = function fromObject(object) { - if (object instanceof $root.opentelemetry.proto.trace.v1.TracesData) - return object; - let message = new $root.opentelemetry.proto.trace.v1.TracesData(); - if (object.resourceSpans) { - if (!Array.isArray(object.resourceSpans)) - throw TypeError(".opentelemetry.proto.trace.v1.TracesData.resourceSpans: array expected"); - message.resourceSpans = []; - for (let i = 0; i < object.resourceSpans.length; ++i) { - if (typeof object.resourceSpans[i] !== "object") - throw TypeError(".opentelemetry.proto.trace.v1.TracesData.resourceSpans: object expected"); - message.resourceSpans[i] = $root.opentelemetry.proto.trace.v1.ResourceSpans.fromObject(object.resourceSpans[i]); - } - } - return message; - }; - - /** - * Creates a plain object from a TracesData message. Also converts values to other types if specified. - * @function toObject - * @memberof opentelemetry.proto.trace.v1.TracesData - * @static - * @param {opentelemetry.proto.trace.v1.TracesData} message TracesData - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - TracesData.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) - object.resourceSpans = []; - if (message.resourceSpans && message.resourceSpans.length) { - object.resourceSpans = []; - for (let j = 0; j < message.resourceSpans.length; ++j) - object.resourceSpans[j] = $root.opentelemetry.proto.trace.v1.ResourceSpans.toObject(message.resourceSpans[j], options); - } - return object; - }; - - /** - * Converts this TracesData to JSON. - * @function toJSON - * @memberof opentelemetry.proto.trace.v1.TracesData - * @instance - * @returns {Object.} JSON object - */ - TracesData.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for TracesData - * @function getTypeUrl - * @memberof opentelemetry.proto.trace.v1.TracesData - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - TracesData.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/opentelemetry.proto.trace.v1.TracesData"; - }; - - return TracesData; - })(); - - v1.ResourceSpans = (function() { - - /** - * Properties of a ResourceSpans. - * @memberof opentelemetry.proto.trace.v1 - * @interface IResourceSpans - * @property {opentelemetry.proto.resource.v1.IResource|null} [resource] ResourceSpans resource - * @property {Array.|null} [scopeSpans] ResourceSpans scopeSpans - * @property {string|null} [schemaUrl] ResourceSpans schemaUrl - */ - - /** - * Constructs a new ResourceSpans. - * @memberof opentelemetry.proto.trace.v1 - * @classdesc Represents a ResourceSpans. - * @implements IResourceSpans - * @constructor - * @param {opentelemetry.proto.trace.v1.IResourceSpans=} [properties] Properties to set - */ - function ResourceSpans(properties) { - this.scopeSpans = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * ResourceSpans resource. - * @member {opentelemetry.proto.resource.v1.IResource|null|undefined} resource - * @memberof opentelemetry.proto.trace.v1.ResourceSpans - * @instance - */ - ResourceSpans.prototype.resource = null; - - /** - * ResourceSpans scopeSpans. - * @member {Array.} scopeSpans - * @memberof opentelemetry.proto.trace.v1.ResourceSpans - * @instance - */ - ResourceSpans.prototype.scopeSpans = $util.emptyArray; - - /** - * ResourceSpans schemaUrl. - * @member {string} schemaUrl - * @memberof opentelemetry.proto.trace.v1.ResourceSpans - * @instance - */ - ResourceSpans.prototype.schemaUrl = ""; - - /** - * Creates a new ResourceSpans instance using the specified properties. - * @function create - * @memberof opentelemetry.proto.trace.v1.ResourceSpans - * @static - * @param {opentelemetry.proto.trace.v1.IResourceSpans=} [properties] Properties to set - * @returns {opentelemetry.proto.trace.v1.ResourceSpans} ResourceSpans instance - */ - ResourceSpans.create = function create(properties) { - return new ResourceSpans(properties); - }; - - /** - * Encodes the specified ResourceSpans message. Does not implicitly {@link opentelemetry.proto.trace.v1.ResourceSpans.verify|verify} messages. - * @function encode - * @memberof opentelemetry.proto.trace.v1.ResourceSpans - * @static - * @param {opentelemetry.proto.trace.v1.IResourceSpans} message ResourceSpans message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ResourceSpans.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.resource != null && Object.hasOwnProperty.call(message, "resource")) - $root.opentelemetry.proto.resource.v1.Resource.encode(message.resource, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.scopeSpans != null && message.scopeSpans.length) - for (let i = 0; i < message.scopeSpans.length; ++i) - $root.opentelemetry.proto.trace.v1.ScopeSpans.encode(message.scopeSpans[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.schemaUrl != null && Object.hasOwnProperty.call(message, "schemaUrl")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.schemaUrl); - return writer; - }; - - /** - * Encodes the specified ResourceSpans message, length delimited. Does not implicitly {@link opentelemetry.proto.trace.v1.ResourceSpans.verify|verify} messages. - * @function encodeDelimited - * @memberof opentelemetry.proto.trace.v1.ResourceSpans - * @static - * @param {opentelemetry.proto.trace.v1.IResourceSpans} message ResourceSpans message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ResourceSpans.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a ResourceSpans message from the specified reader or buffer. - * @function decode - * @memberof opentelemetry.proto.trace.v1.ResourceSpans - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {opentelemetry.proto.trace.v1.ResourceSpans} ResourceSpans - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ResourceSpans.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.opentelemetry.proto.trace.v1.ResourceSpans(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.resource = $root.opentelemetry.proto.resource.v1.Resource.decode(reader, reader.uint32()); - break; - } - case 2: { - if (!(message.scopeSpans && message.scopeSpans.length)) - message.scopeSpans = []; - message.scopeSpans.push($root.opentelemetry.proto.trace.v1.ScopeSpans.decode(reader, reader.uint32())); - break; - } - case 3: { - message.schemaUrl = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a ResourceSpans message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof opentelemetry.proto.trace.v1.ResourceSpans - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {opentelemetry.proto.trace.v1.ResourceSpans} ResourceSpans - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ResourceSpans.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a ResourceSpans message. - * @function verify - * @memberof opentelemetry.proto.trace.v1.ResourceSpans - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ResourceSpans.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.resource != null && message.hasOwnProperty("resource")) { - let error = $root.opentelemetry.proto.resource.v1.Resource.verify(message.resource); - if (error) - return "resource." + error; - } - if (message.scopeSpans != null && message.hasOwnProperty("scopeSpans")) { - if (!Array.isArray(message.scopeSpans)) - return "scopeSpans: array expected"; - for (let i = 0; i < message.scopeSpans.length; ++i) { - let error = $root.opentelemetry.proto.trace.v1.ScopeSpans.verify(message.scopeSpans[i]); - if (error) - return "scopeSpans." + error; - } - } - if (message.schemaUrl != null && message.hasOwnProperty("schemaUrl")) - if (!$util.isString(message.schemaUrl)) - return "schemaUrl: string expected"; - return null; - }; - - /** - * Creates a ResourceSpans message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof opentelemetry.proto.trace.v1.ResourceSpans - * @static - * @param {Object.} object Plain object - * @returns {opentelemetry.proto.trace.v1.ResourceSpans} ResourceSpans - */ - ResourceSpans.fromObject = function fromObject(object) { - if (object instanceof $root.opentelemetry.proto.trace.v1.ResourceSpans) - return object; - let message = new $root.opentelemetry.proto.trace.v1.ResourceSpans(); - if (object.resource != null) { - if (typeof object.resource !== "object") - throw TypeError(".opentelemetry.proto.trace.v1.ResourceSpans.resource: object expected"); - message.resource = $root.opentelemetry.proto.resource.v1.Resource.fromObject(object.resource); - } - if (object.scopeSpans) { - if (!Array.isArray(object.scopeSpans)) - throw TypeError(".opentelemetry.proto.trace.v1.ResourceSpans.scopeSpans: array expected"); - message.scopeSpans = []; - for (let i = 0; i < object.scopeSpans.length; ++i) { - if (typeof object.scopeSpans[i] !== "object") - throw TypeError(".opentelemetry.proto.trace.v1.ResourceSpans.scopeSpans: object expected"); - message.scopeSpans[i] = $root.opentelemetry.proto.trace.v1.ScopeSpans.fromObject(object.scopeSpans[i]); - } - } - if (object.schemaUrl != null) - message.schemaUrl = String(object.schemaUrl); - return message; - }; - - /** - * Creates a plain object from a ResourceSpans message. Also converts values to other types if specified. - * @function toObject - * @memberof opentelemetry.proto.trace.v1.ResourceSpans - * @static - * @param {opentelemetry.proto.trace.v1.ResourceSpans} message ResourceSpans - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ResourceSpans.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) - object.scopeSpans = []; - if (options.defaults) { - object.resource = null; - object.schemaUrl = ""; - } - if (message.resource != null && message.hasOwnProperty("resource")) - object.resource = $root.opentelemetry.proto.resource.v1.Resource.toObject(message.resource, options); - if (message.scopeSpans && message.scopeSpans.length) { - object.scopeSpans = []; - for (let j = 0; j < message.scopeSpans.length; ++j) - object.scopeSpans[j] = $root.opentelemetry.proto.trace.v1.ScopeSpans.toObject(message.scopeSpans[j], options); - } - if (message.schemaUrl != null && message.hasOwnProperty("schemaUrl")) - object.schemaUrl = message.schemaUrl; - return object; - }; - - /** - * Converts this ResourceSpans to JSON. - * @function toJSON - * @memberof opentelemetry.proto.trace.v1.ResourceSpans - * @instance - * @returns {Object.} JSON object - */ - ResourceSpans.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for ResourceSpans - * @function getTypeUrl - * @memberof opentelemetry.proto.trace.v1.ResourceSpans - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - ResourceSpans.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/opentelemetry.proto.trace.v1.ResourceSpans"; - }; - - return ResourceSpans; - })(); - - v1.ScopeSpans = (function() { - - /** - * Properties of a ScopeSpans. - * @memberof opentelemetry.proto.trace.v1 - * @interface IScopeSpans - * @property {opentelemetry.proto.common.v1.IInstrumentationScope|null} [scope] ScopeSpans scope - * @property {Array.|null} [spans] ScopeSpans spans - * @property {string|null} [schemaUrl] ScopeSpans schemaUrl - */ - - /** - * Constructs a new ScopeSpans. - * @memberof opentelemetry.proto.trace.v1 - * @classdesc Represents a ScopeSpans. - * @implements IScopeSpans - * @constructor - * @param {opentelemetry.proto.trace.v1.IScopeSpans=} [properties] Properties to set - */ - function ScopeSpans(properties) { - this.spans = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * ScopeSpans scope. - * @member {opentelemetry.proto.common.v1.IInstrumentationScope|null|undefined} scope - * @memberof opentelemetry.proto.trace.v1.ScopeSpans - * @instance - */ - ScopeSpans.prototype.scope = null; - - /** - * ScopeSpans spans. - * @member {Array.} spans - * @memberof opentelemetry.proto.trace.v1.ScopeSpans - * @instance - */ - ScopeSpans.prototype.spans = $util.emptyArray; - - /** - * ScopeSpans schemaUrl. - * @member {string} schemaUrl - * @memberof opentelemetry.proto.trace.v1.ScopeSpans - * @instance - */ - ScopeSpans.prototype.schemaUrl = ""; - - /** - * Creates a new ScopeSpans instance using the specified properties. - * @function create - * @memberof opentelemetry.proto.trace.v1.ScopeSpans - * @static - * @param {opentelemetry.proto.trace.v1.IScopeSpans=} [properties] Properties to set - * @returns {opentelemetry.proto.trace.v1.ScopeSpans} ScopeSpans instance - */ - ScopeSpans.create = function create(properties) { - return new ScopeSpans(properties); - }; - - /** - * Encodes the specified ScopeSpans message. Does not implicitly {@link opentelemetry.proto.trace.v1.ScopeSpans.verify|verify} messages. - * @function encode - * @memberof opentelemetry.proto.trace.v1.ScopeSpans - * @static - * @param {opentelemetry.proto.trace.v1.IScopeSpans} message ScopeSpans message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ScopeSpans.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.scope != null && Object.hasOwnProperty.call(message, "scope")) - $root.opentelemetry.proto.common.v1.InstrumentationScope.encode(message.scope, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.spans != null && message.spans.length) - for (let i = 0; i < message.spans.length; ++i) - $root.opentelemetry.proto.trace.v1.Span.encode(message.spans[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.schemaUrl != null && Object.hasOwnProperty.call(message, "schemaUrl")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.schemaUrl); - return writer; - }; - - /** - * Encodes the specified ScopeSpans message, length delimited. Does not implicitly {@link opentelemetry.proto.trace.v1.ScopeSpans.verify|verify} messages. - * @function encodeDelimited - * @memberof opentelemetry.proto.trace.v1.ScopeSpans - * @static - * @param {opentelemetry.proto.trace.v1.IScopeSpans} message ScopeSpans message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ScopeSpans.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a ScopeSpans message from the specified reader or buffer. - * @function decode - * @memberof opentelemetry.proto.trace.v1.ScopeSpans - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {opentelemetry.proto.trace.v1.ScopeSpans} ScopeSpans - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ScopeSpans.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.opentelemetry.proto.trace.v1.ScopeSpans(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.scope = $root.opentelemetry.proto.common.v1.InstrumentationScope.decode(reader, reader.uint32()); - break; - } - case 2: { - if (!(message.spans && message.spans.length)) - message.spans = []; - message.spans.push($root.opentelemetry.proto.trace.v1.Span.decode(reader, reader.uint32())); - break; - } - case 3: { - message.schemaUrl = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a ScopeSpans message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof opentelemetry.proto.trace.v1.ScopeSpans - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {opentelemetry.proto.trace.v1.ScopeSpans} ScopeSpans - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ScopeSpans.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a ScopeSpans message. - * @function verify - * @memberof opentelemetry.proto.trace.v1.ScopeSpans - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ScopeSpans.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.scope != null && message.hasOwnProperty("scope")) { - let error = $root.opentelemetry.proto.common.v1.InstrumentationScope.verify(message.scope); - if (error) - return "scope." + error; - } - if (message.spans != null && message.hasOwnProperty("spans")) { - if (!Array.isArray(message.spans)) - return "spans: array expected"; - for (let i = 0; i < message.spans.length; ++i) { - let error = $root.opentelemetry.proto.trace.v1.Span.verify(message.spans[i]); - if (error) - return "spans." + error; - } - } - if (message.schemaUrl != null && message.hasOwnProperty("schemaUrl")) - if (!$util.isString(message.schemaUrl)) - return "schemaUrl: string expected"; - return null; - }; - - /** - * Creates a ScopeSpans message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof opentelemetry.proto.trace.v1.ScopeSpans - * @static - * @param {Object.} object Plain object - * @returns {opentelemetry.proto.trace.v1.ScopeSpans} ScopeSpans - */ - ScopeSpans.fromObject = function fromObject(object) { - if (object instanceof $root.opentelemetry.proto.trace.v1.ScopeSpans) - return object; - let message = new $root.opentelemetry.proto.trace.v1.ScopeSpans(); - if (object.scope != null) { - if (typeof object.scope !== "object") - throw TypeError(".opentelemetry.proto.trace.v1.ScopeSpans.scope: object expected"); - message.scope = $root.opentelemetry.proto.common.v1.InstrumentationScope.fromObject(object.scope); - } - if (object.spans) { - if (!Array.isArray(object.spans)) - throw TypeError(".opentelemetry.proto.trace.v1.ScopeSpans.spans: array expected"); - message.spans = []; - for (let i = 0; i < object.spans.length; ++i) { - if (typeof object.spans[i] !== "object") - throw TypeError(".opentelemetry.proto.trace.v1.ScopeSpans.spans: object expected"); - message.spans[i] = $root.opentelemetry.proto.trace.v1.Span.fromObject(object.spans[i]); - } - } - if (object.schemaUrl != null) - message.schemaUrl = String(object.schemaUrl); - return message; - }; - - /** - * Creates a plain object from a ScopeSpans message. Also converts values to other types if specified. - * @function toObject - * @memberof opentelemetry.proto.trace.v1.ScopeSpans - * @static - * @param {opentelemetry.proto.trace.v1.ScopeSpans} message ScopeSpans - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ScopeSpans.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) - object.spans = []; - if (options.defaults) { - object.scope = null; - object.schemaUrl = ""; - } - if (message.scope != null && message.hasOwnProperty("scope")) - object.scope = $root.opentelemetry.proto.common.v1.InstrumentationScope.toObject(message.scope, options); - if (message.spans && message.spans.length) { - object.spans = []; - for (let j = 0; j < message.spans.length; ++j) - object.spans[j] = $root.opentelemetry.proto.trace.v1.Span.toObject(message.spans[j], options); - } - if (message.schemaUrl != null && message.hasOwnProperty("schemaUrl")) - object.schemaUrl = message.schemaUrl; - return object; - }; - - /** - * Converts this ScopeSpans to JSON. - * @function toJSON - * @memberof opentelemetry.proto.trace.v1.ScopeSpans - * @instance - * @returns {Object.} JSON object - */ - ScopeSpans.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for ScopeSpans - * @function getTypeUrl - * @memberof opentelemetry.proto.trace.v1.ScopeSpans - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - ScopeSpans.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/opentelemetry.proto.trace.v1.ScopeSpans"; - }; - - return ScopeSpans; - })(); - - v1.Span = (function() { - - /** - * Properties of a Span. - * @memberof opentelemetry.proto.trace.v1 - * @interface ISpan - * @property {Uint8Array|null} [traceId] Span traceId - * @property {Uint8Array|null} [spanId] Span spanId - * @property {string|null} [traceState] Span traceState - * @property {Uint8Array|null} [parentSpanId] Span parentSpanId - * @property {string|null} [name] Span name - * @property {opentelemetry.proto.trace.v1.Span.SpanKind|null} [kind] Span kind - * @property {number|Long|null} [startTimeUnixNano] Span startTimeUnixNano - * @property {number|Long|null} [endTimeUnixNano] Span endTimeUnixNano - * @property {Array.|null} [attributes] Span attributes - * @property {number|null} [droppedAttributesCount] Span droppedAttributesCount - * @property {Array.|null} [events] Span events - * @property {number|null} [droppedEventsCount] Span droppedEventsCount - * @property {Array.|null} [links] Span links - * @property {number|null} [droppedLinksCount] Span droppedLinksCount - * @property {opentelemetry.proto.trace.v1.IStatus|null} [status] Span status - */ - - /** - * Constructs a new Span. - * @memberof opentelemetry.proto.trace.v1 - * @classdesc Represents a Span. - * @implements ISpan - * @constructor - * @param {opentelemetry.proto.trace.v1.ISpan=} [properties] Properties to set - */ - function Span(properties) { - this.attributes = []; - this.events = []; - this.links = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Span traceId. - * @member {Uint8Array} traceId - * @memberof opentelemetry.proto.trace.v1.Span - * @instance - */ - Span.prototype.traceId = $util.newBuffer([]); - - /** - * Span spanId. - * @member {Uint8Array} spanId - * @memberof opentelemetry.proto.trace.v1.Span - * @instance - */ - Span.prototype.spanId = $util.newBuffer([]); - - /** - * Span traceState. - * @member {string} traceState - * @memberof opentelemetry.proto.trace.v1.Span - * @instance - */ - Span.prototype.traceState = ""; - - /** - * Span parentSpanId. - * @member {Uint8Array} parentSpanId - * @memberof opentelemetry.proto.trace.v1.Span - * @instance - */ - Span.prototype.parentSpanId = $util.newBuffer([]); - - /** - * Span name. - * @member {string} name - * @memberof opentelemetry.proto.trace.v1.Span - * @instance - */ - Span.prototype.name = ""; - - /** - * Span kind. - * @member {opentelemetry.proto.trace.v1.Span.SpanKind} kind - * @memberof opentelemetry.proto.trace.v1.Span - * @instance - */ - Span.prototype.kind = 0; - - /** - * Span startTimeUnixNano. - * @member {number|Long} startTimeUnixNano - * @memberof opentelemetry.proto.trace.v1.Span - * @instance - */ - Span.prototype.startTimeUnixNano = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - - /** - * Span endTimeUnixNano. - * @member {number|Long} endTimeUnixNano - * @memberof opentelemetry.proto.trace.v1.Span - * @instance - */ - Span.prototype.endTimeUnixNano = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - - /** - * Span attributes. - * @member {Array.} attributes - * @memberof opentelemetry.proto.trace.v1.Span - * @instance - */ - Span.prototype.attributes = $util.emptyArray; - - /** - * Span droppedAttributesCount. - * @member {number} droppedAttributesCount - * @memberof opentelemetry.proto.trace.v1.Span - * @instance - */ - Span.prototype.droppedAttributesCount = 0; - - /** - * Span events. - * @member {Array.} events - * @memberof opentelemetry.proto.trace.v1.Span - * @instance - */ - Span.prototype.events = $util.emptyArray; - - /** - * Span droppedEventsCount. - * @member {number} droppedEventsCount - * @memberof opentelemetry.proto.trace.v1.Span - * @instance - */ - Span.prototype.droppedEventsCount = 0; - - /** - * Span links. - * @member {Array.} links - * @memberof opentelemetry.proto.trace.v1.Span - * @instance - */ - Span.prototype.links = $util.emptyArray; - - /** - * Span droppedLinksCount. - * @member {number} droppedLinksCount - * @memberof opentelemetry.proto.trace.v1.Span - * @instance - */ - Span.prototype.droppedLinksCount = 0; - - /** - * Span status. - * @member {opentelemetry.proto.trace.v1.IStatus|null|undefined} status - * @memberof opentelemetry.proto.trace.v1.Span - * @instance - */ - Span.prototype.status = null; - - /** - * Creates a new Span instance using the specified properties. - * @function create - * @memberof opentelemetry.proto.trace.v1.Span - * @static - * @param {opentelemetry.proto.trace.v1.ISpan=} [properties] Properties to set - * @returns {opentelemetry.proto.trace.v1.Span} Span instance - */ - Span.create = function create(properties) { - return new Span(properties); - }; - - /** - * Encodes the specified Span message. Does not implicitly {@link opentelemetry.proto.trace.v1.Span.verify|verify} messages. - * @function encode - * @memberof opentelemetry.proto.trace.v1.Span - * @static - * @param {opentelemetry.proto.trace.v1.ISpan} message Span message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Span.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.traceId != null && Object.hasOwnProperty.call(message, "traceId")) - writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.traceId); - if (message.spanId != null && Object.hasOwnProperty.call(message, "spanId")) - writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.spanId); - if (message.traceState != null && Object.hasOwnProperty.call(message, "traceState")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.traceState); - if (message.parentSpanId != null && Object.hasOwnProperty.call(message, "parentSpanId")) - writer.uint32(/* id 4, wireType 2 =*/34).bytes(message.parentSpanId); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 5, wireType 2 =*/42).string(message.name); - if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) - writer.uint32(/* id 6, wireType 0 =*/48).int32(message.kind); - if (message.startTimeUnixNano != null && Object.hasOwnProperty.call(message, "startTimeUnixNano")) - writer.uint32(/* id 7, wireType 1 =*/57).fixed64(message.startTimeUnixNano); - if (message.endTimeUnixNano != null && Object.hasOwnProperty.call(message, "endTimeUnixNano")) - writer.uint32(/* id 8, wireType 1 =*/65).fixed64(message.endTimeUnixNano); - if (message.attributes != null && message.attributes.length) - for (let i = 0; i < message.attributes.length; ++i) - $root.opentelemetry.proto.common.v1.KeyValue.encode(message.attributes[i], writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); - if (message.droppedAttributesCount != null && Object.hasOwnProperty.call(message, "droppedAttributesCount")) - writer.uint32(/* id 10, wireType 0 =*/80).uint32(message.droppedAttributesCount); - if (message.events != null && message.events.length) - for (let i = 0; i < message.events.length; ++i) - $root.opentelemetry.proto.trace.v1.Span.Event.encode(message.events[i], writer.uint32(/* id 11, wireType 2 =*/90).fork()).ldelim(); - if (message.droppedEventsCount != null && Object.hasOwnProperty.call(message, "droppedEventsCount")) - writer.uint32(/* id 12, wireType 0 =*/96).uint32(message.droppedEventsCount); - if (message.links != null && message.links.length) - for (let i = 0; i < message.links.length; ++i) - $root.opentelemetry.proto.trace.v1.Span.Link.encode(message.links[i], writer.uint32(/* id 13, wireType 2 =*/106).fork()).ldelim(); - if (message.droppedLinksCount != null && Object.hasOwnProperty.call(message, "droppedLinksCount")) - writer.uint32(/* id 14, wireType 0 =*/112).uint32(message.droppedLinksCount); - if (message.status != null && Object.hasOwnProperty.call(message, "status")) - $root.opentelemetry.proto.trace.v1.Status.encode(message.status, writer.uint32(/* id 15, wireType 2 =*/122).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified Span message, length delimited. Does not implicitly {@link opentelemetry.proto.trace.v1.Span.verify|verify} messages. - * @function encodeDelimited - * @memberof opentelemetry.proto.trace.v1.Span - * @static - * @param {opentelemetry.proto.trace.v1.ISpan} message Span message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Span.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a Span message from the specified reader or buffer. - * @function decode - * @memberof opentelemetry.proto.trace.v1.Span - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {opentelemetry.proto.trace.v1.Span} Span - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Span.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.opentelemetry.proto.trace.v1.Span(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.traceId = reader.bytes(); - break; - } - case 2: { - message.spanId = reader.bytes(); - break; - } - case 3: { - message.traceState = reader.string(); - break; - } - case 4: { - message.parentSpanId = reader.bytes(); - break; - } - case 5: { - message.name = reader.string(); - break; - } - case 6: { - message.kind = reader.int32(); - break; - } - case 7: { - message.startTimeUnixNano = reader.fixed64(); - break; - } - case 8: { - message.endTimeUnixNano = reader.fixed64(); - break; - } - case 9: { - if (!(message.attributes && message.attributes.length)) - message.attributes = []; - message.attributes.push($root.opentelemetry.proto.common.v1.KeyValue.decode(reader, reader.uint32())); - break; - } - case 10: { - message.droppedAttributesCount = reader.uint32(); - break; - } - case 11: { - if (!(message.events && message.events.length)) - message.events = []; - message.events.push($root.opentelemetry.proto.trace.v1.Span.Event.decode(reader, reader.uint32())); - break; - } - case 12: { - message.droppedEventsCount = reader.uint32(); - break; - } - case 13: { - if (!(message.links && message.links.length)) - message.links = []; - message.links.push($root.opentelemetry.proto.trace.v1.Span.Link.decode(reader, reader.uint32())); - break; - } - case 14: { - message.droppedLinksCount = reader.uint32(); - break; - } - case 15: { - message.status = $root.opentelemetry.proto.trace.v1.Status.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a Span message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof opentelemetry.proto.trace.v1.Span - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {opentelemetry.proto.trace.v1.Span} Span - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Span.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a Span message. - * @function verify - * @memberof opentelemetry.proto.trace.v1.Span - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Span.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.traceId != null && message.hasOwnProperty("traceId")) - if (!(message.traceId && typeof message.traceId.length === "number" || $util.isString(message.traceId))) - return "traceId: buffer expected"; - if (message.spanId != null && message.hasOwnProperty("spanId")) - if (!(message.spanId && typeof message.spanId.length === "number" || $util.isString(message.spanId))) - return "spanId: buffer expected"; - if (message.traceState != null && message.hasOwnProperty("traceState")) - if (!$util.isString(message.traceState)) - return "traceState: string expected"; - if (message.parentSpanId != null && message.hasOwnProperty("parentSpanId")) - if (!(message.parentSpanId && typeof message.parentSpanId.length === "number" || $util.isString(message.parentSpanId))) - return "parentSpanId: buffer expected"; - if (message.name != null && message.hasOwnProperty("name")) - if (!$util.isString(message.name)) - return "name: string expected"; - if (message.kind != null && message.hasOwnProperty("kind")) - switch (message.kind) { - default: - return "kind: enum value expected"; - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - break; - } - if (message.startTimeUnixNano != null && message.hasOwnProperty("startTimeUnixNano")) - if (!$util.isInteger(message.startTimeUnixNano) && !(message.startTimeUnixNano && $util.isInteger(message.startTimeUnixNano.low) && $util.isInteger(message.startTimeUnixNano.high))) - return "startTimeUnixNano: integer|Long expected"; - if (message.endTimeUnixNano != null && message.hasOwnProperty("endTimeUnixNano")) - if (!$util.isInteger(message.endTimeUnixNano) && !(message.endTimeUnixNano && $util.isInteger(message.endTimeUnixNano.low) && $util.isInteger(message.endTimeUnixNano.high))) - return "endTimeUnixNano: integer|Long expected"; - if (message.attributes != null && message.hasOwnProperty("attributes")) { - if (!Array.isArray(message.attributes)) - return "attributes: array expected"; - for (let i = 0; i < message.attributes.length; ++i) { - let error = $root.opentelemetry.proto.common.v1.KeyValue.verify(message.attributes[i]); - if (error) - return "attributes." + error; - } - } - if (message.droppedAttributesCount != null && message.hasOwnProperty("droppedAttributesCount")) - if (!$util.isInteger(message.droppedAttributesCount)) - return "droppedAttributesCount: integer expected"; - if (message.events != null && message.hasOwnProperty("events")) { - if (!Array.isArray(message.events)) - return "events: array expected"; - for (let i = 0; i < message.events.length; ++i) { - let error = $root.opentelemetry.proto.trace.v1.Span.Event.verify(message.events[i]); - if (error) - return "events." + error; - } - } - if (message.droppedEventsCount != null && message.hasOwnProperty("droppedEventsCount")) - if (!$util.isInteger(message.droppedEventsCount)) - return "droppedEventsCount: integer expected"; - if (message.links != null && message.hasOwnProperty("links")) { - if (!Array.isArray(message.links)) - return "links: array expected"; - for (let i = 0; i < message.links.length; ++i) { - let error = $root.opentelemetry.proto.trace.v1.Span.Link.verify(message.links[i]); - if (error) - return "links." + error; - } - } - if (message.droppedLinksCount != null && message.hasOwnProperty("droppedLinksCount")) - if (!$util.isInteger(message.droppedLinksCount)) - return "droppedLinksCount: integer expected"; - if (message.status != null && message.hasOwnProperty("status")) { - let error = $root.opentelemetry.proto.trace.v1.Status.verify(message.status); - if (error) - return "status." + error; - } - return null; - }; - - /** - * Creates a Span message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof opentelemetry.proto.trace.v1.Span - * @static - * @param {Object.} object Plain object - * @returns {opentelemetry.proto.trace.v1.Span} Span - */ - Span.fromObject = function fromObject(object) { - if (object instanceof $root.opentelemetry.proto.trace.v1.Span) - return object; - let message = new $root.opentelemetry.proto.trace.v1.Span(); - if (object.traceId != null) - if (typeof object.traceId === "string") - $util.base64.decode(object.traceId, message.traceId = $util.newBuffer($util.base64.length(object.traceId)), 0); - else if (object.traceId.length >= 0) - message.traceId = object.traceId; - if (object.spanId != null) - if (typeof object.spanId === "string") - $util.base64.decode(object.spanId, message.spanId = $util.newBuffer($util.base64.length(object.spanId)), 0); - else if (object.spanId.length >= 0) - message.spanId = object.spanId; - if (object.traceState != null) - message.traceState = String(object.traceState); - if (object.parentSpanId != null) - if (typeof object.parentSpanId === "string") - $util.base64.decode(object.parentSpanId, message.parentSpanId = $util.newBuffer($util.base64.length(object.parentSpanId)), 0); - else if (object.parentSpanId.length >= 0) - message.parentSpanId = object.parentSpanId; - if (object.name != null) - message.name = String(object.name); - switch (object.kind) { - default: - if (typeof object.kind === "number") { - message.kind = object.kind; - break; - } - break; - case "SPAN_KIND_UNSPECIFIED": - case 0: - message.kind = 0; - break; - case "SPAN_KIND_INTERNAL": - case 1: - message.kind = 1; - break; - case "SPAN_KIND_SERVER": - case 2: - message.kind = 2; - break; - case "SPAN_KIND_CLIENT": - case 3: - message.kind = 3; - break; - case "SPAN_KIND_PRODUCER": - case 4: - message.kind = 4; - break; - case "SPAN_KIND_CONSUMER": - case 5: - message.kind = 5; - break; - } - if (object.startTimeUnixNano != null) - if ($util.Long) - (message.startTimeUnixNano = $util.Long.fromValue(object.startTimeUnixNano)).unsigned = false; - else if (typeof object.startTimeUnixNano === "string") - message.startTimeUnixNano = parseInt(object.startTimeUnixNano, 10); - else if (typeof object.startTimeUnixNano === "number") - message.startTimeUnixNano = object.startTimeUnixNano; - else if (typeof object.startTimeUnixNano === "object") - message.startTimeUnixNano = new $util.LongBits(object.startTimeUnixNano.low >>> 0, object.startTimeUnixNano.high >>> 0).toNumber(); - if (object.endTimeUnixNano != null) - if ($util.Long) - (message.endTimeUnixNano = $util.Long.fromValue(object.endTimeUnixNano)).unsigned = false; - else if (typeof object.endTimeUnixNano === "string") - message.endTimeUnixNano = parseInt(object.endTimeUnixNano, 10); - else if (typeof object.endTimeUnixNano === "number") - message.endTimeUnixNano = object.endTimeUnixNano; - else if (typeof object.endTimeUnixNano === "object") - message.endTimeUnixNano = new $util.LongBits(object.endTimeUnixNano.low >>> 0, object.endTimeUnixNano.high >>> 0).toNumber(); - if (object.attributes) { - if (!Array.isArray(object.attributes)) - throw TypeError(".opentelemetry.proto.trace.v1.Span.attributes: array expected"); - message.attributes = []; - for (let i = 0; i < object.attributes.length; ++i) { - if (typeof object.attributes[i] !== "object") - throw TypeError(".opentelemetry.proto.trace.v1.Span.attributes: object expected"); - message.attributes[i] = $root.opentelemetry.proto.common.v1.KeyValue.fromObject(object.attributes[i]); - } - } - if (object.droppedAttributesCount != null) - message.droppedAttributesCount = object.droppedAttributesCount >>> 0; - if (object.events) { - if (!Array.isArray(object.events)) - throw TypeError(".opentelemetry.proto.trace.v1.Span.events: array expected"); - message.events = []; - for (let i = 0; i < object.events.length; ++i) { - if (typeof object.events[i] !== "object") - throw TypeError(".opentelemetry.proto.trace.v1.Span.events: object expected"); - message.events[i] = $root.opentelemetry.proto.trace.v1.Span.Event.fromObject(object.events[i]); - } - } - if (object.droppedEventsCount != null) - message.droppedEventsCount = object.droppedEventsCount >>> 0; - if (object.links) { - if (!Array.isArray(object.links)) - throw TypeError(".opentelemetry.proto.trace.v1.Span.links: array expected"); - message.links = []; - for (let i = 0; i < object.links.length; ++i) { - if (typeof object.links[i] !== "object") - throw TypeError(".opentelemetry.proto.trace.v1.Span.links: object expected"); - message.links[i] = $root.opentelemetry.proto.trace.v1.Span.Link.fromObject(object.links[i]); - } - } - if (object.droppedLinksCount != null) - message.droppedLinksCount = object.droppedLinksCount >>> 0; - if (object.status != null) { - if (typeof object.status !== "object") - throw TypeError(".opentelemetry.proto.trace.v1.Span.status: object expected"); - message.status = $root.opentelemetry.proto.trace.v1.Status.fromObject(object.status); - } - return message; - }; - - /** - * Creates a plain object from a Span message. Also converts values to other types if specified. - * @function toObject - * @memberof opentelemetry.proto.trace.v1.Span - * @static - * @param {opentelemetry.proto.trace.v1.Span} message Span - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Span.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) { - object.attributes = []; - object.events = []; - object.links = []; - } - if (options.defaults) { - if (options.bytes === String) - object.traceId = ""; - else { - object.traceId = []; - if (options.bytes !== Array) - object.traceId = $util.newBuffer(object.traceId); - } - if (options.bytes === String) - object.spanId = ""; - else { - object.spanId = []; - if (options.bytes !== Array) - object.spanId = $util.newBuffer(object.spanId); - } - object.traceState = ""; - if (options.bytes === String) - object.parentSpanId = ""; - else { - object.parentSpanId = []; - if (options.bytes !== Array) - object.parentSpanId = $util.newBuffer(object.parentSpanId); - } - object.name = ""; - object.kind = options.enums === String ? "SPAN_KIND_UNSPECIFIED" : 0; - if ($util.Long) { - let long = new $util.Long(0, 0, false); - object.startTimeUnixNano = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.startTimeUnixNano = options.longs === String ? "0" : 0; - if ($util.Long) { - let long = new $util.Long(0, 0, false); - object.endTimeUnixNano = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.endTimeUnixNano = options.longs === String ? "0" : 0; - object.droppedAttributesCount = 0; - object.droppedEventsCount = 0; - object.droppedLinksCount = 0; - object.status = null; - } - if (message.traceId != null && message.hasOwnProperty("traceId")) - object.traceId = options.bytes === String ? $util.base64.encode(message.traceId, 0, message.traceId.length) : options.bytes === Array ? Array.prototype.slice.call(message.traceId) : message.traceId; - if (message.spanId != null && message.hasOwnProperty("spanId")) - object.spanId = options.bytes === String ? $util.base64.encode(message.spanId, 0, message.spanId.length) : options.bytes === Array ? Array.prototype.slice.call(message.spanId) : message.spanId; - if (message.traceState != null && message.hasOwnProperty("traceState")) - object.traceState = message.traceState; - if (message.parentSpanId != null && message.hasOwnProperty("parentSpanId")) - object.parentSpanId = options.bytes === String ? $util.base64.encode(message.parentSpanId, 0, message.parentSpanId.length) : options.bytes === Array ? Array.prototype.slice.call(message.parentSpanId) : message.parentSpanId; - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; - if (message.kind != null && message.hasOwnProperty("kind")) - object.kind = options.enums === String ? $root.opentelemetry.proto.trace.v1.Span.SpanKind[message.kind] === undefined ? message.kind : $root.opentelemetry.proto.trace.v1.Span.SpanKind[message.kind] : message.kind; - if (message.startTimeUnixNano != null && message.hasOwnProperty("startTimeUnixNano")) - if (typeof message.startTimeUnixNano === "number") - object.startTimeUnixNano = options.longs === String ? String(message.startTimeUnixNano) : message.startTimeUnixNano; - else - object.startTimeUnixNano = options.longs === String ? $util.Long.prototype.toString.call(message.startTimeUnixNano) : options.longs === Number ? new $util.LongBits(message.startTimeUnixNano.low >>> 0, message.startTimeUnixNano.high >>> 0).toNumber() : message.startTimeUnixNano; - if (message.endTimeUnixNano != null && message.hasOwnProperty("endTimeUnixNano")) - if (typeof message.endTimeUnixNano === "number") - object.endTimeUnixNano = options.longs === String ? String(message.endTimeUnixNano) : message.endTimeUnixNano; - else - object.endTimeUnixNano = options.longs === String ? $util.Long.prototype.toString.call(message.endTimeUnixNano) : options.longs === Number ? new $util.LongBits(message.endTimeUnixNano.low >>> 0, message.endTimeUnixNano.high >>> 0).toNumber() : message.endTimeUnixNano; - if (message.attributes && message.attributes.length) { - object.attributes = []; - for (let j = 0; j < message.attributes.length; ++j) - object.attributes[j] = $root.opentelemetry.proto.common.v1.KeyValue.toObject(message.attributes[j], options); - } - if (message.droppedAttributesCount != null && message.hasOwnProperty("droppedAttributesCount")) - object.droppedAttributesCount = message.droppedAttributesCount; - if (message.events && message.events.length) { - object.events = []; - for (let j = 0; j < message.events.length; ++j) - object.events[j] = $root.opentelemetry.proto.trace.v1.Span.Event.toObject(message.events[j], options); - } - if (message.droppedEventsCount != null && message.hasOwnProperty("droppedEventsCount")) - object.droppedEventsCount = message.droppedEventsCount; - if (message.links && message.links.length) { - object.links = []; - for (let j = 0; j < message.links.length; ++j) - object.links[j] = $root.opentelemetry.proto.trace.v1.Span.Link.toObject(message.links[j], options); - } - if (message.droppedLinksCount != null && message.hasOwnProperty("droppedLinksCount")) - object.droppedLinksCount = message.droppedLinksCount; - if (message.status != null && message.hasOwnProperty("status")) - object.status = $root.opentelemetry.proto.trace.v1.Status.toObject(message.status, options); - return object; - }; - - /** - * Converts this Span to JSON. - * @function toJSON - * @memberof opentelemetry.proto.trace.v1.Span - * @instance - * @returns {Object.} JSON object - */ - Span.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for Span - * @function getTypeUrl - * @memberof opentelemetry.proto.trace.v1.Span - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - Span.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/opentelemetry.proto.trace.v1.Span"; - }; - - /** - * SpanKind enum. - * @name opentelemetry.proto.trace.v1.Span.SpanKind - * @enum {number} - * @property {number} SPAN_KIND_UNSPECIFIED=0 SPAN_KIND_UNSPECIFIED value - * @property {number} SPAN_KIND_INTERNAL=1 SPAN_KIND_INTERNAL value - * @property {number} SPAN_KIND_SERVER=2 SPAN_KIND_SERVER value - * @property {number} SPAN_KIND_CLIENT=3 SPAN_KIND_CLIENT value - * @property {number} SPAN_KIND_PRODUCER=4 SPAN_KIND_PRODUCER value - * @property {number} SPAN_KIND_CONSUMER=5 SPAN_KIND_CONSUMER value - */ - Span.SpanKind = (function() { - const valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "SPAN_KIND_UNSPECIFIED"] = 0; - values[valuesById[1] = "SPAN_KIND_INTERNAL"] = 1; - values[valuesById[2] = "SPAN_KIND_SERVER"] = 2; - values[valuesById[3] = "SPAN_KIND_CLIENT"] = 3; - values[valuesById[4] = "SPAN_KIND_PRODUCER"] = 4; - values[valuesById[5] = "SPAN_KIND_CONSUMER"] = 5; - return values; - })(); - - Span.Event = (function() { - - /** - * Properties of an Event. - * @memberof opentelemetry.proto.trace.v1.Span - * @interface IEvent - * @property {number|Long|null} [timeUnixNano] Event timeUnixNano - * @property {string|null} [name] Event name - * @property {Array.|null} [attributes] Event attributes - * @property {number|null} [droppedAttributesCount] Event droppedAttributesCount - */ - - /** - * Constructs a new Event. - * @memberof opentelemetry.proto.trace.v1.Span - * @classdesc Represents an Event. - * @implements IEvent - * @constructor - * @param {opentelemetry.proto.trace.v1.Span.IEvent=} [properties] Properties to set - */ - function Event(properties) { - this.attributes = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Event timeUnixNano. - * @member {number|Long} timeUnixNano - * @memberof opentelemetry.proto.trace.v1.Span.Event - * @instance - */ - Event.prototype.timeUnixNano = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - - /** - * Event name. - * @member {string} name - * @memberof opentelemetry.proto.trace.v1.Span.Event - * @instance - */ - Event.prototype.name = ""; - - /** - * Event attributes. - * @member {Array.} attributes - * @memberof opentelemetry.proto.trace.v1.Span.Event - * @instance - */ - Event.prototype.attributes = $util.emptyArray; - - /** - * Event droppedAttributesCount. - * @member {number} droppedAttributesCount - * @memberof opentelemetry.proto.trace.v1.Span.Event - * @instance - */ - Event.prototype.droppedAttributesCount = 0; - - /** - * Creates a new Event instance using the specified properties. - * @function create - * @memberof opentelemetry.proto.trace.v1.Span.Event - * @static - * @param {opentelemetry.proto.trace.v1.Span.IEvent=} [properties] Properties to set - * @returns {opentelemetry.proto.trace.v1.Span.Event} Event instance - */ - Event.create = function create(properties) { - return new Event(properties); - }; - - /** - * Encodes the specified Event message. Does not implicitly {@link opentelemetry.proto.trace.v1.Span.Event.verify|verify} messages. - * @function encode - * @memberof opentelemetry.proto.trace.v1.Span.Event - * @static - * @param {opentelemetry.proto.trace.v1.Span.IEvent} message Event message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Event.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.timeUnixNano != null && Object.hasOwnProperty.call(message, "timeUnixNano")) - writer.uint32(/* id 1, wireType 1 =*/9).fixed64(message.timeUnixNano); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.name); - if (message.attributes != null && message.attributes.length) - for (let i = 0; i < message.attributes.length; ++i) - $root.opentelemetry.proto.common.v1.KeyValue.encode(message.attributes[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - if (message.droppedAttributesCount != null && Object.hasOwnProperty.call(message, "droppedAttributesCount")) - writer.uint32(/* id 4, wireType 0 =*/32).uint32(message.droppedAttributesCount); - return writer; - }; - - /** - * Encodes the specified Event message, length delimited. Does not implicitly {@link opentelemetry.proto.trace.v1.Span.Event.verify|verify} messages. - * @function encodeDelimited - * @memberof opentelemetry.proto.trace.v1.Span.Event - * @static - * @param {opentelemetry.proto.trace.v1.Span.IEvent} message Event message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Event.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an Event message from the specified reader or buffer. - * @function decode - * @memberof opentelemetry.proto.trace.v1.Span.Event - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {opentelemetry.proto.trace.v1.Span.Event} Event - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Event.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.opentelemetry.proto.trace.v1.Span.Event(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.timeUnixNano = reader.fixed64(); - break; - } - case 2: { - message.name = reader.string(); - break; - } - case 3: { - if (!(message.attributes && message.attributes.length)) - message.attributes = []; - message.attributes.push($root.opentelemetry.proto.common.v1.KeyValue.decode(reader, reader.uint32())); - break; - } - case 4: { - message.droppedAttributesCount = reader.uint32(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an Event message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof opentelemetry.proto.trace.v1.Span.Event - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {opentelemetry.proto.trace.v1.Span.Event} Event - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Event.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an Event message. - * @function verify - * @memberof opentelemetry.proto.trace.v1.Span.Event - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Event.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.timeUnixNano != null && message.hasOwnProperty("timeUnixNano")) - if (!$util.isInteger(message.timeUnixNano) && !(message.timeUnixNano && $util.isInteger(message.timeUnixNano.low) && $util.isInteger(message.timeUnixNano.high))) - return "timeUnixNano: integer|Long expected"; - if (message.name != null && message.hasOwnProperty("name")) - if (!$util.isString(message.name)) - return "name: string expected"; - if (message.attributes != null && message.hasOwnProperty("attributes")) { - if (!Array.isArray(message.attributes)) - return "attributes: array expected"; - for (let i = 0; i < message.attributes.length; ++i) { - let error = $root.opentelemetry.proto.common.v1.KeyValue.verify(message.attributes[i]); - if (error) - return "attributes." + error; - } - } - if (message.droppedAttributesCount != null && message.hasOwnProperty("droppedAttributesCount")) - if (!$util.isInteger(message.droppedAttributesCount)) - return "droppedAttributesCount: integer expected"; - return null; - }; - - /** - * Creates an Event message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof opentelemetry.proto.trace.v1.Span.Event - * @static - * @param {Object.} object Plain object - * @returns {opentelemetry.proto.trace.v1.Span.Event} Event - */ - Event.fromObject = function fromObject(object) { - if (object instanceof $root.opentelemetry.proto.trace.v1.Span.Event) - return object; - let message = new $root.opentelemetry.proto.trace.v1.Span.Event(); - if (object.timeUnixNano != null) - if ($util.Long) - (message.timeUnixNano = $util.Long.fromValue(object.timeUnixNano)).unsigned = false; - else if (typeof object.timeUnixNano === "string") - message.timeUnixNano = parseInt(object.timeUnixNano, 10); - else if (typeof object.timeUnixNano === "number") - message.timeUnixNano = object.timeUnixNano; - else if (typeof object.timeUnixNano === "object") - message.timeUnixNano = new $util.LongBits(object.timeUnixNano.low >>> 0, object.timeUnixNano.high >>> 0).toNumber(); - if (object.name != null) - message.name = String(object.name); - if (object.attributes) { - if (!Array.isArray(object.attributes)) - throw TypeError(".opentelemetry.proto.trace.v1.Span.Event.attributes: array expected"); - message.attributes = []; - for (let i = 0; i < object.attributes.length; ++i) { - if (typeof object.attributes[i] !== "object") - throw TypeError(".opentelemetry.proto.trace.v1.Span.Event.attributes: object expected"); - message.attributes[i] = $root.opentelemetry.proto.common.v1.KeyValue.fromObject(object.attributes[i]); - } - } - if (object.droppedAttributesCount != null) - message.droppedAttributesCount = object.droppedAttributesCount >>> 0; - return message; - }; - - /** - * Creates a plain object from an Event message. Also converts values to other types if specified. - * @function toObject - * @memberof opentelemetry.proto.trace.v1.Span.Event - * @static - * @param {opentelemetry.proto.trace.v1.Span.Event} message Event - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Event.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) - object.attributes = []; - if (options.defaults) { - if ($util.Long) { - let long = new $util.Long(0, 0, false); - object.timeUnixNano = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.timeUnixNano = options.longs === String ? "0" : 0; - object.name = ""; - object.droppedAttributesCount = 0; - } - if (message.timeUnixNano != null && message.hasOwnProperty("timeUnixNano")) - if (typeof message.timeUnixNano === "number") - object.timeUnixNano = options.longs === String ? String(message.timeUnixNano) : message.timeUnixNano; - else - object.timeUnixNano = options.longs === String ? $util.Long.prototype.toString.call(message.timeUnixNano) : options.longs === Number ? new $util.LongBits(message.timeUnixNano.low >>> 0, message.timeUnixNano.high >>> 0).toNumber() : message.timeUnixNano; - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; - if (message.attributes && message.attributes.length) { - object.attributes = []; - for (let j = 0; j < message.attributes.length; ++j) - object.attributes[j] = $root.opentelemetry.proto.common.v1.KeyValue.toObject(message.attributes[j], options); - } - if (message.droppedAttributesCount != null && message.hasOwnProperty("droppedAttributesCount")) - object.droppedAttributesCount = message.droppedAttributesCount; - return object; - }; - - /** - * Converts this Event to JSON. - * @function toJSON - * @memberof opentelemetry.proto.trace.v1.Span.Event - * @instance - * @returns {Object.} JSON object - */ - Event.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for Event - * @function getTypeUrl - * @memberof opentelemetry.proto.trace.v1.Span.Event - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - Event.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/opentelemetry.proto.trace.v1.Span.Event"; - }; - - return Event; - })(); - - Span.Link = (function() { - - /** - * Properties of a Link. - * @memberof opentelemetry.proto.trace.v1.Span - * @interface ILink - * @property {Uint8Array|null} [traceId] Link traceId - * @property {Uint8Array|null} [spanId] Link spanId - * @property {string|null} [traceState] Link traceState - * @property {Array.|null} [attributes] Link attributes - * @property {number|null} [droppedAttributesCount] Link droppedAttributesCount - */ - - /** - * Constructs a new Link. - * @memberof opentelemetry.proto.trace.v1.Span - * @classdesc Represents a Link. - * @implements ILink - * @constructor - * @param {opentelemetry.proto.trace.v1.Span.ILink=} [properties] Properties to set - */ - function Link(properties) { - this.attributes = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Link traceId. - * @member {Uint8Array} traceId - * @memberof opentelemetry.proto.trace.v1.Span.Link - * @instance - */ - Link.prototype.traceId = $util.newBuffer([]); - - /** - * Link spanId. - * @member {Uint8Array} spanId - * @memberof opentelemetry.proto.trace.v1.Span.Link - * @instance - */ - Link.prototype.spanId = $util.newBuffer([]); - - /** - * Link traceState. - * @member {string} traceState - * @memberof opentelemetry.proto.trace.v1.Span.Link - * @instance - */ - Link.prototype.traceState = ""; - - /** - * Link attributes. - * @member {Array.} attributes - * @memberof opentelemetry.proto.trace.v1.Span.Link - * @instance - */ - Link.prototype.attributes = $util.emptyArray; - - /** - * Link droppedAttributesCount. - * @member {number} droppedAttributesCount - * @memberof opentelemetry.proto.trace.v1.Span.Link - * @instance - */ - Link.prototype.droppedAttributesCount = 0; - - /** - * Creates a new Link instance using the specified properties. - * @function create - * @memberof opentelemetry.proto.trace.v1.Span.Link - * @static - * @param {opentelemetry.proto.trace.v1.Span.ILink=} [properties] Properties to set - * @returns {opentelemetry.proto.trace.v1.Span.Link} Link instance - */ - Link.create = function create(properties) { - return new Link(properties); - }; - - /** - * Encodes the specified Link message. Does not implicitly {@link opentelemetry.proto.trace.v1.Span.Link.verify|verify} messages. - * @function encode - * @memberof opentelemetry.proto.trace.v1.Span.Link - * @static - * @param {opentelemetry.proto.trace.v1.Span.ILink} message Link message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Link.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.traceId != null && Object.hasOwnProperty.call(message, "traceId")) - writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.traceId); - if (message.spanId != null && Object.hasOwnProperty.call(message, "spanId")) - writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.spanId); - if (message.traceState != null && Object.hasOwnProperty.call(message, "traceState")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.traceState); - if (message.attributes != null && message.attributes.length) - for (let i = 0; i < message.attributes.length; ++i) - $root.opentelemetry.proto.common.v1.KeyValue.encode(message.attributes[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - if (message.droppedAttributesCount != null && Object.hasOwnProperty.call(message, "droppedAttributesCount")) - writer.uint32(/* id 5, wireType 0 =*/40).uint32(message.droppedAttributesCount); - return writer; - }; - - /** - * Encodes the specified Link message, length delimited. Does not implicitly {@link opentelemetry.proto.trace.v1.Span.Link.verify|verify} messages. - * @function encodeDelimited - * @memberof opentelemetry.proto.trace.v1.Span.Link - * @static - * @param {opentelemetry.proto.trace.v1.Span.ILink} message Link message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Link.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a Link message from the specified reader or buffer. - * @function decode - * @memberof opentelemetry.proto.trace.v1.Span.Link - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {opentelemetry.proto.trace.v1.Span.Link} Link - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Link.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.opentelemetry.proto.trace.v1.Span.Link(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.traceId = reader.bytes(); - break; - } - case 2: { - message.spanId = reader.bytes(); - break; - } - case 3: { - message.traceState = reader.string(); - break; - } - case 4: { - if (!(message.attributes && message.attributes.length)) - message.attributes = []; - message.attributes.push($root.opentelemetry.proto.common.v1.KeyValue.decode(reader, reader.uint32())); - break; - } - case 5: { - message.droppedAttributesCount = reader.uint32(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a Link message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof opentelemetry.proto.trace.v1.Span.Link - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {opentelemetry.proto.trace.v1.Span.Link} Link - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Link.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a Link message. - * @function verify - * @memberof opentelemetry.proto.trace.v1.Span.Link - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Link.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.traceId != null && message.hasOwnProperty("traceId")) - if (!(message.traceId && typeof message.traceId.length === "number" || $util.isString(message.traceId))) - return "traceId: buffer expected"; - if (message.spanId != null && message.hasOwnProperty("spanId")) - if (!(message.spanId && typeof message.spanId.length === "number" || $util.isString(message.spanId))) - return "spanId: buffer expected"; - if (message.traceState != null && message.hasOwnProperty("traceState")) - if (!$util.isString(message.traceState)) - return "traceState: string expected"; - if (message.attributes != null && message.hasOwnProperty("attributes")) { - if (!Array.isArray(message.attributes)) - return "attributes: array expected"; - for (let i = 0; i < message.attributes.length; ++i) { - let error = $root.opentelemetry.proto.common.v1.KeyValue.verify(message.attributes[i]); - if (error) - return "attributes." + error; - } - } - if (message.droppedAttributesCount != null && message.hasOwnProperty("droppedAttributesCount")) - if (!$util.isInteger(message.droppedAttributesCount)) - return "droppedAttributesCount: integer expected"; - return null; - }; - - /** - * Creates a Link message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof opentelemetry.proto.trace.v1.Span.Link - * @static - * @param {Object.} object Plain object - * @returns {opentelemetry.proto.trace.v1.Span.Link} Link - */ - Link.fromObject = function fromObject(object) { - if (object instanceof $root.opentelemetry.proto.trace.v1.Span.Link) - return object; - let message = new $root.opentelemetry.proto.trace.v1.Span.Link(); - if (object.traceId != null) - if (typeof object.traceId === "string") - $util.base64.decode(object.traceId, message.traceId = $util.newBuffer($util.base64.length(object.traceId)), 0); - else if (object.traceId.length >= 0) - message.traceId = object.traceId; - if (object.spanId != null) - if (typeof object.spanId === "string") - $util.base64.decode(object.spanId, message.spanId = $util.newBuffer($util.base64.length(object.spanId)), 0); - else if (object.spanId.length >= 0) - message.spanId = object.spanId; - if (object.traceState != null) - message.traceState = String(object.traceState); - if (object.attributes) { - if (!Array.isArray(object.attributes)) - throw TypeError(".opentelemetry.proto.trace.v1.Span.Link.attributes: array expected"); - message.attributes = []; - for (let i = 0; i < object.attributes.length; ++i) { - if (typeof object.attributes[i] !== "object") - throw TypeError(".opentelemetry.proto.trace.v1.Span.Link.attributes: object expected"); - message.attributes[i] = $root.opentelemetry.proto.common.v1.KeyValue.fromObject(object.attributes[i]); - } - } - if (object.droppedAttributesCount != null) - message.droppedAttributesCount = object.droppedAttributesCount >>> 0; - return message; - }; - - /** - * Creates a plain object from a Link message. Also converts values to other types if specified. - * @function toObject - * @memberof opentelemetry.proto.trace.v1.Span.Link - * @static - * @param {opentelemetry.proto.trace.v1.Span.Link} message Link - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Link.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) - object.attributes = []; - if (options.defaults) { - if (options.bytes === String) - object.traceId = ""; - else { - object.traceId = []; - if (options.bytes !== Array) - object.traceId = $util.newBuffer(object.traceId); - } - if (options.bytes === String) - object.spanId = ""; - else { - object.spanId = []; - if (options.bytes !== Array) - object.spanId = $util.newBuffer(object.spanId); - } - object.traceState = ""; - object.droppedAttributesCount = 0; - } - if (message.traceId != null && message.hasOwnProperty("traceId")) - object.traceId = options.bytes === String ? $util.base64.encode(message.traceId, 0, message.traceId.length) : options.bytes === Array ? Array.prototype.slice.call(message.traceId) : message.traceId; - if (message.spanId != null && message.hasOwnProperty("spanId")) - object.spanId = options.bytes === String ? $util.base64.encode(message.spanId, 0, message.spanId.length) : options.bytes === Array ? Array.prototype.slice.call(message.spanId) : message.spanId; - if (message.traceState != null && message.hasOwnProperty("traceState")) - object.traceState = message.traceState; - if (message.attributes && message.attributes.length) { - object.attributes = []; - for (let j = 0; j < message.attributes.length; ++j) - object.attributes[j] = $root.opentelemetry.proto.common.v1.KeyValue.toObject(message.attributes[j], options); - } - if (message.droppedAttributesCount != null && message.hasOwnProperty("droppedAttributesCount")) - object.droppedAttributesCount = message.droppedAttributesCount; - return object; - }; - - /** - * Converts this Link to JSON. - * @function toJSON - * @memberof opentelemetry.proto.trace.v1.Span.Link - * @instance - * @returns {Object.} JSON object - */ - Link.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for Link - * @function getTypeUrl - * @memberof opentelemetry.proto.trace.v1.Span.Link - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - Link.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/opentelemetry.proto.trace.v1.Span.Link"; - }; - - return Link; - })(); - - return Span; - })(); - - v1.Status = (function() { - - /** - * Properties of a Status. - * @memberof opentelemetry.proto.trace.v1 - * @interface IStatus - * @property {string|null} [message] Status message - * @property {opentelemetry.proto.trace.v1.Status.StatusCode|null} [code] Status code - */ - - /** - * Constructs a new Status. - * @memberof opentelemetry.proto.trace.v1 - * @classdesc Represents a Status. - * @implements IStatus - * @constructor - * @param {opentelemetry.proto.trace.v1.IStatus=} [properties] Properties to set - */ - function Status(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Status message. - * @member {string} message - * @memberof opentelemetry.proto.trace.v1.Status - * @instance - */ - Status.prototype.message = ""; - - /** - * Status code. - * @member {opentelemetry.proto.trace.v1.Status.StatusCode} code - * @memberof opentelemetry.proto.trace.v1.Status - * @instance - */ - Status.prototype.code = 0; - - /** - * Creates a new Status instance using the specified properties. - * @function create - * @memberof opentelemetry.proto.trace.v1.Status - * @static - * @param {opentelemetry.proto.trace.v1.IStatus=} [properties] Properties to set - * @returns {opentelemetry.proto.trace.v1.Status} Status instance - */ - Status.create = function create(properties) { - return new Status(properties); - }; - - /** - * Encodes the specified Status message. Does not implicitly {@link opentelemetry.proto.trace.v1.Status.verify|verify} messages. - * @function encode - * @memberof opentelemetry.proto.trace.v1.Status - * @static - * @param {opentelemetry.proto.trace.v1.IStatus} message Status message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Status.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.message != null && Object.hasOwnProperty.call(message, "message")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.message); - if (message.code != null && Object.hasOwnProperty.call(message, "code")) - writer.uint32(/* id 3, wireType 0 =*/24).int32(message.code); - return writer; - }; - - /** - * Encodes the specified Status message, length delimited. Does not implicitly {@link opentelemetry.proto.trace.v1.Status.verify|verify} messages. - * @function encodeDelimited - * @memberof opentelemetry.proto.trace.v1.Status - * @static - * @param {opentelemetry.proto.trace.v1.IStatus} message Status message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Status.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a Status message from the specified reader or buffer. - * @function decode - * @memberof opentelemetry.proto.trace.v1.Status - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {opentelemetry.proto.trace.v1.Status} Status - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Status.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.opentelemetry.proto.trace.v1.Status(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 2: { - message.message = reader.string(); - break; - } - case 3: { - message.code = reader.int32(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a Status message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof opentelemetry.proto.trace.v1.Status - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {opentelemetry.proto.trace.v1.Status} Status - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Status.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a Status message. - * @function verify - * @memberof opentelemetry.proto.trace.v1.Status - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Status.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.message != null && message.hasOwnProperty("message")) - if (!$util.isString(message.message)) - return "message: string expected"; - if (message.code != null && message.hasOwnProperty("code")) - switch (message.code) { - default: - return "code: enum value expected"; - case 0: - case 1: - case 2: - break; - } - return null; - }; - - /** - * Creates a Status message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof opentelemetry.proto.trace.v1.Status - * @static - * @param {Object.} object Plain object - * @returns {opentelemetry.proto.trace.v1.Status} Status - */ - Status.fromObject = function fromObject(object) { - if (object instanceof $root.opentelemetry.proto.trace.v1.Status) - return object; - let message = new $root.opentelemetry.proto.trace.v1.Status(); - if (object.message != null) - message.message = String(object.message); - switch (object.code) { - default: - if (typeof object.code === "number") { - message.code = object.code; - break; - } - break; - case "STATUS_CODE_UNSET": - case 0: - message.code = 0; - break; - case "STATUS_CODE_OK": - case 1: - message.code = 1; - break; - case "STATUS_CODE_ERROR": - case 2: - message.code = 2; - break; - } - return message; - }; - - /** - * Creates a plain object from a Status message. Also converts values to other types if specified. - * @function toObject - * @memberof opentelemetry.proto.trace.v1.Status - * @static - * @param {opentelemetry.proto.trace.v1.Status} message Status - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Status.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.message = ""; - object.code = options.enums === String ? "STATUS_CODE_UNSET" : 0; - } - if (message.message != null && message.hasOwnProperty("message")) - object.message = message.message; - if (message.code != null && message.hasOwnProperty("code")) - object.code = options.enums === String ? $root.opentelemetry.proto.trace.v1.Status.StatusCode[message.code] === undefined ? message.code : $root.opentelemetry.proto.trace.v1.Status.StatusCode[message.code] : message.code; - return object; - }; - - /** - * Converts this Status to JSON. - * @function toJSON - * @memberof opentelemetry.proto.trace.v1.Status - * @instance - * @returns {Object.} JSON object - */ - Status.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for Status - * @function getTypeUrl - * @memberof opentelemetry.proto.trace.v1.Status - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - Status.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/opentelemetry.proto.trace.v1.Status"; - }; - - /** - * StatusCode enum. - * @name opentelemetry.proto.trace.v1.Status.StatusCode - * @enum {number} - * @property {number} STATUS_CODE_UNSET=0 STATUS_CODE_UNSET value - * @property {number} STATUS_CODE_OK=1 STATUS_CODE_OK value - * @property {number} STATUS_CODE_ERROR=2 STATUS_CODE_ERROR value - */ - Status.StatusCode = (function() { - const valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "STATUS_CODE_UNSET"] = 0; - values[valuesById[1] = "STATUS_CODE_OK"] = 1; - values[valuesById[2] = "STATUS_CODE_ERROR"] = 2; - return values; - })(); - - return Status; - })(); - - return v1; - })(); - - return trace; - })(); - proto.resource = (function() { + /** + * Constructs a new Event. + * @memberof opentelemetry.proto.trace.v1.Span + * @classdesc Represents an Event. + * @implements IEvent + * @constructor + * @param {opentelemetry.proto.trace.v1.Span.IEvent=} [properties] Properties to set + */ + function Event(properties) { + this.attributes = []; + if (properties) + for ( + let keys = Object.keys(properties), i = 0; + i < keys.length; + ++i + ) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } /** - * Namespace resource. - * @memberof opentelemetry.proto - * @namespace + * Event timeUnixNano. + * @member {number|Long} timeUnixNano + * @memberof opentelemetry.proto.trace.v1.Span.Event + * @instance */ - const resource = {}; - - resource.v1 = (function() { - - /** - * Namespace v1. - * @memberof opentelemetry.proto.resource - * @namespace - */ - const v1 = {}; - - v1.Resource = (function() { - - /** - * Properties of a Resource. - * @memberof opentelemetry.proto.resource.v1 - * @interface IResource - * @property {Array.|null} [attributes] Resource attributes - * @property {number|null} [droppedAttributesCount] Resource droppedAttributesCount - */ - - /** - * Constructs a new Resource. - * @memberof opentelemetry.proto.resource.v1 - * @classdesc Represents a Resource. - * @implements IResource - * @constructor - * @param {opentelemetry.proto.resource.v1.IResource=} [properties] Properties to set - */ - function Resource(properties) { - this.attributes = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Resource attributes. - * @member {Array.} attributes - * @memberof opentelemetry.proto.resource.v1.Resource - * @instance - */ - Resource.prototype.attributes = $util.emptyArray; - - /** - * Resource droppedAttributesCount. - * @member {number} droppedAttributesCount - * @memberof opentelemetry.proto.resource.v1.Resource - * @instance - */ - Resource.prototype.droppedAttributesCount = 0; - - /** - * Creates a new Resource instance using the specified properties. - * @function create - * @memberof opentelemetry.proto.resource.v1.Resource - * @static - * @param {opentelemetry.proto.resource.v1.IResource=} [properties] Properties to set - * @returns {opentelemetry.proto.resource.v1.Resource} Resource instance - */ - Resource.create = function create(properties) { - return new Resource(properties); - }; - - /** - * Encodes the specified Resource message. Does not implicitly {@link opentelemetry.proto.resource.v1.Resource.verify|verify} messages. - * @function encode - * @memberof opentelemetry.proto.resource.v1.Resource - * @static - * @param {opentelemetry.proto.resource.v1.IResource} message Resource message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Resource.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.attributes != null && message.attributes.length) - for (let i = 0; i < message.attributes.length; ++i) - $root.opentelemetry.proto.common.v1.KeyValue.encode(message.attributes[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.droppedAttributesCount != null && Object.hasOwnProperty.call(message, "droppedAttributesCount")) - writer.uint32(/* id 2, wireType 0 =*/16).uint32(message.droppedAttributesCount); - return writer; - }; - - /** - * Encodes the specified Resource message, length delimited. Does not implicitly {@link opentelemetry.proto.resource.v1.Resource.verify|verify} messages. - * @function encodeDelimited - * @memberof opentelemetry.proto.resource.v1.Resource - * @static - * @param {opentelemetry.proto.resource.v1.IResource} message Resource message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Resource.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a Resource message from the specified reader or buffer. - * @function decode - * @memberof opentelemetry.proto.resource.v1.Resource - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {opentelemetry.proto.resource.v1.Resource} Resource - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Resource.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.opentelemetry.proto.resource.v1.Resource(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (!(message.attributes && message.attributes.length)) - message.attributes = []; - message.attributes.push($root.opentelemetry.proto.common.v1.KeyValue.decode(reader, reader.uint32())); - break; - } - case 2: { - message.droppedAttributesCount = reader.uint32(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a Resource message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof opentelemetry.proto.resource.v1.Resource - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {opentelemetry.proto.resource.v1.Resource} Resource - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Resource.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a Resource message. - * @function verify - * @memberof opentelemetry.proto.resource.v1.Resource - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Resource.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.attributes != null && message.hasOwnProperty("attributes")) { - if (!Array.isArray(message.attributes)) - return "attributes: array expected"; - for (let i = 0; i < message.attributes.length; ++i) { - let error = $root.opentelemetry.proto.common.v1.KeyValue.verify(message.attributes[i]); - if (error) - return "attributes." + error; - } - } - if (message.droppedAttributesCount != null && message.hasOwnProperty("droppedAttributesCount")) - if (!$util.isInteger(message.droppedAttributesCount)) - return "droppedAttributesCount: integer expected"; - return null; - }; - - /** - * Creates a Resource message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof opentelemetry.proto.resource.v1.Resource - * @static - * @param {Object.} object Plain object - * @returns {opentelemetry.proto.resource.v1.Resource} Resource - */ - Resource.fromObject = function fromObject(object) { - if (object instanceof $root.opentelemetry.proto.resource.v1.Resource) - return object; - let message = new $root.opentelemetry.proto.resource.v1.Resource(); - if (object.attributes) { - if (!Array.isArray(object.attributes)) - throw TypeError(".opentelemetry.proto.resource.v1.Resource.attributes: array expected"); - message.attributes = []; - for (let i = 0; i < object.attributes.length; ++i) { - if (typeof object.attributes[i] !== "object") - throw TypeError(".opentelemetry.proto.resource.v1.Resource.attributes: object expected"); - message.attributes[i] = $root.opentelemetry.proto.common.v1.KeyValue.fromObject(object.attributes[i]); - } - } - if (object.droppedAttributesCount != null) - message.droppedAttributesCount = object.droppedAttributesCount >>> 0; - return message; - }; - - /** - * Creates a plain object from a Resource message. Also converts values to other types if specified. - * @function toObject - * @memberof opentelemetry.proto.resource.v1.Resource - * @static - * @param {opentelemetry.proto.resource.v1.Resource} message Resource - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Resource.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) - object.attributes = []; - if (options.defaults) - object.droppedAttributesCount = 0; - if (message.attributes && message.attributes.length) { - object.attributes = []; - for (let j = 0; j < message.attributes.length; ++j) - object.attributes[j] = $root.opentelemetry.proto.common.v1.KeyValue.toObject(message.attributes[j], options); - } - if (message.droppedAttributesCount != null && message.hasOwnProperty("droppedAttributesCount")) - object.droppedAttributesCount = message.droppedAttributesCount; - return object; - }; - - /** - * Converts this Resource to JSON. - * @function toJSON - * @memberof opentelemetry.proto.resource.v1.Resource - * @instance - * @returns {Object.} JSON object - */ - Resource.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for Resource - * @function getTypeUrl - * @memberof opentelemetry.proto.resource.v1.Resource - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - Resource.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/opentelemetry.proto.resource.v1.Resource"; - }; - - return Resource; - })(); - - return v1; - })(); - - return resource; - })(); + Event.prototype.timeUnixNano = $util.Long + ? $util.Long.fromBits(0, 0, false) + : 0; + + /** + * Event name. + * @member {string} name + * @memberof opentelemetry.proto.trace.v1.Span.Event + * @instance + */ + Event.prototype.name = ''; + + /** + * Event attributes. + * @member {Array.} attributes + * @memberof opentelemetry.proto.trace.v1.Span.Event + * @instance + */ + Event.prototype.attributes = $util.emptyArray; + + /** + * Event droppedAttributesCount. + * @member {number} droppedAttributesCount + * @memberof opentelemetry.proto.trace.v1.Span.Event + * @instance + */ + Event.prototype.droppedAttributesCount = 0; + + /** + * Creates a new Event instance using the specified properties. + * @function create + * @memberof opentelemetry.proto.trace.v1.Span.Event + * @static + * @param {opentelemetry.proto.trace.v1.Span.IEvent=} [properties] Properties to set + * @returns {opentelemetry.proto.trace.v1.Span.Event} Event instance + */ + Event.create = function create(properties) { + return new Event(properties); + }; + + /** + * Encodes the specified Event message. Does not implicitly {@link opentelemetry.proto.trace.v1.Span.Event.verify|verify} messages. + * @function encode + * @memberof opentelemetry.proto.trace.v1.Span.Event + * @static + * @param {opentelemetry.proto.trace.v1.Span.IEvent} message Event message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Event.encode = function encode(message, writer) { + if (!writer) writer = $Writer.create(); + if ( + message.timeUnixNano != null && + Object.hasOwnProperty.call(message, 'timeUnixNano') + ) + writer + .uint32(/* id 1, wireType 1 =*/ 9) + .fixed64(message.timeUnixNano); + if ( + message.name != null && + Object.hasOwnProperty.call(message, 'name') + ) + writer.uint32(/* id 2, wireType 2 =*/ 18).string(message.name); + if (message.attributes != null && message.attributes.length) + for (let i = 0; i < message.attributes.length; ++i) + $root.opentelemetry.proto.common.v1.KeyValue.encode( + message.attributes[i], + writer.uint32(/* id 3, wireType 2 =*/ 26).fork(), + ).ldelim(); + if ( + message.droppedAttributesCount != null && + Object.hasOwnProperty.call(message, 'droppedAttributesCount') + ) + writer + .uint32(/* id 4, wireType 0 =*/ 32) + .uint32(message.droppedAttributesCount); + return writer; + }; + + /** + * Encodes the specified Event message, length delimited. Does not implicitly {@link opentelemetry.proto.trace.v1.Span.Event.verify|verify} messages. + * @function encodeDelimited + * @memberof opentelemetry.proto.trace.v1.Span.Event + * @static + * @param {opentelemetry.proto.trace.v1.Span.IEvent} message Event message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Event.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an Event message from the specified reader or buffer. + * @function decode + * @memberof opentelemetry.proto.trace.v1.Span.Event + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {opentelemetry.proto.trace.v1.Span.Event} Event + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Event.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, + message = new $root.opentelemetry.proto.trace.v1.Span.Event(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.timeUnixNano = reader.fixed64(); + break; + } + case 2: { + message.name = reader.string(); + break; + } + case 3: { + if (!(message.attributes && message.attributes.length)) + message.attributes = []; + message.attributes.push( + $root.opentelemetry.proto.common.v1.KeyValue.decode( + reader, + reader.uint32(), + ), + ); + break; + } + case 4: { + message.droppedAttributesCount = reader.uint32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an Event message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof opentelemetry.proto.trace.v1.Span.Event + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {opentelemetry.proto.trace.v1.Span.Event} Event + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Event.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; - proto.common = (function() { + /** + * Verifies an Event message. + * @function verify + * @memberof opentelemetry.proto.trace.v1.Span.Event + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Event.verify = function verify(message) { + if (typeof message !== 'object' || message === null) + return 'object expected'; + if ( + message.timeUnixNano != null && + message.hasOwnProperty('timeUnixNano') + ) + if ( + !$util.isInteger(message.timeUnixNano) && + !( + message.timeUnixNano && + $util.isInteger(message.timeUnixNano.low) && + $util.isInteger(message.timeUnixNano.high) + ) + ) + return 'timeUnixNano: integer|Long expected'; + if (message.name != null && message.hasOwnProperty('name')) + if (!$util.isString(message.name)) + return 'name: string expected'; + if ( + message.attributes != null && + message.hasOwnProperty('attributes') + ) { + if (!Array.isArray(message.attributes)) + return 'attributes: array expected'; + for (let i = 0; i < message.attributes.length; ++i) { + let error = + $root.opentelemetry.proto.common.v1.KeyValue.verify( + message.attributes[i], + ); + if (error) return 'attributes.' + error; + } + } + if ( + message.droppedAttributesCount != null && + message.hasOwnProperty('droppedAttributesCount') + ) + if (!$util.isInteger(message.droppedAttributesCount)) + return 'droppedAttributesCount: integer expected'; + return null; + }; + + /** + * Creates an Event message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof opentelemetry.proto.trace.v1.Span.Event + * @static + * @param {Object.} object Plain object + * @returns {opentelemetry.proto.trace.v1.Span.Event} Event + */ + Event.fromObject = function fromObject(object) { + if ( + object instanceof $root.opentelemetry.proto.trace.v1.Span.Event + ) + return object; + let message = new $root.opentelemetry.proto.trace.v1.Span.Event(); + if (object.timeUnixNano != null) + if ($util.Long) + (message.timeUnixNano = $util.Long.fromValue( + object.timeUnixNano, + )).unsigned = false; + else if (typeof object.timeUnixNano === 'string') + message.timeUnixNano = parseInt(object.timeUnixNano, 10); + else if (typeof object.timeUnixNano === 'number') + message.timeUnixNano = object.timeUnixNano; + else if (typeof object.timeUnixNano === 'object') + message.timeUnixNano = new $util.LongBits( + object.timeUnixNano.low >>> 0, + object.timeUnixNano.high >>> 0, + ).toNumber(); + if (object.name != null) message.name = String(object.name); + if (object.attributes) { + if (!Array.isArray(object.attributes)) + throw TypeError( + '.opentelemetry.proto.trace.v1.Span.Event.attributes: array expected', + ); + message.attributes = []; + for (let i = 0; i < object.attributes.length; ++i) { + if (typeof object.attributes[i] !== 'object') + throw TypeError( + '.opentelemetry.proto.trace.v1.Span.Event.attributes: object expected', + ); + message.attributes[i] = + $root.opentelemetry.proto.common.v1.KeyValue.fromObject( + object.attributes[i], + ); + } + } + if (object.droppedAttributesCount != null) + message.droppedAttributesCount = + object.droppedAttributesCount >>> 0; + return message; + }; + + /** + * Creates a plain object from an Event message. Also converts values to other types if specified. + * @function toObject + * @memberof opentelemetry.proto.trace.v1.Span.Event + * @static + * @param {opentelemetry.proto.trace.v1.Span.Event} message Event + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Event.toObject = function toObject(message, options) { + if (!options) options = {}; + let object = {}; + if (options.arrays || options.defaults) object.attributes = []; + if (options.defaults) { + if ($util.Long) { + let long = new $util.Long(0, 0, false); + object.timeUnixNano = + options.longs === String + ? long.toString() + : options.longs === Number + ? long.toNumber() + : long; + } else object.timeUnixNano = options.longs === String ? '0' : 0; + object.name = ''; + object.droppedAttributesCount = 0; + } + if ( + message.timeUnixNano != null && + message.hasOwnProperty('timeUnixNano') + ) + if (typeof message.timeUnixNano === 'number') + object.timeUnixNano = + options.longs === String + ? String(message.timeUnixNano) + : message.timeUnixNano; + else + object.timeUnixNano = + options.longs === String + ? $util.Long.prototype.toString.call(message.timeUnixNano) + : options.longs === Number + ? new $util.LongBits( + message.timeUnixNano.low >>> 0, + message.timeUnixNano.high >>> 0, + ).toNumber() + : message.timeUnixNano; + if (message.name != null && message.hasOwnProperty('name')) + object.name = message.name; + if (message.attributes && message.attributes.length) { + object.attributes = []; + for (let j = 0; j < message.attributes.length; ++j) + object.attributes[j] = + $root.opentelemetry.proto.common.v1.KeyValue.toObject( + message.attributes[j], + options, + ); + } + if ( + message.droppedAttributesCount != null && + message.hasOwnProperty('droppedAttributesCount') + ) + object.droppedAttributesCount = message.droppedAttributesCount; + return object; + }; + + /** + * Converts this Event to JSON. + * @function toJSON + * @memberof opentelemetry.proto.trace.v1.Span.Event + * @instance + * @returns {Object.} JSON object + */ + Event.prototype.toJSON = function toJSON() { + return this.constructor.toObject( + this, + $protobuf.util.toJSONOptions, + ); + }; + + /** + * Gets the default type url for Event + * @function getTypeUrl + * @memberof opentelemetry.proto.trace.v1.Span.Event + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Event.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = 'type.googleapis.com'; + } + return typeUrlPrefix + '/opentelemetry.proto.trace.v1.Span.Event'; + }; + + return Event; + })(); + + Span.Link = (function () { + /** + * Properties of a Link. + * @memberof opentelemetry.proto.trace.v1.Span + * @interface ILink + * @property {Uint8Array|null} [traceId] Link traceId + * @property {Uint8Array|null} [spanId] Link spanId + * @property {string|null} [traceState] Link traceState + * @property {Array.|null} [attributes] Link attributes + * @property {number|null} [droppedAttributesCount] Link droppedAttributesCount + */ + + /** + * Constructs a new Link. + * @memberof opentelemetry.proto.trace.v1.Span + * @classdesc Represents a Link. + * @implements ILink + * @constructor + * @param {opentelemetry.proto.trace.v1.Span.ILink=} [properties] Properties to set + */ + function Link(properties) { + this.attributes = []; + if (properties) + for ( + let keys = Object.keys(properties), i = 0; + i < keys.length; + ++i + ) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Link traceId. + * @member {Uint8Array} traceId + * @memberof opentelemetry.proto.trace.v1.Span.Link + * @instance + */ + Link.prototype.traceId = $util.newBuffer([]); /** - * Namespace common. - * @memberof opentelemetry.proto - * @namespace + * Link spanId. + * @member {Uint8Array} spanId + * @memberof opentelemetry.proto.trace.v1.Span.Link + * @instance */ - const common = {}; - - common.v1 = (function() { - - /** - * Namespace v1. - * @memberof opentelemetry.proto.common - * @namespace - */ - const 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 (let 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 - let $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); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.opentelemetry.proto.common.v1.AnyValue(); - while (reader.pos < end) { - let 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.} 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"; - let 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; - { - let 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; - { - let 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.} 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; - let 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.} Plain object - */ - AnyValue.toObject = function toObject(message, options) { - if (!options) - options = {}; - let 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.} 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.|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 (let 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.} 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 (let 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); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.opentelemetry.proto.common.v1.ArrayValue(); - while (reader.pos < end) { - let 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.} 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 (let i = 0; i < message.values.length; ++i) { - let 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.} 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; - let 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 (let 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.} Plain object - */ - ArrayValue.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) - object.values = []; - if (message.values && message.values.length) { - object.values = []; - for (let 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.} 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.|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 (let 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.} 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 (let 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); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.opentelemetry.proto.common.v1.KeyValueList(); - while (reader.pos < end) { - let 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.} 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 (let i = 0; i < message.values.length; ++i) { - let 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.} 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; - let 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 (let 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.} Plain object - */ - KeyValueList.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) - object.values = []; - if (message.values && message.values.length) { - object.values = []; - for (let 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.common.v1.KeyValueList - * @instance - * @returns {Object.} JSON object - */ - KeyValueList.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for KeyValueList - * @function getTypeUrl - * @memberof opentelemetry.proto.common.v1.KeyValueList - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - KeyValueList.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/opentelemetry.proto.common.v1.KeyValueList"; - }; - - return KeyValueList; - })(); - - v1.KeyValue = (function() { - - /** - * Properties of a KeyValue. - * @memberof opentelemetry.proto.common.v1 - * @interface IKeyValue - * @property {string|null} [key] KeyValue key - * @property {opentelemetry.proto.common.v1.IAnyValue|null} [value] KeyValue value - */ - - /** - * Constructs a new KeyValue. - * @memberof opentelemetry.proto.common.v1 - * @classdesc Represents a KeyValue. - * @implements IKeyValue - * @constructor - * @param {opentelemetry.proto.common.v1.IKeyValue=} [properties] Properties to set - */ - function KeyValue(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * KeyValue key. - * @member {string} key - * @memberof opentelemetry.proto.common.v1.KeyValue - * @instance - */ - KeyValue.prototype.key = ""; - - /** - * KeyValue value. - * @member {opentelemetry.proto.common.v1.IAnyValue|null|undefined} value - * @memberof opentelemetry.proto.common.v1.KeyValue - * @instance - */ - KeyValue.prototype.value = null; - - /** - * Creates a new KeyValue instance using the specified properties. - * @function create - * @memberof opentelemetry.proto.common.v1.KeyValue - * @static - * @param {opentelemetry.proto.common.v1.IKeyValue=} [properties] Properties to set - * @returns {opentelemetry.proto.common.v1.KeyValue} KeyValue instance - */ - KeyValue.create = function create(properties) { - return new KeyValue(properties); - }; - - /** - * Encodes the specified KeyValue message. Does not implicitly {@link opentelemetry.proto.common.v1.KeyValue.verify|verify} messages. - * @function encode - * @memberof opentelemetry.proto.common.v1.KeyValue - * @static - * @param {opentelemetry.proto.common.v1.IKeyValue} message KeyValue message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - KeyValue.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.key != null && Object.hasOwnProperty.call(message, "key")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.key); - if (message.value != null && Object.hasOwnProperty.call(message, "value")) - $root.opentelemetry.proto.common.v1.AnyValue.encode(message.value, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified KeyValue message, length delimited. Does not implicitly {@link opentelemetry.proto.common.v1.KeyValue.verify|verify} messages. - * @function encodeDelimited - * @memberof opentelemetry.proto.common.v1.KeyValue - * @static - * @param {opentelemetry.proto.common.v1.IKeyValue} message KeyValue message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - KeyValue.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a KeyValue message from the specified reader or buffer. - * @function decode - * @memberof opentelemetry.proto.common.v1.KeyValue - * @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.KeyValue} KeyValue - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - KeyValue.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.opentelemetry.proto.common.v1.KeyValue(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.key = reader.string(); - break; - } - case 2: { - message.value = $root.opentelemetry.proto.common.v1.AnyValue.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a KeyValue message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof opentelemetry.proto.common.v1.KeyValue - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {opentelemetry.proto.common.v1.KeyValue} KeyValue - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - KeyValue.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a KeyValue message. - * @function verify - * @memberof opentelemetry.proto.common.v1.KeyValue - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - KeyValue.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.key != null && message.hasOwnProperty("key")) - if (!$util.isString(message.key)) - return "key: string expected"; - if (message.value != null && message.hasOwnProperty("value")) { - let error = $root.opentelemetry.proto.common.v1.AnyValue.verify(message.value); - if (error) - return "value." + error; - } - return null; - }; - - /** - * Creates a KeyValue message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof opentelemetry.proto.common.v1.KeyValue - * @static - * @param {Object.} object Plain object - * @returns {opentelemetry.proto.common.v1.KeyValue} KeyValue - */ - KeyValue.fromObject = function fromObject(object) { - if (object instanceof $root.opentelemetry.proto.common.v1.KeyValue) - return object; - let message = new $root.opentelemetry.proto.common.v1.KeyValue(); - if (object.key != null) - message.key = String(object.key); - if (object.value != null) { - if (typeof object.value !== "object") - throw TypeError(".opentelemetry.proto.common.v1.KeyValue.value: object expected"); - message.value = $root.opentelemetry.proto.common.v1.AnyValue.fromObject(object.value); - } - return message; - }; - - /** - * Creates a plain object from a KeyValue message. Also converts values to other types if specified. - * @function toObject - * @memberof opentelemetry.proto.common.v1.KeyValue - * @static - * @param {opentelemetry.proto.common.v1.KeyValue} message KeyValue - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - KeyValue.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.key = ""; - object.value = null; - } - if (message.key != null && message.hasOwnProperty("key")) - object.key = message.key; - if (message.value != null && message.hasOwnProperty("value")) - object.value = $root.opentelemetry.proto.common.v1.AnyValue.toObject(message.value, options); - return object; - }; - - /** - * Converts this KeyValue to JSON. - * @function toJSON - * @memberof opentelemetry.proto.common.v1.KeyValue - * @instance - * @returns {Object.} JSON object - */ - KeyValue.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for KeyValue - * @function getTypeUrl - * @memberof opentelemetry.proto.common.v1.KeyValue - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - KeyValue.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/opentelemetry.proto.common.v1.KeyValue"; - }; - - return KeyValue; - })(); - - v1.InstrumentationScope = (function() { - - /** - * Properties of an InstrumentationScope. - * @memberof opentelemetry.proto.common.v1 - * @interface IInstrumentationScope - * @property {string|null} [name] InstrumentationScope name - * @property {string|null} [version] InstrumentationScope version - * @property {Array.|null} [attributes] InstrumentationScope attributes - * @property {number|null} [droppedAttributesCount] InstrumentationScope droppedAttributesCount - */ - - /** - * Constructs a new InstrumentationScope. - * @memberof opentelemetry.proto.common.v1 - * @classdesc Represents an InstrumentationScope. - * @implements IInstrumentationScope - * @constructor - * @param {opentelemetry.proto.common.v1.IInstrumentationScope=} [properties] Properties to set - */ - function InstrumentationScope(properties) { - this.attributes = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * InstrumentationScope name. - * @member {string} name - * @memberof opentelemetry.proto.common.v1.InstrumentationScope - * @instance - */ - InstrumentationScope.prototype.name = ""; - - /** - * InstrumentationScope version. - * @member {string} version - * @memberof opentelemetry.proto.common.v1.InstrumentationScope - * @instance - */ - InstrumentationScope.prototype.version = ""; - - /** - * InstrumentationScope attributes. - * @member {Array.} attributes - * @memberof opentelemetry.proto.common.v1.InstrumentationScope - * @instance - */ - InstrumentationScope.prototype.attributes = $util.emptyArray; - - /** - * InstrumentationScope droppedAttributesCount. - * @member {number} droppedAttributesCount - * @memberof opentelemetry.proto.common.v1.InstrumentationScope - * @instance - */ - InstrumentationScope.prototype.droppedAttributesCount = 0; - - /** - * Creates a new InstrumentationScope instance using the specified properties. - * @function create - * @memberof opentelemetry.proto.common.v1.InstrumentationScope - * @static - * @param {opentelemetry.proto.common.v1.IInstrumentationScope=} [properties] Properties to set - * @returns {opentelemetry.proto.common.v1.InstrumentationScope} InstrumentationScope instance - */ - InstrumentationScope.create = function create(properties) { - return new InstrumentationScope(properties); - }; - - /** - * Encodes the specified InstrumentationScope message. Does not implicitly {@link opentelemetry.proto.common.v1.InstrumentationScope.verify|verify} messages. - * @function encode - * @memberof opentelemetry.proto.common.v1.InstrumentationScope - * @static - * @param {opentelemetry.proto.common.v1.IInstrumentationScope} message InstrumentationScope message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - InstrumentationScope.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); - if (message.version != null && Object.hasOwnProperty.call(message, "version")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.version); - if (message.attributes != null && message.attributes.length) - for (let i = 0; i < message.attributes.length; ++i) - $root.opentelemetry.proto.common.v1.KeyValue.encode(message.attributes[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - if (message.droppedAttributesCount != null && Object.hasOwnProperty.call(message, "droppedAttributesCount")) - writer.uint32(/* id 4, wireType 0 =*/32).uint32(message.droppedAttributesCount); - return writer; - }; - - /** - * Encodes the specified InstrumentationScope message, length delimited. Does not implicitly {@link opentelemetry.proto.common.v1.InstrumentationScope.verify|verify} messages. - * @function encodeDelimited - * @memberof opentelemetry.proto.common.v1.InstrumentationScope - * @static - * @param {opentelemetry.proto.common.v1.IInstrumentationScope} message InstrumentationScope message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - InstrumentationScope.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an InstrumentationScope message from the specified reader or buffer. - * @function decode - * @memberof opentelemetry.proto.common.v1.InstrumentationScope - * @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.InstrumentationScope} InstrumentationScope - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - InstrumentationScope.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.opentelemetry.proto.common.v1.InstrumentationScope(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.name = reader.string(); - break; - } - case 2: { - message.version = reader.string(); - break; - } - case 3: { - if (!(message.attributes && message.attributes.length)) - message.attributes = []; - message.attributes.push($root.opentelemetry.proto.common.v1.KeyValue.decode(reader, reader.uint32())); - break; - } - case 4: { - message.droppedAttributesCount = reader.uint32(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an InstrumentationScope message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof opentelemetry.proto.common.v1.InstrumentationScope - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {opentelemetry.proto.common.v1.InstrumentationScope} InstrumentationScope - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - InstrumentationScope.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an InstrumentationScope message. - * @function verify - * @memberof opentelemetry.proto.common.v1.InstrumentationScope - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - InstrumentationScope.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.name != null && message.hasOwnProperty("name")) - if (!$util.isString(message.name)) - return "name: string expected"; - if (message.version != null && message.hasOwnProperty("version")) - if (!$util.isString(message.version)) - return "version: string expected"; - if (message.attributes != null && message.hasOwnProperty("attributes")) { - if (!Array.isArray(message.attributes)) - return "attributes: array expected"; - for (let i = 0; i < message.attributes.length; ++i) { - let error = $root.opentelemetry.proto.common.v1.KeyValue.verify(message.attributes[i]); - if (error) - return "attributes." + error; - } - } - if (message.droppedAttributesCount != null && message.hasOwnProperty("droppedAttributesCount")) - if (!$util.isInteger(message.droppedAttributesCount)) - return "droppedAttributesCount: integer expected"; - return null; - }; - - /** - * Creates an InstrumentationScope message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof opentelemetry.proto.common.v1.InstrumentationScope - * @static - * @param {Object.} object Plain object - * @returns {opentelemetry.proto.common.v1.InstrumentationScope} InstrumentationScope - */ - InstrumentationScope.fromObject = function fromObject(object) { - if (object instanceof $root.opentelemetry.proto.common.v1.InstrumentationScope) - return object; - let message = new $root.opentelemetry.proto.common.v1.InstrumentationScope(); - if (object.name != null) - message.name = String(object.name); - if (object.version != null) - message.version = String(object.version); - if (object.attributes) { - if (!Array.isArray(object.attributes)) - throw TypeError(".opentelemetry.proto.common.v1.InstrumentationScope.attributes: array expected"); - message.attributes = []; - for (let i = 0; i < object.attributes.length; ++i) { - if (typeof object.attributes[i] !== "object") - throw TypeError(".opentelemetry.proto.common.v1.InstrumentationScope.attributes: object expected"); - message.attributes[i] = $root.opentelemetry.proto.common.v1.KeyValue.fromObject(object.attributes[i]); - } - } - if (object.droppedAttributesCount != null) - message.droppedAttributesCount = object.droppedAttributesCount >>> 0; - return message; - }; - - /** - * Creates a plain object from an InstrumentationScope message. Also converts values to other types if specified. - * @function toObject - * @memberof opentelemetry.proto.common.v1.InstrumentationScope - * @static - * @param {opentelemetry.proto.common.v1.InstrumentationScope} message InstrumentationScope - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - InstrumentationScope.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) - object.attributes = []; - if (options.defaults) { - object.name = ""; - object.version = ""; - object.droppedAttributesCount = 0; - } - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; - if (message.version != null && message.hasOwnProperty("version")) - object.version = message.version; - if (message.attributes && message.attributes.length) { - object.attributes = []; - for (let j = 0; j < message.attributes.length; ++j) - object.attributes[j] = $root.opentelemetry.proto.common.v1.KeyValue.toObject(message.attributes[j], options); - } - if (message.droppedAttributesCount != null && message.hasOwnProperty("droppedAttributesCount")) - object.droppedAttributesCount = message.droppedAttributesCount; - return object; - }; - - /** - * Converts this InstrumentationScope to JSON. - * @function toJSON - * @memberof opentelemetry.proto.common.v1.InstrumentationScope - * @instance - * @returns {Object.} JSON object - */ - InstrumentationScope.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for InstrumentationScope - * @function getTypeUrl - * @memberof opentelemetry.proto.common.v1.InstrumentationScope - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - InstrumentationScope.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/opentelemetry.proto.common.v1.InstrumentationScope"; - }; - - return InstrumentationScope; - })(); - - return v1; - })(); - - return common; + Link.prototype.spanId = $util.newBuffer([]); + + /** + * Link traceState. + * @member {string} traceState + * @memberof opentelemetry.proto.trace.v1.Span.Link + * @instance + */ + Link.prototype.traceState = ''; + + /** + * Link attributes. + * @member {Array.} attributes + * @memberof opentelemetry.proto.trace.v1.Span.Link + * @instance + */ + Link.prototype.attributes = $util.emptyArray; + + /** + * Link droppedAttributesCount. + * @member {number} droppedAttributesCount + * @memberof opentelemetry.proto.trace.v1.Span.Link + * @instance + */ + Link.prototype.droppedAttributesCount = 0; + + /** + * Creates a new Link instance using the specified properties. + * @function create + * @memberof opentelemetry.proto.trace.v1.Span.Link + * @static + * @param {opentelemetry.proto.trace.v1.Span.ILink=} [properties] Properties to set + * @returns {opentelemetry.proto.trace.v1.Span.Link} Link instance + */ + Link.create = function create(properties) { + return new Link(properties); + }; + + /** + * Encodes the specified Link message. Does not implicitly {@link opentelemetry.proto.trace.v1.Span.Link.verify|verify} messages. + * @function encode + * @memberof opentelemetry.proto.trace.v1.Span.Link + * @static + * @param {opentelemetry.proto.trace.v1.Span.ILink} message Link message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Link.encode = function encode(message, writer) { + if (!writer) writer = $Writer.create(); + if ( + message.traceId != null && + Object.hasOwnProperty.call(message, 'traceId') + ) + writer + .uint32(/* id 1, wireType 2 =*/ 10) + .bytes(message.traceId); + if ( + message.spanId != null && + Object.hasOwnProperty.call(message, 'spanId') + ) + writer.uint32(/* id 2, wireType 2 =*/ 18).bytes(message.spanId); + if ( + message.traceState != null && + Object.hasOwnProperty.call(message, 'traceState') + ) + writer + .uint32(/* id 3, wireType 2 =*/ 26) + .string(message.traceState); + if (message.attributes != null && message.attributes.length) + for (let i = 0; i < message.attributes.length; ++i) + $root.opentelemetry.proto.common.v1.KeyValue.encode( + message.attributes[i], + writer.uint32(/* id 4, wireType 2 =*/ 34).fork(), + ).ldelim(); + if ( + message.droppedAttributesCount != null && + Object.hasOwnProperty.call(message, 'droppedAttributesCount') + ) + writer + .uint32(/* id 5, wireType 0 =*/ 40) + .uint32(message.droppedAttributesCount); + return writer; + }; + + /** + * Encodes the specified Link message, length delimited. Does not implicitly {@link opentelemetry.proto.trace.v1.Span.Link.verify|verify} messages. + * @function encodeDelimited + * @memberof opentelemetry.proto.trace.v1.Span.Link + * @static + * @param {opentelemetry.proto.trace.v1.Span.ILink} message Link message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Link.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Link message from the specified reader or buffer. + * @function decode + * @memberof opentelemetry.proto.trace.v1.Span.Link + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {opentelemetry.proto.trace.v1.Span.Link} Link + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Link.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, + message = new $root.opentelemetry.proto.trace.v1.Span.Link(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.traceId = reader.bytes(); + break; + } + case 2: { + message.spanId = reader.bytes(); + break; + } + case 3: { + message.traceState = reader.string(); + break; + } + case 4: { + if (!(message.attributes && message.attributes.length)) + message.attributes = []; + message.attributes.push( + $root.opentelemetry.proto.common.v1.KeyValue.decode( + reader, + reader.uint32(), + ), + ); + break; + } + case 5: { + message.droppedAttributesCount = reader.uint32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Link message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof opentelemetry.proto.trace.v1.Span.Link + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {opentelemetry.proto.trace.v1.Span.Link} Link + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Link.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Link message. + * @function verify + * @memberof opentelemetry.proto.trace.v1.Span.Link + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Link.verify = function verify(message) { + if (typeof message !== 'object' || message === null) + return 'object expected'; + if (message.traceId != null && message.hasOwnProperty('traceId')) + if ( + !( + (message.traceId && + typeof message.traceId.length === 'number') || + $util.isString(message.traceId) + ) + ) + return 'traceId: buffer expected'; + if (message.spanId != null && message.hasOwnProperty('spanId')) + if ( + !( + (message.spanId && + typeof message.spanId.length === 'number') || + $util.isString(message.spanId) + ) + ) + return 'spanId: buffer expected'; + if ( + message.traceState != null && + message.hasOwnProperty('traceState') + ) + if (!$util.isString(message.traceState)) + return 'traceState: string expected'; + if ( + message.attributes != null && + message.hasOwnProperty('attributes') + ) { + if (!Array.isArray(message.attributes)) + return 'attributes: array expected'; + for (let i = 0; i < message.attributes.length; ++i) { + let error = + $root.opentelemetry.proto.common.v1.KeyValue.verify( + message.attributes[i], + ); + if (error) return 'attributes.' + error; + } + } + if ( + message.droppedAttributesCount != null && + message.hasOwnProperty('droppedAttributesCount') + ) + if (!$util.isInteger(message.droppedAttributesCount)) + return 'droppedAttributesCount: integer expected'; + return null; + }; + + /** + * Creates a Link message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof opentelemetry.proto.trace.v1.Span.Link + * @static + * @param {Object.} object Plain object + * @returns {opentelemetry.proto.trace.v1.Span.Link} Link + */ + Link.fromObject = function fromObject(object) { + if ( + object instanceof $root.opentelemetry.proto.trace.v1.Span.Link + ) + return object; + let message = new $root.opentelemetry.proto.trace.v1.Span.Link(); + if (object.traceId != null) + if (typeof object.traceId === 'string') + $util.base64.decode( + object.traceId, + (message.traceId = $util.newBuffer( + $util.base64.length(object.traceId), + )), + 0, + ); + else if (object.traceId.length >= 0) + message.traceId = object.traceId; + if (object.spanId != null) + if (typeof object.spanId === 'string') + $util.base64.decode( + object.spanId, + (message.spanId = $util.newBuffer( + $util.base64.length(object.spanId), + )), + 0, + ); + else if (object.spanId.length >= 0) + message.spanId = object.spanId; + if (object.traceState != null) + message.traceState = String(object.traceState); + if (object.attributes) { + if (!Array.isArray(object.attributes)) + throw TypeError( + '.opentelemetry.proto.trace.v1.Span.Link.attributes: array expected', + ); + message.attributes = []; + for (let i = 0; i < object.attributes.length; ++i) { + if (typeof object.attributes[i] !== 'object') + throw TypeError( + '.opentelemetry.proto.trace.v1.Span.Link.attributes: object expected', + ); + message.attributes[i] = + $root.opentelemetry.proto.common.v1.KeyValue.fromObject( + object.attributes[i], + ); + } + } + if (object.droppedAttributesCount != null) + message.droppedAttributesCount = + object.droppedAttributesCount >>> 0; + return message; + }; + + /** + * Creates a plain object from a Link message. Also converts values to other types if specified. + * @function toObject + * @memberof opentelemetry.proto.trace.v1.Span.Link + * @static + * @param {opentelemetry.proto.trace.v1.Span.Link} message Link + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Link.toObject = function toObject(message, options) { + if (!options) options = {}; + let object = {}; + if (options.arrays || options.defaults) object.attributes = []; + if (options.defaults) { + if (options.bytes === String) object.traceId = ''; + else { + object.traceId = []; + if (options.bytes !== Array) + object.traceId = $util.newBuffer(object.traceId); + } + if (options.bytes === String) object.spanId = ''; + else { + object.spanId = []; + if (options.bytes !== Array) + object.spanId = $util.newBuffer(object.spanId); + } + object.traceState = ''; + object.droppedAttributesCount = 0; + } + if (message.traceId != null && message.hasOwnProperty('traceId')) + object.traceId = + options.bytes === String + ? $util.base64.encode( + message.traceId, + 0, + message.traceId.length, + ) + : options.bytes === Array + ? Array.prototype.slice.call(message.traceId) + : message.traceId; + if (message.spanId != null && message.hasOwnProperty('spanId')) + object.spanId = + options.bytes === String + ? $util.base64.encode( + message.spanId, + 0, + message.spanId.length, + ) + : options.bytes === Array + ? Array.prototype.slice.call(message.spanId) + : message.spanId; + if ( + message.traceState != null && + message.hasOwnProperty('traceState') + ) + object.traceState = message.traceState; + if (message.attributes && message.attributes.length) { + object.attributes = []; + for (let j = 0; j < message.attributes.length; ++j) + object.attributes[j] = + $root.opentelemetry.proto.common.v1.KeyValue.toObject( + message.attributes[j], + options, + ); + } + if ( + message.droppedAttributesCount != null && + message.hasOwnProperty('droppedAttributesCount') + ) + object.droppedAttributesCount = message.droppedAttributesCount; + return object; + }; + + /** + * Converts this Link to JSON. + * @function toJSON + * @memberof opentelemetry.proto.trace.v1.Span.Link + * @instance + * @returns {Object.} JSON object + */ + Link.prototype.toJSON = function toJSON() { + return this.constructor.toObject( + this, + $protobuf.util.toJSONOptions, + ); + }; + + /** + * Gets the default type url for Link + * @function getTypeUrl + * @memberof opentelemetry.proto.trace.v1.Span.Link + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Link.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = 'type.googleapis.com'; + } + return typeUrlPrefix + '/opentelemetry.proto.trace.v1.Span.Link'; + }; + + return Link; + })(); + + return Span; + })(); + + v1.Status = (function () { + /** + * Properties of a Status. + * @memberof opentelemetry.proto.trace.v1 + * @interface IStatus + * @property {string|null} [message] Status message + * @property {opentelemetry.proto.trace.v1.Status.StatusCode|null} [code] Status code + */ + + /** + * Constructs a new Status. + * @memberof opentelemetry.proto.trace.v1 + * @classdesc Represents a Status. + * @implements IStatus + * @constructor + * @param {opentelemetry.proto.trace.v1.IStatus=} [properties] Properties to set + */ + function Status(properties) { + if (properties) + for ( + let keys = Object.keys(properties), i = 0; + i < keys.length; + ++i + ) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Status message. + * @member {string} message + * @memberof opentelemetry.proto.trace.v1.Status + * @instance + */ + Status.prototype.message = ''; + + /** + * Status code. + * @member {opentelemetry.proto.trace.v1.Status.StatusCode} code + * @memberof opentelemetry.proto.trace.v1.Status + * @instance + */ + Status.prototype.code = 0; + + /** + * Creates a new Status instance using the specified properties. + * @function create + * @memberof opentelemetry.proto.trace.v1.Status + * @static + * @param {opentelemetry.proto.trace.v1.IStatus=} [properties] Properties to set + * @returns {opentelemetry.proto.trace.v1.Status} Status instance + */ + Status.create = function create(properties) { + return new Status(properties); + }; + + /** + * Encodes the specified Status message. Does not implicitly {@link opentelemetry.proto.trace.v1.Status.verify|verify} messages. + * @function encode + * @memberof opentelemetry.proto.trace.v1.Status + * @static + * @param {opentelemetry.proto.trace.v1.IStatus} message Status message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Status.encode = function encode(message, writer) { + if (!writer) writer = $Writer.create(); + if ( + message.message != null && + Object.hasOwnProperty.call(message, 'message') + ) + writer.uint32(/* id 2, wireType 2 =*/ 18).string(message.message); + if ( + message.code != null && + Object.hasOwnProperty.call(message, 'code') + ) + writer.uint32(/* id 3, wireType 0 =*/ 24).int32(message.code); + return writer; + }; + + /** + * Encodes the specified Status message, length delimited. Does not implicitly {@link opentelemetry.proto.trace.v1.Status.verify|verify} messages. + * @function encodeDelimited + * @memberof opentelemetry.proto.trace.v1.Status + * @static + * @param {opentelemetry.proto.trace.v1.IStatus} message Status message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Status.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Status message from the specified reader or buffer. + * @function decode + * @memberof opentelemetry.proto.trace.v1.Status + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {opentelemetry.proto.trace.v1.Status} Status + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Status.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, + message = new $root.opentelemetry.proto.trace.v1.Status(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 2: { + message.message = reader.string(); + break; + } + case 3: { + message.code = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Status message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof opentelemetry.proto.trace.v1.Status + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {opentelemetry.proto.trace.v1.Status} Status + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Status.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Status message. + * @function verify + * @memberof opentelemetry.proto.trace.v1.Status + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Status.verify = function verify(message) { + if (typeof message !== 'object' || message === null) + return 'object expected'; + if (message.message != null && message.hasOwnProperty('message')) + if (!$util.isString(message.message)) + return 'message: string expected'; + if (message.code != null && message.hasOwnProperty('code')) + switch (message.code) { + default: + return 'code: enum value expected'; + case 0: + case 1: + case 2: + break; + } + return null; + }; + + /** + * Creates a Status message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof opentelemetry.proto.trace.v1.Status + * @static + * @param {Object.} object Plain object + * @returns {opentelemetry.proto.trace.v1.Status} Status + */ + Status.fromObject = function fromObject(object) { + if (object instanceof $root.opentelemetry.proto.trace.v1.Status) + return object; + let message = new $root.opentelemetry.proto.trace.v1.Status(); + if (object.message != null) + message.message = String(object.message); + switch (object.code) { + default: + if (typeof object.code === 'number') { + message.code = object.code; + break; + } + break; + case 'STATUS_CODE_UNSET': + case 0: + message.code = 0; + break; + case 'STATUS_CODE_OK': + case 1: + message.code = 1; + break; + case 'STATUS_CODE_ERROR': + case 2: + message.code = 2; + break; + } + return message; + }; + + /** + * Creates a plain object from a Status message. Also converts values to other types if specified. + * @function toObject + * @memberof opentelemetry.proto.trace.v1.Status + * @static + * @param {opentelemetry.proto.trace.v1.Status} message Status + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Status.toObject = function toObject(message, options) { + if (!options) options = {}; + let object = {}; + if (options.defaults) { + object.message = ''; + object.code = options.enums === String ? 'STATUS_CODE_UNSET' : 0; + } + if (message.message != null && message.hasOwnProperty('message')) + object.message = message.message; + if (message.code != null && message.hasOwnProperty('code')) + object.code = + options.enums === String + ? $root.opentelemetry.proto.trace.v1.Status.StatusCode[ + message.code + ] === undefined + ? message.code + : $root.opentelemetry.proto.trace.v1.Status.StatusCode[ + message.code + ] + : message.code; + return object; + }; + + /** + * Converts this Status to JSON. + * @function toJSON + * @memberof opentelemetry.proto.trace.v1.Status + * @instance + * @returns {Object.} JSON object + */ + Status.prototype.toJSON = function toJSON() { + return this.constructor.toObject( + this, + $protobuf.util.toJSONOptions, + ); + }; + + /** + * Gets the default type url for Status + * @function getTypeUrl + * @memberof opentelemetry.proto.trace.v1.Status + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Status.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = 'type.googleapis.com'; + } + return typeUrlPrefix + '/opentelemetry.proto.trace.v1.Status'; + }; + + /** + * StatusCode enum. + * @name opentelemetry.proto.trace.v1.Status.StatusCode + * @enum {number} + * @property {number} STATUS_CODE_UNSET=0 STATUS_CODE_UNSET value + * @property {number} STATUS_CODE_OK=1 STATUS_CODE_OK value + * @property {number} STATUS_CODE_ERROR=2 STATUS_CODE_ERROR value + */ + Status.StatusCode = (function () { + const valuesById = {}, + values = Object.create(valuesById); + values[(valuesById[0] = 'STATUS_CODE_UNSET')] = 0; + values[(valuesById[1] = 'STATUS_CODE_OK')] = 1; + values[(valuesById[2] = 'STATUS_CODE_ERROR')] = 2; + return values; + })(); + + return Status; + })(); + + return v1; + })(); + + return trace; + })(); + + proto.resource = (function () { + /** + * Namespace resource. + * @memberof opentelemetry.proto + * @namespace + */ + const resource = {}; + + resource.v1 = (function () { + /** + * Namespace v1. + * @memberof opentelemetry.proto.resource + * @namespace + */ + const v1 = {}; + + v1.Resource = (function () { + /** + * Properties of a Resource. + * @memberof opentelemetry.proto.resource.v1 + * @interface IResource + * @property {Array.|null} [attributes] Resource attributes + * @property {number|null} [droppedAttributesCount] Resource droppedAttributesCount + */ + + /** + * Constructs a new Resource. + * @memberof opentelemetry.proto.resource.v1 + * @classdesc Represents a Resource. + * @implements IResource + * @constructor + * @param {opentelemetry.proto.resource.v1.IResource=} [properties] Properties to set + */ + function Resource(properties) { + this.attributes = []; + if (properties) + for ( + let keys = Object.keys(properties), i = 0; + i < keys.length; + ++i + ) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Resource attributes. + * @member {Array.} attributes + * @memberof opentelemetry.proto.resource.v1.Resource + * @instance + */ + Resource.prototype.attributes = $util.emptyArray; + + /** + * Resource droppedAttributesCount. + * @member {number} droppedAttributesCount + * @memberof opentelemetry.proto.resource.v1.Resource + * @instance + */ + Resource.prototype.droppedAttributesCount = 0; + + /** + * Creates a new Resource instance using the specified properties. + * @function create + * @memberof opentelemetry.proto.resource.v1.Resource + * @static + * @param {opentelemetry.proto.resource.v1.IResource=} [properties] Properties to set + * @returns {opentelemetry.proto.resource.v1.Resource} Resource instance + */ + Resource.create = function create(properties) { + return new Resource(properties); + }; + + /** + * Encodes the specified Resource message. Does not implicitly {@link opentelemetry.proto.resource.v1.Resource.verify|verify} messages. + * @function encode + * @memberof opentelemetry.proto.resource.v1.Resource + * @static + * @param {opentelemetry.proto.resource.v1.IResource} message Resource message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Resource.encode = function encode(message, writer) { + if (!writer) writer = $Writer.create(); + if (message.attributes != null && message.attributes.length) + for (let i = 0; i < message.attributes.length; ++i) + $root.opentelemetry.proto.common.v1.KeyValue.encode( + message.attributes[i], + writer.uint32(/* id 1, wireType 2 =*/ 10).fork(), + ).ldelim(); + if ( + message.droppedAttributesCount != null && + Object.hasOwnProperty.call(message, 'droppedAttributesCount') + ) + writer + .uint32(/* id 2, wireType 0 =*/ 16) + .uint32(message.droppedAttributesCount); + return writer; + }; + + /** + * Encodes the specified Resource message, length delimited. Does not implicitly {@link opentelemetry.proto.resource.v1.Resource.verify|verify} messages. + * @function encodeDelimited + * @memberof opentelemetry.proto.resource.v1.Resource + * @static + * @param {opentelemetry.proto.resource.v1.IResource} message Resource message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Resource.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Resource message from the specified reader or buffer. + * @function decode + * @memberof opentelemetry.proto.resource.v1.Resource + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {opentelemetry.proto.resource.v1.Resource} Resource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Resource.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, + message = new $root.opentelemetry.proto.resource.v1.Resource(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.attributes && message.attributes.length)) + message.attributes = []; + message.attributes.push( + $root.opentelemetry.proto.common.v1.KeyValue.decode( + reader, + reader.uint32(), + ), + ); + break; + } + case 2: { + message.droppedAttributesCount = reader.uint32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Resource message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof opentelemetry.proto.resource.v1.Resource + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {opentelemetry.proto.resource.v1.Resource} Resource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Resource.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Resource message. + * @function verify + * @memberof opentelemetry.proto.resource.v1.Resource + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Resource.verify = function verify(message) { + if (typeof message !== 'object' || message === null) + return 'object expected'; + if ( + message.attributes != null && + message.hasOwnProperty('attributes') + ) { + if (!Array.isArray(message.attributes)) + return 'attributes: array expected'; + for (let i = 0; i < message.attributes.length; ++i) { + let error = $root.opentelemetry.proto.common.v1.KeyValue.verify( + message.attributes[i], + ); + if (error) return 'attributes.' + error; + } + } + if ( + message.droppedAttributesCount != null && + message.hasOwnProperty('droppedAttributesCount') + ) + if (!$util.isInteger(message.droppedAttributesCount)) + return 'droppedAttributesCount: integer expected'; + return null; + }; + + /** + * Creates a Resource message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof opentelemetry.proto.resource.v1.Resource + * @static + * @param {Object.} object Plain object + * @returns {opentelemetry.proto.resource.v1.Resource} Resource + */ + Resource.fromObject = function fromObject(object) { + if ( + object instanceof $root.opentelemetry.proto.resource.v1.Resource + ) + return object; + let message = new $root.opentelemetry.proto.resource.v1.Resource(); + if (object.attributes) { + if (!Array.isArray(object.attributes)) + throw TypeError( + '.opentelemetry.proto.resource.v1.Resource.attributes: array expected', + ); + message.attributes = []; + for (let i = 0; i < object.attributes.length; ++i) { + if (typeof object.attributes[i] !== 'object') + throw TypeError( + '.opentelemetry.proto.resource.v1.Resource.attributes: object expected', + ); + message.attributes[i] = + $root.opentelemetry.proto.common.v1.KeyValue.fromObject( + object.attributes[i], + ); + } + } + if (object.droppedAttributesCount != null) + message.droppedAttributesCount = + object.droppedAttributesCount >>> 0; + return message; + }; + + /** + * Creates a plain object from a Resource message. Also converts values to other types if specified. + * @function toObject + * @memberof opentelemetry.proto.resource.v1.Resource + * @static + * @param {opentelemetry.proto.resource.v1.Resource} message Resource + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Resource.toObject = function toObject(message, options) { + if (!options) options = {}; + let object = {}; + if (options.arrays || options.defaults) object.attributes = []; + if (options.defaults) object.droppedAttributesCount = 0; + if (message.attributes && message.attributes.length) { + object.attributes = []; + for (let j = 0; j < message.attributes.length; ++j) + object.attributes[j] = + $root.opentelemetry.proto.common.v1.KeyValue.toObject( + message.attributes[j], + options, + ); + } + if ( + message.droppedAttributesCount != null && + message.hasOwnProperty('droppedAttributesCount') + ) + object.droppedAttributesCount = message.droppedAttributesCount; + return object; + }; + + /** + * Converts this Resource to JSON. + * @function toJSON + * @memberof opentelemetry.proto.resource.v1.Resource + * @instance + * @returns {Object.} JSON object + */ + Resource.prototype.toJSON = function toJSON() { + return this.constructor.toObject( + this, + $protobuf.util.toJSONOptions, + ); + }; + + /** + * Gets the default type url for Resource + * @function getTypeUrl + * @memberof opentelemetry.proto.resource.v1.Resource + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Resource.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = 'type.googleapis.com'; + } + return typeUrlPrefix + '/opentelemetry.proto.resource.v1.Resource'; + }; + + return Resource; })(); - return proto; + return v1; + })(); + + return resource; })(); - return opentelemetry; -})(); + proto.common = (function () { + /** + * Namespace common. + * @memberof opentelemetry.proto + * @namespace + */ + const common = {}; + + common.v1 = (function () { + /** + * Namespace v1. + * @memberof opentelemetry.proto.common + * @namespace + */ + const 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 ( + let 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 + let $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); + let end = length === undefined ? reader.len : reader.pos + length, + message = new $root.opentelemetry.proto.common.v1.AnyValue(); + while (reader.pos < end) { + let 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.} 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'; + let 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; + { + let 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; + { + let 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.} 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; + let 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.} Plain object + */ + AnyValue.toObject = function toObject(message, options) { + if (!options) options = {}; + let 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.} 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.|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 ( + let 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.} 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 (let 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); + let end = length === undefined ? reader.len : reader.pos + length, + message = new $root.opentelemetry.proto.common.v1.ArrayValue(); + while (reader.pos < end) { + let 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.} 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 (let i = 0; i < message.values.length; ++i) { + let 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.} 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; + let 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 (let 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.} Plain object + */ + ArrayValue.toObject = function toObject(message, options) { + if (!options) options = {}; + let object = {}; + if (options.arrays || options.defaults) object.values = []; + if (message.values && message.values.length) { + object.values = []; + for (let 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.} 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.|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 ( + let 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.} 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 (let 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); + let end = length === undefined ? reader.len : reader.pos + length, + message = new $root.opentelemetry.proto.common.v1.KeyValueList(); + while (reader.pos < end) { + let 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.} 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 (let i = 0; i < message.values.length; ++i) { + let 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.} 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; + let 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 (let 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.} Plain object + */ + KeyValueList.toObject = function toObject(message, options) { + if (!options) options = {}; + let object = {}; + if (options.arrays || options.defaults) object.values = []; + if (message.values && message.values.length) { + object.values = []; + for (let 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.common.v1.KeyValueList + * @instance + * @returns {Object.} JSON object + */ + KeyValueList.prototype.toJSON = function toJSON() { + return this.constructor.toObject( + this, + $protobuf.util.toJSONOptions, + ); + }; + + /** + * Gets the default type url for KeyValueList + * @function getTypeUrl + * @memberof opentelemetry.proto.common.v1.KeyValueList + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + KeyValueList.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = 'type.googleapis.com'; + } + return ( + typeUrlPrefix + '/opentelemetry.proto.common.v1.KeyValueList' + ); + }; + + return KeyValueList; + })(); + + v1.KeyValue = (function () { + /** + * Properties of a KeyValue. + * @memberof opentelemetry.proto.common.v1 + * @interface IKeyValue + * @property {string|null} [key] KeyValue key + * @property {opentelemetry.proto.common.v1.IAnyValue|null} [value] KeyValue value + */ + + /** + * Constructs a new KeyValue. + * @memberof opentelemetry.proto.common.v1 + * @classdesc Represents a KeyValue. + * @implements IKeyValue + * @constructor + * @param {opentelemetry.proto.common.v1.IKeyValue=} [properties] Properties to set + */ + function KeyValue(properties) { + if (properties) + for ( + let keys = Object.keys(properties), i = 0; + i < keys.length; + ++i + ) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * KeyValue key. + * @member {string} key + * @memberof opentelemetry.proto.common.v1.KeyValue + * @instance + */ + KeyValue.prototype.key = ''; + + /** + * KeyValue value. + * @member {opentelemetry.proto.common.v1.IAnyValue|null|undefined} value + * @memberof opentelemetry.proto.common.v1.KeyValue + * @instance + */ + KeyValue.prototype.value = null; + + /** + * Creates a new KeyValue instance using the specified properties. + * @function create + * @memberof opentelemetry.proto.common.v1.KeyValue + * @static + * @param {opentelemetry.proto.common.v1.IKeyValue=} [properties] Properties to set + * @returns {opentelemetry.proto.common.v1.KeyValue} KeyValue instance + */ + KeyValue.create = function create(properties) { + return new KeyValue(properties); + }; + + /** + * Encodes the specified KeyValue message. Does not implicitly {@link opentelemetry.proto.common.v1.KeyValue.verify|verify} messages. + * @function encode + * @memberof opentelemetry.proto.common.v1.KeyValue + * @static + * @param {opentelemetry.proto.common.v1.IKeyValue} message KeyValue message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + KeyValue.encode = function encode(message, writer) { + if (!writer) writer = $Writer.create(); + if ( + message.key != null && + Object.hasOwnProperty.call(message, 'key') + ) + writer.uint32(/* id 1, wireType 2 =*/ 10).string(message.key); + if ( + message.value != null && + Object.hasOwnProperty.call(message, 'value') + ) + $root.opentelemetry.proto.common.v1.AnyValue.encode( + message.value, + writer.uint32(/* id 2, wireType 2 =*/ 18).fork(), + ).ldelim(); + return writer; + }; + + /** + * Encodes the specified KeyValue message, length delimited. Does not implicitly {@link opentelemetry.proto.common.v1.KeyValue.verify|verify} messages. + * @function encodeDelimited + * @memberof opentelemetry.proto.common.v1.KeyValue + * @static + * @param {opentelemetry.proto.common.v1.IKeyValue} message KeyValue message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + KeyValue.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a KeyValue message from the specified reader or buffer. + * @function decode + * @memberof opentelemetry.proto.common.v1.KeyValue + * @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.KeyValue} KeyValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + KeyValue.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, + message = new $root.opentelemetry.proto.common.v1.KeyValue(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.key = reader.string(); + break; + } + case 2: { + message.value = + $root.opentelemetry.proto.common.v1.AnyValue.decode( + reader, + reader.uint32(), + ); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a KeyValue message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof opentelemetry.proto.common.v1.KeyValue + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {opentelemetry.proto.common.v1.KeyValue} KeyValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + KeyValue.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a KeyValue message. + * @function verify + * @memberof opentelemetry.proto.common.v1.KeyValue + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + KeyValue.verify = function verify(message) { + if (typeof message !== 'object' || message === null) + return 'object expected'; + if (message.key != null && message.hasOwnProperty('key')) + if (!$util.isString(message.key)) return 'key: string expected'; + if (message.value != null && message.hasOwnProperty('value')) { + let error = $root.opentelemetry.proto.common.v1.AnyValue.verify( + message.value, + ); + if (error) return 'value.' + error; + } + return null; + }; + + /** + * Creates a KeyValue message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof opentelemetry.proto.common.v1.KeyValue + * @static + * @param {Object.} object Plain object + * @returns {opentelemetry.proto.common.v1.KeyValue} KeyValue + */ + KeyValue.fromObject = function fromObject(object) { + if (object instanceof $root.opentelemetry.proto.common.v1.KeyValue) + return object; + let message = new $root.opentelemetry.proto.common.v1.KeyValue(); + if (object.key != null) message.key = String(object.key); + if (object.value != null) { + if (typeof object.value !== 'object') + throw TypeError( + '.opentelemetry.proto.common.v1.KeyValue.value: object expected', + ); + message.value = + $root.opentelemetry.proto.common.v1.AnyValue.fromObject( + object.value, + ); + } + return message; + }; + + /** + * Creates a plain object from a KeyValue message. Also converts values to other types if specified. + * @function toObject + * @memberof opentelemetry.proto.common.v1.KeyValue + * @static + * @param {opentelemetry.proto.common.v1.KeyValue} message KeyValue + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + KeyValue.toObject = function toObject(message, options) { + if (!options) options = {}; + let object = {}; + if (options.defaults) { + object.key = ''; + object.value = null; + } + if (message.key != null && message.hasOwnProperty('key')) + object.key = message.key; + if (message.value != null && message.hasOwnProperty('value')) + object.value = + $root.opentelemetry.proto.common.v1.AnyValue.toObject( + message.value, + options, + ); + return object; + }; + + /** + * Converts this KeyValue to JSON. + * @function toJSON + * @memberof opentelemetry.proto.common.v1.KeyValue + * @instance + * @returns {Object.} JSON object + */ + KeyValue.prototype.toJSON = function toJSON() { + return this.constructor.toObject( + this, + $protobuf.util.toJSONOptions, + ); + }; + + /** + * Gets the default type url for KeyValue + * @function getTypeUrl + * @memberof opentelemetry.proto.common.v1.KeyValue + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + KeyValue.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = 'type.googleapis.com'; + } + return typeUrlPrefix + '/opentelemetry.proto.common.v1.KeyValue'; + }; + + return KeyValue; + })(); + + v1.InstrumentationScope = (function () { + /** + * Properties of an InstrumentationScope. + * @memberof opentelemetry.proto.common.v1 + * @interface IInstrumentationScope + * @property {string|null} [name] InstrumentationScope name + * @property {string|null} [version] InstrumentationScope version + * @property {Array.|null} [attributes] InstrumentationScope attributes + * @property {number|null} [droppedAttributesCount] InstrumentationScope droppedAttributesCount + */ + + /** + * Constructs a new InstrumentationScope. + * @memberof opentelemetry.proto.common.v1 + * @classdesc Represents an InstrumentationScope. + * @implements IInstrumentationScope + * @constructor + * @param {opentelemetry.proto.common.v1.IInstrumentationScope=} [properties] Properties to set + */ + function InstrumentationScope(properties) { + this.attributes = []; + if (properties) + for ( + let keys = Object.keys(properties), i = 0; + i < keys.length; + ++i + ) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * InstrumentationScope name. + * @member {string} name + * @memberof opentelemetry.proto.common.v1.InstrumentationScope + * @instance + */ + InstrumentationScope.prototype.name = ''; + + /** + * InstrumentationScope version. + * @member {string} version + * @memberof opentelemetry.proto.common.v1.InstrumentationScope + * @instance + */ + InstrumentationScope.prototype.version = ''; + + /** + * InstrumentationScope attributes. + * @member {Array.} attributes + * @memberof opentelemetry.proto.common.v1.InstrumentationScope + * @instance + */ + InstrumentationScope.prototype.attributes = $util.emptyArray; + + /** + * InstrumentationScope droppedAttributesCount. + * @member {number} droppedAttributesCount + * @memberof opentelemetry.proto.common.v1.InstrumentationScope + * @instance + */ + InstrumentationScope.prototype.droppedAttributesCount = 0; + + /** + * Creates a new InstrumentationScope instance using the specified properties. + * @function create + * @memberof opentelemetry.proto.common.v1.InstrumentationScope + * @static + * @param {opentelemetry.proto.common.v1.IInstrumentationScope=} [properties] Properties to set + * @returns {opentelemetry.proto.common.v1.InstrumentationScope} InstrumentationScope instance + */ + InstrumentationScope.create = function create(properties) { + return new InstrumentationScope(properties); + }; + + /** + * Encodes the specified InstrumentationScope message. Does not implicitly {@link opentelemetry.proto.common.v1.InstrumentationScope.verify|verify} messages. + * @function encode + * @memberof opentelemetry.proto.common.v1.InstrumentationScope + * @static + * @param {opentelemetry.proto.common.v1.IInstrumentationScope} message InstrumentationScope message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + InstrumentationScope.encode = function encode(message, writer) { + if (!writer) writer = $Writer.create(); + if ( + message.name != null && + Object.hasOwnProperty.call(message, 'name') + ) + writer.uint32(/* id 1, wireType 2 =*/ 10).string(message.name); + if ( + message.version != null && + Object.hasOwnProperty.call(message, 'version') + ) + writer.uint32(/* id 2, wireType 2 =*/ 18).string(message.version); + if (message.attributes != null && message.attributes.length) + for (let i = 0; i < message.attributes.length; ++i) + $root.opentelemetry.proto.common.v1.KeyValue.encode( + message.attributes[i], + writer.uint32(/* id 3, wireType 2 =*/ 26).fork(), + ).ldelim(); + if ( + message.droppedAttributesCount != null && + Object.hasOwnProperty.call(message, 'droppedAttributesCount') + ) + writer + .uint32(/* id 4, wireType 0 =*/ 32) + .uint32(message.droppedAttributesCount); + return writer; + }; + + /** + * Encodes the specified InstrumentationScope message, length delimited. Does not implicitly {@link opentelemetry.proto.common.v1.InstrumentationScope.verify|verify} messages. + * @function encodeDelimited + * @memberof opentelemetry.proto.common.v1.InstrumentationScope + * @static + * @param {opentelemetry.proto.common.v1.IInstrumentationScope} message InstrumentationScope message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + InstrumentationScope.encodeDelimited = function encodeDelimited( + message, + writer, + ) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an InstrumentationScope message from the specified reader or buffer. + * @function decode + * @memberof opentelemetry.proto.common.v1.InstrumentationScope + * @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.InstrumentationScope} InstrumentationScope + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + InstrumentationScope.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, + message = + new $root.opentelemetry.proto.common.v1.InstrumentationScope(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.version = reader.string(); + break; + } + case 3: { + if (!(message.attributes && message.attributes.length)) + message.attributes = []; + message.attributes.push( + $root.opentelemetry.proto.common.v1.KeyValue.decode( + reader, + reader.uint32(), + ), + ); + break; + } + case 4: { + message.droppedAttributesCount = reader.uint32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an InstrumentationScope message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof opentelemetry.proto.common.v1.InstrumentationScope + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {opentelemetry.proto.common.v1.InstrumentationScope} InstrumentationScope + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + InstrumentationScope.decodeDelimited = function decodeDelimited( + reader, + ) { + if (!(reader instanceof $Reader)) reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an InstrumentationScope message. + * @function verify + * @memberof opentelemetry.proto.common.v1.InstrumentationScope + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + InstrumentationScope.verify = function verify(message) { + if (typeof message !== 'object' || message === null) + return 'object expected'; + if (message.name != null && message.hasOwnProperty('name')) + if (!$util.isString(message.name)) return 'name: string expected'; + if (message.version != null && message.hasOwnProperty('version')) + if (!$util.isString(message.version)) + return 'version: string expected'; + if ( + message.attributes != null && + message.hasOwnProperty('attributes') + ) { + if (!Array.isArray(message.attributes)) + return 'attributes: array expected'; + for (let i = 0; i < message.attributes.length; ++i) { + let error = $root.opentelemetry.proto.common.v1.KeyValue.verify( + message.attributes[i], + ); + if (error) return 'attributes.' + error; + } + } + if ( + message.droppedAttributesCount != null && + message.hasOwnProperty('droppedAttributesCount') + ) + if (!$util.isInteger(message.droppedAttributesCount)) + return 'droppedAttributesCount: integer expected'; + return null; + }; + + /** + * Creates an InstrumentationScope message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof opentelemetry.proto.common.v1.InstrumentationScope + * @static + * @param {Object.} object Plain object + * @returns {opentelemetry.proto.common.v1.InstrumentationScope} InstrumentationScope + */ + InstrumentationScope.fromObject = function fromObject(object) { + if ( + object instanceof + $root.opentelemetry.proto.common.v1.InstrumentationScope + ) + return object; + let message = + new $root.opentelemetry.proto.common.v1.InstrumentationScope(); + if (object.name != null) message.name = String(object.name); + if (object.version != null) + message.version = String(object.version); + if (object.attributes) { + if (!Array.isArray(object.attributes)) + throw TypeError( + '.opentelemetry.proto.common.v1.InstrumentationScope.attributes: array expected', + ); + message.attributes = []; + for (let i = 0; i < object.attributes.length; ++i) { + if (typeof object.attributes[i] !== 'object') + throw TypeError( + '.opentelemetry.proto.common.v1.InstrumentationScope.attributes: object expected', + ); + message.attributes[i] = + $root.opentelemetry.proto.common.v1.KeyValue.fromObject( + object.attributes[i], + ); + } + } + if (object.droppedAttributesCount != null) + message.droppedAttributesCount = + object.droppedAttributesCount >>> 0; + return message; + }; + + /** + * Creates a plain object from an InstrumentationScope message. Also converts values to other types if specified. + * @function toObject + * @memberof opentelemetry.proto.common.v1.InstrumentationScope + * @static + * @param {opentelemetry.proto.common.v1.InstrumentationScope} message InstrumentationScope + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + InstrumentationScope.toObject = function toObject(message, options) { + if (!options) options = {}; + let object = {}; + if (options.arrays || options.defaults) object.attributes = []; + if (options.defaults) { + object.name = ''; + object.version = ''; + object.droppedAttributesCount = 0; + } + if (message.name != null && message.hasOwnProperty('name')) + object.name = message.name; + if (message.version != null && message.hasOwnProperty('version')) + object.version = message.version; + if (message.attributes && message.attributes.length) { + object.attributes = []; + for (let j = 0; j < message.attributes.length; ++j) + object.attributes[j] = + $root.opentelemetry.proto.common.v1.KeyValue.toObject( + message.attributes[j], + options, + ); + } + if ( + message.droppedAttributesCount != null && + message.hasOwnProperty('droppedAttributesCount') + ) + object.droppedAttributesCount = message.droppedAttributesCount; + return object; + }; + + /** + * Converts this InstrumentationScope to JSON. + * @function toJSON + * @memberof opentelemetry.proto.common.v1.InstrumentationScope + * @instance + * @returns {Object.} JSON object + */ + InstrumentationScope.prototype.toJSON = function toJSON() { + return this.constructor.toObject( + this, + $protobuf.util.toJSONOptions, + ); + }; + + /** + * Gets the default type url for InstrumentationScope + * @function getTypeUrl + * @memberof opentelemetry.proto.common.v1.InstrumentationScope + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + InstrumentationScope.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = 'type.googleapis.com'; + } + return ( + typeUrlPrefix + + '/opentelemetry.proto.common.v1.InstrumentationScope' + ); + }; + + return InstrumentationScope; + })(); + + return v1; + })(); + + return common; + })(); + + return proto; + })(); + + return opentelemetry; +})()); module.exports = $root;