From fc9cb4c9ee8aa22c69b3709583e5b638252a986a Mon Sep 17 00:00:00 2001 From: Marc Pichler Date: Wed, 13 Mar 2024 11:16:40 +0100 Subject: [PATCH 01/14] feat!:move serializers to otlp-transformer --- .gitmodules | 6 +- experimental/CHANGELOG.md | 32 +++++--- .../src/OTLPLogExporter.ts | 9 +-- .../test/OTLPLogExporter.test.ts | 4 +- .../src/OTLPTraceExporter.ts | 9 +-- .../test/OTLPTraceExporter.test.ts | 4 +- .../src/OTLPMetricExporter.ts | 9 +-- .../test/OTLPMetricExporter.test.ts | 4 +- .../packages/otlp-exporter-base/package.json | 3 +- .../otlp-exporter-base/tsconfig.esm.json | 3 + .../otlp-exporter-base/tsconfig.esnext.json | 3 + .../packages/otlp-exporter-base/tsconfig.json | 3 + .../otlp-grpc-exporter-base/package.json | 7 +- .../src/OTLPGRPCExporterNodeBase.ts | 14 ++-- .../otlp-grpc-exporter-base/src/index.ts | 6 -- .../test/OTLPGRPCExporterNodeBase.test.ts | 6 +- .../otlp-grpc-exporter-base/tsconfig.json | 3 - .../packages/otlp-transformer/.gitignore | 5 +- .../packages/otlp-transformer/package.json | 13 ++- .../protos | 0 .../src/common/i-serializer.ts | 23 ++++++ .../src/generated/.gitkeep | 0 .../packages/otlp-transformer/src/index.ts | 8 ++ .../otlp-transformer/src/json/serializers.ts | 79 +++++++++++++++++++ .../src/protobuf/protobuf-export-type.ts | 22 ++++++ .../src/protobuf}/serializers.ts | 70 ++++++++-------- .../otlp-transformer/tsconfig.esm.json | 5 +- .../otlp-transformer/tsconfig.esnext.json | 5 +- .../packages/otlp-transformer/tsconfig.json | 3 + package-lock.json | 10 ++- 30 files changed, 255 insertions(+), 113 deletions(-) rename experimental/packages/{otlp-grpc-exporter-base => otlp-transformer}/protos (100%) create mode 100644 experimental/packages/otlp-transformer/src/common/i-serializer.ts rename experimental/packages/{otlp-grpc-exporter-base => otlp-transformer}/src/generated/.gitkeep (100%) create mode 100644 experimental/packages/otlp-transformer/src/json/serializers.ts create mode 100644 experimental/packages/otlp-transformer/src/protobuf/protobuf-export-type.ts rename experimental/packages/{otlp-grpc-exporter-base/src => otlp-transformer/src/protobuf}/serializers.ts (57%) diff --git a/.gitmodules b/.gitmodules index 33a9a7d9b2..1cf297f787 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,6 +1,6 @@ -[submodule "experimental/packages/otlp-grpc-exporter-base/protos"] - path = experimental/packages/otlp-grpc-exporter-base/protos - url = https://github.com/open-telemetry/opentelemetry-proto.git [submodule "experimental/packages/otlp-proto-exporter-base/protos"] path = experimental/packages/otlp-proto-exporter-base/protos url = https://github.com/open-telemetry/opentelemetry-proto.git +[submodule "experimental/packages/otlp-transformer/protos"] + path = experimental/packages/otlp-transformer/protos + url = https://github.com/open-telemetry/opentelemetry-proto.git diff --git a/experimental/CHANGELOG.md b/experimental/CHANGELOG.md index c437d9eec6..026c39e595 100644 --- a/experimental/CHANGELOG.md +++ b/experimental/CHANGELOG.md @@ -6,6 +6,25 @@ All notable changes to experimental packages in this project will be documented ### :boom: Breaking Change +* fix(exporter-*-otlp-grpc)!: lazy load gRPC to improve compatibility with `@opentelemetry/instrumenation-grpc` [#4432](https://github.com/open-telemetry/opentelemetry-js/pull/4432) @pichlermarc + * Fixes a bug where requiring up the gRPC exporter before enabling the instrumentation from `@opentelemetry/instrumentation-grpc` would lead to missing telemetry + * Breaking changes, removes several functions and properties that were used internally and were not intended for end-users + * `getServiceClientType()` + * this returned a static enum value that would denote the export type (`SPAN`, `METRICS`, `LOGS`) + * `getServiceProtoPath()` + * this returned a static enum value that would correspond to the gRPC service path + * `metadata` + * was used internally to access metadata, but as a side effect allowed end-users to modify metadata on runtime. + * `serviceClient` + * was used internally to keep track of the service client used by the exporter, as a side effect it allowed end-users to modify the gRPC service client that was used + * `compression` + * was used internally to keep track of the compression to use but was unintentionally exposed to the users. It allowed to read and write the value, writing, however, would have no effect. +* feat(exporter-*-otlp-*)!: move serialization for Node.js exporters to `@opentelemetry/otlp-transformer` [#4542](https://github.com/open-telemetry/opentelemetry-js/pull/4542) @pichlermarc + * Breaking changes: + * (user-facing) `convert()` now returns an empty object and will be removed in a follow-up + * (internal) OTLPExporterNodeBase now has additional constructor parameters that are required + * (internal) OTLPExporterNodeBase now has an additional `ResponseType` type parameter + ### :rocket: (Enhancement) ### :bug: (Bug Fix) @@ -59,19 +78,6 @@ All notable changes to experimental packages in this project will be documented * This breaking change only affects users that are using the *experimental* `@opentelemetry/instrumentation/hook.mjs` loader hook AND Node.js 18.19 or later: * This reverts back to an older version of `import-in-the-middle` due to * This version does not support Node.js 18.19 or later -* fix(exporter-*-otlp-grpc)!: lazy load gRPC to improve compatibility with `@opentelemetry/instrumenation-grpc` [#4432](https://github.com/open-telemetry/opentelemetry-js/pull/4432) @pichlermarc - * Fixes a bug where requiring up the gRPC exporter before enabling the instrumentation from `@opentelemetry/instrumentation-grpc` would lead to missing telemetry - * Breaking changes, removes several functions and properties that were used internally and were not intended for end-users - * `getServiceClientType()` - * this returned a static enum value that would denote the export type (`SPAN`, `METRICS`, `LOGS`) - * `getServiceProtoPath()` - * this returned a static enum value that would correspond to the gRPC service path - * `metadata` - * was used internally to access metadata, but as a side effect allowed end-users to modify metadata on runtime. - * `serviceClient` - * was used internally to keep track of the service client used by the exporter, as a side effect it allowed end-users to modify the gRPC service client that was used - * `compression` - * was used internally to keep track of the compression to use but was unintentionally exposed to the users. It allowed to read and write the value, writing, however, would have no effect. ### :bug: (Bug Fix) diff --git a/experimental/packages/exporter-logs-otlp-grpc/src/OTLPLogExporter.ts b/experimental/packages/exporter-logs-otlp-grpc/src/OTLPLogExporter.ts index b59a177b22..600f6626b0 100644 --- a/experimental/packages/exporter-logs-otlp-grpc/src/OTLPLogExporter.ts +++ b/experimental/packages/exporter-logs-otlp-grpc/src/OTLPLogExporter.ts @@ -21,12 +21,11 @@ import { OTLPGRPCExporterNodeBase, validateAndNormalizeUrl, DEFAULT_COLLECTOR_URL, - LogsSerializer, } from '@opentelemetry/otlp-grpc-exporter-base'; import { - createExportLogsServiceRequest, IExportLogsServiceRequest, IExportLogsServiceResponse, + ProtobufLogsSerializer, } from '@opentelemetry/otlp-transformer'; import { VERSION } from './version'; @@ -57,14 +56,10 @@ export class OTLPLogExporter signalSpecificMetadata, 'LogsExportService', '/opentelemetry.proto.collector.logs.v1.LogsService/Export', - LogsSerializer + ProtobufLogsSerializer ); } - convert(logRecords: ReadableLogRecord[]): IExportLogsServiceRequest { - return createExportLogsServiceRequest(logRecords); - } - getDefaultUrl(config: OTLPGRPCExporterConfigNode) { return validateAndNormalizeUrl(this.getUrlFromConfig(config)); } diff --git a/experimental/packages/exporter-logs-otlp-grpc/test/OTLPLogExporter.test.ts b/experimental/packages/exporter-logs-otlp-grpc/test/OTLPLogExporter.test.ts index e48a1cef68..b52facec74 100644 --- a/experimental/packages/exporter-logs-otlp-grpc/test/OTLPLogExporter.test.ts +++ b/experimental/packages/exporter-logs-otlp-grpc/test/OTLPLogExporter.test.ts @@ -40,9 +40,7 @@ import { VERSION } from '../src/version'; const logsServiceProtoPath = 'opentelemetry/proto/collector/logs/v1/logs_service.proto'; -const includeDirs = [ - path.resolve(__dirname, '../../otlp-grpc-exporter-base/protos'), -]; +const includeDirs = [path.resolve(__dirname, '../../otlp-transformer/protos')]; const httpAddr = 'https://localhost:1503'; const udsAddr = 'unix:///tmp/otlp-logs.sock'; diff --git a/experimental/packages/exporter-trace-otlp-grpc/src/OTLPTraceExporter.ts b/experimental/packages/exporter-trace-otlp-grpc/src/OTLPTraceExporter.ts index 88e55734e6..82bdaa3da2 100644 --- a/experimental/packages/exporter-trace-otlp-grpc/src/OTLPTraceExporter.ts +++ b/experimental/packages/exporter-trace-otlp-grpc/src/OTLPTraceExporter.ts @@ -21,12 +21,11 @@ import { OTLPGRPCExporterNodeBase, validateAndNormalizeUrl, DEFAULT_COLLECTOR_URL, - TraceSerializer, } from '@opentelemetry/otlp-grpc-exporter-base'; import { - createExportTraceServiceRequest, IExportTraceServiceRequest, IExportTraceServiceResponse, + ProtobufTraceSerializer, } from '@opentelemetry/otlp-transformer'; import { VERSION } from './version'; @@ -57,14 +56,10 @@ export class OTLPTraceExporter signalSpecificMetadata, 'TraceExportService', '/opentelemetry.proto.collector.trace.v1.TraceService/Export', - TraceSerializer + ProtobufTraceSerializer ); } - convert(spans: ReadableSpan[]): IExportTraceServiceRequest { - return createExportTraceServiceRequest(spans); - } - getDefaultUrl(config: OTLPGRPCExporterConfigNode) { return validateAndNormalizeUrl(this.getUrlFromConfig(config)); } diff --git a/experimental/packages/exporter-trace-otlp-grpc/test/OTLPTraceExporter.test.ts b/experimental/packages/exporter-trace-otlp-grpc/test/OTLPTraceExporter.test.ts index 9a3a13ce32..e23fb82939 100644 --- a/experimental/packages/exporter-trace-otlp-grpc/test/OTLPTraceExporter.test.ts +++ b/experimental/packages/exporter-trace-otlp-grpc/test/OTLPTraceExporter.test.ts @@ -44,9 +44,7 @@ import { const traceServiceProtoPath = 'opentelemetry/proto/collector/trace/v1/trace_service.proto'; -const includeDirs = [ - path.resolve(__dirname, '../../otlp-grpc-exporter-base/protos'), -]; +const includeDirs = [path.resolve(__dirname, '../../otlp-transformer/protos')]; const httpAddr = 'https://localhost:1501'; const udsAddr = 'unix:///tmp/otlp-traces.sock'; diff --git a/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/src/OTLPMetricExporter.ts b/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/src/OTLPMetricExporter.ts index 77d68d60a6..547f3843a8 100644 --- a/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/src/OTLPMetricExporter.ts +++ b/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/src/OTLPMetricExporter.ts @@ -24,13 +24,12 @@ import { OTLPGRPCExporterNodeBase, validateAndNormalizeUrl, DEFAULT_COLLECTOR_URL, - MetricsSerializer, } from '@opentelemetry/otlp-grpc-exporter-base'; import { baggageUtils, getEnv } from '@opentelemetry/core'; import { - createExportMetricsServiceRequest, IExportMetricsServiceRequest, IExportMetricsServiceResponse, + ProtobufMetricsSerializer, } from '@opentelemetry/otlp-transformer'; import { VERSION } from './version'; @@ -56,7 +55,7 @@ class OTLPMetricExporterProxy extends OTLPGRPCExporterNodeBase< signalSpecificMetadata, 'MetricsExportService', '/opentelemetry.proto.collector.metrics.v1.MetricsService/Export', - MetricsSerializer + ProtobufMetricsSerializer ); } @@ -64,10 +63,6 @@ class OTLPMetricExporterProxy extends OTLPGRPCExporterNodeBase< return validateAndNormalizeUrl(this.getUrlFromConfig(config)); } - convert(metrics: ResourceMetrics[]): IExportMetricsServiceRequest { - return createExportMetricsServiceRequest(metrics); - } - getUrlFromConfig(config: OTLPGRPCExporterConfigNode): string { if (typeof config.url === 'string') { return config.url; diff --git a/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/test/OTLPMetricExporter.test.ts b/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/test/OTLPMetricExporter.test.ts index 3ed034bde8..a90b13923e 100644 --- a/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/test/OTLPMetricExporter.test.ts +++ b/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/test/OTLPMetricExporter.test.ts @@ -45,9 +45,7 @@ import { AggregationTemporalityPreference } from '@opentelemetry/exporter-metric const metricsServiceProtoPath = 'opentelemetry/proto/collector/metrics/v1/metrics_service.proto'; -const includeDirs = [ - path.resolve(__dirname, '../../otlp-grpc-exporter-base/protos'), -]; +const includeDirs = [path.resolve(__dirname, '../../otlp-transformer/protos')]; const httpAddr = 'https://localhost:1502'; const udsAddr = 'unix:///tmp/otlp-metrics.sock'; diff --git a/experimental/packages/otlp-exporter-base/package.json b/experimental/packages/otlp-exporter-base/package.json index eb4fc6b955..bd417beb8e 100644 --- a/experimental/packages/otlp-exporter-base/package.json +++ b/experimental/packages/otlp-exporter-base/package.json @@ -61,7 +61,8 @@ "access": "public" }, "dependencies": { - "@opentelemetry/core": "1.22.0" + "@opentelemetry/core": "1.22.0", + "@opentelemetry/otlp-transformer": "0.49.1" }, "devDependencies": { "@babel/core": "7.23.6", diff --git a/experimental/packages/otlp-exporter-base/tsconfig.esm.json b/experimental/packages/otlp-exporter-base/tsconfig.esm.json index ae47403334..29f55b1213 100644 --- a/experimental/packages/otlp-exporter-base/tsconfig.esm.json +++ b/experimental/packages/otlp-exporter-base/tsconfig.esm.json @@ -14,6 +14,9 @@ }, { "path": "../../../packages/opentelemetry-core" + }, + { + "path": "../otlp-transformer" } ] } diff --git a/experimental/packages/otlp-exporter-base/tsconfig.esnext.json b/experimental/packages/otlp-exporter-base/tsconfig.esnext.json index 5f6cf572d5..0fb9636081 100644 --- a/experimental/packages/otlp-exporter-base/tsconfig.esnext.json +++ b/experimental/packages/otlp-exporter-base/tsconfig.esnext.json @@ -14,6 +14,9 @@ }, { "path": "../../../packages/opentelemetry-core" + }, + { + "path": "../otlp-transformer" } ] } diff --git a/experimental/packages/otlp-exporter-base/tsconfig.json b/experimental/packages/otlp-exporter-base/tsconfig.json index 6feabd6465..2bff90df9b 100644 --- a/experimental/packages/otlp-exporter-base/tsconfig.json +++ b/experimental/packages/otlp-exporter-base/tsconfig.json @@ -15,6 +15,9 @@ }, { "path": "../../../packages/opentelemetry-core" + }, + { + "path": "../otlp-transformer" } ] } diff --git a/experimental/packages/otlp-grpc-exporter-base/package.json b/experimental/packages/otlp-grpc-exporter-base/package.json index f12206137b..9a8c76b8fc 100644 --- a/experimental/packages/otlp-grpc-exporter-base/package.json +++ b/experimental/packages/otlp-grpc-exporter-base/package.json @@ -8,17 +8,14 @@ "scripts": { "prepublishOnly": "npm run compile", "codecov": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../../", - "compile": "npm run protos && tsc --build", + "compile": "tsc --build", "clean": "tsc --build --clean", "lint": "eslint . --ext .ts", "lint:fix": "eslint . --ext .ts --fix", - "protos": "npm run submodule && npm run protos:generate", - "protos:generate": "node ../../../scripts/generate-protos.js", - "submodule": "git submodule sync --recursive && git submodule update --init --recursive", "tdd": "npm run test -- --watch-extensions ts --watch", "test": "nyc ts-mocha -p tsconfig.json 'test/**/*.test.ts'", "version": "node ../../../scripts/version-update.js", - "watch": "npm run protos && tsc -w", + "watch": "tsc -w", "precompile": "cross-var lerna run version --scope $npm_package_name --include-dependencies", "prewatch": "npm run precompile" }, diff --git a/experimental/packages/otlp-grpc-exporter-base/src/OTLPGRPCExporterNodeBase.ts b/experimental/packages/otlp-grpc-exporter-base/src/OTLPGRPCExporterNodeBase.ts index cfa7fba3d7..fb75bcf19c 100644 --- a/experimental/packages/otlp-grpc-exporter-base/src/OTLPGRPCExporterNodeBase.ts +++ b/experimental/packages/otlp-grpc-exporter-base/src/OTLPGRPCExporterNodeBase.ts @@ -27,7 +27,7 @@ import { GrpcExporterTransport, } from './grpc-exporter-transport'; import { configureCompression, configureCredentials } from './util'; -import { ISerializer } from './serializers'; +import { ISerializer } from '@opentelemetry/otlp-transformer'; import { IExporterTransport } from './exporter-transport'; /** @@ -45,14 +45,14 @@ export abstract class OTLPGRPCExporterNodeBase< grpcQueue: GRPCQueueItem[] = []; compression: CompressionAlgorithm; private _transport: IExporterTransport; - private _serializer: ISerializer; + private _serializer: ISerializer; constructor( config: OTLPGRPCExporterConfigNode = {}, signalSpecificMetadata: Record, grpcName: string, grpcPath: string, - serializer: ISerializer + serializer: ISerializer ) { super(config); this._serializer = serializer; @@ -114,6 +114,11 @@ export abstract class OTLPGRPCExporterNodeBase< this._transport.shutdown(); } + override convert(_objects: ExportItem[]): ServiceRequest { + // Not used, nothing to do. + return {} as ServiceRequest; + } + send( objects: ExportItem[], onSuccess: () => void, @@ -124,8 +129,7 @@ export abstract class OTLPGRPCExporterNodeBase< return; } - const converted = this.convert(objects); - const data = this._serializer.serializeRequest(converted); + const data = this._serializer.serializeRequest(objects); if (data == null) { onError(new Error('Could not serialize message')); diff --git a/experimental/packages/otlp-grpc-exporter-base/src/index.ts b/experimental/packages/otlp-grpc-exporter-base/src/index.ts index 0e7f487e2b..566b12f42f 100644 --- a/experimental/packages/otlp-grpc-exporter-base/src/index.ts +++ b/experimental/packages/otlp-grpc-exporter-base/src/index.ts @@ -17,9 +17,3 @@ export { OTLPGRPCExporterNodeBase } from './OTLPGRPCExporterNodeBase'; export { OTLPGRPCExporterConfigNode } from './types'; export { DEFAULT_COLLECTOR_URL, validateAndNormalizeUrl } from './util'; -export { - MetricsSerializer, - TraceSerializer, - LogsSerializer, - ISerializer, -} from './serializers'; diff --git a/experimental/packages/otlp-grpc-exporter-base/test/OTLPGRPCExporterNodeBase.test.ts b/experimental/packages/otlp-grpc-exporter-base/test/OTLPGRPCExporterNodeBase.test.ts index f70ffd08cd..cca5434c9c 100644 --- a/experimental/packages/otlp-grpc-exporter-base/test/OTLPGRPCExporterNodeBase.test.ts +++ b/experimental/packages/otlp-grpc-exporter-base/test/OTLPGRPCExporterNodeBase.test.ts @@ -21,7 +21,7 @@ import { OTLPGRPCExporterConfigNode } from '../src/types'; import { mockedReadableSpan } from './traceHelper'; import { ExportResponse, ExportResponseSuccess } from '../src/export-response'; import { IExporterTransport } from '../src/exporter-transport'; -import { ISerializer } from '../src'; +import { ISerializer } from '@opentelemetry/otlp-transformer'; import sinon = require('sinon'); class MockCollectorExporter extends OTLPGRPCExporterNodeBase< @@ -33,10 +33,6 @@ class MockCollectorExporter extends OTLPGRPCExporterNodeBase< return ''; } - convert(spans: ReadableSpan[]): ReadableSpan[] { - return spans; - } - getUrlFromConfig(config: OTLPGRPCExporterConfigNode): string { return ''; } diff --git a/experimental/packages/otlp-grpc-exporter-base/tsconfig.json b/experimental/packages/otlp-grpc-exporter-base/tsconfig.json index ddc035cf3a..417e1ad468 100644 --- a/experimental/packages/otlp-grpc-exporter-base/tsconfig.json +++ b/experimental/packages/otlp-grpc-exporter-base/tsconfig.json @@ -1,14 +1,11 @@ { "extends": "../../../tsconfig.base.json", "compilerOptions": { - "allowJs": true, "outDir": "build", "rootDir": "." }, "include": [ "src/**/*.ts", - "src/generated/**/*.js", - "src/generated/**/*.ts", "test/**/*.ts" ], "references": [ diff --git a/experimental/packages/otlp-transformer/.gitignore b/experimental/packages/otlp-transformer/.gitignore index ae2d188110..2cded78f30 100644 --- a/experimental/packages/otlp-transformer/.gitignore +++ b/experimental/packages/otlp-transformer/.gitignore @@ -1,2 +1,3 @@ -src/generated -!src/logs \ No newline at end of file +src/generated/* +!src/generated/.gitkeep +!src/logs diff --git a/experimental/packages/otlp-transformer/package.json b/experimental/packages/otlp-transformer/package.json index e79130b68e..b32e44719f 100644 --- a/experimental/packages/otlp-transformer/package.json +++ b/experimental/packages/otlp-transformer/package.json @@ -14,16 +14,19 @@ "scripts": { "prepublishOnly": "npm run compile", "precompile": "cross-var lerna run version --scope $npm_package_name --include-dependencies", - "compile": "tsc --build tsconfig.json tsconfig.esm.json tsconfig.esnext.json", + "compile": "npm run protos && tsc --build tsconfig.json tsconfig.esm.json tsconfig.esnext.json", "clean": "tsc --build --clean tsconfig.json tsconfig.esm.json tsconfig.esnext.json", + "protos": "npm run submodule && npm run protos:generate", + "protos:generate": "node ../../../scripts/generate-protos.js", "lint": "eslint . --ext .ts", "lint:fix": "eslint . --ext .ts --fix", "tdd": "npm run test -- --watch-extensions ts --watch", + "submodule": "git submodule sync --recursive && git submodule update --init --recursive", "test": "nyc ts-mocha -p tsconfig.json 'test/**/*.test.ts'", "test:browser": "karma start --single-run", "test:bench": "node test/performance/benchmark/index.js | tee .benchmark-results.txt", "prewatch": "node ../../../scripts/version-update.js", - "watch": "tsc --build -w tsconfig.json tsconfig.esm.json tsconfig.esnext.json", + "watch": "npm run protos && tsc -w tsconfig.json tsconfig.esm.json tsconfig.esnext.json", "peer-api-check": "node ../../../scripts/peer-api-check.js", "codecov": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../../" }, @@ -76,7 +79,8 @@ "ts-loader": "8.4.0", "ts-mocha": "10.0.0", "typescript": "4.4.4", - "webpack": "5.89.0" + "webpack": "5.89.0", + "protobufjs-cli": "1.1.2" }, "dependencies": { "@opentelemetry/api-logs": "0.49.1", @@ -84,7 +88,8 @@ "@opentelemetry/resources": "1.22.0", "@opentelemetry/sdk-logs": "0.49.1", "@opentelemetry/sdk-metrics": "1.22.0", - "@opentelemetry/sdk-trace-base": "1.22.0" + "@opentelemetry/sdk-trace-base": "1.22.0", + "protobufjs": "^7.2.3" }, "homepage": "https://github.com/open-telemetry/opentelemetry-js/tree/main/experimental/packages/otlp-transformer", "sideEffects": false diff --git a/experimental/packages/otlp-grpc-exporter-base/protos b/experimental/packages/otlp-transformer/protos similarity index 100% rename from experimental/packages/otlp-grpc-exporter-base/protos rename to experimental/packages/otlp-transformer/protos diff --git a/experimental/packages/otlp-transformer/src/common/i-serializer.ts b/experimental/packages/otlp-transformer/src/common/i-serializer.ts new file mode 100644 index 0000000000..c7cf7c9cba --- /dev/null +++ b/experimental/packages/otlp-transformer/src/common/i-serializer.ts @@ -0,0 +1,23 @@ +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * Serializes and deserializes the OTLP request/response to and from {@link Uint8Array} + */ +export interface ISerializer { + serializeRequest(request: Request): Uint8Array | undefined; + deserializeResponse(data: Uint8Array): Response; +} diff --git a/experimental/packages/otlp-grpc-exporter-base/src/generated/.gitkeep b/experimental/packages/otlp-transformer/src/generated/.gitkeep similarity index 100% rename from experimental/packages/otlp-grpc-exporter-base/src/generated/.gitkeep rename to experimental/packages/otlp-transformer/src/generated/.gitkeep diff --git a/experimental/packages/otlp-transformer/src/index.ts b/experimental/packages/otlp-transformer/src/index.ts index 9c325644dc..6f7ca0009a 100644 --- a/experimental/packages/otlp-transformer/src/index.ts +++ b/experimental/packages/otlp-transformer/src/index.ts @@ -24,3 +24,11 @@ export * from './logs/types'; export { createExportTraceServiceRequest } from './trace'; export { createExportMetricsServiceRequest } from './metrics'; export { createExportLogsServiceRequest } from './logs'; + +export { + ProtobufLogsSerializer, + ProtobufMetricsSerializer, + ProtobufTraceSerializer, +} from './protobuf/serializers'; + +export { ISerializer } from './common/i-serializer'; diff --git a/experimental/packages/otlp-transformer/src/json/serializers.ts b/experimental/packages/otlp-transformer/src/json/serializers.ts new file mode 100644 index 0000000000..fe78aeedfc --- /dev/null +++ b/experimental/packages/otlp-transformer/src/json/serializers.ts @@ -0,0 +1,79 @@ +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { ISerializer } from '../common/i-serializer'; +import { ReadableSpan } from '@opentelemetry/sdk-trace-base'; +import { IExportTraceServiceResponse } from '../trace/types'; +import { createExportTraceServiceRequest } from '../trace'; +import { ResourceMetrics } from '@opentelemetry/sdk-metrics'; +import { createExportMetricsServiceRequest } from '../metrics'; +import { ReadableLogRecord } from '@opentelemetry/sdk-logs'; +import { IExportMetricsServiceResponse } from '../metrics/types'; +import { IExportLogsServiceResponse } from '../logs/types'; +import { createExportLogsServiceRequest } from '../logs'; + +export const JsonTraceSerializer: ISerializer< + ReadableSpan[], + IExportTraceServiceResponse +> = { + serializeRequest: (arg: ReadableSpan[]) => { + const request = createExportTraceServiceRequest(arg, { + useHex: true, + useLongBits: false, + }); + const encoder = new TextEncoder(); + return encoder.encode(JSON.stringify(request)); + }, + deserializeResponse: (_arg: Uint8Array) => { + // Not yet implemented + return {}; + }, +}; + +export const JsonMetricsSerializer: ISerializer< + ResourceMetrics[], + IExportMetricsServiceResponse +> = { + serializeRequest: (arg: ResourceMetrics[]) => { + const request = createExportMetricsServiceRequest(arg, { + useHex: true, + useLongBits: false, + }); + const encoder = new TextEncoder(); + return encoder.encode(JSON.stringify(request)); + }, + deserializeResponse: (_arg: Uint8Array) => { + // Not yet implemented + return {}; + }, +}; + +export const JsonLogsSerializer: ISerializer< + ReadableLogRecord[], + IExportLogsServiceResponse +> = { + serializeRequest: (arg: ReadableLogRecord[]) => { + const request = createExportLogsServiceRequest(arg, { + useHex: true, + useLongBits: false, + }); + const encoder = new TextEncoder(); + return encoder.encode(JSON.stringify(request)); + }, + deserializeResponse: (_arg: Uint8Array) => { + // Not yet implemented + return {}; + }, +}; diff --git a/experimental/packages/otlp-transformer/src/protobuf/protobuf-export-type.ts b/experimental/packages/otlp-transformer/src/protobuf/protobuf-export-type.ts new file mode 100644 index 0000000000..c84d5311c1 --- /dev/null +++ b/experimental/packages/otlp-transformer/src/protobuf/protobuf-export-type.ts @@ -0,0 +1,22 @@ +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import * as protobuf from 'protobufjs'; + +export interface ExportType unknown }> { + encode(message: T, writer?: protobuf.Writer): protobuf.Writer; + decode(reader: protobuf.Reader | Uint8Array, length?: number): R; +} diff --git a/experimental/packages/otlp-grpc-exporter-base/src/serializers.ts b/experimental/packages/otlp-transformer/src/protobuf/serializers.ts similarity index 57% rename from experimental/packages/otlp-grpc-exporter-base/src/serializers.ts rename to experimental/packages/otlp-transformer/src/protobuf/serializers.ts index 3e8b22f605..ce2d0d9409 100644 --- a/experimental/packages/otlp-grpc-exporter-base/src/serializers.ts +++ b/experimental/packages/otlp-transformer/src/protobuf/serializers.ts @@ -14,16 +14,27 @@ * limitations under the License. */ -import * as root from './generated/root'; +import * as root from '../generated/root'; +import { ISerializer } from '../common/i-serializer'; import { - IExportLogsServiceRequest, - IExportLogsServiceResponse, IExportMetricsServiceRequest, IExportMetricsServiceResponse, +} from '../metrics/types'; +import { ExportType } from './protobuf-export-type'; +import { IExportTraceServiceRequest, IExportTraceServiceResponse, -} from '@opentelemetry/otlp-transformer'; -import { ExportType } from './internal-types'; +} from '../trace/types'; +import { + IExportLogsServiceRequest, + IExportLogsServiceResponse, +} from '../logs/types'; +import { ReadableSpan } from '@opentelemetry/sdk-trace-base'; +import { createExportTraceServiceRequest } from '../trace'; +import { createExportMetricsServiceRequest } from '../metrics'; +import { ResourceMetrics } from '@opentelemetry/sdk-metrics'; +import { createExportLogsServiceRequest } from '../logs'; +import { ReadableLogRecord } from '@opentelemetry/sdk-logs'; const logsResponseType = root.opentelemetry.proto.collector.logs.v1 .ExportLogsServiceResponse as ExportType; @@ -43,46 +54,41 @@ const traceResponseType = root.opentelemetry.proto.collector.trace.v1 const traceRequestType = root.opentelemetry.proto.collector.trace.v1 .ExportTraceServiceRequest as ExportType; -/** - * Serializes and deserializes the OTLP request/response to and from {@link Uint8Array} - */ -export interface ISerializer { - serializeRequest(request: Request): Uint8Array | undefined; - deserializeResponse(data: Uint8Array): Response; -} - -export const LogsSerializer: ISerializer< - IExportLogsServiceRequest, +export const ProtobufLogsSerializer: ISerializer< + ReadableLogRecord[], IExportLogsServiceResponse > = { - serializeRequest: (arg: IExportLogsServiceRequest) => { - return Buffer.from(logsRequestType.encode(arg).finish()); + serializeRequest: (arg: ReadableLogRecord[]) => { + const request = createExportLogsServiceRequest(arg); + return logsRequestType.encode(request).finish(); }, - deserializeResponse: (arg: Buffer) => { + deserializeResponse: (arg: Uint8Array) => { return logsResponseType.decode(arg); }, }; -export const TraceSerializer: ISerializer< - IExportTraceServiceRequest, - IExportTraceServiceResponse +export const ProtobufMetricsSerializer: ISerializer< + ResourceMetrics[], + IExportMetricsServiceResponse > = { - serializeRequest: (arg: IExportTraceServiceRequest) => { - return Buffer.from(traceRequestType.encode(arg).finish()); + serializeRequest: (arg: ResourceMetrics[]) => { + const request = createExportMetricsServiceRequest(arg); + return metricsRequestType.encode(request).finish(); }, - deserializeResponse: (arg: Buffer) => { - return traceResponseType.decode(arg); + deserializeResponse: (arg: Uint8Array) => { + return metricsResponseType.decode(arg); }, }; -export const MetricsSerializer: ISerializer< - IExportMetricsServiceRequest, - IExportMetricsServiceResponse +export const ProtobufTraceSerializer: ISerializer< + ReadableSpan[], + IExportTraceServiceResponse > = { - serializeRequest: (arg: IExportMetricsServiceRequest) => { - return Buffer.from(metricsRequestType.encode(arg).finish()); + serializeRequest: (arg: ReadableSpan[]) => { + const request = createExportTraceServiceRequest(arg); + return traceRequestType.encode(request).finish(); }, - deserializeResponse: (arg: Buffer) => { - return metricsResponseType.decode(arg); + deserializeResponse: (arg: Uint8Array) => { + return traceResponseType.decode(arg); }, }; diff --git a/experimental/packages/otlp-transformer/tsconfig.esm.json b/experimental/packages/otlp-transformer/tsconfig.esm.json index 0dc676825c..b2f0a9b99c 100644 --- a/experimental/packages/otlp-transformer/tsconfig.esm.json +++ b/experimental/packages/otlp-transformer/tsconfig.esm.json @@ -1,12 +1,15 @@ { "extends": "../../../tsconfig.base.esm.json", "compilerOptions": { + "allowJs": true, "outDir": "build/esm", "rootDir": "src", "tsBuildInfoFile": "build/esm/tsconfig.esm.tsbuildinfo" }, "include": [ - "src/**/*.ts" + "src/**/*.ts", + "src/generated/*.js", + "src/generated/*.ts" ], "references": [ { diff --git a/experimental/packages/otlp-transformer/tsconfig.esnext.json b/experimental/packages/otlp-transformer/tsconfig.esnext.json index 56f7465ceb..ff98b47cd1 100644 --- a/experimental/packages/otlp-transformer/tsconfig.esnext.json +++ b/experimental/packages/otlp-transformer/tsconfig.esnext.json @@ -1,12 +1,15 @@ { "extends": "../../../tsconfig.base.esnext.json", "compilerOptions": { + "allowJs": true, "outDir": "build/esnext", "rootDir": "src", "tsBuildInfoFile": "build/esnext/tsconfig.esnext.tsbuildinfo" }, "include": [ - "src/**/*.ts" + "src/**/*.ts", + "src/generated/*.js", + "src/generated/*.ts" ], "references": [ { diff --git a/experimental/packages/otlp-transformer/tsconfig.json b/experimental/packages/otlp-transformer/tsconfig.json index cb92fea575..d68d60fa7e 100644 --- a/experimental/packages/otlp-transformer/tsconfig.json +++ b/experimental/packages/otlp-transformer/tsconfig.json @@ -1,12 +1,15 @@ { "extends": "../../../tsconfig.base.json", "compilerOptions": { + "allowJs": true, "outDir": "build", "rootDir": "." }, "files": [], "include": [ "src/**/*.ts", + "src/generated/*.js", + "src/generated/*.ts", "test/**/*.ts" ], "references": [ diff --git a/package-lock.json b/package-lock.json index 160db7842d..4e46099214 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4214,7 +4214,8 @@ "version": "0.49.1", "license": "Apache-2.0", "dependencies": { - "@opentelemetry/core": "1.22.0" + "@opentelemetry/core": "1.22.0", + "@opentelemetry/otlp-transformer": "0.49.1" }, "devDependencies": { "@babel/core": "7.23.6", @@ -4596,7 +4597,8 @@ "@opentelemetry/resources": "1.22.0", "@opentelemetry/sdk-logs": "0.49.1", "@opentelemetry/sdk-metrics": "1.22.0", - "@opentelemetry/sdk-trace-base": "1.22.0" + "@opentelemetry/sdk-trace-base": "1.22.0", + "protobufjs": "^7.2.3" }, "devDependencies": { "@opentelemetry/api": "1.8.0", @@ -4614,6 +4616,7 @@ "lerna": "6.6.2", "mocha": "10.2.0", "nyc": "15.1.0", + "protobufjs-cli": "1.1.2", "ts-loader": "8.4.0", "ts-mocha": "10.0.0", "typescript": "4.4.4", @@ -42733,6 +42736,7 @@ "@babel/preset-env": "7.22.20", "@opentelemetry/api": "1.8.0", "@opentelemetry/core": "1.22.0", + "@opentelemetry/otlp-transformer": "0.49.1", "@types/mocha": "10.0.6", "@types/node": "18.6.5", "@types/sinon": "10.0.20", @@ -42967,6 +42971,8 @@ "lerna": "6.6.2", "mocha": "10.2.0", "nyc": "15.1.0", + "protobufjs": "^7.2.3", + "protobufjs-cli": "1.1.2", "ts-loader": "8.4.0", "ts-mocha": "10.0.0", "typescript": "4.4.4", From dfffc2330499ccaa38608e7a1d2958385f0021ee Mon Sep 17 00:00:00 2001 From: Marc Pichler Date: Wed, 13 Mar 2024 13:18:41 +0100 Subject: [PATCH 02/14] feat!: use serializeres in protobuf and json exporters --- .../src/platform/node/OTLPLogExporter.ts | 32 ++++--- .../src/platform/node/OTLPLogExporter.ts | 19 ++-- .../test/node/OTLPLogExporter.test.ts | 31 +++---- .../src/platform/node/OTLPTraceExporter.ts | 18 ++-- .../src/platform/node/OTLPTraceExporter.ts | 21 +++-- .../test/node/OTLPTraceExporter.test.ts | 34 +++---- .../src/platform/node/OTLPMetricExporter.ts | 12 ++- .../src/OTLPMetricExporter.ts | 20 ++--- .../test/OTLPMetricExporter.test.ts | 34 +++---- .../src/platform/node/OTLPExporterNodeBase.ts | 22 ++++- .../src/platform/node/util.ts | 12 +-- .../otlp-exporter-base/test/node/util.test.ts | 52 +++++++---- .../src/platform/index.ts | 1 - .../node/OTLPProtoExporterNodeBase.ts | 88 ------------------- .../src/platform/node/index.ts | 18 ---- .../src/platform/node/util.ts | 53 ----------- .../packages/otlp-transformer/src/index.ts | 6 ++ 17 files changed, 170 insertions(+), 303 deletions(-) delete mode 100644 experimental/packages/otlp-proto-exporter-base/src/platform/node/OTLPProtoExporterNodeBase.ts delete mode 100644 experimental/packages/otlp-proto-exporter-base/src/platform/node/index.ts delete mode 100644 experimental/packages/otlp-proto-exporter-base/src/platform/node/util.ts diff --git a/experimental/packages/exporter-logs-otlp-http/src/platform/node/OTLPLogExporter.ts b/experimental/packages/exporter-logs-otlp-http/src/platform/node/OTLPLogExporter.ts index 9181b082cf..e0d4660f22 100644 --- a/experimental/packages/exporter-logs-otlp-http/src/platform/node/OTLPLogExporter.ts +++ b/experimental/packages/exporter-logs-otlp-http/src/platform/node/OTLPLogExporter.ts @@ -19,10 +19,13 @@ import type { LogRecordExporter, } from '@opentelemetry/sdk-logs'; import type { OTLPExporterNodeConfigBase } from '@opentelemetry/otlp-exporter-base'; -import type { IExportLogsServiceRequest } from '@opentelemetry/otlp-transformer'; +import type { + IExportLogsServiceRequest, + IExportLogsServiceResponse, +} from '@opentelemetry/otlp-transformer'; import { getEnv, baggageUtils } from '@opentelemetry/core'; import { OTLPExporterNodeBase } from '@opentelemetry/otlp-exporter-base'; -import { createExportLogsServiceRequest } from '@opentelemetry/otlp-transformer'; +import { JsonLogsSerializer } from '@opentelemetry/otlp-transformer'; import { getDefaultUrl } from '../config'; import { VERSION } from '../../version'; @@ -35,15 +38,23 @@ const USER_AGENT = { * Collector Logs Exporter for Node */ export class OTLPLogExporter - extends OTLPExporterNodeBase + extends OTLPExporterNodeBase< + ReadableLogRecord, + IExportLogsServiceRequest, + IExportLogsServiceResponse + > implements LogRecordExporter { constructor(config: OTLPExporterNodeConfigBase = {}) { // load OTEL_EXPORTER_OTLP_LOGS_TIMEOUT env - super({ - timeoutMillis: getEnv().OTEL_EXPORTER_OTLP_LOGS_TIMEOUT, - ...config, - }); + super( + { + timeoutMillis: getEnv().OTEL_EXPORTER_OTLP_LOGS_TIMEOUT, + ...config, + }, + JsonLogsSerializer, + 'application/json' + ); this.headers = { ...this.headers, ...USER_AGENT, @@ -54,13 +65,6 @@ export class OTLPLogExporter }; } - convert(logRecords: ReadableLogRecord[]): IExportLogsServiceRequest { - return createExportLogsServiceRequest(logRecords, { - useHex: true, - useLongBits: false, - }); - } - getDefaultUrl(config: OTLPExporterNodeConfigBase): string { return getDefaultUrl(config); } diff --git a/experimental/packages/exporter-logs-otlp-proto/src/platform/node/OTLPLogExporter.ts b/experimental/packages/exporter-logs-otlp-proto/src/platform/node/OTLPLogExporter.ts index caec7352ff..f27ca229e0 100644 --- a/experimental/packages/exporter-logs-otlp-proto/src/platform/node/OTLPLogExporter.ts +++ b/experimental/packages/exporter-logs-otlp-proto/src/platform/node/OTLPLogExporter.ts @@ -19,14 +19,13 @@ import { OTLPExporterConfigBase, appendResourcePathToUrl, appendRootPathToUrlIfNeeded, + OTLPExporterNodeBase, } from '@opentelemetry/otlp-exporter-base'; +import { ServiceClientType } from '@opentelemetry/otlp-proto-exporter-base'; import { - OTLPProtoExporterNodeBase, - ServiceClientType, -} from '@opentelemetry/otlp-proto-exporter-base'; -import { - createExportLogsServiceRequest, IExportLogsServiceRequest, + IExportLogsServiceResponse, + ProtobufLogsSerializer, } from '@opentelemetry/otlp-transformer'; import { ReadableLogRecord, LogRecordExporter } from '@opentelemetry/sdk-logs'; @@ -43,14 +42,15 @@ const DEFAULT_COLLECTOR_URL = `http://localhost:4318/${DEFAULT_COLLECTOR_RESOURC * Collector Trace Exporter for Node */ export class OTLPLogExporter - extends OTLPProtoExporterNodeBase< + extends OTLPExporterNodeBase< ReadableLogRecord, - IExportLogsServiceRequest + IExportLogsServiceRequest, + IExportLogsServiceResponse > implements LogRecordExporter { constructor(config: OTLPExporterConfigBase = {}) { - super(config); + super(config, ProtobufLogsSerializer, 'application/x-protobuf'); this.headers = { ...this.headers, ...USER_AGENT, @@ -60,9 +60,6 @@ export class OTLPLogExporter ...config.headers, }; } - convert(logs: ReadableLogRecord[]): IExportLogsServiceRequest { - return createExportLogsServiceRequest(logs); - } getDefaultUrl(config: OTLPExporterConfigBase): string { return typeof config.url === 'string' diff --git a/experimental/packages/exporter-logs-otlp-proto/test/node/OTLPLogExporter.test.ts b/experimental/packages/exporter-logs-otlp-proto/test/node/OTLPLogExporter.test.ts index 9778c95046..8bf1436206 100644 --- a/experimental/packages/exporter-logs-otlp-proto/test/node/OTLPLogExporter.test.ts +++ b/experimental/packages/exporter-logs-otlp-proto/test/node/OTLPLogExporter.test.ts @@ -193,8 +193,6 @@ describe('OTLPLogExporter - node with proto over http', () => { }); it('should open the connection', done => { - collectorExporter.export(logs, () => {}); - sinon.stub(http, 'request').callsFake((options: any, cb: any) => { assert.strictEqual(options.hostname, 'foo.bar.com'); assert.strictEqual(options.method, 'POST'); @@ -206,11 +204,10 @@ describe('OTLPLogExporter - node with proto over http', () => { done(); return fakeRequest as any; }); + collectorExporter.export(logs, () => {}); }); it('should set custom headers', done => { - collectorExporter.export(logs, () => {}); - sinon.stub(http, 'request').callsFake((options: any, cb: any) => { assert.strictEqual(options.headers['foo'], 'bar'); @@ -220,11 +217,10 @@ describe('OTLPLogExporter - node with proto over http', () => { done(); return fakeRequest as any; }); + collectorExporter.export(logs, () => {}); }); it('should have keep alive and keepAliveMsecs option set', done => { - collectorExporter.export(logs, () => {}); - sinon.stub(http, 'request').callsFake((options: any, cb: any) => { assert.strictEqual(options.agent.keepAlive, true); assert.strictEqual(options.agent.options.keepAliveMsecs, 2000); @@ -235,6 +231,7 @@ describe('OTLPLogExporter - node with proto over http', () => { done(); return fakeRequest as any; }); + collectorExporter.export(logs, () => {}); }); it('should successfully send the logs', done => { @@ -271,28 +268,21 @@ describe('OTLPLogExporter - node with proto over http', () => { // Need to stub/spy on the underlying logger as the "diag" instance is global const spyLoggerError = sinon.stub(diag, 'error'); - collectorExporter.export(logs, result => { - assert.strictEqual(result.code, ExportResultCode.SUCCESS); - assert.strictEqual(spyLoggerError.args.length, 0); - done(); - }); - sinon.stub(http, 'request').callsFake((options: any, cb: any) => { const mockRes = new MockedResponse(200); cb(mockRes); mockRes.send('success'); return fakeRequest as any; }); - }); - it('should log the error message', done => { collectorExporter.export(logs, result => { - assert.strictEqual(result.code, ExportResultCode.FAILED); - // @ts-expect-error verify error code - assert.strictEqual(result.error.code, 400); + assert.strictEqual(result.code, ExportResultCode.SUCCESS); + assert.strictEqual(spyLoggerError.args.length, 0); done(); }); + }); + it('should log the error message', done => { sinon.stub(http, 'request').callsFake((options: any, cb: any) => { const mockResError = new MockedResponse(400); cb(mockResError); @@ -300,6 +290,13 @@ describe('OTLPLogExporter - node with proto over http', () => { return fakeRequest as any; }); + + collectorExporter.export(logs, result => { + assert.strictEqual(result.code, ExportResultCode.FAILED); + // @ts-expect-error verify error code + assert.strictEqual(result.error.code, 400); + done(); + }); }); }); describe('export - with compression', () => { diff --git a/experimental/packages/exporter-trace-otlp-http/src/platform/node/OTLPTraceExporter.ts b/experimental/packages/exporter-trace-otlp-http/src/platform/node/OTLPTraceExporter.ts index aeb3b94ca7..b829ee76fd 100644 --- a/experimental/packages/exporter-trace-otlp-http/src/platform/node/OTLPTraceExporter.ts +++ b/experimental/packages/exporter-trace-otlp-http/src/platform/node/OTLPTraceExporter.ts @@ -23,10 +23,11 @@ import { appendRootPathToUrlIfNeeded, } from '@opentelemetry/otlp-exporter-base'; import { - createExportTraceServiceRequest, IExportTraceServiceRequest, + IExportTraceServiceResponse, } from '@opentelemetry/otlp-transformer'; import { VERSION } from '../../version'; +import { JsonTraceSerializer } from '@opentelemetry/otlp-transformer'; const DEFAULT_COLLECTOR_RESOURCE_PATH = 'v1/traces'; const DEFAULT_COLLECTOR_URL = `http://localhost:4318/${DEFAULT_COLLECTOR_RESOURCE_PATH}`; @@ -38,11 +39,15 @@ const USER_AGENT = { * Collector Trace Exporter for Node */ export class OTLPTraceExporter - extends OTLPExporterNodeBase + extends OTLPExporterNodeBase< + ReadableSpan, + IExportTraceServiceRequest, + IExportTraceServiceResponse + > implements SpanExporter { constructor(config: OTLPExporterNodeConfigBase = {}) { - super(config); + super(config, JsonTraceSerializer, 'application/json'); this.headers = { ...this.headers, ...USER_AGENT, @@ -53,13 +58,6 @@ export class OTLPTraceExporter }; } - convert(spans: ReadableSpan[]): IExportTraceServiceRequest { - return createExportTraceServiceRequest(spans, { - useHex: true, - useLongBits: false, - }); - } - getDefaultUrl(config: OTLPExporterNodeConfigBase): string { return typeof config.url === 'string' ? config.url diff --git a/experimental/packages/exporter-trace-otlp-proto/src/platform/node/OTLPTraceExporter.ts b/experimental/packages/exporter-trace-otlp-proto/src/platform/node/OTLPTraceExporter.ts index be115583cd..8a0d222ae7 100644 --- a/experimental/packages/exporter-trace-otlp-proto/src/platform/node/OTLPTraceExporter.ts +++ b/experimental/packages/exporter-trace-otlp-proto/src/platform/node/OTLPTraceExporter.ts @@ -20,14 +20,13 @@ import { OTLPExporterNodeConfigBase, appendResourcePathToUrl, appendRootPathToUrlIfNeeded, + OTLPExporterNodeBase, } from '@opentelemetry/otlp-exporter-base'; +import { ServiceClientType } from '@opentelemetry/otlp-proto-exporter-base'; import { - OTLPProtoExporterNodeBase, - ServiceClientType, -} from '@opentelemetry/otlp-proto-exporter-base'; -import { - createExportTraceServiceRequest, IExportTraceServiceRequest, + IExportTraceServiceResponse, + ProtobufTraceSerializer, } from '@opentelemetry/otlp-transformer'; import { VERSION } from '../../version'; @@ -41,11 +40,15 @@ const USER_AGENT = { * Collector Trace Exporter for Node with protobuf */ export class OTLPTraceExporter - extends OTLPProtoExporterNodeBase + extends OTLPExporterNodeBase< + ReadableSpan, + IExportTraceServiceRequest, + IExportTraceServiceResponse + > implements SpanExporter { constructor(config: OTLPExporterNodeConfigBase = {}) { - super(config); + super(config, ProtobufTraceSerializer, 'application/x-protobuf'); this.headers = { ...this.headers, ...USER_AGENT, @@ -56,10 +59,6 @@ export class OTLPTraceExporter }; } - convert(spans: ReadableSpan[]): IExportTraceServiceRequest { - return createExportTraceServiceRequest(spans); - } - getDefaultUrl(config: OTLPExporterNodeConfigBase) { return typeof config.url === 'string' ? config.url diff --git a/experimental/packages/exporter-trace-otlp-proto/test/node/OTLPTraceExporter.test.ts b/experimental/packages/exporter-trace-otlp-proto/test/node/OTLPTraceExporter.test.ts index b18c5a39de..7dfbb101fe 100644 --- a/experimental/packages/exporter-trace-otlp-proto/test/node/OTLPTraceExporter.test.ts +++ b/experimental/packages/exporter-trace-otlp-proto/test/node/OTLPTraceExporter.test.ts @@ -197,8 +197,6 @@ describe('OTLPTraceExporter - node with proto over http', () => { }); it('should open the connection', done => { - collectorExporter.export(spans, () => {}); - sinon.stub(http, 'request').callsFake((options: any, cb: any) => { assert.strictEqual(options.hostname, 'foo.bar.com'); assert.strictEqual(options.method, 'POST'); @@ -210,11 +208,11 @@ describe('OTLPTraceExporter - node with proto over http', () => { done(); return fakeRequest as any; }); - }); - it('should set custom headers', done => { collectorExporter.export(spans, () => {}); + }); + it('should set custom headers', done => { sinon.stub(http, 'request').callsFake((options: any, cb: any) => { assert.strictEqual(options.headers['foo'], 'bar'); @@ -224,11 +222,11 @@ describe('OTLPTraceExporter - node with proto over http', () => { done(); return fakeRequest as any; }); - }); - it('should have keep alive and keepAliveMsecs option set', done => { collectorExporter.export(spans, () => {}); + }); + it('should have keep alive and keepAliveMsecs option set', done => { sinon.stub(http, 'request').callsFake((options: any, cb: any) => { assert.strictEqual(options.agent.keepAlive, true); assert.strictEqual(options.agent.options.keepAliveMsecs, 2000); @@ -239,6 +237,8 @@ describe('OTLPTraceExporter - node with proto over http', () => { done(); return fakeRequest as any; }); + + collectorExporter.export(spans, () => {}); }); it('should successfully send the spans', done => { @@ -275,28 +275,21 @@ describe('OTLPTraceExporter - node with proto over http', () => { // Need to stub/spy on the underlying logger as the "diag" instance is global const spyLoggerError = sinon.stub(diag, 'error'); - collectorExporter.export(spans, result => { - assert.strictEqual(result.code, ExportResultCode.SUCCESS); - assert.strictEqual(spyLoggerError.args.length, 0); - done(); - }); - sinon.stub(http, 'request').callsFake((options: any, cb: any) => { const mockRes = new MockedResponse(200); cb(mockRes); mockRes.send('success'); return fakeRequest as any; }); - }); - it('should log the error message', done => { collectorExporter.export(spans, result => { - assert.strictEqual(result.code, ExportResultCode.FAILED); - // @ts-expect-error verify error code - assert.strictEqual(result.error.code, 400); + assert.strictEqual(result.code, ExportResultCode.SUCCESS); + assert.strictEqual(spyLoggerError.args.length, 0); done(); }); + }); + it('should log the error message', done => { sinon.stub(http, 'request').callsFake((options: any, cb: any) => { const mockResError = new MockedResponse(400); cb(mockResError); @@ -304,6 +297,13 @@ describe('OTLPTraceExporter - node with proto over http', () => { return fakeRequest as any; }); + + collectorExporter.export(spans, result => { + assert.strictEqual(result.code, ExportResultCode.FAILED); + // @ts-expect-error verify error code + assert.strictEqual(result.error.code, 400); + done(); + }); }); }); describe('export - with compression', () => { diff --git a/experimental/packages/opentelemetry-exporter-metrics-otlp-http/src/platform/node/OTLPMetricExporter.ts b/experimental/packages/opentelemetry-exporter-metrics-otlp-http/src/platform/node/OTLPMetricExporter.ts index cd648ce875..f52fe8583e 100644 --- a/experimental/packages/opentelemetry-exporter-metrics-otlp-http/src/platform/node/OTLPMetricExporter.ts +++ b/experimental/packages/opentelemetry-exporter-metrics-otlp-http/src/platform/node/OTLPMetricExporter.ts @@ -25,8 +25,9 @@ import { appendRootPathToUrlIfNeeded, } from '@opentelemetry/otlp-exporter-base'; import { - createExportMetricsServiceRequest, IExportMetricsServiceRequest, + IExportMetricsServiceResponse, + JsonMetricsSerializer, } from '@opentelemetry/otlp-transformer'; import { VERSION } from '../../version'; @@ -38,10 +39,11 @@ const USER_AGENT = { class OTLPExporterNodeProxy extends OTLPExporterNodeBase< ResourceMetrics, - IExportMetricsServiceRequest + IExportMetricsServiceRequest, + IExportMetricsServiceResponse > { constructor(config?: OTLPExporterNodeConfigBase & OTLPMetricExporterOptions) { - super(config); + super(config, JsonMetricsSerializer, 'application/json'); this.headers = { ...this.headers, ...USER_AGENT, @@ -52,10 +54,6 @@ class OTLPExporterNodeProxy extends OTLPExporterNodeBase< }; } - convert(metrics: ResourceMetrics[]): IExportMetricsServiceRequest { - return createExportMetricsServiceRequest(metrics, { useLongBits: false }); - } - getDefaultUrl(config: OTLPExporterNodeConfigBase): string { return typeof config.url === 'string' ? config.url diff --git a/experimental/packages/opentelemetry-exporter-metrics-otlp-proto/src/OTLPMetricExporter.ts b/experimental/packages/opentelemetry-exporter-metrics-otlp-proto/src/OTLPMetricExporter.ts index 52c9991e30..fceac9d95a 100644 --- a/experimental/packages/opentelemetry-exporter-metrics-otlp-proto/src/OTLPMetricExporter.ts +++ b/experimental/packages/opentelemetry-exporter-metrics-otlp-proto/src/OTLPMetricExporter.ts @@ -15,10 +15,7 @@ */ import { OTLPMetricExporterOptions } from '@opentelemetry/exporter-metrics-otlp-http'; -import { - ServiceClientType, - OTLPProtoExporterNodeBase, -} from '@opentelemetry/otlp-proto-exporter-base'; +import { ServiceClientType } from '@opentelemetry/otlp-proto-exporter-base'; import { getEnv, baggageUtils } from '@opentelemetry/core'; import { ResourceMetrics } from '@opentelemetry/sdk-metrics'; import { OTLPMetricExporterBase } from '@opentelemetry/exporter-metrics-otlp-http'; @@ -26,10 +23,12 @@ import { OTLPExporterNodeConfigBase, appendResourcePathToUrl, appendRootPathToUrlIfNeeded, + OTLPExporterNodeBase, } from '@opentelemetry/otlp-exporter-base'; import { - createExportMetricsServiceRequest, IExportMetricsServiceRequest, + IExportMetricsServiceResponse, + ProtobufMetricsSerializer, } from '@opentelemetry/otlp-transformer'; import { VERSION } from './version'; @@ -39,12 +38,13 @@ const USER_AGENT = { 'User-Agent': `OTel-OTLP-Exporter-JavaScript/${VERSION}`, }; -class OTLPMetricExporterNodeProxy extends OTLPProtoExporterNodeBase< +class OTLPMetricExporterNodeProxy extends OTLPExporterNodeBase< ResourceMetrics, - IExportMetricsServiceRequest + IExportMetricsServiceRequest, + IExportMetricsServiceResponse > { constructor(config?: OTLPExporterNodeConfigBase & OTLPMetricExporterOptions) { - super(config); + super(config, ProtobufMetricsSerializer, 'application/x-protobuf'); this.headers = { ...this.headers, ...USER_AGENT, @@ -55,10 +55,6 @@ class OTLPMetricExporterNodeProxy extends OTLPProtoExporterNodeBase< }; } - convert(metrics: ResourceMetrics[]): IExportMetricsServiceRequest { - return createExportMetricsServiceRequest(metrics); - } - getDefaultUrl(config: OTLPExporterNodeConfigBase) { return typeof config.url === 'string' ? config.url diff --git a/experimental/packages/opentelemetry-exporter-metrics-otlp-proto/test/OTLPMetricExporter.test.ts b/experimental/packages/opentelemetry-exporter-metrics-otlp-proto/test/OTLPMetricExporter.test.ts index 51c175f8e6..8398b2a3f7 100644 --- a/experimental/packages/opentelemetry-exporter-metrics-otlp-proto/test/OTLPMetricExporter.test.ts +++ b/experimental/packages/opentelemetry-exporter-metrics-otlp-proto/test/OTLPMetricExporter.test.ts @@ -228,8 +228,6 @@ describe('OTLPMetricExporter - node with proto over http', () => { }); it('should open the connection', done => { - collectorExporter.export(metrics, () => {}); - sinon.stub(http, 'request').callsFake((options: any, cb: any) => { assert.strictEqual(options.hostname, 'foo.bar.com'); assert.strictEqual(options.method, 'POST'); @@ -241,11 +239,11 @@ describe('OTLPMetricExporter - node with proto over http', () => { done(); return fakeRequest as any; }); - }); - it('should set custom headers', done => { collectorExporter.export(metrics, () => {}); + }); + it('should set custom headers', done => { sinon.stub(http, 'request').callsFake((options: any, cb: any) => { assert.strictEqual(options.headers['foo'], 'bar'); @@ -256,11 +254,11 @@ describe('OTLPMetricExporter - node with proto over http', () => { done(); return fakeRequest as any; }); - }); - it('should have keep alive and keepAliveMsecs option set', done => { collectorExporter.export(metrics, () => {}); + }); + it('should have keep alive and keepAliveMsecs option set', done => { sinon.stub(http, 'request').callsFake((options: any, cb: any) => { assert.strictEqual(options.agent.keepAlive, true); assert.strictEqual(options.agent.options.keepAliveMsecs, 2000); @@ -272,6 +270,8 @@ describe('OTLPMetricExporter - node with proto over http', () => { done(); return fakeRequest as any; }); + + collectorExporter.export(metrics, () => {}); }); it('should successfully send metrics', done => { @@ -353,28 +353,21 @@ describe('OTLPMetricExporter - node with proto over http', () => { // Need to stub/spy on the underlying logger as the "diag" instance is global const spyLoggerError = sinon.stub(diag, 'error'); - collectorExporter.export(metrics, result => { - assert.strictEqual(result.code, ExportResultCode.SUCCESS); - assert.strictEqual(spyLoggerError.args.length, 0); - done(); - }); - sinon.stub(http, 'request').callsFake((options: any, cb: any) => { const mockRes = new MockedResponse(200); cb(mockRes); mockRes.send('success'); return fakeRequest as any; }); - }); - it('should log the error message', done => { collectorExporter.export(metrics, result => { - assert.strictEqual(result.code, ExportResultCode.FAILED); - // @ts-expect-error verify error code - assert.strictEqual(result.error.code, 400); + assert.strictEqual(result.code, ExportResultCode.SUCCESS); + assert.strictEqual(spyLoggerError.args.length, 0); done(); }); + }); + it('should log the error message', done => { sinon.stub(http, 'request').callsFake((options: any, cb: any) => { const mockResError = new MockedResponse(400); cb(mockResError); @@ -382,6 +375,13 @@ describe('OTLPMetricExporter - node with proto over http', () => { return fakeRequest as any; }); + + collectorExporter.export(metrics, result => { + assert.strictEqual(result.code, ExportResultCode.FAILED); + // @ts-expect-error verify error code + assert.strictEqual(result.error.code, 400); + done(); + }); }); }); }); diff --git a/experimental/packages/otlp-exporter-base/src/platform/node/OTLPExporterNodeBase.ts b/experimental/packages/otlp-exporter-base/src/platform/node/OTLPExporterNodeBase.ts index 5a8b1dfdfa..c4b13e8218 100644 --- a/experimental/packages/otlp-exporter-base/src/platform/node/OTLPExporterNodeBase.ts +++ b/experimental/packages/otlp-exporter-base/src/platform/node/OTLPExporterNodeBase.ts @@ -24,6 +24,7 @@ import { parseHeaders } from '../../util'; import { createHttpAgent, sendWithHttp, configureCompression } from './util'; import { diag } from '@opentelemetry/api'; import { getEnv, baggageUtils } from '@opentelemetry/core'; +import { ISerializer } from '@opentelemetry/otlp-transformer'; /** * Collector Metric Exporter abstract base class @@ -31,6 +32,7 @@ import { getEnv, baggageUtils } from '@opentelemetry/core'; export abstract class OTLPExporterNodeBase< ExportItem, ServiceRequest, + ServiceResponse, > extends OTLPExporterBase< OTLPExporterNodeConfigBase, ExportItem, @@ -40,9 +42,16 @@ export abstract class OTLPExporterNodeBase< headers: Record; agent: http.Agent | https.Agent | undefined; compression: CompressionAlgorithm; + private _serializer: ISerializer; + private _contentType: string; - constructor(config: OTLPExporterNodeConfigBase = {}) { + constructor( + config: OTLPExporterNodeConfigBase = {}, + serializer: ISerializer, + contentType: string + ) { super(config); + this._contentType = contentType; // eslint-disable-next-line @typescript-eslint/no-explicit-any if ((config as any).metadata) { diag.warn('Metadata cannot be set when using http'); @@ -54,10 +63,16 @@ export abstract class OTLPExporterNodeBase< ); this.agent = createHttpAgent(config); this.compression = configureCompression(config.compression); + this._serializer = serializer; } onInit(_config: OTLPExporterNodeConfigBase): void {} + override convert(_objects: ExportItem[]): ServiceRequest { + // TODO(pichlermarc): needs to be removed from base in a follow-up + return {} as ServiceRequest; + } + send( objects: ExportItem[], onSuccess: () => void, @@ -67,13 +82,12 @@ export abstract class OTLPExporterNodeBase< diag.debug('Shutdown already started. Cannot send objects'); return; } - const serviceRequest = this.convert(objects); const promise = new Promise((resolve, reject) => { sendWithHttp( this, - JSON.stringify(serviceRequest), - 'application/json', + this._serializer.serializeRequest(objects) ?? new Uint8Array(), + this._contentType, resolve, reject ); diff --git a/experimental/packages/otlp-exporter-base/src/platform/node/util.ts b/experimental/packages/otlp-exporter-base/src/platform/node/util.ts index fd40981e85..a42c95b110 100644 --- a/experimental/packages/otlp-exporter-base/src/platform/node/util.ts +++ b/experimental/packages/otlp-exporter-base/src/platform/node/util.ts @@ -41,9 +41,9 @@ import { * @param onSuccess * @param onError */ -export function sendWithHttp( - collector: OTLPExporterNodeBase, - data: string | Buffer, +export function sendWithHttp( + collector: OTLPExporterNodeBase, + data: string | Uint8Array, contentType: string, onSuccess: () => void, onError: (error: OTLPExporterError) => void @@ -165,7 +165,7 @@ export function sendWithHttp( switch (collector.compression) { case CompressionAlgorithm.GZIP: { req.setHeader('Content-Encoding', 'gzip'); - const dataStream = readableFromBuffer(data); + const dataStream = readableFromUnit8Array(data); dataStream .on('error', onError) .pipe(zlib.createGzip()) @@ -175,14 +175,14 @@ export function sendWithHttp( break; } default: - req.end(data); + req.end(Buffer.from(data)); break; } }; sendWithRetry(); } -function readableFromBuffer(buff: string | Buffer): Readable { +function readableFromUnit8Array(buff: string | Uint8Array): Readable { const readable = new Readable(); readable.push(buff); readable.push(null); diff --git a/experimental/packages/otlp-exporter-base/test/node/util.test.ts b/experimental/packages/otlp-exporter-base/test/node/util.test.ts index b279e57b9a..39c2321349 100644 --- a/experimental/packages/otlp-exporter-base/test/node/util.test.ts +++ b/experimental/packages/otlp-exporter-base/test/node/util.test.ts @@ -28,6 +28,7 @@ import { OTLPExporterError } from '../../src/types'; import { PassThrough } from 'stream'; import * as http from 'http'; import * as zlib from 'zlib'; +import { ISerializer } from '@opentelemetry/otlp-transformer'; // Meant to simulate http.IncomingMessage, at least the parts that sendWithHttp cares about // but make it a PassThrough so we can inspect it for the test @@ -50,19 +51,24 @@ class HttpRequest extends PassThrough { // Barebones exporter for use by sendWithHttp type ExporterConfig = OTLPExporterNodeConfigBase; -class Exporter extends OTLPExporterNodeBase { +class Exporter extends OTLPExporterNodeBase { getDefaultUrl(config: ExporterConfig): string { return config.url || ''; } +} - convert(spans: object[]): object { +const noopSerializer: ISerializer = { + serializeRequest(request: object): Uint8Array | undefined { + return new Uint8Array(); + }, + deserializeResponse(data: Uint8Array): object { return {}; - } -} + }, +}; describe('force flush', () => { it('forceFlush should flush spans and return', async () => { - const exporter = new Exporter({}); + const exporter = new Exporter({}, noopSerializer, ''); await exporter.forceFlush(); }); }); @@ -219,10 +225,14 @@ describe('sendWithHttp', () => { }); it('should send with no compression if configured to do so', () => { - exporter = new Exporter({ - url: 'http://foobar.com', - compression: CompressionAlgorithm.NONE, - }); + exporter = new Exporter( + { + url: 'http://foobar.com', + compression: CompressionAlgorithm.NONE, + }, + noopSerializer, + '' + ); const data = JSON.stringify(spanData); // Show that data is written to the request stream @@ -252,10 +262,14 @@ describe('sendWithHttp', () => { }); it('should send with gzip compression if configured to do so', () => { - exporter = new Exporter({ - url: 'http://foobar.com', - compression: CompressionAlgorithm.GZIP, - }); + exporter = new Exporter( + { + url: 'http://foobar.com', + compression: CompressionAlgorithm.GZIP, + }, + noopSerializer, + '' + ); const data = JSON.stringify(spanData); const compressedData = zlib.gzipSync(Buffer.from(data)); @@ -287,10 +301,14 @@ describe('sendWithHttp', () => { }); it('should work with gzip compression enabled even after multiple requests', () => { - exporter = new Exporter({ - url: 'http://foobar.com', - compression: CompressionAlgorithm.GZIP, - }); + exporter = new Exporter( + { + url: 'http://foobar.com', + compression: CompressionAlgorithm.GZIP, + }, + noopSerializer, + '' + ); const data = JSON.stringify(spanData); const compressedData = zlib.gzipSync(Buffer.from(data)); diff --git a/experimental/packages/otlp-proto-exporter-base/src/platform/index.ts b/experimental/packages/otlp-proto-exporter-base/src/platform/index.ts index fc344756ea..f6ead82b84 100644 --- a/experimental/packages/otlp-proto-exporter-base/src/platform/index.ts +++ b/experimental/packages/otlp-proto-exporter-base/src/platform/index.ts @@ -14,7 +14,6 @@ * limitations under the License. */ -export { OTLPProtoExporterNodeBase, send } from './node'; export { OTLPProtoExporterBrowserBase } from './browser'; export { ServiceClientType } from './types'; export { ExportRequestType, getExportRequestProto } from './util'; diff --git a/experimental/packages/otlp-proto-exporter-base/src/platform/node/OTLPProtoExporterNodeBase.ts b/experimental/packages/otlp-proto-exporter-base/src/platform/node/OTLPProtoExporterNodeBase.ts deleted file mode 100644 index 17804c47b4..0000000000 --- a/experimental/packages/otlp-proto-exporter-base/src/platform/node/OTLPProtoExporterNodeBase.ts +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import { diag } from '@opentelemetry/api'; -import { ServiceClientType } from '../types'; -import { - OTLPExporterNodeBase as OTLPExporterBaseMain, - CompressionAlgorithm, - OTLPExporterError, - OTLPExporterNodeConfigBase, -} from '@opentelemetry/otlp-exporter-base'; - -type SendFn = ( - collector: OTLPProtoExporterNodeBase, - objects: ExportItem[], - compression: CompressionAlgorithm, - onSuccess: () => void, - onError: (error: OTLPExporterError) => void -) => void; - -/** - * Collector Exporter abstract base class - */ -export abstract class OTLPProtoExporterNodeBase< - ExportItem, - ServiceRequest, -> extends OTLPExporterBaseMain { - private _send!: SendFn; - - constructor(config: OTLPExporterNodeConfigBase = {}) { - super(config); - } - - private _sendPromise( - objects: ExportItem[], - onSuccess: () => void, - onError: (error: OTLPExporterError) => void - ): void { - const promise = new Promise((resolve, reject) => { - this._send(this, objects, this.compression, resolve, reject); - }).then(onSuccess, onError); - - this._sendingPromises.push(promise); - const popPromise = () => { - const index = this._sendingPromises.indexOf(promise); - this._sendingPromises.splice(index, 1); - }; - promise.then(popPromise, popPromise); - } - - override send( - objects: ExportItem[], - onSuccess: () => void, - onError: (error: OTLPExporterError) => void - ): void { - if (this._shutdownOnce.isCalled) { - diag.debug('Shutdown already started. Cannot send objects'); - return; - } - if (!this._send) { - // defer to next tick and lazy load to avoid loading protobufjs too early - // and making this impossible to be instrumented - setImmediate(() => { - // eslint-disable-next-line @typescript-eslint/no-var-requires - const { send } = require('./util'); - this._send = send; - this._sendPromise(objects, onSuccess, onError); - }); - } else { - this._sendPromise(objects, onSuccess, onError); - } - } - - abstract getServiceClientType(): ServiceClientType; -} diff --git a/experimental/packages/otlp-proto-exporter-base/src/platform/node/index.ts b/experimental/packages/otlp-proto-exporter-base/src/platform/node/index.ts deleted file mode 100644 index 08016fec93..0000000000 --- a/experimental/packages/otlp-proto-exporter-base/src/platform/node/index.ts +++ /dev/null @@ -1,18 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -export { OTLPProtoExporterNodeBase } from './OTLPProtoExporterNodeBase'; -export { send } from './util'; diff --git a/experimental/packages/otlp-proto-exporter-base/src/platform/node/util.ts b/experimental/packages/otlp-proto-exporter-base/src/platform/node/util.ts deleted file mode 100644 index 36fe866d67..0000000000 --- a/experimental/packages/otlp-proto-exporter-base/src/platform/node/util.ts +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import { OTLPProtoExporterNodeBase } from './OTLPProtoExporterNodeBase'; -import { - CompressionAlgorithm, - OTLPExporterError, - sendWithHttp, -} from '@opentelemetry/otlp-exporter-base'; - -import { getExportRequestProto } from '../util'; - -export function send( - collector: OTLPProtoExporterNodeBase, - objects: ExportItem[], - compression: CompressionAlgorithm, - onSuccess: () => void, - onError: (error: OTLPExporterError) => void -): void { - const serviceRequest = collector.convert(objects); - - const exportRequestType = getExportRequestProto( - collector.getServiceClientType() - ); - const message = exportRequestType.create(serviceRequest); - if (message) { - const body = exportRequestType.encode(message).finish(); - if (body) { - sendWithHttp( - collector, - Buffer.from(body), - 'application/x-protobuf', - onSuccess, - onError - ); - } - } else { - onError(new OTLPExporterError('No proto')); - } -} diff --git a/experimental/packages/otlp-transformer/src/index.ts b/experimental/packages/otlp-transformer/src/index.ts index 6f7ca0009a..66040a07c0 100644 --- a/experimental/packages/otlp-transformer/src/index.ts +++ b/experimental/packages/otlp-transformer/src/index.ts @@ -31,4 +31,10 @@ export { ProtobufTraceSerializer, } from './protobuf/serializers'; +export { + JsonTraceSerializer, + JsonLogsSerializer, + JsonMetricsSerializer, +} from './json/serializers'; + export { ISerializer } from './common/i-serializer'; From 76c4667b3fe09bfad4c3715d5b9e2653d4950e3a Mon Sep 17 00:00:00 2001 From: Marc Pichler Date: Fri, 15 Mar 2024 17:00:40 +0100 Subject: [PATCH 03/14] test(otlp-transformer): add tests for trace serializer --- .../otlp-transformer/src/json/serializers.ts | 18 +- .../otlp-transformer/test/trace.test.ts | 313 +++++++++++++++--- 2 files changed, 267 insertions(+), 64 deletions(-) diff --git a/experimental/packages/otlp-transformer/src/json/serializers.ts b/experimental/packages/otlp-transformer/src/json/serializers.ts index fe78aeedfc..45c42fc81d 100644 --- a/experimental/packages/otlp-transformer/src/json/serializers.ts +++ b/experimental/packages/otlp-transformer/src/json/serializers.ts @@ -36,9 +36,9 @@ export const JsonTraceSerializer: ISerializer< const encoder = new TextEncoder(); return encoder.encode(JSON.stringify(request)); }, - deserializeResponse: (_arg: Uint8Array) => { - // Not yet implemented - return {}; + deserializeResponse: (arg: Uint8Array) => { + const decoder = new TextDecoder(); + return JSON.parse(decoder.decode(arg)) as IExportTraceServiceResponse; }, }; @@ -54,9 +54,9 @@ export const JsonMetricsSerializer: ISerializer< const encoder = new TextEncoder(); return encoder.encode(JSON.stringify(request)); }, - deserializeResponse: (_arg: Uint8Array) => { - // Not yet implemented - return {}; + deserializeResponse: (arg: Uint8Array) => { + const decoder = new TextDecoder(); + return JSON.parse(decoder.decode(arg)) as IExportMetricsServiceResponse; }, }; @@ -72,8 +72,8 @@ export const JsonLogsSerializer: ISerializer< const encoder = new TextEncoder(); return encoder.encode(JSON.stringify(request)); }, - deserializeResponse: (_arg: Uint8Array) => { - // Not yet implemented - return {}; + deserializeResponse: (arg: Uint8Array) => { + const decoder = new TextDecoder(); + return JSON.parse(decoder.decode(arg)) as IExportLogsServiceResponse; }, }; diff --git a/experimental/packages/otlp-transformer/test/trace.test.ts b/experimental/packages/otlp-transformer/test/trace.test.ts index 65b23ddc2d..b2ecc767a8 100644 --- a/experimental/packages/otlp-transformer/test/trace.test.ts +++ b/experimental/packages/otlp-transformer/test/trace.test.ts @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +import * as root from '../src/generated/root'; import { SpanKind, SpanStatusCode, TraceFlags } from '@opentelemetry/api'; import { TraceState, hexToBinary } from '@opentelemetry/core'; import { Resource } from '@opentelemetry/resources'; @@ -23,6 +24,8 @@ import { createExportTraceServiceRequest, ESpanKind, EStatusCode, + ProtobufTraceSerializer, + JsonTraceSerializer, } from '../src'; function createExpectedSpanJson(options: OtlpEncodingOptions) { @@ -133,69 +136,173 @@ function createExpectedSpanJson(options: OtlpEncodingOptions) { }; } -describe('Trace', () => { - describe('createExportTraceServiceRequest', () => { - let resource: Resource; - let span: ReadableSpan; +/** + * utility function to convert a string representing a hex value to a base64 string + * that represents the bytes of that hex value. This is needed as we need to support Node.js 14 + * where btoa() does not exist, and the Browser, where Buffer does not exist. + * @param hexStr + */ +function toBase64(hexStr: string) { + if (typeof btoa !== 'undefined') { + const decoder = new TextDecoder('utf8'); + return btoa(decoder.decode(hexToBinary(hexStr))); + } - beforeEach(() => { - resource = new Resource({ - 'resource-attribute': 'resource attribute value', - }); - span = { - spanContext: () => ({ - spanId: '0000000000000002', - traceFlags: TraceFlags.SAMPLED, - traceId: '00000000000000000000000000000001', - isRemote: false, - traceState: new TraceState('span=bar'), - }), - parentSpanId: '0000000000000001', - attributes: { 'string-attribute': 'some attribute value' }, - duration: [1, 300000000], - endTime: [1640715558, 642725388], - ended: true, - events: [ - { - name: 'some event', - time: [1640715558, 542725388], - attributes: { - 'event-attribute': 'some string value', + return Buffer.from(hexToBinary(hexStr)).toString('base64'); +} + +function createExpectedSpanProtobuf() { + const startTime = 1640715557342725400; + const endTime = 1640715558642725400; + const eventTime = 1640715558542725400; + + const traceId = toBase64('00000000000000000000000000000001'); + const spanId = toBase64('0000000000000002'); + const parentSpanId = toBase64('0000000000000001'); + const linkSpanId = toBase64('0000000000000003'); + const linkTraceId = toBase64('00000000000000000000000000000002'); + + return { + resourceSpans: [ + { + resource: { + attributes: [ + { + key: 'resource-attribute', + value: { stringValue: 'resource attribute value' }, }, - }, - ], - instrumentationLibrary: { - name: 'myLib', - version: '0.1.0', - schemaUrl: 'http://url.to.schema', + ], + droppedAttributesCount: 0, }, - kind: SpanKind.CLIENT, - links: [ + scopeSpans: [ { - context: { - spanId: '0000000000000003', - traceId: '00000000000000000000000000000002', - traceFlags: TraceFlags.SAMPLED, - isRemote: false, - traceState: new TraceState('link=foo'), - }, - attributes: { - 'link-attribute': 'string value', - }, + scope: { name: 'myLib', version: '0.1.0' }, + spans: [ + { + traceId: traceId, + spanId: spanId, + traceState: 'span=bar', + parentSpanId: parentSpanId, + name: 'span-name', + kind: ESpanKind.SPAN_KIND_CLIENT, + links: [ + { + droppedAttributesCount: 0, + spanId: linkSpanId, + traceId: linkTraceId, + traceState: 'link=foo', + attributes: [ + { + key: 'link-attribute', + value: { + stringValue: 'string value', + }, + }, + ], + }, + ], + startTimeUnixNano: startTime, + endTimeUnixNano: endTime, + events: [ + { + droppedAttributesCount: 0, + attributes: [ + { + key: 'event-attribute', + value: { + stringValue: 'some string value', + }, + }, + ], + name: 'some event', + timeUnixNano: eventTime, + }, + ], + attributes: [ + { + key: 'string-attribute', + value: { stringValue: 'some attribute value' }, + }, + ], + droppedAttributesCount: 0, + droppedEventsCount: 0, + droppedLinksCount: 0, + status: { + code: EStatusCode.STATUS_CODE_OK, + }, + }, + ], + schemaUrl: 'http://url.to.schema', }, ], - name: 'span-name', - resource, - startTime: [1640715557, 342725388], - status: { - code: SpanStatusCode.OK, - }, - droppedAttributesCount: 0, - droppedEventsCount: 0, - droppedLinksCount: 0, - }; + }, + ], + }; +} + +describe('Trace', () => { + let resource: Resource; + let span: ReadableSpan; + + beforeEach(() => { + resource = new Resource({ + 'resource-attribute': 'resource attribute value', }); + span = { + spanContext: () => ({ + spanId: '0000000000000002', + traceFlags: TraceFlags.SAMPLED, + traceId: '00000000000000000000000000000001', + isRemote: false, + traceState: new TraceState('span=bar'), + }), + parentSpanId: '0000000000000001', + attributes: { 'string-attribute': 'some attribute value' }, + duration: [1, 300000000], + endTime: [1640715558, 642725388], + ended: true, + events: [ + { + name: 'some event', + time: [1640715558, 542725388], + attributes: { + 'event-attribute': 'some string value', + }, + }, + ], + instrumentationLibrary: { + name: 'myLib', + version: '0.1.0', + schemaUrl: 'http://url.to.schema', + }, + kind: SpanKind.CLIENT, + links: [ + { + context: { + spanId: '0000000000000003', + traceId: '00000000000000000000000000000002', + traceFlags: TraceFlags.SAMPLED, + isRemote: false, + traceState: new TraceState('link=foo'), + }, + attributes: { + 'link-attribute': 'string value', + }, + }, + ], + name: 'span-name', + resource, + startTime: [1640715557, 342725388], + status: { + code: SpanStatusCode.OK, + }, + droppedAttributesCount: 0, + droppedEventsCount: 0, + droppedLinksCount: 0, + }; + }); + describe('createExportTraceServiceRequest', () => { it('returns null on an empty list', () => { assert.deepStrictEqual( createExportTraceServiceRequest([], { useHex: true }), @@ -343,4 +450,100 @@ describe('Trace', () => { }); }); }); + + describe('ProtobufTracesSerializer', function () { + it('serializes an export request', () => { + const serialized = ProtobufTraceSerializer.serializeRequest([span]); + assert.ok(serialized, 'serialized response is undefined'); + const decoded = + root.opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest.decode( + serialized + ); + + const expected = createExpectedSpanProtobuf(); + const decodedObj = + root.opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest.toObject( + decoded, + { + // This incurs some precision loss that's taken into account in createExpectedSpanProtobuf() + // Using String here will incur the same precision loss on browser only, using Number to prevent having to + // have different assertions for browser and Node.js + longs: Number, + // Convert to String (Base64) as otherwise the type will be different for Node.js (Buffer) and Browser (Uint8Array) + // and this fails assertions. + bytes: String, + } + ); + + assert.deepStrictEqual(decodedObj, expected); + }); + + it('deserializes a response', () => { + const protobufSerializedResponse = + root.opentelemetry.proto.collector.trace.v1.ExportTraceServiceResponse.encode( + { + partialSuccess: { + errorMessage: 'foo', + rejectedSpans: 1, + }, + } + ).finish(); + + const deserializedResponse = ProtobufTraceSerializer.deserializeResponse( + protobufSerializedResponse + ); + + assert.ok( + deserializedResponse.partialSuccess, + 'partialSuccess not present in the deserialized message' + ); + assert.equal(deserializedResponse.partialSuccess.errorMessage, 'foo'); + assert.equal( + Number(deserializedResponse.partialSuccess.rejectedSpans), + 1 + ); + }); + }); + + describe('JsonTracesSerializer', function () { + it('serializes an export request', () => { + // stringify, then parse to remove undefined keys in the expected JSON + const expected = JSON.parse( + JSON.stringify( + createExpectedSpanJson({ + useHex: true, + useLongBits: false, + }) + ) + ); + const serialized = JsonTraceSerializer.serializeRequest([span]); + + const decoder = new TextDecoder(); + assert.deepStrictEqual(JSON.parse(decoder.decode(serialized)), expected); + }); + + it('deserializes a response', () => { + const expectedResponse = { + partialSuccess: { + errorMessage: 'foo', + rejectedSpans: 1, + }, + }; + const encoder = new TextEncoder(); + const encodedResponse = encoder.encode(JSON.stringify(expectedResponse)); + + const deserializedResponse = + JsonTraceSerializer.deserializeResponse(encodedResponse); + + assert.ok( + deserializedResponse.partialSuccess, + 'partialSuccess not present in the deserialized message' + ); + assert.equal(deserializedResponse.partialSuccess.errorMessage, 'foo'); + assert.equal( + Number(deserializedResponse.partialSuccess.rejectedSpans), + 1 + ); + }); + }); }); From c14bc9b981253dca849b26b3f28f54785fb5cd42 Mon Sep 17 00:00:00 2001 From: Marc Pichler Date: Fri, 15 Mar 2024 17:44:23 +0100 Subject: [PATCH 04/14] test(otlp-transformer): add tests for metrics serializer --- .../otlp-transformer/test/metrics.test.ts | 698 +++++++++++------- 1 file changed, 430 insertions(+), 268 deletions(-) diff --git a/experimental/packages/otlp-transformer/test/metrics.test.ts b/experimental/packages/otlp-transformer/test/metrics.test.ts index 526458e658..54d67cde86 100644 --- a/experimental/packages/otlp-transformer/test/metrics.test.ts +++ b/experimental/packages/otlp-transformer/test/metrics.test.ts @@ -25,8 +25,14 @@ import { import * as assert from 'assert'; import { createExportMetricsServiceRequest } from '../src/metrics'; import { EAggregationTemporality } from '../src/metrics/types'; -import { hrTime } from '@opentelemetry/core'; -import { encodeAsLongBits } from '../src'; +import { hrTime, hrTimeToNanoseconds } from '@opentelemetry/core'; +import { + encodeAsString, + encodeAsLongBits, + ProtobufMetricsSerializer, + JsonMetricsSerializer, +} from '../src'; +import * as root from '../src/generated/root'; const START_TIME = hrTime(); const END_TIME = hrTime(); @@ -39,293 +45,293 @@ const ATTRIBUTES = { }; describe('Metrics', () => { - describe('createExportMetricsServiceRequest', () => { - const expectedResource = { - attributes: [ - { - key: 'resource-attribute', - value: { - stringValue: 'resource attribute value', - }, - }, - ], - droppedAttributesCount: 0, - }; - - const expectedScope = { - name: 'mylib', - version: '0.1.0', - }; - - const expectedSchemaUrl = 'http://url.to.schema'; - - const expectedAttributes = [ + const expectedResource = { + attributes: [ { - key: 'string-attribute', + key: 'resource-attribute', value: { - stringValue: 'some attribute value', + stringValue: 'resource attribute value', }, }, - { - key: 'int-attribute', - value: { - intValue: 1, - }, + ], + droppedAttributesCount: 0, + }; + + const expectedScope = { + name: 'mylib', + version: '0.1.0', + }; + + const expectedSchemaUrl = 'http://url.to.schema'; + + const expectedAttributes = [ + { + key: 'string-attribute', + value: { + stringValue: 'some attribute value', }, - { - key: 'double-attribute', - value: { - doubleValue: 1.1, - }, + }, + { + key: 'int-attribute', + value: { + intValue: 1, }, - { - key: 'boolean-attribute', - value: { - boolValue: true, - }, + }, + { + key: 'double-attribute', + value: { + doubleValue: 1.1, }, - { - key: 'array-attribute', - value: { - arrayValue: { - values: [ - { - stringValue: 'attribute value 1', - }, - { - stringValue: 'attribute value 2', - }, - ], - }, - }, + }, + { + key: 'boolean-attribute', + value: { + boolValue: true, }, - ]; - - function createCounterData( - value: number, - aggregationTemporality: AggregationTemporality - ): MetricData { - return { - descriptor: { - description: 'this is a description', - type: InstrumentType.COUNTER, - name: 'counter', - unit: '1', - valueType: ValueType.INT, + }, + { + key: 'array-attribute', + value: { + arrayValue: { + values: [ + { + stringValue: 'attribute value 1', + }, + { + stringValue: 'attribute value 2', + }, + ], }, - aggregationTemporality, - dataPointType: DataPointType.SUM, - isMonotonic: true, - dataPoints: [ - { - value: value, - startTime: START_TIME, - endTime: END_TIME, - attributes: ATTRIBUTES, - }, - ], - }; - } - - function createUpDownCounterData( - value: number, - aggregationTemporality: AggregationTemporality - ): MetricData { - return { - descriptor: { - description: 'this is a description', - type: InstrumentType.UP_DOWN_COUNTER, - name: 'up-down-counter', - unit: '1', - valueType: ValueType.INT, + }, + }, + ]; + + function createCounterData( + value: number, + aggregationTemporality: AggregationTemporality + ): MetricData { + return { + descriptor: { + description: 'this is a description', + type: InstrumentType.COUNTER, + name: 'counter', + unit: '1', + valueType: ValueType.INT, + }, + aggregationTemporality, + dataPointType: DataPointType.SUM, + isMonotonic: true, + dataPoints: [ + { + value: value, + startTime: START_TIME, + endTime: END_TIME, + attributes: ATTRIBUTES, }, - aggregationTemporality, - dataPointType: DataPointType.SUM, - isMonotonic: false, - dataPoints: [ - { - value: value, - startTime: START_TIME, - endTime: END_TIME, - attributes: ATTRIBUTES, - }, - ], - }; - } - - function createObservableCounterData( - value: number, - aggregationTemporality: AggregationTemporality - ): MetricData { - return { - descriptor: { - description: 'this is a description', - type: InstrumentType.OBSERVABLE_COUNTER, - name: 'observable-counter', - unit: '1', - valueType: ValueType.INT, + ], + }; + } + + function createUpDownCounterData( + value: number, + aggregationTemporality: AggregationTemporality + ): MetricData { + return { + descriptor: { + description: 'this is a description', + type: InstrumentType.UP_DOWN_COUNTER, + name: 'up-down-counter', + unit: '1', + valueType: ValueType.INT, + }, + aggregationTemporality, + dataPointType: DataPointType.SUM, + isMonotonic: false, + dataPoints: [ + { + value: value, + startTime: START_TIME, + endTime: END_TIME, + attributes: ATTRIBUTES, }, - aggregationTemporality, - dataPointType: DataPointType.SUM, - isMonotonic: true, - dataPoints: [ - { - value: value, - startTime: START_TIME, - endTime: END_TIME, - attributes: ATTRIBUTES, - }, - ], - }; - } - - function createObservableUpDownCounterData( - value: number, - aggregationTemporality: AggregationTemporality - ): MetricData { - return { - descriptor: { - description: 'this is a description', - type: InstrumentType.OBSERVABLE_UP_DOWN_COUNTER, - name: 'observable-up-down-counter', - unit: '1', - valueType: ValueType.INT, + ], + }; + } + + function createObservableCounterData( + value: number, + aggregationTemporality: AggregationTemporality + ): MetricData { + return { + descriptor: { + description: 'this is a description', + type: InstrumentType.OBSERVABLE_COUNTER, + name: 'observable-counter', + unit: '1', + valueType: ValueType.INT, + }, + aggregationTemporality, + dataPointType: DataPointType.SUM, + isMonotonic: true, + dataPoints: [ + { + value: value, + startTime: START_TIME, + endTime: END_TIME, + attributes: ATTRIBUTES, }, - aggregationTemporality, - dataPointType: DataPointType.SUM, - isMonotonic: false, - dataPoints: [ - { - value: value, - startTime: START_TIME, - endTime: END_TIME, - attributes: ATTRIBUTES, - }, - ], - }; - } - - function createObservableGaugeData(value: number): MetricData { - return { - descriptor: { - description: 'this is a description', - type: InstrumentType.OBSERVABLE_GAUGE, - name: 'gauge', - unit: '1', - valueType: ValueType.DOUBLE, + ], + }; + } + + function createObservableUpDownCounterData( + value: number, + aggregationTemporality: AggregationTemporality + ): MetricData { + return { + descriptor: { + description: 'this is a description', + type: InstrumentType.OBSERVABLE_UP_DOWN_COUNTER, + name: 'observable-up-down-counter', + unit: '1', + valueType: ValueType.INT, + }, + aggregationTemporality, + dataPointType: DataPointType.SUM, + isMonotonic: false, + dataPoints: [ + { + value: value, + startTime: START_TIME, + endTime: END_TIME, + attributes: ATTRIBUTES, }, - aggregationTemporality: AggregationTemporality.CUMULATIVE, - dataPointType: DataPointType.GAUGE, - dataPoints: [ - { - value: value, - startTime: START_TIME, - endTime: END_TIME, - attributes: ATTRIBUTES, - }, - ], - }; - } - - function createHistogramMetrics( - count: number, - sum: number, - boundaries: number[], - counts: number[], - aggregationTemporality: AggregationTemporality, - min?: number, - max?: number - ): MetricData { - return { - descriptor: { - description: 'this is a description', - type: InstrumentType.HISTOGRAM, - name: 'hist', - unit: '1', - valueType: ValueType.INT, + ], + }; + } + + function createObservableGaugeData(value: number): MetricData { + return { + descriptor: { + description: 'this is a description', + type: InstrumentType.OBSERVABLE_GAUGE, + name: 'gauge', + unit: '1', + valueType: ValueType.DOUBLE, + }, + aggregationTemporality: AggregationTemporality.CUMULATIVE, + dataPointType: DataPointType.GAUGE, + dataPoints: [ + { + value: value, + startTime: START_TIME, + endTime: END_TIME, + attributes: ATTRIBUTES, }, - aggregationTemporality, - dataPointType: DataPointType.HISTOGRAM, - dataPoints: [ - { - value: { - sum: sum, - count: count, - min: min, - max: max, - buckets: { - boundaries: boundaries, - counts: counts, - }, + ], + }; + } + + function createHistogramMetrics( + count: number, + sum: number, + boundaries: number[], + counts: number[], + aggregationTemporality: AggregationTemporality, + min?: number, + max?: number + ): MetricData { + return { + descriptor: { + description: 'this is a description', + type: InstrumentType.HISTOGRAM, + name: 'hist', + unit: '1', + valueType: ValueType.INT, + }, + aggregationTemporality, + dataPointType: DataPointType.HISTOGRAM, + dataPoints: [ + { + value: { + sum: sum, + count: count, + min: min, + max: max, + buckets: { + boundaries: boundaries, + counts: counts, }, - startTime: START_TIME, - endTime: END_TIME, - attributes: ATTRIBUTES, }, - ], - }; - } - - function createExponentialHistogramMetrics( - count: number, - sum: number, - scale: number, - zeroCount: number, - positive: { offset: number; bucketCounts: number[] }, - negative: { offset: number; bucketCounts: number[] }, - aggregationTemporality: AggregationTemporality, - min?: number, - max?: number - ): MetricData { - return { - descriptor: { - description: 'this is a description', - type: InstrumentType.HISTOGRAM, - name: 'xhist', - unit: '1', - valueType: ValueType.INT, + startTime: START_TIME, + endTime: END_TIME, + attributes: ATTRIBUTES, }, - aggregationTemporality, - dataPointType: DataPointType.EXPONENTIAL_HISTOGRAM, - dataPoints: [ - { - value: { - sum: sum, - count: count, - min: min, - max: max, - zeroCount: zeroCount, - scale: scale, - positive: positive, - negative: negative, - }, - startTime: START_TIME, - endTime: END_TIME, - attributes: ATTRIBUTES, + ], + }; + } + + function createExponentialHistogramMetrics( + count: number, + sum: number, + scale: number, + zeroCount: number, + positive: { offset: number; bucketCounts: number[] }, + negative: { offset: number; bucketCounts: number[] }, + aggregationTemporality: AggregationTemporality, + min?: number, + max?: number + ): MetricData { + return { + descriptor: { + description: 'this is a description', + type: InstrumentType.HISTOGRAM, + name: 'xhist', + unit: '1', + valueType: ValueType.INT, + }, + aggregationTemporality, + dataPointType: DataPointType.EXPONENTIAL_HISTOGRAM, + dataPoints: [ + { + value: { + sum: sum, + count: count, + min: min, + max: max, + zeroCount: zeroCount, + scale: scale, + positive: positive, + negative: negative, }, - ], - }; - } + startTime: START_TIME, + endTime: END_TIME, + attributes: ATTRIBUTES, + }, + ], + }; + } - function createResourceMetrics(metricData: MetricData[]): ResourceMetrics { - const resource = new Resource({ - 'resource-attribute': 'resource attribute value', - }); - return { - resource: resource, - scopeMetrics: [ - { - scope: { - name: 'mylib', - version: '0.1.0', - schemaUrl: expectedSchemaUrl, - }, - metrics: metricData, + function createResourceMetrics(metricData: MetricData[]): ResourceMetrics { + const resource = new Resource({ + 'resource-attribute': 'resource attribute value', + }); + return { + resource: resource, + scopeMetrics: [ + { + scope: { + name: 'mylib', + version: '0.1.0', + schemaUrl: expectedSchemaUrl, }, - ], - }; - } + metrics: metricData, + }, + ], + }; + } + describe('createExportMetricsServiceRequest', () => { it('serializes a monotonic sum metric record', () => { const metrics = createResourceMetrics([ createCounterData(10, AggregationTemporality.DELTA), @@ -779,4 +785,160 @@ describe('Metrics', () => { }); }); }); + + describe('ProtobufMetricsSerializer', function () { + it('serializes an export request', () => { + const serialized = ProtobufMetricsSerializer.serializeRequest([ + createResourceMetrics([ + createCounterData(10, AggregationTemporality.DELTA), + ]), + ]); + assert.ok(serialized, 'serialized response is undefined'); + const decoded = + root.opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceRequest.decode( + serialized + ); + + const decodedObj = + root.opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceRequest.toObject( + decoded, + { + longs: Number, + } + ); + + const expected = { + resourceMetrics: [ + { + resource: expectedResource, + scopeMetrics: [ + { + scope: expectedScope, + schemaUrl: expectedSchemaUrl, + metrics: [ + { + name: 'counter', + description: 'this is a description', + unit: '1', + sum: { + dataPoints: [ + { + attributes: expectedAttributes, + startTimeUnixNano: hrTimeToNanoseconds(START_TIME), + timeUnixNano: hrTimeToNanoseconds(END_TIME), + asInt: 10, + }, + ], + aggregationTemporality: + EAggregationTemporality.AGGREGATION_TEMPORALITY_DELTA, + isMonotonic: true, + }, + }, + ], + }, + ], + }, + ], + }; + assert.deepStrictEqual(decodedObj, expected); + }); + + it('deserializes a response', () => { + const protobufSerializedResponse = + root.opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceResponse.encode( + { + partialSuccess: { + errorMessage: 'foo', + rejectedDataPoints: 1, + }, + } + ).finish(); + + const deserializedResponse = + ProtobufMetricsSerializer.deserializeResponse( + protobufSerializedResponse + ); + + assert.ok( + deserializedResponse.partialSuccess, + 'partialSuccess not present in the deserialized message' + ); + assert.equal(deserializedResponse.partialSuccess.errorMessage, 'foo'); + assert.equal( + Number(deserializedResponse.partialSuccess.rejectedDataPoints), + 1 + ); + }); + }); + + describe('JsonMetricsSerializer', function () { + it('serializes an export request', () => { + const serialized = JsonMetricsSerializer.serializeRequest([ + createResourceMetrics([ + createCounterData(10, AggregationTemporality.DELTA), + ]), + ]); + + const decoder = new TextDecoder(); + const expected = { + resourceMetrics: [ + { + resource: expectedResource, + scopeMetrics: [ + { + scope: expectedScope, + schemaUrl: expectedSchemaUrl, + metrics: [ + { + name: 'counter', + description: 'this is a description', + unit: '1', + sum: { + dataPoints: [ + { + attributes: expectedAttributes, + startTimeUnixNano: encodeAsString(START_TIME), + timeUnixNano: encodeAsString(END_TIME), + asInt: 10, + }, + ], + aggregationTemporality: + EAggregationTemporality.AGGREGATION_TEMPORALITY_DELTA, + isMonotonic: true, + }, + }, + ], + }, + ], + }, + ], + }; + + assert.deepStrictEqual(JSON.parse(decoder.decode(serialized)), expected); + }); + + it('deserializes a response', () => { + const expectedResponse = { + partialSuccess: { + errorMessage: 'foo', + rejectedDataPoints: 1, + }, + }; + const encoder = new TextEncoder(); + const encodedResponse = encoder.encode(JSON.stringify(expectedResponse)); + + const deserializedResponse = + JsonMetricsSerializer.deserializeResponse(encodedResponse); + + assert.ok( + deserializedResponse.partialSuccess, + 'partialSuccess not present in the deserialized message' + ); + assert.equal(deserializedResponse.partialSuccess.errorMessage, 'foo'); + assert.equal( + Number(deserializedResponse.partialSuccess.rejectedDataPoints), + 1 + ); + }); + }); }); From 432cb41253ef653d9996d21ff8491115491b97a4 Mon Sep 17 00:00:00 2001 From: Marc Pichler Date: Wed, 20 Mar 2024 12:58:49 +0100 Subject: [PATCH 05/14] test(otlp-transformer): add tests for logs serializer --- .../otlp-transformer/test/logs.test.ts | 311 +++++++++++++----- .../otlp-transformer/test/trace.test.ts | 16 +- .../packages/otlp-transformer/test/utils.ts | 32 ++ 3 files changed, 270 insertions(+), 89 deletions(-) create mode 100644 experimental/packages/otlp-transformer/test/utils.ts diff --git a/experimental/packages/otlp-transformer/test/logs.test.ts b/experimental/packages/otlp-transformer/test/logs.test.ts index ea8dd7e82b..a75f306c62 100644 --- a/experimental/packages/otlp-transformer/test/logs.test.ts +++ b/experimental/packages/otlp-transformer/test/logs.test.ts @@ -21,11 +21,28 @@ import { createExportLogsServiceRequest, ESeverityNumber, IExportLogsServiceRequest, + ProtobufLogsSerializer, + JsonLogsSerializer, + OtlpEncodingOptions, } from '../src'; import { ReadableLogRecord } from '@opentelemetry/sdk-logs'; import { SeverityNumber } from '@opentelemetry/api-logs'; +import { toBase64 } from './utils'; +import * as root from '../src/generated/root'; + +function createExpectedLogJson( + options: OtlpEncodingOptions +): IExportLogsServiceRequest { + const useHex = options.useHex ?? false; + const useLongBits = options.useLongBits ?? true; + + const timeUnixNano = useLongBits + ? { low: 4132445859, high: 391214506 } + : '1680253513123241635'; + const observedTimeUnixNano = useLongBits + ? { low: 584929536, high: 391976663 } + : '1683526948965142784'; -function createExpectedLogJson(useHex: boolean): IExportLogsServiceRequest { const traceId = useHex ? '00000000000000000000000000000001' : hexToBinary('00000000000000000000000000000001'); @@ -49,8 +66,8 @@ function createExpectedLogJson(useHex: boolean): IExportLogsServiceRequest { scope: { name: 'scope_name_1', version: '0.1.0' }, logRecords: [ { - timeUnixNano: { low: 4132445859, high: 391214506 }, - observedTimeUnixNano: { low: 584929536, high: 391976663 }, + timeUnixNano, + observedTimeUnixNano, severityNumber: ESeverityNumber.SEVERITY_NUMBER_ERROR, severityText: 'error', body: { stringValue: 'some_log_body' }, @@ -75,78 +92,125 @@ function createExpectedLogJson(useHex: boolean): IExportLogsServiceRequest { }; } -describe('Logs', () => { - describe('createExportLogsServiceRequest', () => { - let resource_1: Resource; - let resource_2: Resource; - let scope_1: InstrumentationScope; - let scope_2: InstrumentationScope; - let log_1_1_1: ReadableLogRecord; - let log_1_1_2: ReadableLogRecord; - let log_1_2_1: ReadableLogRecord; - let log_2_1_1: ReadableLogRecord; - - beforeEach(() => { - resource_1 = new Resource({ - 'resource-attribute': 'some attribute value', - }); - resource_2 = new Resource({ - 'resource-attribute': 'another attribute value', - }); - scope_1 = { - name: 'scope_name_1', - version: '0.1.0', - schemaUrl: 'http://url.to.schema', - }; - scope_2 = { - name: 'scope_name_2', - }; - const log_fragment_1 = { - hrTime: [1680253513, 123241635] as HrTime, - hrTimeObserved: [1683526948, 965142784] as HrTime, - attributes: { - 'some-attribute': 'some attribute value', - }, - droppedAttributesCount: 0, - severityNumber: SeverityNumber.ERROR, - severityText: 'error', - body: 'some_log_body', - spanContext: { - spanId: '0000000000000002', - traceFlags: TraceFlags.SAMPLED, - traceId: '00000000000000000000000000000001', - }, - }; - const log_fragment_2 = { - hrTime: [1680253797, 687038506] as HrTime, - hrTimeObserved: [1680253797, 687038506] as HrTime, - attributes: { - 'another-attribute': 'another attribute value', +function createExpectedLogProtobuf(): IExportLogsServiceRequest { + const traceId = toBase64('00000000000000000000000000000001'); + const spanId = toBase64('0000000000000002'); + + return { + resourceLogs: [ + { + resource: { + attributes: [ + { + key: 'resource-attribute', + value: { stringValue: 'some attribute value' }, + }, + ], + droppedAttributesCount: 0, }, - droppedAttributesCount: 0, - }; - log_1_1_1 = { - ...log_fragment_1, - resource: resource_1, - instrumentationScope: scope_1, - }; - log_1_1_2 = { - ...log_fragment_2, - resource: resource_1, - instrumentationScope: scope_1, - }; - log_1_2_1 = { - ...log_fragment_1, - resource: resource_1, - instrumentationScope: scope_2, - }; - log_2_1_1 = { - ...log_fragment_1, - resource: resource_2, - instrumentationScope: scope_1, - }; + scopeLogs: [ + { + scope: { name: 'scope_name_1', version: '0.1.0' }, + logRecords: [ + { + timeUnixNano: 1680253513123241700, + observedTimeUnixNano: 1683526948965142800, + severityNumber: ESeverityNumber.SEVERITY_NUMBER_ERROR, + severityText: 'error', + body: { stringValue: 'some_log_body' }, + + attributes: [ + { + key: 'some-attribute', + value: { stringValue: 'some attribute value' }, + }, + ], + droppedAttributesCount: 0, + flags: 1, + traceId: traceId, + spanId: spanId, + }, + ], + schemaUrl: 'http://url.to.schema', + }, + ], + }, + ], + }; +} + +describe('Logs', () => { + let resource_1: Resource; + let resource_2: Resource; + let scope_1: InstrumentationScope; + let scope_2: InstrumentationScope; + let log_1_1_1: ReadableLogRecord; + let log_1_1_2: ReadableLogRecord; + let log_1_2_1: ReadableLogRecord; + let log_2_1_1: ReadableLogRecord; + + beforeEach(() => { + resource_1 = new Resource({ + 'resource-attribute': 'some attribute value', + }); + resource_2 = new Resource({ + 'resource-attribute': 'another attribute value', }); + scope_1 = { + name: 'scope_name_1', + version: '0.1.0', + schemaUrl: 'http://url.to.schema', + }; + scope_2 = { + name: 'scope_name_2', + }; + const log_fragment_1 = { + hrTime: [1680253513, 123241635] as HrTime, + hrTimeObserved: [1683526948, 965142784] as HrTime, + attributes: { + 'some-attribute': 'some attribute value', + }, + droppedAttributesCount: 0, + severityNumber: SeverityNumber.ERROR, + severityText: 'error', + body: 'some_log_body', + spanContext: { + spanId: '0000000000000002', + traceFlags: TraceFlags.SAMPLED, + traceId: '00000000000000000000000000000001', + }, + }; + const log_fragment_2 = { + hrTime: [1680253797, 687038506] as HrTime, + hrTimeObserved: [1680253797, 687038506] as HrTime, + attributes: { + 'another-attribute': 'another attribute value', + }, + droppedAttributesCount: 0, + }; + log_1_1_1 = { + ...log_fragment_1, + resource: resource_1, + instrumentationScope: scope_1, + }; + log_1_1_2 = { + ...log_fragment_2, + resource: resource_1, + instrumentationScope: scope_1, + }; + log_1_2_1 = { + ...log_fragment_1, + resource: resource_1, + instrumentationScope: scope_2, + }; + log_2_1_1 = { + ...log_fragment_1, + resource: resource_2, + instrumentationScope: scope_1, + }; + }); + describe('createExportLogsServiceRequest', () => { it('returns null on an empty list', () => { assert.deepStrictEqual( createExportLogsServiceRequest([], { useHex: true }), @@ -161,7 +225,10 @@ describe('Logs', () => { useHex: true, }); assert.ok(exportRequest); - assert.deepStrictEqual(exportRequest, createExpectedLogJson(true)); + assert.deepStrictEqual( + exportRequest, + createExpectedLogJson({ useHex: true }) + ); }); it('serializes a log record with useHex = false', () => { @@ -169,7 +236,10 @@ describe('Logs', () => { useHex: false, }); assert.ok(exportRequest); - assert.deepStrictEqual(exportRequest, createExpectedLogJson(false)); + assert.deepStrictEqual( + exportRequest, + createExpectedLogJson({ useHex: false }) + ); }); it('aggregates multiple logs with same resource and same scope', () => { @@ -205,4 +275,97 @@ describe('Logs', () => { assert.strictEqual(exportRequest.resourceLogs?.length, 2); }); }); + + describe('ProtobufLogsSerializer', function () { + it('serializes an export request', () => { + const serialized = ProtobufLogsSerializer.serializeRequest([log_1_1_1]); + assert.ok(serialized, 'serialized response is undefined'); + const decoded = + root.opentelemetry.proto.collector.logs.v1.ExportLogsServiceRequest.decode( + serialized + ); + + const expected = createExpectedLogProtobuf(); + const decodedObj = + root.opentelemetry.proto.collector.logs.v1.ExportLogsServiceRequest.toObject( + decoded, + { + // This incurs some precision loss that's taken into account in createExpectedLogsProtobuf() + // Using String here will incur the same precision loss on browser only, using Number to prevent having to + // have different assertions for browser and Node.js + longs: Number, + // Convert to String (Base64) as otherwise the type will be different for Node.js (Buffer) and Browser (Uint8Array) + // and this fails assertions. + bytes: String, + } + ); + + assert.deepStrictEqual(decodedObj, expected); + }); + + it('deserializes a response', () => { + const protobufSerializedResponse = + root.opentelemetry.proto.collector.logs.v1.ExportLogsServiceResponse.encode( + { + partialSuccess: { + errorMessage: 'foo', + rejectedLogRecords: 1, + }, + } + ).finish(); + + const deserializedResponse = ProtobufLogsSerializer.deserializeResponse( + protobufSerializedResponse + ); + + assert.ok( + deserializedResponse.partialSuccess, + 'partialSuccess not present in the deserialized message' + ); + assert.equal(deserializedResponse.partialSuccess.errorMessage, 'foo'); + assert.equal( + Number(deserializedResponse.partialSuccess.rejectedLogRecords), + 1 + ); + }); + }); + + describe('JsonLogsSerializer', function () { + it('serializes an export request', () => { + // stringify, then parse to remove undefined keys in the expected JSON + const expected = JSON.parse( + JSON.stringify( + createExpectedLogJson({ useHex: true, useLongBits: false }) + ) + ); + const serialized = JsonLogsSerializer.serializeRequest([log_1_1_1]); + + const decoder = new TextDecoder(); + assert.deepStrictEqual(JSON.parse(decoder.decode(serialized)), expected); + }); + + it('deserializes a response', () => { + const expectedResponse = { + partialSuccess: { + errorMessage: 'foo', + rejectedLogRecords: 1, + }, + }; + const encoder = new TextEncoder(); + const encodedResponse = encoder.encode(JSON.stringify(expectedResponse)); + + const deserializedResponse = + JsonLogsSerializer.deserializeResponse(encodedResponse); + + assert.ok( + deserializedResponse.partialSuccess, + 'partialSuccess not present in the deserialized message' + ); + assert.equal(deserializedResponse.partialSuccess.errorMessage, 'foo'); + assert.equal( + Number(deserializedResponse.partialSuccess.rejectedLogRecords), + 1 + ); + }); + }); }); diff --git a/experimental/packages/otlp-transformer/test/trace.test.ts b/experimental/packages/otlp-transformer/test/trace.test.ts index b2ecc767a8..65492e35a9 100644 --- a/experimental/packages/otlp-transformer/test/trace.test.ts +++ b/experimental/packages/otlp-transformer/test/trace.test.ts @@ -27,6 +27,7 @@ import { ProtobufTraceSerializer, JsonTraceSerializer, } from '../src'; +import { toBase64 } from './utils'; function createExpectedSpanJson(options: OtlpEncodingOptions) { const useHex = options.useHex ?? false; @@ -136,21 +137,6 @@ function createExpectedSpanJson(options: OtlpEncodingOptions) { }; } -/** - * utility function to convert a string representing a hex value to a base64 string - * that represents the bytes of that hex value. This is needed as we need to support Node.js 14 - * where btoa() does not exist, and the Browser, where Buffer does not exist. - * @param hexStr - */ -function toBase64(hexStr: string) { - if (typeof btoa !== 'undefined') { - const decoder = new TextDecoder('utf8'); - return btoa(decoder.decode(hexToBinary(hexStr))); - } - - return Buffer.from(hexToBinary(hexStr)).toString('base64'); -} - function createExpectedSpanProtobuf() { const startTime = 1640715557342725400; const endTime = 1640715558642725400; diff --git a/experimental/packages/otlp-transformer/test/utils.ts b/experimental/packages/otlp-transformer/test/utils.ts new file mode 100644 index 0000000000..d13c9cf314 --- /dev/null +++ b/experimental/packages/otlp-transformer/test/utils.ts @@ -0,0 +1,32 @@ +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { hexToBinary } from '@opentelemetry/core'; + +/** + * utility function to convert a string representing a hex value to a base64 string + * that represents the bytes of that hex value. This is needed as we need to support Node.js 14 + * where btoa() does not exist, and the Browser, where Buffer does not exist. + * @param hexStr + */ +export function toBase64(hexStr: string) { + if (typeof btoa !== 'undefined') { + const decoder = new TextDecoder('utf8'); + return btoa(decoder.decode(hexToBinary(hexStr))); + } + + return Buffer.from(hexToBinary(hexStr)).toString('base64'); +} From 5205cae126bff4ddcb67bfc40bc0fbff651d1b75 Mon Sep 17 00:00:00 2001 From: Marc Pichler Date: Wed, 10 Apr 2024 14:42:54 +0200 Subject: [PATCH 06/14] chore: resolve more conflicts --- .../packages/otlp-exporter-base/package.json | 2 +- package-lock.json | 291 +++++++++++++++++- 2 files changed, 290 insertions(+), 3 deletions(-) diff --git a/experimental/packages/otlp-exporter-base/package.json b/experimental/packages/otlp-exporter-base/package.json index 7807f939f1..d8121e44e1 100644 --- a/experimental/packages/otlp-exporter-base/package.json +++ b/experimental/packages/otlp-exporter-base/package.json @@ -62,7 +62,7 @@ }, "dependencies": { "@opentelemetry/core": "1.23.0", - "@opentelemetry/otlp-transformer": "0.49.1" + "@opentelemetry/otlp-transformer": "0.50.0" }, "devDependencies": { "@babel/core": "7.23.6", diff --git a/package-lock.json b/package-lock.json index 503a0f1523..7c3cd78bc4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,6 +10,7 @@ "hasInstallScript": true, "license": "Apache-2.0", "workspaces": [ + "api", "packages/*", "experimental/packages/*", "experimental/examples/*", @@ -4214,7 +4215,8 @@ "version": "0.50.0", "license": "Apache-2.0", "dependencies": { - "@opentelemetry/core": "1.23.0" + "@opentelemetry/core": "1.23.0", + "@opentelemetry/otlp-transformer": "0.50.0" }, "devDependencies": { "@babel/core": "7.23.6", @@ -4250,6 +4252,158 @@ "@opentelemetry/api": "^1.0.0" } }, + "experimental/packages/otlp-exporter-base/node_modules/@opentelemetry/api-logs": { + "version": "0.49.1", + "resolved": "https://registry.npmjs.org/@opentelemetry/api-logs/-/api-logs-0.49.1.tgz", + "integrity": "sha512-kaNl/T7WzyMUQHQlVq7q0oV4Kev6+0xFwqzofryC66jgGMacd0QH5TwfpbUwSTby+SdAdprAe5UKMvBw4tKS5Q==", + "dependencies": { + "@opentelemetry/api": "^1.0.0" + }, + "engines": { + "node": ">=14" + } + }, + "experimental/packages/otlp-exporter-base/node_modules/@opentelemetry/otlp-transformer/node_modules/@opentelemetry/core": { + "version": "1.22.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/core/-/core-1.22.0.tgz", + "integrity": "sha512-0VoAlT6x+Xzik1v9goJ3pZ2ppi6+xd3aUfg4brfrLkDBHRIVjMP0eBHrKrhB+NKcDyMAg8fAbGL3Npg/F6AwWA==", + "dependencies": { + "@opentelemetry/semantic-conventions": "1.22.0" + }, + "engines": { + "node": ">=14" + }, + "peerDependencies": { + "@opentelemetry/api": ">=1.0.0 <1.9.0" + } + }, + "experimental/packages/otlp-exporter-base/node_modules/@opentelemetry/resources": { + "version": "1.22.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/resources/-/resources-1.22.0.tgz", + "integrity": "sha512-+vNeIFPH2hfcNL0AJk/ykJXoUCtR1YaDUZM+p3wZNU4Hq98gzq+7b43xbkXjadD9VhWIUQqEwXyY64q6msPj6A==", + "dependencies": { + "@opentelemetry/core": "1.22.0", + "@opentelemetry/semantic-conventions": "1.22.0" + }, + "engines": { + "node": ">=14" + }, + "peerDependencies": { + "@opentelemetry/api": ">=1.0.0 <1.9.0" + } + }, + "experimental/packages/otlp-exporter-base/node_modules/@opentelemetry/resources/node_modules/@opentelemetry/core": { + "version": "1.22.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/core/-/core-1.22.0.tgz", + "integrity": "sha512-0VoAlT6x+Xzik1v9goJ3pZ2ppi6+xd3aUfg4brfrLkDBHRIVjMP0eBHrKrhB+NKcDyMAg8fAbGL3Npg/F6AwWA==", + "dependencies": { + "@opentelemetry/semantic-conventions": "1.22.0" + }, + "engines": { + "node": ">=14" + }, + "peerDependencies": { + "@opentelemetry/api": ">=1.0.0 <1.9.0" + } + }, + "experimental/packages/otlp-exporter-base/node_modules/@opentelemetry/sdk-logs": { + "version": "0.49.1", + "resolved": "https://registry.npmjs.org/@opentelemetry/sdk-logs/-/sdk-logs-0.49.1.tgz", + "integrity": "sha512-gCzYWsJE0h+3cuh3/cK+9UwlVFyHvj3PReIOCDOmdeXOp90ZjKRoDOJBc3mvk1LL6wyl1RWIivR8Rg9OToyesw==", + "dependencies": { + "@opentelemetry/core": "1.22.0", + "@opentelemetry/resources": "1.22.0" + }, + "engines": { + "node": ">=14" + }, + "peerDependencies": { + "@opentelemetry/api": ">=1.4.0 <1.9.0", + "@opentelemetry/api-logs": ">=0.39.1" + } + }, + "experimental/packages/otlp-exporter-base/node_modules/@opentelemetry/sdk-logs/node_modules/@opentelemetry/core": { + "version": "1.22.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/core/-/core-1.22.0.tgz", + "integrity": "sha512-0VoAlT6x+Xzik1v9goJ3pZ2ppi6+xd3aUfg4brfrLkDBHRIVjMP0eBHrKrhB+NKcDyMAg8fAbGL3Npg/F6AwWA==", + "dependencies": { + "@opentelemetry/semantic-conventions": "1.22.0" + }, + "engines": { + "node": ">=14" + }, + "peerDependencies": { + "@opentelemetry/api": ">=1.0.0 <1.9.0" + } + }, + "experimental/packages/otlp-exporter-base/node_modules/@opentelemetry/sdk-metrics": { + "version": "1.22.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/sdk-metrics/-/sdk-metrics-1.22.0.tgz", + "integrity": "sha512-k6iIx6H3TZ+BVMr2z8M16ri2OxWaljg5h8ihGJxi/KQWcjign6FEaEzuigXt5bK9wVEhqAcWLCfarSftaNWkkg==", + "dependencies": { + "@opentelemetry/core": "1.22.0", + "@opentelemetry/resources": "1.22.0", + "lodash.merge": "^4.6.2" + }, + "engines": { + "node": ">=14" + }, + "peerDependencies": { + "@opentelemetry/api": ">=1.3.0 <1.9.0" + } + }, + "experimental/packages/otlp-exporter-base/node_modules/@opentelemetry/sdk-metrics/node_modules/@opentelemetry/core": { + "version": "1.22.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/core/-/core-1.22.0.tgz", + "integrity": "sha512-0VoAlT6x+Xzik1v9goJ3pZ2ppi6+xd3aUfg4brfrLkDBHRIVjMP0eBHrKrhB+NKcDyMAg8fAbGL3Npg/F6AwWA==", + "dependencies": { + "@opentelemetry/semantic-conventions": "1.22.0" + }, + "engines": { + "node": ">=14" + }, + "peerDependencies": { + "@opentelemetry/api": ">=1.0.0 <1.9.0" + } + }, + "experimental/packages/otlp-exporter-base/node_modules/@opentelemetry/sdk-trace-base": { + "version": "1.22.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/sdk-trace-base/-/sdk-trace-base-1.22.0.tgz", + "integrity": "sha512-pfTuSIpCKONC6vkTpv6VmACxD+P1woZf4q0K46nSUvXFvOFqjBYKFaAMkKD3M1mlKUUh0Oajwj35qNjMl80m1Q==", + "dependencies": { + "@opentelemetry/core": "1.22.0", + "@opentelemetry/resources": "1.22.0", + "@opentelemetry/semantic-conventions": "1.22.0" + }, + "engines": { + "node": ">=14" + }, + "peerDependencies": { + "@opentelemetry/api": ">=1.0.0 <1.9.0" + } + }, + "experimental/packages/otlp-exporter-base/node_modules/@opentelemetry/sdk-trace-base/node_modules/@opentelemetry/core": { + "version": "1.22.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/core/-/core-1.22.0.tgz", + "integrity": "sha512-0VoAlT6x+Xzik1v9goJ3pZ2ppi6+xd3aUfg4brfrLkDBHRIVjMP0eBHrKrhB+NKcDyMAg8fAbGL3Npg/F6AwWA==", + "dependencies": { + "@opentelemetry/semantic-conventions": "1.22.0" + }, + "engines": { + "node": ">=14" + }, + "peerDependencies": { + "@opentelemetry/api": ">=1.0.0 <1.9.0" + } + }, + "experimental/packages/otlp-exporter-base/node_modules/@opentelemetry/semantic-conventions": { + "version": "1.22.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/semantic-conventions/-/semantic-conventions-1.22.0.tgz", + "integrity": "sha512-CAOgFOKLybd02uj/GhCdEeeBjOS0yeoDeo/CA7ASBSmenpZHAKGB3iDm/rv3BQLcabb/OprDEsSQ1y0P8A7Siw==", + "engines": { + "node": ">=14" + } + }, "experimental/packages/otlp-exporter-base/node_modules/@webpack-cli/configtest": { "version": "2.1.1", "dev": true, @@ -4596,7 +4750,8 @@ "@opentelemetry/resources": "1.23.0", "@opentelemetry/sdk-logs": "0.50.0", "@opentelemetry/sdk-metrics": "1.23.0", - "@opentelemetry/sdk-trace-base": "1.23.0" + "@opentelemetry/sdk-trace-base": "1.23.0", + "protobufjs": "^7.2.3" }, "devDependencies": { "@opentelemetry/api": "1.8.0", @@ -4614,6 +4769,7 @@ "lerna": "6.6.2", "mocha": "10.2.0", "nyc": "15.1.0", + "protobufjs-cli": "1.1.2", "ts-loader": "8.4.0", "ts-mocha": "10.0.0", "typescript": "4.4.4", @@ -35481,6 +35637,15 @@ "@opentelemetry/api": ">=1.0.0 <1.9.0" } }, + "packages/opentelemetry-resources/node_modules/@opentelemetry/api": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/@opentelemetry/api/-/api-1.4.1.tgz", + "integrity": "sha512-O2yRJce1GOc6PAy3QxFM4NzFiWzvScDC1/5ihYBL6BUEVdq0XMWN01sppE+H6bBXbaFYipjwFLEWLg5PaSOThA==", + "dev": true, + "engines": { + "node": ">=8.0.0" + } + }, "packages/opentelemetry-resources/node_modules/@opentelemetry/resources_1.9.0": { "name": "@opentelemetry/resources", "version": "1.9.0", @@ -42895,6 +43060,7 @@ "@babel/preset-env": "7.22.20", "@opentelemetry/api": "1.8.0", "@opentelemetry/core": "1.23.0", + "@opentelemetry/otlp-transformer": "0.50.0", "@types/mocha": "10.0.6", "@types/node": "18.6.5", "@types/sinon": "10.0.20", @@ -42919,6 +43085,119 @@ "webpack-merge": "5.10.0" }, "dependencies": { + "@opentelemetry/api-logs": { + "version": "0.49.1", + "resolved": "https://registry.npmjs.org/@opentelemetry/api-logs/-/api-logs-0.49.1.tgz", + "integrity": "sha512-kaNl/T7WzyMUQHQlVq7q0oV4Kev6+0xFwqzofryC66jgGMacd0QH5TwfpbUwSTby+SdAdprAe5UKMvBw4tKS5Q==", + "requires": { + "@opentelemetry/api": "^1.0.0" + } + }, + "@opentelemetry/otlp-transformer": { + "version": "https://registry.npmjs.org/@opentelemetry/otlp-transformer/-/otlp-transformer-0.49.1.tgz", + "integrity": "sha512-Z+koA4wp9L9e3jkFacyXTGphSWTbOKjwwXMpb0CxNb0kjTHGUxhYRN8GnkLFsFo5NbZPjP07hwAqeEG/uCratQ==", + "requires": { + "@opentelemetry/api-logs": "0.49.1", + "@opentelemetry/core": "1.22.0", + "@opentelemetry/resources": "1.22.0", + "@opentelemetry/sdk-logs": "0.49.1", + "@opentelemetry/sdk-metrics": "1.22.0", + "@opentelemetry/sdk-trace-base": "1.22.0" + }, + "dependencies": { + "@opentelemetry/core": { + "version": "1.22.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/core/-/core-1.22.0.tgz", + "integrity": "sha512-0VoAlT6x+Xzik1v9goJ3pZ2ppi6+xd3aUfg4brfrLkDBHRIVjMP0eBHrKrhB+NKcDyMAg8fAbGL3Npg/F6AwWA==", + "requires": { + "@opentelemetry/semantic-conventions": "1.22.0" + } + } + } + }, + "@opentelemetry/resources": { + "version": "1.22.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/resources/-/resources-1.22.0.tgz", + "integrity": "sha512-+vNeIFPH2hfcNL0AJk/ykJXoUCtR1YaDUZM+p3wZNU4Hq98gzq+7b43xbkXjadD9VhWIUQqEwXyY64q6msPj6A==", + "requires": { + "@opentelemetry/core": "1.22.0", + "@opentelemetry/semantic-conventions": "1.22.0" + }, + "dependencies": { + "@opentelemetry/core": { + "version": "1.22.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/core/-/core-1.22.0.tgz", + "integrity": "sha512-0VoAlT6x+Xzik1v9goJ3pZ2ppi6+xd3aUfg4brfrLkDBHRIVjMP0eBHrKrhB+NKcDyMAg8fAbGL3Npg/F6AwWA==", + "requires": { + "@opentelemetry/semantic-conventions": "1.22.0" + } + } + } + }, + "@opentelemetry/sdk-logs": { + "version": "0.49.1", + "resolved": "https://registry.npmjs.org/@opentelemetry/sdk-logs/-/sdk-logs-0.49.1.tgz", + "integrity": "sha512-gCzYWsJE0h+3cuh3/cK+9UwlVFyHvj3PReIOCDOmdeXOp90ZjKRoDOJBc3mvk1LL6wyl1RWIivR8Rg9OToyesw==", + "requires": { + "@opentelemetry/core": "1.22.0", + "@opentelemetry/resources": "1.22.0" + }, + "dependencies": { + "@opentelemetry/core": { + "version": "1.22.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/core/-/core-1.22.0.tgz", + "integrity": "sha512-0VoAlT6x+Xzik1v9goJ3pZ2ppi6+xd3aUfg4brfrLkDBHRIVjMP0eBHrKrhB+NKcDyMAg8fAbGL3Npg/F6AwWA==", + "requires": { + "@opentelemetry/semantic-conventions": "1.22.0" + } + } + } + }, + "@opentelemetry/sdk-metrics": { + "version": "1.22.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/sdk-metrics/-/sdk-metrics-1.22.0.tgz", + "integrity": "sha512-k6iIx6H3TZ+BVMr2z8M16ri2OxWaljg5h8ihGJxi/KQWcjign6FEaEzuigXt5bK9wVEhqAcWLCfarSftaNWkkg==", + "requires": { + "@opentelemetry/core": "1.22.0", + "@opentelemetry/resources": "1.22.0", + "lodash.merge": "^4.6.2" + }, + "dependencies": { + "@opentelemetry/core": { + "version": "1.22.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/core/-/core-1.22.0.tgz", + "integrity": "sha512-0VoAlT6x+Xzik1v9goJ3pZ2ppi6+xd3aUfg4brfrLkDBHRIVjMP0eBHrKrhB+NKcDyMAg8fAbGL3Npg/F6AwWA==", + "requires": { + "@opentelemetry/semantic-conventions": "1.22.0" + } + } + } + }, + "@opentelemetry/sdk-trace-base": { + "version": "1.22.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/sdk-trace-base/-/sdk-trace-base-1.22.0.tgz", + "integrity": "sha512-pfTuSIpCKONC6vkTpv6VmACxD+P1woZf4q0K46nSUvXFvOFqjBYKFaAMkKD3M1mlKUUh0Oajwj35qNjMl80m1Q==", + "requires": { + "@opentelemetry/core": "1.22.0", + "@opentelemetry/resources": "1.22.0", + "@opentelemetry/semantic-conventions": "1.22.0" + }, + "dependencies": { + "@opentelemetry/core": { + "version": "1.22.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/core/-/core-1.22.0.tgz", + "integrity": "sha512-0VoAlT6x+Xzik1v9goJ3pZ2ppi6+xd3aUfg4brfrLkDBHRIVjMP0eBHrKrhB+NKcDyMAg8fAbGL3Npg/F6AwWA==", + "requires": { + "@opentelemetry/semantic-conventions": "1.22.0" + } + } + } + }, + "@opentelemetry/semantic-conventions": { + "version": "1.22.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/semantic-conventions/-/semantic-conventions-1.22.0.tgz", + "integrity": "sha512-CAOgFOKLybd02uj/GhCdEeeBjOS0yeoDeo/CA7ASBSmenpZHAKGB3iDm/rv3BQLcabb/OprDEsSQ1y0P8A7Siw==" + }, "@webpack-cli/configtest": { "version": "2.1.1", "dev": true, @@ -43129,6 +43408,8 @@ "lerna": "6.6.2", "mocha": "10.2.0", "nyc": "15.1.0", + "protobufjs": "^7.2.3", + "protobufjs-cli": "1.1.2", "ts-loader": "8.4.0", "ts-mocha": "10.0.0", "typescript": "4.4.4", @@ -43330,6 +43611,12 @@ "webpack-merge": "5.10.0" }, "dependencies": { + "@opentelemetry/api": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/@opentelemetry/api/-/api-1.4.1.tgz", + "integrity": "sha512-O2yRJce1GOc6PAy3QxFM4NzFiWzvScDC1/5ihYBL6BUEVdq0XMWN01sppE+H6bBXbaFYipjwFLEWLg5PaSOThA==", + "dev": true + }, "@opentelemetry/resources_1.9.0": { "version": "npm:@opentelemetry/resources@1.9.0", "dev": true, From b9bdeea880f3515b5eea4d4f65bccfd76a76a987 Mon Sep 17 00:00:00 2001 From: Marc Pichler Date: Thu, 11 Apr 2024 16:10:46 +0200 Subject: [PATCH 07/14] fix: sync package-lock --- package-lock.json | 252 +--------------------------------------------- 1 file changed, 1 insertion(+), 251 deletions(-) diff --git a/package-lock.json b/package-lock.json index afdd990ce0..5ec629ab51 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4239,21 +4239,11 @@ "@opentelemetry/api": "^1.0.0" } }, - "experimental/packages/otlp-exporter-base/node_modules/@opentelemetry/api-logs": { - "version": "0.49.1", - "resolved": "https://registry.npmjs.org/@opentelemetry/api-logs/-/api-logs-0.49.1.tgz", - "integrity": "sha512-kaNl/T7WzyMUQHQlVq7q0oV4Kev6+0xFwqzofryC66jgGMacd0QH5TwfpbUwSTby+SdAdprAe5UKMvBw4tKS5Q==", - "dependencies": { - "@opentelemetry/api": "^1.0.0" - }, - "engines": { - "node": ">=14" - } - }, "experimental/packages/otlp-exporter-base/node_modules/@opentelemetry/otlp-transformer/node_modules/@opentelemetry/core": { "version": "1.22.0", "resolved": "https://registry.npmjs.org/@opentelemetry/core/-/core-1.22.0.tgz", "integrity": "sha512-0VoAlT6x+Xzik1v9goJ3pZ2ppi6+xd3aUfg4brfrLkDBHRIVjMP0eBHrKrhB+NKcDyMAg8fAbGL3Npg/F6AwWA==", + "extraneous": true, "dependencies": { "@opentelemetry/semantic-conventions": "1.22.0" }, @@ -4264,133 +4254,6 @@ "@opentelemetry/api": ">=1.0.0 <1.9.0" } }, - "experimental/packages/otlp-exporter-base/node_modules/@opentelemetry/resources": { - "version": "1.22.0", - "resolved": "https://registry.npmjs.org/@opentelemetry/resources/-/resources-1.22.0.tgz", - "integrity": "sha512-+vNeIFPH2hfcNL0AJk/ykJXoUCtR1YaDUZM+p3wZNU4Hq98gzq+7b43xbkXjadD9VhWIUQqEwXyY64q6msPj6A==", - "dependencies": { - "@opentelemetry/core": "1.22.0", - "@opentelemetry/semantic-conventions": "1.22.0" - }, - "engines": { - "node": ">=14" - }, - "peerDependencies": { - "@opentelemetry/api": ">=1.0.0 <1.9.0" - } - }, - "experimental/packages/otlp-exporter-base/node_modules/@opentelemetry/resources/node_modules/@opentelemetry/core": { - "version": "1.22.0", - "resolved": "https://registry.npmjs.org/@opentelemetry/core/-/core-1.22.0.tgz", - "integrity": "sha512-0VoAlT6x+Xzik1v9goJ3pZ2ppi6+xd3aUfg4brfrLkDBHRIVjMP0eBHrKrhB+NKcDyMAg8fAbGL3Npg/F6AwWA==", - "dependencies": { - "@opentelemetry/semantic-conventions": "1.22.0" - }, - "engines": { - "node": ">=14" - }, - "peerDependencies": { - "@opentelemetry/api": ">=1.0.0 <1.9.0" - } - }, - "experimental/packages/otlp-exporter-base/node_modules/@opentelemetry/sdk-logs": { - "version": "0.49.1", - "resolved": "https://registry.npmjs.org/@opentelemetry/sdk-logs/-/sdk-logs-0.49.1.tgz", - "integrity": "sha512-gCzYWsJE0h+3cuh3/cK+9UwlVFyHvj3PReIOCDOmdeXOp90ZjKRoDOJBc3mvk1LL6wyl1RWIivR8Rg9OToyesw==", - "dependencies": { - "@opentelemetry/core": "1.22.0", - "@opentelemetry/resources": "1.22.0" - }, - "engines": { - "node": ">=14" - }, - "peerDependencies": { - "@opentelemetry/api": ">=1.4.0 <1.9.0", - "@opentelemetry/api-logs": ">=0.39.1" - } - }, - "experimental/packages/otlp-exporter-base/node_modules/@opentelemetry/sdk-logs/node_modules/@opentelemetry/core": { - "version": "1.22.0", - "resolved": "https://registry.npmjs.org/@opentelemetry/core/-/core-1.22.0.tgz", - "integrity": "sha512-0VoAlT6x+Xzik1v9goJ3pZ2ppi6+xd3aUfg4brfrLkDBHRIVjMP0eBHrKrhB+NKcDyMAg8fAbGL3Npg/F6AwWA==", - "dependencies": { - "@opentelemetry/semantic-conventions": "1.22.0" - }, - "engines": { - "node": ">=14" - }, - "peerDependencies": { - "@opentelemetry/api": ">=1.0.0 <1.9.0" - } - }, - "experimental/packages/otlp-exporter-base/node_modules/@opentelemetry/sdk-metrics": { - "version": "1.22.0", - "resolved": "https://registry.npmjs.org/@opentelemetry/sdk-metrics/-/sdk-metrics-1.22.0.tgz", - "integrity": "sha512-k6iIx6H3TZ+BVMr2z8M16ri2OxWaljg5h8ihGJxi/KQWcjign6FEaEzuigXt5bK9wVEhqAcWLCfarSftaNWkkg==", - "dependencies": { - "@opentelemetry/core": "1.22.0", - "@opentelemetry/resources": "1.22.0", - "lodash.merge": "^4.6.2" - }, - "engines": { - "node": ">=14" - }, - "peerDependencies": { - "@opentelemetry/api": ">=1.3.0 <1.9.0" - } - }, - "experimental/packages/otlp-exporter-base/node_modules/@opentelemetry/sdk-metrics/node_modules/@opentelemetry/core": { - "version": "1.22.0", - "resolved": "https://registry.npmjs.org/@opentelemetry/core/-/core-1.22.0.tgz", - "integrity": "sha512-0VoAlT6x+Xzik1v9goJ3pZ2ppi6+xd3aUfg4brfrLkDBHRIVjMP0eBHrKrhB+NKcDyMAg8fAbGL3Npg/F6AwWA==", - "dependencies": { - "@opentelemetry/semantic-conventions": "1.22.0" - }, - "engines": { - "node": ">=14" - }, - "peerDependencies": { - "@opentelemetry/api": ">=1.0.0 <1.9.0" - } - }, - "experimental/packages/otlp-exporter-base/node_modules/@opentelemetry/sdk-trace-base": { - "version": "1.22.0", - "resolved": "https://registry.npmjs.org/@opentelemetry/sdk-trace-base/-/sdk-trace-base-1.22.0.tgz", - "integrity": "sha512-pfTuSIpCKONC6vkTpv6VmACxD+P1woZf4q0K46nSUvXFvOFqjBYKFaAMkKD3M1mlKUUh0Oajwj35qNjMl80m1Q==", - "dependencies": { - "@opentelemetry/core": "1.22.0", - "@opentelemetry/resources": "1.22.0", - "@opentelemetry/semantic-conventions": "1.22.0" - }, - "engines": { - "node": ">=14" - }, - "peerDependencies": { - "@opentelemetry/api": ">=1.0.0 <1.9.0" - } - }, - "experimental/packages/otlp-exporter-base/node_modules/@opentelemetry/sdk-trace-base/node_modules/@opentelemetry/core": { - "version": "1.22.0", - "resolved": "https://registry.npmjs.org/@opentelemetry/core/-/core-1.22.0.tgz", - "integrity": "sha512-0VoAlT6x+Xzik1v9goJ3pZ2ppi6+xd3aUfg4brfrLkDBHRIVjMP0eBHrKrhB+NKcDyMAg8fAbGL3Npg/F6AwWA==", - "dependencies": { - "@opentelemetry/semantic-conventions": "1.22.0" - }, - "engines": { - "node": ">=14" - }, - "peerDependencies": { - "@opentelemetry/api": ">=1.0.0 <1.9.0" - } - }, - "experimental/packages/otlp-exporter-base/node_modules/@opentelemetry/semantic-conventions": { - "version": "1.22.0", - "resolved": "https://registry.npmjs.org/@opentelemetry/semantic-conventions/-/semantic-conventions-1.22.0.tgz", - "integrity": "sha512-CAOgFOKLybd02uj/GhCdEeeBjOS0yeoDeo/CA7ASBSmenpZHAKGB3iDm/rv3BQLcabb/OprDEsSQ1y0P8A7Siw==", - "engines": { - "node": ">=14" - } - }, "experimental/packages/otlp-exporter-base/node_modules/@webpack-cli/configtest": { "version": "2.1.1", "dev": true, @@ -43080,119 +42943,6 @@ "webpack-merge": "5.10.0" }, "dependencies": { - "@opentelemetry/api-logs": { - "version": "0.49.1", - "resolved": "https://registry.npmjs.org/@opentelemetry/api-logs/-/api-logs-0.49.1.tgz", - "integrity": "sha512-kaNl/T7WzyMUQHQlVq7q0oV4Kev6+0xFwqzofryC66jgGMacd0QH5TwfpbUwSTby+SdAdprAe5UKMvBw4tKS5Q==", - "requires": { - "@opentelemetry/api": "^1.0.0" - } - }, - "@opentelemetry/otlp-transformer": { - "version": "https://registry.npmjs.org/@opentelemetry/otlp-transformer/-/otlp-transformer-0.49.1.tgz", - "integrity": "sha512-Z+koA4wp9L9e3jkFacyXTGphSWTbOKjwwXMpb0CxNb0kjTHGUxhYRN8GnkLFsFo5NbZPjP07hwAqeEG/uCratQ==", - "requires": { - "@opentelemetry/api-logs": "0.49.1", - "@opentelemetry/core": "1.22.0", - "@opentelemetry/resources": "1.22.0", - "@opentelemetry/sdk-logs": "0.49.1", - "@opentelemetry/sdk-metrics": "1.22.0", - "@opentelemetry/sdk-trace-base": "1.22.0" - }, - "dependencies": { - "@opentelemetry/core": { - "version": "1.22.0", - "resolved": "https://registry.npmjs.org/@opentelemetry/core/-/core-1.22.0.tgz", - "integrity": "sha512-0VoAlT6x+Xzik1v9goJ3pZ2ppi6+xd3aUfg4brfrLkDBHRIVjMP0eBHrKrhB+NKcDyMAg8fAbGL3Npg/F6AwWA==", - "requires": { - "@opentelemetry/semantic-conventions": "1.22.0" - } - } - } - }, - "@opentelemetry/resources": { - "version": "1.22.0", - "resolved": "https://registry.npmjs.org/@opentelemetry/resources/-/resources-1.22.0.tgz", - "integrity": "sha512-+vNeIFPH2hfcNL0AJk/ykJXoUCtR1YaDUZM+p3wZNU4Hq98gzq+7b43xbkXjadD9VhWIUQqEwXyY64q6msPj6A==", - "requires": { - "@opentelemetry/core": "1.22.0", - "@opentelemetry/semantic-conventions": "1.22.0" - }, - "dependencies": { - "@opentelemetry/core": { - "version": "1.22.0", - "resolved": "https://registry.npmjs.org/@opentelemetry/core/-/core-1.22.0.tgz", - "integrity": "sha512-0VoAlT6x+Xzik1v9goJ3pZ2ppi6+xd3aUfg4brfrLkDBHRIVjMP0eBHrKrhB+NKcDyMAg8fAbGL3Npg/F6AwWA==", - "requires": { - "@opentelemetry/semantic-conventions": "1.22.0" - } - } - } - }, - "@opentelemetry/sdk-logs": { - "version": "0.49.1", - "resolved": "https://registry.npmjs.org/@opentelemetry/sdk-logs/-/sdk-logs-0.49.1.tgz", - "integrity": "sha512-gCzYWsJE0h+3cuh3/cK+9UwlVFyHvj3PReIOCDOmdeXOp90ZjKRoDOJBc3mvk1LL6wyl1RWIivR8Rg9OToyesw==", - "requires": { - "@opentelemetry/core": "1.22.0", - "@opentelemetry/resources": "1.22.0" - }, - "dependencies": { - "@opentelemetry/core": { - "version": "1.22.0", - "resolved": "https://registry.npmjs.org/@opentelemetry/core/-/core-1.22.0.tgz", - "integrity": "sha512-0VoAlT6x+Xzik1v9goJ3pZ2ppi6+xd3aUfg4brfrLkDBHRIVjMP0eBHrKrhB+NKcDyMAg8fAbGL3Npg/F6AwWA==", - "requires": { - "@opentelemetry/semantic-conventions": "1.22.0" - } - } - } - }, - "@opentelemetry/sdk-metrics": { - "version": "1.22.0", - "resolved": "https://registry.npmjs.org/@opentelemetry/sdk-metrics/-/sdk-metrics-1.22.0.tgz", - "integrity": "sha512-k6iIx6H3TZ+BVMr2z8M16ri2OxWaljg5h8ihGJxi/KQWcjign6FEaEzuigXt5bK9wVEhqAcWLCfarSftaNWkkg==", - "requires": { - "@opentelemetry/core": "1.22.0", - "@opentelemetry/resources": "1.22.0", - "lodash.merge": "^4.6.2" - }, - "dependencies": { - "@opentelemetry/core": { - "version": "1.22.0", - "resolved": "https://registry.npmjs.org/@opentelemetry/core/-/core-1.22.0.tgz", - "integrity": "sha512-0VoAlT6x+Xzik1v9goJ3pZ2ppi6+xd3aUfg4brfrLkDBHRIVjMP0eBHrKrhB+NKcDyMAg8fAbGL3Npg/F6AwWA==", - "requires": { - "@opentelemetry/semantic-conventions": "1.22.0" - } - } - } - }, - "@opentelemetry/sdk-trace-base": { - "version": "1.22.0", - "resolved": "https://registry.npmjs.org/@opentelemetry/sdk-trace-base/-/sdk-trace-base-1.22.0.tgz", - "integrity": "sha512-pfTuSIpCKONC6vkTpv6VmACxD+P1woZf4q0K46nSUvXFvOFqjBYKFaAMkKD3M1mlKUUh0Oajwj35qNjMl80m1Q==", - "requires": { - "@opentelemetry/core": "1.22.0", - "@opentelemetry/resources": "1.22.0", - "@opentelemetry/semantic-conventions": "1.22.0" - }, - "dependencies": { - "@opentelemetry/core": { - "version": "1.22.0", - "resolved": "https://registry.npmjs.org/@opentelemetry/core/-/core-1.22.0.tgz", - "integrity": "sha512-0VoAlT6x+Xzik1v9goJ3pZ2ppi6+xd3aUfg4brfrLkDBHRIVjMP0eBHrKrhB+NKcDyMAg8fAbGL3Npg/F6AwWA==", - "requires": { - "@opentelemetry/semantic-conventions": "1.22.0" - } - } - } - }, - "@opentelemetry/semantic-conventions": { - "version": "1.22.0", - "resolved": "https://registry.npmjs.org/@opentelemetry/semantic-conventions/-/semantic-conventions-1.22.0.tgz", - "integrity": "sha512-CAOgFOKLybd02uj/GhCdEeeBjOS0yeoDeo/CA7ASBSmenpZHAKGB3iDm/rv3BQLcabb/OprDEsSQ1y0P8A7Siw==" - }, "@webpack-cli/configtest": { "version": "2.1.1", "dev": true, From fd77885498451e4e94a5bf3c6a2db8a1c25e46ec Mon Sep 17 00:00:00 2001 From: Marc Pichler Date: Mon, 15 Apr 2024 14:51:42 +0200 Subject: [PATCH 08/14] chore: cleanup dependencies, unused code, .gitignore --- .../otlp-grpc-exporter-base/.gitignore | 2 -- .../otlp-grpc-exporter-base/package.json | 4 +--- .../src/internal-types.ts | 22 ------------------- package-lock.json | 21 +----------------- 4 files changed, 2 insertions(+), 47 deletions(-) delete mode 100644 experimental/packages/otlp-grpc-exporter-base/.gitignore delete mode 100644 experimental/packages/otlp-grpc-exporter-base/src/internal-types.ts diff --git a/experimental/packages/otlp-grpc-exporter-base/.gitignore b/experimental/packages/otlp-grpc-exporter-base/.gitignore deleted file mode 100644 index c82683cbd7..0000000000 --- a/experimental/packages/otlp-grpc-exporter-base/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -src/generated/* -!src/generated/.gitkeep diff --git a/experimental/packages/otlp-grpc-exporter-base/package.json b/experimental/packages/otlp-grpc-exporter-base/package.json index 1df4b39a91..6725f9be11 100644 --- a/experimental/packages/otlp-grpc-exporter-base/package.json +++ b/experimental/packages/otlp-grpc-exporter-base/package.json @@ -58,7 +58,6 @@ "lerna": "6.6.2", "mocha": "10.2.0", "nyc": "15.1.0", - "protobufjs-cli": "1.1.2", "sinon": "15.1.2", "ts-loader": "8.4.0", "ts-mocha": "10.0.0", @@ -70,8 +69,7 @@ "dependencies": { "@grpc/grpc-js": "^1.7.1", "@opentelemetry/core": "1.23.0", - "@opentelemetry/otlp-exporter-base": "0.50.0", - "protobufjs": "^7.2.3" + "@opentelemetry/otlp-exporter-base": "0.50.0" }, "homepage": "https://github.com/open-telemetry/opentelemetry-js/tree/main/experimental/packages/otlp-grpc-exporter-base", "sideEffects": false diff --git a/experimental/packages/otlp-grpc-exporter-base/src/internal-types.ts b/experimental/packages/otlp-grpc-exporter-base/src/internal-types.ts deleted file mode 100644 index 8d108a0a22..0000000000 --- a/experimental/packages/otlp-grpc-exporter-base/src/internal-types.ts +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import type * as protobuf from 'protobufjs'; - -export interface ExportType unknown }> { - encode(message: T, writer?: protobuf.Writer): protobuf.Writer; - decode(reader: protobuf.Reader | Uint8Array, length?: number): R; -} diff --git a/package-lock.json b/package-lock.json index 5ec629ab51..5f0c06632c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4239,21 +4239,6 @@ "@opentelemetry/api": "^1.0.0" } }, - "experimental/packages/otlp-exporter-base/node_modules/@opentelemetry/otlp-transformer/node_modules/@opentelemetry/core": { - "version": "1.22.0", - "resolved": "https://registry.npmjs.org/@opentelemetry/core/-/core-1.22.0.tgz", - "integrity": "sha512-0VoAlT6x+Xzik1v9goJ3pZ2ppi6+xd3aUfg4brfrLkDBHRIVjMP0eBHrKrhB+NKcDyMAg8fAbGL3Npg/F6AwWA==", - "extraneous": true, - "dependencies": { - "@opentelemetry/semantic-conventions": "1.22.0" - }, - "engines": { - "node": ">=14" - }, - "peerDependencies": { - "@opentelemetry/api": ">=1.0.0 <1.9.0" - } - }, "experimental/packages/otlp-exporter-base/node_modules/@webpack-cli/configtest": { "version": "2.1.1", "dev": true, @@ -4526,8 +4511,7 @@ "dependencies": { "@grpc/grpc-js": "^1.7.1", "@opentelemetry/core": "1.23.0", - "@opentelemetry/otlp-exporter-base": "0.50.0", - "protobufjs": "^7.2.3" + "@opentelemetry/otlp-exporter-base": "0.50.0" }, "devDependencies": { "@opentelemetry/api": "1.8.0", @@ -4543,7 +4527,6 @@ "lerna": "6.6.2", "mocha": "10.2.0", "nyc": "15.1.0", - "protobufjs-cli": "1.1.2", "sinon": "15.1.2", "ts-loader": "8.4.0", "ts-mocha": "10.0.0", @@ -43097,8 +43080,6 @@ "lerna": "6.6.2", "mocha": "10.2.0", "nyc": "15.1.0", - "protobufjs": "^7.2.3", - "protobufjs-cli": "1.1.2", "sinon": "15.1.2", "ts-loader": "8.4.0", "ts-mocha": "10.0.0", From 105da170028f02cf763938927aff90150d9840f2 Mon Sep 17 00:00:00 2001 From: Marc Pichler Date: Mon, 15 Apr 2024 14:52:31 +0200 Subject: [PATCH 09/14] chore: fix changelog indentation --- experimental/CHANGELOG.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/experimental/CHANGELOG.md b/experimental/CHANGELOG.md index 907da6b373..b7545a1edb 100644 --- a/experimental/CHANGELOG.md +++ b/experimental/CHANGELOG.md @@ -13,10 +13,10 @@ All notable changes to experimental packages in this project will be documented * `NodeSDK.addResource()`, please use constructor options instead * `NodeSDK.detectResources()`, this is not necessary anymore, resources are now auto-detected on `NodeSDK.start()` if the constructor option `autoDetectResources` is unset, `undefined` or `true`. * feat(exporter-*-otlp-*)!: move serialization for Node.js exporters to `@opentelemetry/otlp-transformer` [#4542](https://github.com/open-telemetry/opentelemetry-js/pull/4542) @pichlermarc - * Breaking changes: - * (user-facing) `convert()` now returns an empty object and will be removed in a follow-up - * (internal) OTLPExporterNodeBase now has additional constructor parameters that are required - * (internal) OTLPExporterNodeBase now has an additional `ResponseType` type parameter + * Breaking changes: + * (user-facing) `convert()` now returns an empty object and will be removed in a follow-up + * (internal) OTLPExporterNodeBase now has additional constructor parameters that are required + * (internal) OTLPExporterNodeBase now has an additional `ResponseType` type parameter ### :rocket: (Enhancement) From 9cb2593009cbe81cc8fb8ecb91f2a7a5cc19de0e Mon Sep 17 00:00:00 2001 From: Marc Pichler Date: Mon, 15 Apr 2024 16:14:57 +0200 Subject: [PATCH 10/14] fix(otlp-transformer): remove unused useHex from JsonMetricsSerializer --- experimental/packages/otlp-transformer/src/json/serializers.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/experimental/packages/otlp-transformer/src/json/serializers.ts b/experimental/packages/otlp-transformer/src/json/serializers.ts index 45c42fc81d..5d360faf47 100644 --- a/experimental/packages/otlp-transformer/src/json/serializers.ts +++ b/experimental/packages/otlp-transformer/src/json/serializers.ts @@ -48,7 +48,6 @@ export const JsonMetricsSerializer: ISerializer< > = { serializeRequest: (arg: ResourceMetrics[]) => { const request = createExportMetricsServiceRequest(arg, { - useHex: true, useLongBits: false, }); const encoder = new TextEncoder(); From 4f80adaa29d6d00a2d9238c7d67ebd46f2877a96 Mon Sep 17 00:00:00 2001 From: Marc Pichler Date: Mon, 15 Apr 2024 16:49:55 +0200 Subject: [PATCH 11/14] chore: add comment about how logs data is structured --- .../packages/otlp-transformer/test/logs.test.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/experimental/packages/otlp-transformer/test/logs.test.ts b/experimental/packages/otlp-transformer/test/logs.test.ts index b7281383b9..b279ae75da 100644 --- a/experimental/packages/otlp-transformer/test/logs.test.ts +++ b/experimental/packages/otlp-transformer/test/logs.test.ts @@ -147,9 +147,21 @@ describe('Logs', () => { let resource_2: Resource; let scope_1: InstrumentationScope; let scope_2: InstrumentationScope; + + /* + The following log_X_Y_Z should follow the pattern + - X is the resource + - Y is the scope + - Z is the log fragment + */ + + // using `resource_1`, `scope_1`, `log_fragment_1` let log_1_1_1: ReadableLogRecord; + // using `resource_1`, `scope_1`, `log_fragment_2` let log_1_1_2: ReadableLogRecord; + // using `resource_1`, `scope_2`, `log_fragment_1` let log_1_2_1: ReadableLogRecord; + // using `resource_2`, `scope_1`, `log_fragment_1` let log_2_1_1: ReadableLogRecord; beforeEach(() => { From e8adc4debbfe6a9fc31d2717e4a54aa16765ad41 Mon Sep 17 00:00:00 2001 From: Marc Pichler Date: Mon, 15 Apr 2024 17:40:40 +0200 Subject: [PATCH 12/14] docs: move submodule.md, adapt contents --- .../{otlp-proto-exporter-base => otlp-transformer}/submodule.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename experimental/packages/{otlp-proto-exporter-base => otlp-transformer}/submodule.md (94%) diff --git a/experimental/packages/otlp-proto-exporter-base/submodule.md b/experimental/packages/otlp-transformer/submodule.md similarity index 94% rename from experimental/packages/otlp-proto-exporter-base/submodule.md rename to experimental/packages/otlp-transformer/submodule.md index 2b3be0c7b7..d5ebe6661a 100644 --- a/experimental/packages/otlp-proto-exporter-base/submodule.md +++ b/experimental/packages/otlp-transformer/submodule.md @@ -40,7 +40,7 @@ Knowing this if you want to change the submodule to point to a different version 8. Now thing which is very important. You have to commit this to apply these changes ```shell script - git commit -am "chore: updating submodule for otlp-proto-exporter-base" + git commit -am "chore: updating submodule for otlp-transformer" ``` 9. If you look now at git log you will notice that the folder `protos` has been changed and it will show what was the previous sha and what is current one. From 62cc3b364bd78c5f99a1f1d1102ca5b59c293a0c Mon Sep 17 00:00:00 2001 From: Marc Pichler Date: Fri, 26 Apr 2024 15:57:58 +0200 Subject: [PATCH 13/14] fixup! Merge branch 'main' into feat/transformer-serializer --- package-lock.json | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/package-lock.json b/package-lock.json index f57e17d355..4cd1dfeb25 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6594,16 +6594,6 @@ "url": "https://opencollective.com/mochajs" } }, - "experimental/packages/shimmer": { - "version": "0.51.0", - "extraneous": true, - "license": "BSD-2-Clause", - "devDependencies": { - "sinon": "^7.2.2", - "standard": "^12.0.1", - "tap": "^12.1.1" - } - }, "integration-tests/api": { "name": "@opentelemetry/integration-tests-api", "version": "1.24.0", From 1324071bbcaf13a41b507b50c9402ab3b06c8482 Mon Sep 17 00:00:00 2001 From: Marc Pichler Date: Fri, 26 Apr 2024 16:02:18 +0200 Subject: [PATCH 14/14] fixup! Merge branch 'main' into feat/transformer-serializer --- .../src/generated/root.d.ts | 5053 ------ .../src/generated/root.js | 13574 ---------------- 2 files changed, 18627 deletions(-) delete mode 100644 experimental/packages/otlp-grpc-exporter-base/src/generated/root.d.ts delete mode 100644 experimental/packages/otlp-grpc-exporter-base/src/generated/root.js diff --git a/experimental/packages/otlp-grpc-exporter-base/src/generated/root.d.ts b/experimental/packages/otlp-grpc-exporter-base/src/generated/root.d.ts deleted file mode 100644 index 5525e18769..0000000000 --- a/experimental/packages/otlp-grpc-exporter-base/src/generated/root.d.ts +++ /dev/null @@ -1,5053 +0,0 @@ -import * as $protobuf from "protobufjs"; -import Long = require("long"); -/** Namespace opentelemetry. */ -export namespace opentelemetry { - - /** Namespace proto. */ - namespace proto { - - /** 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|null); - - /** 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|null); - - /** InstrumentationScope version. */ - public version?: (string|null); - - /** InstrumentationScope attributes. */ - public attributes: opentelemetry.proto.common.v1.IKeyValue[]; - - /** InstrumentationScope droppedAttributesCount. */ - public droppedAttributesCount?: (number|null); - - /** - * 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; - } - } - } - - /** 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|null); - - /** - * 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 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|null); - - /** - * 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|null); - - /** - * 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|null); - - /** Span spanId. */ - public spanId?: (Uint8Array|null); - - /** Span traceState. */ - public traceState?: (string|null); - - /** Span parentSpanId. */ - public parentSpanId?: (Uint8Array|null); - - /** Span name. */ - public name?: (string|null); - - /** Span kind. */ - public kind?: (opentelemetry.proto.trace.v1.Span.SpanKind|null); - - /** Span startTimeUnixNano. */ - public startTimeUnixNano?: (number|Long|null); - - /** Span endTimeUnixNano. */ - public endTimeUnixNano?: (number|Long|null); - - /** Span attributes. */ - public attributes: opentelemetry.proto.common.v1.IKeyValue[]; - - /** Span droppedAttributesCount. */ - public droppedAttributesCount?: (number|null); - - /** Span events. */ - public events: opentelemetry.proto.trace.v1.Span.IEvent[]; - - /** Span droppedEventsCount. */ - public droppedEventsCount?: (number|null); - - /** Span links. */ - public links: opentelemetry.proto.trace.v1.Span.ILink[]; - - /** Span droppedLinksCount. */ - public droppedLinksCount?: (number|null); - - /** 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|null); - - /** Event name. */ - public name?: (string|null); - - /** Event attributes. */ - public attributes: opentelemetry.proto.common.v1.IKeyValue[]; - - /** Event droppedAttributesCount. */ - public droppedAttributesCount?: (number|null); - - /** - * 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|null); - - /** Link spanId. */ - public spanId?: (Uint8Array|null); - - /** Link traceState. */ - public traceState?: (string|null); - - /** Link attributes. */ - public attributes: opentelemetry.proto.common.v1.IKeyValue[]; - - /** Link droppedAttributesCount. */ - public droppedAttributesCount?: (number|null); - - /** - * 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|null); - - /** Status code. */ - public code?: (opentelemetry.proto.trace.v1.Status.StatusCode|null); - - /** - * 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 - } - } - } - } - - /** Namespace collector. */ - namespace collector { - - /** Namespace trace. */ - namespace trace { - - /** Namespace v1. */ - namespace v1 { - - /** Represents a TraceService */ - class TraceService extends $protobuf.rpc.Service { - - /** - * Constructs a new TraceService service. - * @param rpcImpl RPC implementation - * @param [requestDelimited=false] Whether requests are length-delimited - * @param [responseDelimited=false] Whether responses are length-delimited - */ - constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); - - /** - * Creates new TraceService service using the specified rpc implementation. - * @param rpcImpl RPC implementation - * @param [requestDelimited=false] Whether requests are length-delimited - * @param [responseDelimited=false] Whether responses are length-delimited - * @returns RPC service. Useful where requests and/or responses are streamed. - */ - public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): TraceService; - - /** - * Calls Export. - * @param request ExportTraceServiceRequest message or plain object - * @param callback Node-style callback called with the error, if any, and ExportTraceServiceResponse - */ - public export(request: opentelemetry.proto.collector.trace.v1.IExportTraceServiceRequest, callback: opentelemetry.proto.collector.trace.v1.TraceService.ExportCallback): void; - - /** - * Calls Export. - * @param request ExportTraceServiceRequest message or plain object - * @returns Promise - */ - public export(request: opentelemetry.proto.collector.trace.v1.IExportTraceServiceRequest): Promise; - } - - namespace TraceService { - - /** - * Callback as used by {@link opentelemetry.proto.collector.trace.v1.TraceService#export_}. - * @param error Error, if any - * @param [response] ExportTraceServiceResponse - */ - type ExportCallback = (error: (Error|null), response?: opentelemetry.proto.collector.trace.v1.ExportTraceServiceResponse) => void; - } - - /** Properties of an ExportTraceServiceRequest. */ - interface IExportTraceServiceRequest { - - /** ExportTraceServiceRequest resourceSpans */ - resourceSpans?: (opentelemetry.proto.trace.v1.IResourceSpans[]|null); - } - - /** Represents an ExportTraceServiceRequest. */ - class ExportTraceServiceRequest implements IExportTraceServiceRequest { - - /** - * Constructs a new ExportTraceServiceRequest. - * @param [properties] Properties to set - */ - constructor(properties?: opentelemetry.proto.collector.trace.v1.IExportTraceServiceRequest); - - /** ExportTraceServiceRequest resourceSpans. */ - public resourceSpans: opentelemetry.proto.trace.v1.IResourceSpans[]; - - /** - * Creates a new ExportTraceServiceRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns ExportTraceServiceRequest instance - */ - public static create(properties?: opentelemetry.proto.collector.trace.v1.IExportTraceServiceRequest): opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest; - - /** - * Encodes the specified ExportTraceServiceRequest message. Does not implicitly {@link opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest.verify|verify} messages. - * @param message ExportTraceServiceRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: opentelemetry.proto.collector.trace.v1.IExportTraceServiceRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified ExportTraceServiceRequest message, length delimited. Does not implicitly {@link opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest.verify|verify} messages. - * @param message ExportTraceServiceRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: opentelemetry.proto.collector.trace.v1.IExportTraceServiceRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes an ExportTraceServiceRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns ExportTraceServiceRequest - * @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.collector.trace.v1.ExportTraceServiceRequest; - - /** - * Decodes an ExportTraceServiceRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns ExportTraceServiceRequest - * @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.collector.trace.v1.ExportTraceServiceRequest; - - /** - * Verifies an ExportTraceServiceRequest 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 ExportTraceServiceRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ExportTraceServiceRequest - */ - public static fromObject(object: { [k: string]: any }): opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest; - - /** - * Creates a plain object from an ExportTraceServiceRequest message. Also converts values to other types if specified. - * @param message ExportTraceServiceRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this ExportTraceServiceRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for ExportTraceServiceRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an ExportTraceServiceResponse. */ - interface IExportTraceServiceResponse { - - /** ExportTraceServiceResponse partialSuccess */ - partialSuccess?: (opentelemetry.proto.collector.trace.v1.IExportTracePartialSuccess|null); - } - - /** Represents an ExportTraceServiceResponse. */ - class ExportTraceServiceResponse implements IExportTraceServiceResponse { - - /** - * Constructs a new ExportTraceServiceResponse. - * @param [properties] Properties to set - */ - constructor(properties?: opentelemetry.proto.collector.trace.v1.IExportTraceServiceResponse); - - /** ExportTraceServiceResponse partialSuccess. */ - public partialSuccess?: (opentelemetry.proto.collector.trace.v1.IExportTracePartialSuccess|null); - - /** - * Creates a new ExportTraceServiceResponse instance using the specified properties. - * @param [properties] Properties to set - * @returns ExportTraceServiceResponse instance - */ - public static create(properties?: opentelemetry.proto.collector.trace.v1.IExportTraceServiceResponse): opentelemetry.proto.collector.trace.v1.ExportTraceServiceResponse; - - /** - * Encodes the specified ExportTraceServiceResponse message. Does not implicitly {@link opentelemetry.proto.collector.trace.v1.ExportTraceServiceResponse.verify|verify} messages. - * @param message ExportTraceServiceResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: opentelemetry.proto.collector.trace.v1.IExportTraceServiceResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified ExportTraceServiceResponse message, length delimited. Does not implicitly {@link opentelemetry.proto.collector.trace.v1.ExportTraceServiceResponse.verify|verify} messages. - * @param message ExportTraceServiceResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: opentelemetry.proto.collector.trace.v1.IExportTraceServiceResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes an ExportTraceServiceResponse message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns ExportTraceServiceResponse - * @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.collector.trace.v1.ExportTraceServiceResponse; - - /** - * Decodes an ExportTraceServiceResponse message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns ExportTraceServiceResponse - * @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.collector.trace.v1.ExportTraceServiceResponse; - - /** - * Verifies an ExportTraceServiceResponse 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 ExportTraceServiceResponse message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ExportTraceServiceResponse - */ - public static fromObject(object: { [k: string]: any }): opentelemetry.proto.collector.trace.v1.ExportTraceServiceResponse; - - /** - * Creates a plain object from an ExportTraceServiceResponse message. Also converts values to other types if specified. - * @param message ExportTraceServiceResponse - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: opentelemetry.proto.collector.trace.v1.ExportTraceServiceResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this ExportTraceServiceResponse to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for ExportTraceServiceResponse - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an ExportTracePartialSuccess. */ - interface IExportTracePartialSuccess { - - /** ExportTracePartialSuccess rejectedSpans */ - rejectedSpans?: (number|Long|null); - - /** ExportTracePartialSuccess errorMessage */ - errorMessage?: (string|null); - } - - /** Represents an ExportTracePartialSuccess. */ - class ExportTracePartialSuccess implements IExportTracePartialSuccess { - - /** - * Constructs a new ExportTracePartialSuccess. - * @param [properties] Properties to set - */ - constructor(properties?: opentelemetry.proto.collector.trace.v1.IExportTracePartialSuccess); - - /** ExportTracePartialSuccess rejectedSpans. */ - public rejectedSpans?: (number|Long|null); - - /** ExportTracePartialSuccess errorMessage. */ - public errorMessage?: (string|null); - - /** - * Creates a new ExportTracePartialSuccess instance using the specified properties. - * @param [properties] Properties to set - * @returns ExportTracePartialSuccess instance - */ - public static create(properties?: opentelemetry.proto.collector.trace.v1.IExportTracePartialSuccess): opentelemetry.proto.collector.trace.v1.ExportTracePartialSuccess; - - /** - * Encodes the specified ExportTracePartialSuccess message. Does not implicitly {@link opentelemetry.proto.collector.trace.v1.ExportTracePartialSuccess.verify|verify} messages. - * @param message ExportTracePartialSuccess message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: opentelemetry.proto.collector.trace.v1.IExportTracePartialSuccess, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified ExportTracePartialSuccess message, length delimited. Does not implicitly {@link opentelemetry.proto.collector.trace.v1.ExportTracePartialSuccess.verify|verify} messages. - * @param message ExportTracePartialSuccess message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: opentelemetry.proto.collector.trace.v1.IExportTracePartialSuccess, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes an ExportTracePartialSuccess message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns ExportTracePartialSuccess - * @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.collector.trace.v1.ExportTracePartialSuccess; - - /** - * Decodes an ExportTracePartialSuccess message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns ExportTracePartialSuccess - * @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.collector.trace.v1.ExportTracePartialSuccess; - - /** - * Verifies an ExportTracePartialSuccess 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 ExportTracePartialSuccess message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ExportTracePartialSuccess - */ - public static fromObject(object: { [k: string]: any }): opentelemetry.proto.collector.trace.v1.ExportTracePartialSuccess; - - /** - * Creates a plain object from an ExportTracePartialSuccess message. Also converts values to other types if specified. - * @param message ExportTracePartialSuccess - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: opentelemetry.proto.collector.trace.v1.ExportTracePartialSuccess, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this ExportTracePartialSuccess to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for ExportTracePartialSuccess - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - } - } - - /** Namespace metrics. */ - namespace metrics { - - /** Namespace v1. */ - namespace v1 { - - /** Represents a MetricsService */ - class MetricsService extends $protobuf.rpc.Service { - - /** - * Constructs a new MetricsService service. - * @param rpcImpl RPC implementation - * @param [requestDelimited=false] Whether requests are length-delimited - * @param [responseDelimited=false] Whether responses are length-delimited - */ - constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); - - /** - * Creates new MetricsService service using the specified rpc implementation. - * @param rpcImpl RPC implementation - * @param [requestDelimited=false] Whether requests are length-delimited - * @param [responseDelimited=false] Whether responses are length-delimited - * @returns RPC service. Useful where requests and/or responses are streamed. - */ - public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): MetricsService; - - /** - * Calls Export. - * @param request ExportMetricsServiceRequest message or plain object - * @param callback Node-style callback called with the error, if any, and ExportMetricsServiceResponse - */ - public export(request: opentelemetry.proto.collector.metrics.v1.IExportMetricsServiceRequest, callback: opentelemetry.proto.collector.metrics.v1.MetricsService.ExportCallback): void; - - /** - * Calls Export. - * @param request ExportMetricsServiceRequest message or plain object - * @returns Promise - */ - public export(request: opentelemetry.proto.collector.metrics.v1.IExportMetricsServiceRequest): Promise; - } - - namespace MetricsService { - - /** - * Callback as used by {@link opentelemetry.proto.collector.metrics.v1.MetricsService#export_}. - * @param error Error, if any - * @param [response] ExportMetricsServiceResponse - */ - type ExportCallback = (error: (Error|null), response?: opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceResponse) => void; - } - - /** Properties of an ExportMetricsServiceRequest. */ - interface IExportMetricsServiceRequest { - - /** ExportMetricsServiceRequest resourceMetrics */ - resourceMetrics?: (opentelemetry.proto.metrics.v1.IResourceMetrics[]|null); - } - - /** Represents an ExportMetricsServiceRequest. */ - class ExportMetricsServiceRequest implements IExportMetricsServiceRequest { - - /** - * Constructs a new ExportMetricsServiceRequest. - * @param [properties] Properties to set - */ - constructor(properties?: opentelemetry.proto.collector.metrics.v1.IExportMetricsServiceRequest); - - /** ExportMetricsServiceRequest resourceMetrics. */ - public resourceMetrics: opentelemetry.proto.metrics.v1.IResourceMetrics[]; - - /** - * Creates a new ExportMetricsServiceRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns ExportMetricsServiceRequest instance - */ - public static create(properties?: opentelemetry.proto.collector.metrics.v1.IExportMetricsServiceRequest): opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceRequest; - - /** - * Encodes the specified ExportMetricsServiceRequest message. Does not implicitly {@link opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceRequest.verify|verify} messages. - * @param message ExportMetricsServiceRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: opentelemetry.proto.collector.metrics.v1.IExportMetricsServiceRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified ExportMetricsServiceRequest message, length delimited. Does not implicitly {@link opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceRequest.verify|verify} messages. - * @param message ExportMetricsServiceRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: opentelemetry.proto.collector.metrics.v1.IExportMetricsServiceRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes an ExportMetricsServiceRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns ExportMetricsServiceRequest - * @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.collector.metrics.v1.ExportMetricsServiceRequest; - - /** - * Decodes an ExportMetricsServiceRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns ExportMetricsServiceRequest - * @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.collector.metrics.v1.ExportMetricsServiceRequest; - - /** - * Verifies an ExportMetricsServiceRequest 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 ExportMetricsServiceRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ExportMetricsServiceRequest - */ - public static fromObject(object: { [k: string]: any }): opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceRequest; - - /** - * Creates a plain object from an ExportMetricsServiceRequest message. Also converts values to other types if specified. - * @param message ExportMetricsServiceRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this ExportMetricsServiceRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for ExportMetricsServiceRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an ExportMetricsServiceResponse. */ - interface IExportMetricsServiceResponse { - - /** ExportMetricsServiceResponse partialSuccess */ - partialSuccess?: (opentelemetry.proto.collector.metrics.v1.IExportMetricsPartialSuccess|null); - } - - /** Represents an ExportMetricsServiceResponse. */ - class ExportMetricsServiceResponse implements IExportMetricsServiceResponse { - - /** - * Constructs a new ExportMetricsServiceResponse. - * @param [properties] Properties to set - */ - constructor(properties?: opentelemetry.proto.collector.metrics.v1.IExportMetricsServiceResponse); - - /** ExportMetricsServiceResponse partialSuccess. */ - public partialSuccess?: (opentelemetry.proto.collector.metrics.v1.IExportMetricsPartialSuccess|null); - - /** - * Creates a new ExportMetricsServiceResponse instance using the specified properties. - * @param [properties] Properties to set - * @returns ExportMetricsServiceResponse instance - */ - public static create(properties?: opentelemetry.proto.collector.metrics.v1.IExportMetricsServiceResponse): opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceResponse; - - /** - * Encodes the specified ExportMetricsServiceResponse message. Does not implicitly {@link opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceResponse.verify|verify} messages. - * @param message ExportMetricsServiceResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: opentelemetry.proto.collector.metrics.v1.IExportMetricsServiceResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified ExportMetricsServiceResponse message, length delimited. Does not implicitly {@link opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceResponse.verify|verify} messages. - * @param message ExportMetricsServiceResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: opentelemetry.proto.collector.metrics.v1.IExportMetricsServiceResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes an ExportMetricsServiceResponse message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns ExportMetricsServiceResponse - * @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.collector.metrics.v1.ExportMetricsServiceResponse; - - /** - * Decodes an ExportMetricsServiceResponse message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns ExportMetricsServiceResponse - * @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.collector.metrics.v1.ExportMetricsServiceResponse; - - /** - * Verifies an ExportMetricsServiceResponse 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 ExportMetricsServiceResponse message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ExportMetricsServiceResponse - */ - public static fromObject(object: { [k: string]: any }): opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceResponse; - - /** - * Creates a plain object from an ExportMetricsServiceResponse message. Also converts values to other types if specified. - * @param message ExportMetricsServiceResponse - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this ExportMetricsServiceResponse to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for ExportMetricsServiceResponse - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an ExportMetricsPartialSuccess. */ - interface IExportMetricsPartialSuccess { - - /** ExportMetricsPartialSuccess rejectedDataPoints */ - rejectedDataPoints?: (number|Long|null); - - /** ExportMetricsPartialSuccess errorMessage */ - errorMessage?: (string|null); - } - - /** Represents an ExportMetricsPartialSuccess. */ - class ExportMetricsPartialSuccess implements IExportMetricsPartialSuccess { - - /** - * Constructs a new ExportMetricsPartialSuccess. - * @param [properties] Properties to set - */ - constructor(properties?: opentelemetry.proto.collector.metrics.v1.IExportMetricsPartialSuccess); - - /** ExportMetricsPartialSuccess rejectedDataPoints. */ - public rejectedDataPoints?: (number|Long|null); - - /** ExportMetricsPartialSuccess errorMessage. */ - public errorMessage?: (string|null); - - /** - * Creates a new ExportMetricsPartialSuccess instance using the specified properties. - * @param [properties] Properties to set - * @returns ExportMetricsPartialSuccess instance - */ - public static create(properties?: opentelemetry.proto.collector.metrics.v1.IExportMetricsPartialSuccess): opentelemetry.proto.collector.metrics.v1.ExportMetricsPartialSuccess; - - /** - * Encodes the specified ExportMetricsPartialSuccess message. Does not implicitly {@link opentelemetry.proto.collector.metrics.v1.ExportMetricsPartialSuccess.verify|verify} messages. - * @param message ExportMetricsPartialSuccess message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: opentelemetry.proto.collector.metrics.v1.IExportMetricsPartialSuccess, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified ExportMetricsPartialSuccess message, length delimited. Does not implicitly {@link opentelemetry.proto.collector.metrics.v1.ExportMetricsPartialSuccess.verify|verify} messages. - * @param message ExportMetricsPartialSuccess message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: opentelemetry.proto.collector.metrics.v1.IExportMetricsPartialSuccess, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes an ExportMetricsPartialSuccess message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns ExportMetricsPartialSuccess - * @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.collector.metrics.v1.ExportMetricsPartialSuccess; - - /** - * Decodes an ExportMetricsPartialSuccess message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns ExportMetricsPartialSuccess - * @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.collector.metrics.v1.ExportMetricsPartialSuccess; - - /** - * Verifies an ExportMetricsPartialSuccess 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 ExportMetricsPartialSuccess message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ExportMetricsPartialSuccess - */ - public static fromObject(object: { [k: string]: any }): opentelemetry.proto.collector.metrics.v1.ExportMetricsPartialSuccess; - - /** - * Creates a plain object from an ExportMetricsPartialSuccess message. Also converts values to other types if specified. - * @param message ExportMetricsPartialSuccess - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: opentelemetry.proto.collector.metrics.v1.ExportMetricsPartialSuccess, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this ExportMetricsPartialSuccess to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for ExportMetricsPartialSuccess - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - } - } - - /** Namespace logs. */ - namespace logs { - - /** Namespace v1. */ - namespace v1 { - - /** Represents a LogsService */ - class LogsService extends $protobuf.rpc.Service { - - /** - * Constructs a new LogsService service. - * @param rpcImpl RPC implementation - * @param [requestDelimited=false] Whether requests are length-delimited - * @param [responseDelimited=false] Whether responses are length-delimited - */ - constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); - - /** - * Creates new LogsService service using the specified rpc implementation. - * @param rpcImpl RPC implementation - * @param [requestDelimited=false] Whether requests are length-delimited - * @param [responseDelimited=false] Whether responses are length-delimited - * @returns RPC service. Useful where requests and/or responses are streamed. - */ - public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): LogsService; - - /** - * Calls Export. - * @param request ExportLogsServiceRequest message or plain object - * @param callback Node-style callback called with the error, if any, and ExportLogsServiceResponse - */ - public export(request: opentelemetry.proto.collector.logs.v1.IExportLogsServiceRequest, callback: opentelemetry.proto.collector.logs.v1.LogsService.ExportCallback): void; - - /** - * Calls Export. - * @param request ExportLogsServiceRequest message or plain object - * @returns Promise - */ - public export(request: opentelemetry.proto.collector.logs.v1.IExportLogsServiceRequest): Promise; - } - - namespace LogsService { - - /** - * Callback as used by {@link opentelemetry.proto.collector.logs.v1.LogsService#export_}. - * @param error Error, if any - * @param [response] ExportLogsServiceResponse - */ - type ExportCallback = (error: (Error|null), response?: opentelemetry.proto.collector.logs.v1.ExportLogsServiceResponse) => void; - } - - /** Properties of an ExportLogsServiceRequest. */ - interface IExportLogsServiceRequest { - - /** ExportLogsServiceRequest resourceLogs */ - resourceLogs?: (opentelemetry.proto.logs.v1.IResourceLogs[]|null); - } - - /** Represents an ExportLogsServiceRequest. */ - class ExportLogsServiceRequest implements IExportLogsServiceRequest { - - /** - * Constructs a new ExportLogsServiceRequest. - * @param [properties] Properties to set - */ - constructor(properties?: opentelemetry.proto.collector.logs.v1.IExportLogsServiceRequest); - - /** ExportLogsServiceRequest resourceLogs. */ - public resourceLogs: opentelemetry.proto.logs.v1.IResourceLogs[]; - - /** - * Creates a new ExportLogsServiceRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns ExportLogsServiceRequest instance - */ - public static create(properties?: opentelemetry.proto.collector.logs.v1.IExportLogsServiceRequest): opentelemetry.proto.collector.logs.v1.ExportLogsServiceRequest; - - /** - * Encodes the specified ExportLogsServiceRequest message. Does not implicitly {@link opentelemetry.proto.collector.logs.v1.ExportLogsServiceRequest.verify|verify} messages. - * @param message ExportLogsServiceRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: opentelemetry.proto.collector.logs.v1.IExportLogsServiceRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified ExportLogsServiceRequest message, length delimited. Does not implicitly {@link opentelemetry.proto.collector.logs.v1.ExportLogsServiceRequest.verify|verify} messages. - * @param message ExportLogsServiceRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: opentelemetry.proto.collector.logs.v1.IExportLogsServiceRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes an ExportLogsServiceRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns ExportLogsServiceRequest - * @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.collector.logs.v1.ExportLogsServiceRequest; - - /** - * Decodes an ExportLogsServiceRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns ExportLogsServiceRequest - * @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.collector.logs.v1.ExportLogsServiceRequest; - - /** - * Verifies an ExportLogsServiceRequest 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 ExportLogsServiceRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ExportLogsServiceRequest - */ - public static fromObject(object: { [k: string]: any }): opentelemetry.proto.collector.logs.v1.ExportLogsServiceRequest; - - /** - * Creates a plain object from an ExportLogsServiceRequest message. Also converts values to other types if specified. - * @param message ExportLogsServiceRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: opentelemetry.proto.collector.logs.v1.ExportLogsServiceRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this ExportLogsServiceRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for ExportLogsServiceRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an ExportLogsServiceResponse. */ - interface IExportLogsServiceResponse { - - /** ExportLogsServiceResponse partialSuccess */ - partialSuccess?: (opentelemetry.proto.collector.logs.v1.IExportLogsPartialSuccess|null); - } - - /** Represents an ExportLogsServiceResponse. */ - class ExportLogsServiceResponse implements IExportLogsServiceResponse { - - /** - * Constructs a new ExportLogsServiceResponse. - * @param [properties] Properties to set - */ - constructor(properties?: opentelemetry.proto.collector.logs.v1.IExportLogsServiceResponse); - - /** ExportLogsServiceResponse partialSuccess. */ - public partialSuccess?: (opentelemetry.proto.collector.logs.v1.IExportLogsPartialSuccess|null); - - /** - * Creates a new ExportLogsServiceResponse instance using the specified properties. - * @param [properties] Properties to set - * @returns ExportLogsServiceResponse instance - */ - public static create(properties?: opentelemetry.proto.collector.logs.v1.IExportLogsServiceResponse): opentelemetry.proto.collector.logs.v1.ExportLogsServiceResponse; - - /** - * Encodes the specified ExportLogsServiceResponse message. Does not implicitly {@link opentelemetry.proto.collector.logs.v1.ExportLogsServiceResponse.verify|verify} messages. - * @param message ExportLogsServiceResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: opentelemetry.proto.collector.logs.v1.IExportLogsServiceResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified ExportLogsServiceResponse message, length delimited. Does not implicitly {@link opentelemetry.proto.collector.logs.v1.ExportLogsServiceResponse.verify|verify} messages. - * @param message ExportLogsServiceResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: opentelemetry.proto.collector.logs.v1.IExportLogsServiceResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes an ExportLogsServiceResponse message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns ExportLogsServiceResponse - * @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.collector.logs.v1.ExportLogsServiceResponse; - - /** - * Decodes an ExportLogsServiceResponse message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns ExportLogsServiceResponse - * @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.collector.logs.v1.ExportLogsServiceResponse; - - /** - * Verifies an ExportLogsServiceResponse 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 ExportLogsServiceResponse message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ExportLogsServiceResponse - */ - public static fromObject(object: { [k: string]: any }): opentelemetry.proto.collector.logs.v1.ExportLogsServiceResponse; - - /** - * Creates a plain object from an ExportLogsServiceResponse message. Also converts values to other types if specified. - * @param message ExportLogsServiceResponse - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: opentelemetry.proto.collector.logs.v1.ExportLogsServiceResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this ExportLogsServiceResponse to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for ExportLogsServiceResponse - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an ExportLogsPartialSuccess. */ - interface IExportLogsPartialSuccess { - - /** ExportLogsPartialSuccess rejectedLogRecords */ - rejectedLogRecords?: (number|Long|null); - - /** ExportLogsPartialSuccess errorMessage */ - errorMessage?: (string|null); - } - - /** Represents an ExportLogsPartialSuccess. */ - class ExportLogsPartialSuccess implements IExportLogsPartialSuccess { - - /** - * Constructs a new ExportLogsPartialSuccess. - * @param [properties] Properties to set - */ - constructor(properties?: opentelemetry.proto.collector.logs.v1.IExportLogsPartialSuccess); - - /** ExportLogsPartialSuccess rejectedLogRecords. */ - public rejectedLogRecords?: (number|Long|null); - - /** ExportLogsPartialSuccess errorMessage. */ - public errorMessage?: (string|null); - - /** - * Creates a new ExportLogsPartialSuccess instance using the specified properties. - * @param [properties] Properties to set - * @returns ExportLogsPartialSuccess instance - */ - public static create(properties?: opentelemetry.proto.collector.logs.v1.IExportLogsPartialSuccess): opentelemetry.proto.collector.logs.v1.ExportLogsPartialSuccess; - - /** - * Encodes the specified ExportLogsPartialSuccess message. Does not implicitly {@link opentelemetry.proto.collector.logs.v1.ExportLogsPartialSuccess.verify|verify} messages. - * @param message ExportLogsPartialSuccess message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: opentelemetry.proto.collector.logs.v1.IExportLogsPartialSuccess, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified ExportLogsPartialSuccess message, length delimited. Does not implicitly {@link opentelemetry.proto.collector.logs.v1.ExportLogsPartialSuccess.verify|verify} messages. - * @param message ExportLogsPartialSuccess message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: opentelemetry.proto.collector.logs.v1.IExportLogsPartialSuccess, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes an ExportLogsPartialSuccess message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns ExportLogsPartialSuccess - * @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.collector.logs.v1.ExportLogsPartialSuccess; - - /** - * Decodes an ExportLogsPartialSuccess message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns ExportLogsPartialSuccess - * @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.collector.logs.v1.ExportLogsPartialSuccess; - - /** - * Verifies an ExportLogsPartialSuccess 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 ExportLogsPartialSuccess message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ExportLogsPartialSuccess - */ - public static fromObject(object: { [k: string]: any }): opentelemetry.proto.collector.logs.v1.ExportLogsPartialSuccess; - - /** - * Creates a plain object from an ExportLogsPartialSuccess message. Also converts values to other types if specified. - * @param message ExportLogsPartialSuccess - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: opentelemetry.proto.collector.logs.v1.ExportLogsPartialSuccess, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this ExportLogsPartialSuccess to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for ExportLogsPartialSuccess - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - } - } - } - - /** Namespace metrics. */ - namespace metrics { - - /** Namespace v1. */ - namespace v1 { - - /** Properties of a MetricsData. */ - interface IMetricsData { - - /** MetricsData resourceMetrics */ - resourceMetrics?: (opentelemetry.proto.metrics.v1.IResourceMetrics[]|null); - } - - /** Represents a MetricsData. */ - class MetricsData implements IMetricsData { - - /** - * Constructs a new MetricsData. - * @param [properties] Properties to set - */ - constructor(properties?: opentelemetry.proto.metrics.v1.IMetricsData); - - /** MetricsData resourceMetrics. */ - public resourceMetrics: opentelemetry.proto.metrics.v1.IResourceMetrics[]; - - /** - * Creates a new MetricsData instance using the specified properties. - * @param [properties] Properties to set - * @returns MetricsData instance - */ - public static create(properties?: opentelemetry.proto.metrics.v1.IMetricsData): opentelemetry.proto.metrics.v1.MetricsData; - - /** - * Encodes the specified MetricsData message. Does not implicitly {@link opentelemetry.proto.metrics.v1.MetricsData.verify|verify} messages. - * @param message MetricsData message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: opentelemetry.proto.metrics.v1.IMetricsData, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified MetricsData message, length delimited. Does not implicitly {@link opentelemetry.proto.metrics.v1.MetricsData.verify|verify} messages. - * @param message MetricsData message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: opentelemetry.proto.metrics.v1.IMetricsData, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a MetricsData message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns MetricsData - * @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.metrics.v1.MetricsData; - - /** - * Decodes a MetricsData message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns MetricsData - * @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.metrics.v1.MetricsData; - - /** - * Verifies a MetricsData 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 MetricsData message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns MetricsData - */ - public static fromObject(object: { [k: string]: any }): opentelemetry.proto.metrics.v1.MetricsData; - - /** - * Creates a plain object from a MetricsData message. Also converts values to other types if specified. - * @param message MetricsData - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: opentelemetry.proto.metrics.v1.MetricsData, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this MetricsData to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for MetricsData - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a ResourceMetrics. */ - interface IResourceMetrics { - - /** ResourceMetrics resource */ - resource?: (opentelemetry.proto.resource.v1.IResource|null); - - /** ResourceMetrics scopeMetrics */ - scopeMetrics?: (opentelemetry.proto.metrics.v1.IScopeMetrics[]|null); - - /** ResourceMetrics schemaUrl */ - schemaUrl?: (string|null); - } - - /** Represents a ResourceMetrics. */ - class ResourceMetrics implements IResourceMetrics { - - /** - * Constructs a new ResourceMetrics. - * @param [properties] Properties to set - */ - constructor(properties?: opentelemetry.proto.metrics.v1.IResourceMetrics); - - /** ResourceMetrics resource. */ - public resource?: (opentelemetry.proto.resource.v1.IResource|null); - - /** ResourceMetrics scopeMetrics. */ - public scopeMetrics: opentelemetry.proto.metrics.v1.IScopeMetrics[]; - - /** ResourceMetrics schemaUrl. */ - public schemaUrl?: (string|null); - - /** - * Creates a new ResourceMetrics instance using the specified properties. - * @param [properties] Properties to set - * @returns ResourceMetrics instance - */ - public static create(properties?: opentelemetry.proto.metrics.v1.IResourceMetrics): opentelemetry.proto.metrics.v1.ResourceMetrics; - - /** - * Encodes the specified ResourceMetrics message. Does not implicitly {@link opentelemetry.proto.metrics.v1.ResourceMetrics.verify|verify} messages. - * @param message ResourceMetrics message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: opentelemetry.proto.metrics.v1.IResourceMetrics, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified ResourceMetrics message, length delimited. Does not implicitly {@link opentelemetry.proto.metrics.v1.ResourceMetrics.verify|verify} messages. - * @param message ResourceMetrics message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: opentelemetry.proto.metrics.v1.IResourceMetrics, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a ResourceMetrics message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns ResourceMetrics - * @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.metrics.v1.ResourceMetrics; - - /** - * Decodes a ResourceMetrics message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns ResourceMetrics - * @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.metrics.v1.ResourceMetrics; - - /** - * Verifies a ResourceMetrics 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 ResourceMetrics message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ResourceMetrics - */ - public static fromObject(object: { [k: string]: any }): opentelemetry.proto.metrics.v1.ResourceMetrics; - - /** - * Creates a plain object from a ResourceMetrics message. Also converts values to other types if specified. - * @param message ResourceMetrics - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: opentelemetry.proto.metrics.v1.ResourceMetrics, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this ResourceMetrics to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for ResourceMetrics - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a ScopeMetrics. */ - interface IScopeMetrics { - - /** ScopeMetrics scope */ - scope?: (opentelemetry.proto.common.v1.IInstrumentationScope|null); - - /** ScopeMetrics metrics */ - metrics?: (opentelemetry.proto.metrics.v1.IMetric[]|null); - - /** ScopeMetrics schemaUrl */ - schemaUrl?: (string|null); - } - - /** Represents a ScopeMetrics. */ - class ScopeMetrics implements IScopeMetrics { - - /** - * Constructs a new ScopeMetrics. - * @param [properties] Properties to set - */ - constructor(properties?: opentelemetry.proto.metrics.v1.IScopeMetrics); - - /** ScopeMetrics scope. */ - public scope?: (opentelemetry.proto.common.v1.IInstrumentationScope|null); - - /** ScopeMetrics metrics. */ - public metrics: opentelemetry.proto.metrics.v1.IMetric[]; - - /** ScopeMetrics schemaUrl. */ - public schemaUrl?: (string|null); - - /** - * Creates a new ScopeMetrics instance using the specified properties. - * @param [properties] Properties to set - * @returns ScopeMetrics instance - */ - public static create(properties?: opentelemetry.proto.metrics.v1.IScopeMetrics): opentelemetry.proto.metrics.v1.ScopeMetrics; - - /** - * Encodes the specified ScopeMetrics message. Does not implicitly {@link opentelemetry.proto.metrics.v1.ScopeMetrics.verify|verify} messages. - * @param message ScopeMetrics message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: opentelemetry.proto.metrics.v1.IScopeMetrics, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified ScopeMetrics message, length delimited. Does not implicitly {@link opentelemetry.proto.metrics.v1.ScopeMetrics.verify|verify} messages. - * @param message ScopeMetrics message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: opentelemetry.proto.metrics.v1.IScopeMetrics, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a ScopeMetrics message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns ScopeMetrics - * @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.metrics.v1.ScopeMetrics; - - /** - * Decodes a ScopeMetrics message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns ScopeMetrics - * @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.metrics.v1.ScopeMetrics; - - /** - * Verifies a ScopeMetrics 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 ScopeMetrics message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ScopeMetrics - */ - public static fromObject(object: { [k: string]: any }): opentelemetry.proto.metrics.v1.ScopeMetrics; - - /** - * Creates a plain object from a ScopeMetrics message. Also converts values to other types if specified. - * @param message ScopeMetrics - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: opentelemetry.proto.metrics.v1.ScopeMetrics, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this ScopeMetrics to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for ScopeMetrics - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a Metric. */ - interface IMetric { - - /** Metric name */ - name?: (string|null); - - /** Metric description */ - description?: (string|null); - - /** Metric unit */ - unit?: (string|null); - - /** Metric gauge */ - gauge?: (opentelemetry.proto.metrics.v1.IGauge|null); - - /** Metric sum */ - sum?: (opentelemetry.proto.metrics.v1.ISum|null); - - /** Metric histogram */ - histogram?: (opentelemetry.proto.metrics.v1.IHistogram|null); - - /** Metric exponentialHistogram */ - exponentialHistogram?: (opentelemetry.proto.metrics.v1.IExponentialHistogram|null); - - /** Metric summary */ - summary?: (opentelemetry.proto.metrics.v1.ISummary|null); - } - - /** Represents a Metric. */ - class Metric implements IMetric { - - /** - * Constructs a new Metric. - * @param [properties] Properties to set - */ - constructor(properties?: opentelemetry.proto.metrics.v1.IMetric); - - /** Metric name. */ - public name?: (string|null); - - /** Metric description. */ - public description?: (string|null); - - /** Metric unit. */ - public unit?: (string|null); - - /** Metric gauge. */ - public gauge?: (opentelemetry.proto.metrics.v1.IGauge|null); - - /** Metric sum. */ - public sum?: (opentelemetry.proto.metrics.v1.ISum|null); - - /** Metric histogram. */ - public histogram?: (opentelemetry.proto.metrics.v1.IHistogram|null); - - /** Metric exponentialHistogram. */ - public exponentialHistogram?: (opentelemetry.proto.metrics.v1.IExponentialHistogram|null); - - /** Metric summary. */ - public summary?: (opentelemetry.proto.metrics.v1.ISummary|null); - - /** Metric data. */ - public data?: ("gauge"|"sum"|"histogram"|"exponentialHistogram"|"summary"); - - /** - * Creates a new Metric instance using the specified properties. - * @param [properties] Properties to set - * @returns Metric instance - */ - public static create(properties?: opentelemetry.proto.metrics.v1.IMetric): opentelemetry.proto.metrics.v1.Metric; - - /** - * Encodes the specified Metric message. Does not implicitly {@link opentelemetry.proto.metrics.v1.Metric.verify|verify} messages. - * @param message Metric message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: opentelemetry.proto.metrics.v1.IMetric, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified Metric message, length delimited. Does not implicitly {@link opentelemetry.proto.metrics.v1.Metric.verify|verify} messages. - * @param message Metric message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: opentelemetry.proto.metrics.v1.IMetric, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a Metric message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns Metric - * @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.metrics.v1.Metric; - - /** - * Decodes a Metric message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns Metric - * @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.metrics.v1.Metric; - - /** - * Verifies a Metric 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 Metric message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns Metric - */ - public static fromObject(object: { [k: string]: any }): opentelemetry.proto.metrics.v1.Metric; - - /** - * Creates a plain object from a Metric message. Also converts values to other types if specified. - * @param message Metric - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: opentelemetry.proto.metrics.v1.Metric, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this Metric to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for Metric - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a Gauge. */ - interface IGauge { - - /** Gauge dataPoints */ - dataPoints?: (opentelemetry.proto.metrics.v1.INumberDataPoint[]|null); - } - - /** Represents a Gauge. */ - class Gauge implements IGauge { - - /** - * Constructs a new Gauge. - * @param [properties] Properties to set - */ - constructor(properties?: opentelemetry.proto.metrics.v1.IGauge); - - /** Gauge dataPoints. */ - public dataPoints: opentelemetry.proto.metrics.v1.INumberDataPoint[]; - - /** - * Creates a new Gauge instance using the specified properties. - * @param [properties] Properties to set - * @returns Gauge instance - */ - public static create(properties?: opentelemetry.proto.metrics.v1.IGauge): opentelemetry.proto.metrics.v1.Gauge; - - /** - * Encodes the specified Gauge message. Does not implicitly {@link opentelemetry.proto.metrics.v1.Gauge.verify|verify} messages. - * @param message Gauge message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: opentelemetry.proto.metrics.v1.IGauge, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified Gauge message, length delimited. Does not implicitly {@link opentelemetry.proto.metrics.v1.Gauge.verify|verify} messages. - * @param message Gauge message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: opentelemetry.proto.metrics.v1.IGauge, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a Gauge message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns Gauge - * @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.metrics.v1.Gauge; - - /** - * Decodes a Gauge message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns Gauge - * @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.metrics.v1.Gauge; - - /** - * Verifies a Gauge 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 Gauge message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns Gauge - */ - public static fromObject(object: { [k: string]: any }): opentelemetry.proto.metrics.v1.Gauge; - - /** - * Creates a plain object from a Gauge message. Also converts values to other types if specified. - * @param message Gauge - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: opentelemetry.proto.metrics.v1.Gauge, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this Gauge to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for Gauge - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a Sum. */ - interface ISum { - - /** Sum dataPoints */ - dataPoints?: (opentelemetry.proto.metrics.v1.INumberDataPoint[]|null); - - /** Sum aggregationTemporality */ - aggregationTemporality?: (opentelemetry.proto.metrics.v1.AggregationTemporality|null); - - /** Sum isMonotonic */ - isMonotonic?: (boolean|null); - } - - /** Represents a Sum. */ - class Sum implements ISum { - - /** - * Constructs a new Sum. - * @param [properties] Properties to set - */ - constructor(properties?: opentelemetry.proto.metrics.v1.ISum); - - /** Sum dataPoints. */ - public dataPoints: opentelemetry.proto.metrics.v1.INumberDataPoint[]; - - /** Sum aggregationTemporality. */ - public aggregationTemporality?: (opentelemetry.proto.metrics.v1.AggregationTemporality|null); - - /** Sum isMonotonic. */ - public isMonotonic?: (boolean|null); - - /** - * Creates a new Sum instance using the specified properties. - * @param [properties] Properties to set - * @returns Sum instance - */ - public static create(properties?: opentelemetry.proto.metrics.v1.ISum): opentelemetry.proto.metrics.v1.Sum; - - /** - * Encodes the specified Sum message. Does not implicitly {@link opentelemetry.proto.metrics.v1.Sum.verify|verify} messages. - * @param message Sum message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: opentelemetry.proto.metrics.v1.ISum, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified Sum message, length delimited. Does not implicitly {@link opentelemetry.proto.metrics.v1.Sum.verify|verify} messages. - * @param message Sum message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: opentelemetry.proto.metrics.v1.ISum, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a Sum message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns Sum - * @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.metrics.v1.Sum; - - /** - * Decodes a Sum message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns Sum - * @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.metrics.v1.Sum; - - /** - * Verifies a Sum 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 Sum message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns Sum - */ - public static fromObject(object: { [k: string]: any }): opentelemetry.proto.metrics.v1.Sum; - - /** - * Creates a plain object from a Sum message. Also converts values to other types if specified. - * @param message Sum - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: opentelemetry.proto.metrics.v1.Sum, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this Sum to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for Sum - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a Histogram. */ - interface IHistogram { - - /** Histogram dataPoints */ - dataPoints?: (opentelemetry.proto.metrics.v1.IHistogramDataPoint[]|null); - - /** Histogram aggregationTemporality */ - aggregationTemporality?: (opentelemetry.proto.metrics.v1.AggregationTemporality|null); - } - - /** Represents a Histogram. */ - class Histogram implements IHistogram { - - /** - * Constructs a new Histogram. - * @param [properties] Properties to set - */ - constructor(properties?: opentelemetry.proto.metrics.v1.IHistogram); - - /** Histogram dataPoints. */ - public dataPoints: opentelemetry.proto.metrics.v1.IHistogramDataPoint[]; - - /** Histogram aggregationTemporality. */ - public aggregationTemporality?: (opentelemetry.proto.metrics.v1.AggregationTemporality|null); - - /** - * Creates a new Histogram instance using the specified properties. - * @param [properties] Properties to set - * @returns Histogram instance - */ - public static create(properties?: opentelemetry.proto.metrics.v1.IHistogram): opentelemetry.proto.metrics.v1.Histogram; - - /** - * Encodes the specified Histogram message. Does not implicitly {@link opentelemetry.proto.metrics.v1.Histogram.verify|verify} messages. - * @param message Histogram message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: opentelemetry.proto.metrics.v1.IHistogram, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified Histogram message, length delimited. Does not implicitly {@link opentelemetry.proto.metrics.v1.Histogram.verify|verify} messages. - * @param message Histogram message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: opentelemetry.proto.metrics.v1.IHistogram, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a Histogram message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns Histogram - * @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.metrics.v1.Histogram; - - /** - * Decodes a Histogram message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns Histogram - * @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.metrics.v1.Histogram; - - /** - * Verifies a Histogram 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 Histogram message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns Histogram - */ - public static fromObject(object: { [k: string]: any }): opentelemetry.proto.metrics.v1.Histogram; - - /** - * Creates a plain object from a Histogram message. Also converts values to other types if specified. - * @param message Histogram - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: opentelemetry.proto.metrics.v1.Histogram, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this Histogram to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for Histogram - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an ExponentialHistogram. */ - interface IExponentialHistogram { - - /** ExponentialHistogram dataPoints */ - dataPoints?: (opentelemetry.proto.metrics.v1.IExponentialHistogramDataPoint[]|null); - - /** ExponentialHistogram aggregationTemporality */ - aggregationTemporality?: (opentelemetry.proto.metrics.v1.AggregationTemporality|null); - } - - /** Represents an ExponentialHistogram. */ - class ExponentialHistogram implements IExponentialHistogram { - - /** - * Constructs a new ExponentialHistogram. - * @param [properties] Properties to set - */ - constructor(properties?: opentelemetry.proto.metrics.v1.IExponentialHistogram); - - /** ExponentialHistogram dataPoints. */ - public dataPoints: opentelemetry.proto.metrics.v1.IExponentialHistogramDataPoint[]; - - /** ExponentialHistogram aggregationTemporality. */ - public aggregationTemporality?: (opentelemetry.proto.metrics.v1.AggregationTemporality|null); - - /** - * Creates a new ExponentialHistogram instance using the specified properties. - * @param [properties] Properties to set - * @returns ExponentialHistogram instance - */ - public static create(properties?: opentelemetry.proto.metrics.v1.IExponentialHistogram): opentelemetry.proto.metrics.v1.ExponentialHistogram; - - /** - * Encodes the specified ExponentialHistogram message. Does not implicitly {@link opentelemetry.proto.metrics.v1.ExponentialHistogram.verify|verify} messages. - * @param message ExponentialHistogram message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: opentelemetry.proto.metrics.v1.IExponentialHistogram, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified ExponentialHistogram message, length delimited. Does not implicitly {@link opentelemetry.proto.metrics.v1.ExponentialHistogram.verify|verify} messages. - * @param message ExponentialHistogram message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: opentelemetry.proto.metrics.v1.IExponentialHistogram, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes an ExponentialHistogram message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns ExponentialHistogram - * @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.metrics.v1.ExponentialHistogram; - - /** - * Decodes an ExponentialHistogram message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns ExponentialHistogram - * @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.metrics.v1.ExponentialHistogram; - - /** - * Verifies an ExponentialHistogram 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 ExponentialHistogram message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ExponentialHistogram - */ - public static fromObject(object: { [k: string]: any }): opentelemetry.proto.metrics.v1.ExponentialHistogram; - - /** - * Creates a plain object from an ExponentialHistogram message. Also converts values to other types if specified. - * @param message ExponentialHistogram - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: opentelemetry.proto.metrics.v1.ExponentialHistogram, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this ExponentialHistogram to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for ExponentialHistogram - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a Summary. */ - interface ISummary { - - /** Summary dataPoints */ - dataPoints?: (opentelemetry.proto.metrics.v1.ISummaryDataPoint[]|null); - } - - /** Represents a Summary. */ - class Summary implements ISummary { - - /** - * Constructs a new Summary. - * @param [properties] Properties to set - */ - constructor(properties?: opentelemetry.proto.metrics.v1.ISummary); - - /** Summary dataPoints. */ - public dataPoints: opentelemetry.proto.metrics.v1.ISummaryDataPoint[]; - - /** - * Creates a new Summary instance using the specified properties. - * @param [properties] Properties to set - * @returns Summary instance - */ - public static create(properties?: opentelemetry.proto.metrics.v1.ISummary): opentelemetry.proto.metrics.v1.Summary; - - /** - * Encodes the specified Summary message. Does not implicitly {@link opentelemetry.proto.metrics.v1.Summary.verify|verify} messages. - * @param message Summary message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: opentelemetry.proto.metrics.v1.ISummary, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified Summary message, length delimited. Does not implicitly {@link opentelemetry.proto.metrics.v1.Summary.verify|verify} messages. - * @param message Summary message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: opentelemetry.proto.metrics.v1.ISummary, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a Summary message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns Summary - * @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.metrics.v1.Summary; - - /** - * Decodes a Summary message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns Summary - * @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.metrics.v1.Summary; - - /** - * Verifies a Summary 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 Summary message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns Summary - */ - public static fromObject(object: { [k: string]: any }): opentelemetry.proto.metrics.v1.Summary; - - /** - * Creates a plain object from a Summary message. Also converts values to other types if specified. - * @param message Summary - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: opentelemetry.proto.metrics.v1.Summary, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this Summary to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for Summary - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** AggregationTemporality enum. */ - enum AggregationTemporality { - AGGREGATION_TEMPORALITY_UNSPECIFIED = 0, - AGGREGATION_TEMPORALITY_DELTA = 1, - AGGREGATION_TEMPORALITY_CUMULATIVE = 2 - } - - /** DataPointFlags enum. */ - enum DataPointFlags { - DATA_POINT_FLAGS_DO_NOT_USE = 0, - DATA_POINT_FLAGS_NO_RECORDED_VALUE_MASK = 1 - } - - /** Properties of a NumberDataPoint. */ - interface INumberDataPoint { - - /** NumberDataPoint attributes */ - attributes?: (opentelemetry.proto.common.v1.IKeyValue[]|null); - - /** NumberDataPoint startTimeUnixNano */ - startTimeUnixNano?: (number|Long|null); - - /** NumberDataPoint timeUnixNano */ - timeUnixNano?: (number|Long|null); - - /** NumberDataPoint asDouble */ - asDouble?: (number|null); - - /** NumberDataPoint asInt */ - asInt?: (number|Long|null); - - /** NumberDataPoint exemplars */ - exemplars?: (opentelemetry.proto.metrics.v1.IExemplar[]|null); - - /** NumberDataPoint flags */ - flags?: (number|null); - } - - /** Represents a NumberDataPoint. */ - class NumberDataPoint implements INumberDataPoint { - - /** - * Constructs a new NumberDataPoint. - * @param [properties] Properties to set - */ - constructor(properties?: opentelemetry.proto.metrics.v1.INumberDataPoint); - - /** NumberDataPoint attributes. */ - public attributes: opentelemetry.proto.common.v1.IKeyValue[]; - - /** NumberDataPoint startTimeUnixNano. */ - public startTimeUnixNano?: (number|Long|null); - - /** NumberDataPoint timeUnixNano. */ - public timeUnixNano?: (number|Long|null); - - /** NumberDataPoint asDouble. */ - public asDouble?: (number|null); - - /** NumberDataPoint asInt. */ - public asInt?: (number|Long|null); - - /** NumberDataPoint exemplars. */ - public exemplars: opentelemetry.proto.metrics.v1.IExemplar[]; - - /** NumberDataPoint flags. */ - public flags?: (number|null); - - /** NumberDataPoint value. */ - public value?: ("asDouble"|"asInt"); - - /** - * Creates a new NumberDataPoint instance using the specified properties. - * @param [properties] Properties to set - * @returns NumberDataPoint instance - */ - public static create(properties?: opentelemetry.proto.metrics.v1.INumberDataPoint): opentelemetry.proto.metrics.v1.NumberDataPoint; - - /** - * Encodes the specified NumberDataPoint message. Does not implicitly {@link opentelemetry.proto.metrics.v1.NumberDataPoint.verify|verify} messages. - * @param message NumberDataPoint message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: opentelemetry.proto.metrics.v1.INumberDataPoint, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified NumberDataPoint message, length delimited. Does not implicitly {@link opentelemetry.proto.metrics.v1.NumberDataPoint.verify|verify} messages. - * @param message NumberDataPoint message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: opentelemetry.proto.metrics.v1.INumberDataPoint, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a NumberDataPoint message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns NumberDataPoint - * @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.metrics.v1.NumberDataPoint; - - /** - * Decodes a NumberDataPoint message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns NumberDataPoint - * @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.metrics.v1.NumberDataPoint; - - /** - * Verifies a NumberDataPoint 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 NumberDataPoint message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns NumberDataPoint - */ - public static fromObject(object: { [k: string]: any }): opentelemetry.proto.metrics.v1.NumberDataPoint; - - /** - * Creates a plain object from a NumberDataPoint message. Also converts values to other types if specified. - * @param message NumberDataPoint - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: opentelemetry.proto.metrics.v1.NumberDataPoint, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this NumberDataPoint to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for NumberDataPoint - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a HistogramDataPoint. */ - interface IHistogramDataPoint { - - /** HistogramDataPoint attributes */ - attributes?: (opentelemetry.proto.common.v1.IKeyValue[]|null); - - /** HistogramDataPoint startTimeUnixNano */ - startTimeUnixNano?: (number|Long|null); - - /** HistogramDataPoint timeUnixNano */ - timeUnixNano?: (number|Long|null); - - /** HistogramDataPoint count */ - count?: (number|Long|null); - - /** HistogramDataPoint sum */ - sum?: (number|null); - - /** HistogramDataPoint bucketCounts */ - bucketCounts?: ((number|Long)[]|null); - - /** HistogramDataPoint explicitBounds */ - explicitBounds?: (number[]|null); - - /** HistogramDataPoint exemplars */ - exemplars?: (opentelemetry.proto.metrics.v1.IExemplar[]|null); - - /** HistogramDataPoint flags */ - flags?: (number|null); - - /** HistogramDataPoint min */ - min?: (number|null); - - /** HistogramDataPoint max */ - max?: (number|null); - } - - /** Represents a HistogramDataPoint. */ - class HistogramDataPoint implements IHistogramDataPoint { - - /** - * Constructs a new HistogramDataPoint. - * @param [properties] Properties to set - */ - constructor(properties?: opentelemetry.proto.metrics.v1.IHistogramDataPoint); - - /** HistogramDataPoint attributes. */ - public attributes: opentelemetry.proto.common.v1.IKeyValue[]; - - /** HistogramDataPoint startTimeUnixNano. */ - public startTimeUnixNano?: (number|Long|null); - - /** HistogramDataPoint timeUnixNano. */ - public timeUnixNano?: (number|Long|null); - - /** HistogramDataPoint count. */ - public count?: (number|Long|null); - - /** HistogramDataPoint sum. */ - public sum?: (number|null); - - /** HistogramDataPoint bucketCounts. */ - public bucketCounts: (number|Long)[]; - - /** HistogramDataPoint explicitBounds. */ - public explicitBounds: number[]; - - /** HistogramDataPoint exemplars. */ - public exemplars: opentelemetry.proto.metrics.v1.IExemplar[]; - - /** HistogramDataPoint flags. */ - public flags?: (number|null); - - /** HistogramDataPoint min. */ - public min?: (number|null); - - /** HistogramDataPoint max. */ - public max?: (number|null); - - /** HistogramDataPoint _sum. */ - public _sum?: "sum"; - - /** HistogramDataPoint _min. */ - public _min?: "min"; - - /** HistogramDataPoint _max. */ - public _max?: "max"; - - /** - * Creates a new HistogramDataPoint instance using the specified properties. - * @param [properties] Properties to set - * @returns HistogramDataPoint instance - */ - public static create(properties?: opentelemetry.proto.metrics.v1.IHistogramDataPoint): opentelemetry.proto.metrics.v1.HistogramDataPoint; - - /** - * Encodes the specified HistogramDataPoint message. Does not implicitly {@link opentelemetry.proto.metrics.v1.HistogramDataPoint.verify|verify} messages. - * @param message HistogramDataPoint message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: opentelemetry.proto.metrics.v1.IHistogramDataPoint, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified HistogramDataPoint message, length delimited. Does not implicitly {@link opentelemetry.proto.metrics.v1.HistogramDataPoint.verify|verify} messages. - * @param message HistogramDataPoint message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: opentelemetry.proto.metrics.v1.IHistogramDataPoint, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a HistogramDataPoint message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns HistogramDataPoint - * @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.metrics.v1.HistogramDataPoint; - - /** - * Decodes a HistogramDataPoint message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns HistogramDataPoint - * @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.metrics.v1.HistogramDataPoint; - - /** - * Verifies a HistogramDataPoint 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 HistogramDataPoint message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns HistogramDataPoint - */ - public static fromObject(object: { [k: string]: any }): opentelemetry.proto.metrics.v1.HistogramDataPoint; - - /** - * Creates a plain object from a HistogramDataPoint message. Also converts values to other types if specified. - * @param message HistogramDataPoint - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: opentelemetry.proto.metrics.v1.HistogramDataPoint, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this HistogramDataPoint to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for HistogramDataPoint - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an ExponentialHistogramDataPoint. */ - interface IExponentialHistogramDataPoint { - - /** ExponentialHistogramDataPoint attributes */ - attributes?: (opentelemetry.proto.common.v1.IKeyValue[]|null); - - /** ExponentialHistogramDataPoint startTimeUnixNano */ - startTimeUnixNano?: (number|Long|null); - - /** ExponentialHistogramDataPoint timeUnixNano */ - timeUnixNano?: (number|Long|null); - - /** ExponentialHistogramDataPoint count */ - count?: (number|Long|null); - - /** ExponentialHistogramDataPoint sum */ - sum?: (number|null); - - /** ExponentialHistogramDataPoint scale */ - scale?: (number|null); - - /** ExponentialHistogramDataPoint zeroCount */ - zeroCount?: (number|Long|null); - - /** ExponentialHistogramDataPoint positive */ - positive?: (opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.IBuckets|null); - - /** ExponentialHistogramDataPoint negative */ - negative?: (opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.IBuckets|null); - - /** ExponentialHistogramDataPoint flags */ - flags?: (number|null); - - /** ExponentialHistogramDataPoint exemplars */ - exemplars?: (opentelemetry.proto.metrics.v1.IExemplar[]|null); - - /** ExponentialHistogramDataPoint min */ - min?: (number|null); - - /** ExponentialHistogramDataPoint max */ - max?: (number|null); - - /** ExponentialHistogramDataPoint zeroThreshold */ - zeroThreshold?: (number|null); - } - - /** Represents an ExponentialHistogramDataPoint. */ - class ExponentialHistogramDataPoint implements IExponentialHistogramDataPoint { - - /** - * Constructs a new ExponentialHistogramDataPoint. - * @param [properties] Properties to set - */ - constructor(properties?: opentelemetry.proto.metrics.v1.IExponentialHistogramDataPoint); - - /** ExponentialHistogramDataPoint attributes. */ - public attributes: opentelemetry.proto.common.v1.IKeyValue[]; - - /** ExponentialHistogramDataPoint startTimeUnixNano. */ - public startTimeUnixNano?: (number|Long|null); - - /** ExponentialHistogramDataPoint timeUnixNano. */ - public timeUnixNano?: (number|Long|null); - - /** ExponentialHistogramDataPoint count. */ - public count?: (number|Long|null); - - /** ExponentialHistogramDataPoint sum. */ - public sum?: (number|null); - - /** ExponentialHistogramDataPoint scale. */ - public scale?: (number|null); - - /** ExponentialHistogramDataPoint zeroCount. */ - public zeroCount?: (number|Long|null); - - /** ExponentialHistogramDataPoint positive. */ - public positive?: (opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.IBuckets|null); - - /** ExponentialHistogramDataPoint negative. */ - public negative?: (opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.IBuckets|null); - - /** ExponentialHistogramDataPoint flags. */ - public flags?: (number|null); - - /** ExponentialHistogramDataPoint exemplars. */ - public exemplars: opentelemetry.proto.metrics.v1.IExemplar[]; - - /** ExponentialHistogramDataPoint min. */ - public min?: (number|null); - - /** ExponentialHistogramDataPoint max. */ - public max?: (number|null); - - /** ExponentialHistogramDataPoint zeroThreshold. */ - public zeroThreshold?: (number|null); - - /** ExponentialHistogramDataPoint _sum. */ - public _sum?: "sum"; - - /** ExponentialHistogramDataPoint _min. */ - public _min?: "min"; - - /** ExponentialHistogramDataPoint _max. */ - public _max?: "max"; - - /** - * Creates a new ExponentialHistogramDataPoint instance using the specified properties. - * @param [properties] Properties to set - * @returns ExponentialHistogramDataPoint instance - */ - public static create(properties?: opentelemetry.proto.metrics.v1.IExponentialHistogramDataPoint): opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint; - - /** - * Encodes the specified ExponentialHistogramDataPoint message. Does not implicitly {@link opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.verify|verify} messages. - * @param message ExponentialHistogramDataPoint message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: opentelemetry.proto.metrics.v1.IExponentialHistogramDataPoint, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified ExponentialHistogramDataPoint message, length delimited. Does not implicitly {@link opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.verify|verify} messages. - * @param message ExponentialHistogramDataPoint message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: opentelemetry.proto.metrics.v1.IExponentialHistogramDataPoint, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes an ExponentialHistogramDataPoint message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns ExponentialHistogramDataPoint - * @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.metrics.v1.ExponentialHistogramDataPoint; - - /** - * Decodes an ExponentialHistogramDataPoint message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns ExponentialHistogramDataPoint - * @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.metrics.v1.ExponentialHistogramDataPoint; - - /** - * Verifies an ExponentialHistogramDataPoint 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 ExponentialHistogramDataPoint message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ExponentialHistogramDataPoint - */ - public static fromObject(object: { [k: string]: any }): opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint; - - /** - * Creates a plain object from an ExponentialHistogramDataPoint message. Also converts values to other types if specified. - * @param message ExponentialHistogramDataPoint - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this ExponentialHistogramDataPoint to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for ExponentialHistogramDataPoint - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - namespace ExponentialHistogramDataPoint { - - /** Properties of a Buckets. */ - interface IBuckets { - - /** Buckets offset */ - offset?: (number|null); - - /** Buckets bucketCounts */ - bucketCounts?: ((number|Long)[]|null); - } - - /** Represents a Buckets. */ - class Buckets implements IBuckets { - - /** - * Constructs a new Buckets. - * @param [properties] Properties to set - */ - constructor(properties?: opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.IBuckets); - - /** Buckets offset. */ - public offset?: (number|null); - - /** Buckets bucketCounts. */ - public bucketCounts: (number|Long)[]; - - /** - * Creates a new Buckets instance using the specified properties. - * @param [properties] Properties to set - * @returns Buckets instance - */ - public static create(properties?: opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.IBuckets): opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets; - - /** - * Encodes the specified Buckets message. Does not implicitly {@link opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets.verify|verify} messages. - * @param message Buckets message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.IBuckets, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified Buckets message, length delimited. Does not implicitly {@link opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets.verify|verify} messages. - * @param message Buckets message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.IBuckets, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a Buckets message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns Buckets - * @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.metrics.v1.ExponentialHistogramDataPoint.Buckets; - - /** - * Decodes a Buckets message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns Buckets - * @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.metrics.v1.ExponentialHistogramDataPoint.Buckets; - - /** - * Verifies a Buckets 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 Buckets message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns Buckets - */ - public static fromObject(object: { [k: string]: any }): opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets; - - /** - * Creates a plain object from a Buckets message. Also converts values to other types if specified. - * @param message Buckets - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this Buckets to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for Buckets - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - } - - /** Properties of a SummaryDataPoint. */ - interface ISummaryDataPoint { - - /** SummaryDataPoint attributes */ - attributes?: (opentelemetry.proto.common.v1.IKeyValue[]|null); - - /** SummaryDataPoint startTimeUnixNano */ - startTimeUnixNano?: (number|Long|null); - - /** SummaryDataPoint timeUnixNano */ - timeUnixNano?: (number|Long|null); - - /** SummaryDataPoint count */ - count?: (number|Long|null); - - /** SummaryDataPoint sum */ - sum?: (number|null); - - /** SummaryDataPoint quantileValues */ - quantileValues?: (opentelemetry.proto.metrics.v1.SummaryDataPoint.IValueAtQuantile[]|null); - - /** SummaryDataPoint flags */ - flags?: (number|null); - } - - /** Represents a SummaryDataPoint. */ - class SummaryDataPoint implements ISummaryDataPoint { - - /** - * Constructs a new SummaryDataPoint. - * @param [properties] Properties to set - */ - constructor(properties?: opentelemetry.proto.metrics.v1.ISummaryDataPoint); - - /** SummaryDataPoint attributes. */ - public attributes: opentelemetry.proto.common.v1.IKeyValue[]; - - /** SummaryDataPoint startTimeUnixNano. */ - public startTimeUnixNano?: (number|Long|null); - - /** SummaryDataPoint timeUnixNano. */ - public timeUnixNano?: (number|Long|null); - - /** SummaryDataPoint count. */ - public count?: (number|Long|null); - - /** SummaryDataPoint sum. */ - public sum?: (number|null); - - /** SummaryDataPoint quantileValues. */ - public quantileValues: opentelemetry.proto.metrics.v1.SummaryDataPoint.IValueAtQuantile[]; - - /** SummaryDataPoint flags. */ - public flags?: (number|null); - - /** - * Creates a new SummaryDataPoint instance using the specified properties. - * @param [properties] Properties to set - * @returns SummaryDataPoint instance - */ - public static create(properties?: opentelemetry.proto.metrics.v1.ISummaryDataPoint): opentelemetry.proto.metrics.v1.SummaryDataPoint; - - /** - * Encodes the specified SummaryDataPoint message. Does not implicitly {@link opentelemetry.proto.metrics.v1.SummaryDataPoint.verify|verify} messages. - * @param message SummaryDataPoint message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: opentelemetry.proto.metrics.v1.ISummaryDataPoint, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SummaryDataPoint message, length delimited. Does not implicitly {@link opentelemetry.proto.metrics.v1.SummaryDataPoint.verify|verify} messages. - * @param message SummaryDataPoint message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: opentelemetry.proto.metrics.v1.ISummaryDataPoint, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SummaryDataPoint message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SummaryDataPoint - * @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.metrics.v1.SummaryDataPoint; - - /** - * Decodes a SummaryDataPoint message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SummaryDataPoint - * @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.metrics.v1.SummaryDataPoint; - - /** - * Verifies a SummaryDataPoint 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 SummaryDataPoint message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SummaryDataPoint - */ - public static fromObject(object: { [k: string]: any }): opentelemetry.proto.metrics.v1.SummaryDataPoint; - - /** - * Creates a plain object from a SummaryDataPoint message. Also converts values to other types if specified. - * @param message SummaryDataPoint - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: opentelemetry.proto.metrics.v1.SummaryDataPoint, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SummaryDataPoint to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SummaryDataPoint - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - namespace SummaryDataPoint { - - /** Properties of a ValueAtQuantile. */ - interface IValueAtQuantile { - - /** ValueAtQuantile quantile */ - quantile?: (number|null); - - /** ValueAtQuantile value */ - value?: (number|null); - } - - /** Represents a ValueAtQuantile. */ - class ValueAtQuantile implements IValueAtQuantile { - - /** - * Constructs a new ValueAtQuantile. - * @param [properties] Properties to set - */ - constructor(properties?: opentelemetry.proto.metrics.v1.SummaryDataPoint.IValueAtQuantile); - - /** ValueAtQuantile quantile. */ - public quantile?: (number|null); - - /** ValueAtQuantile value. */ - public value?: (number|null); - - /** - * Creates a new ValueAtQuantile instance using the specified properties. - * @param [properties] Properties to set - * @returns ValueAtQuantile instance - */ - public static create(properties?: opentelemetry.proto.metrics.v1.SummaryDataPoint.IValueAtQuantile): opentelemetry.proto.metrics.v1.SummaryDataPoint.ValueAtQuantile; - - /** - * Encodes the specified ValueAtQuantile message. Does not implicitly {@link opentelemetry.proto.metrics.v1.SummaryDataPoint.ValueAtQuantile.verify|verify} messages. - * @param message ValueAtQuantile message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: opentelemetry.proto.metrics.v1.SummaryDataPoint.IValueAtQuantile, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified ValueAtQuantile message, length delimited. Does not implicitly {@link opentelemetry.proto.metrics.v1.SummaryDataPoint.ValueAtQuantile.verify|verify} messages. - * @param message ValueAtQuantile message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: opentelemetry.proto.metrics.v1.SummaryDataPoint.IValueAtQuantile, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a ValueAtQuantile message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns ValueAtQuantile - * @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.metrics.v1.SummaryDataPoint.ValueAtQuantile; - - /** - * Decodes a ValueAtQuantile message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns ValueAtQuantile - * @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.metrics.v1.SummaryDataPoint.ValueAtQuantile; - - /** - * Verifies a ValueAtQuantile 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 ValueAtQuantile message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ValueAtQuantile - */ - public static fromObject(object: { [k: string]: any }): opentelemetry.proto.metrics.v1.SummaryDataPoint.ValueAtQuantile; - - /** - * Creates a plain object from a ValueAtQuantile message. Also converts values to other types if specified. - * @param message ValueAtQuantile - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: opentelemetry.proto.metrics.v1.SummaryDataPoint.ValueAtQuantile, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this ValueAtQuantile to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for ValueAtQuantile - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - } - - /** Properties of an Exemplar. */ - interface IExemplar { - - /** Exemplar filteredAttributes */ - filteredAttributes?: (opentelemetry.proto.common.v1.IKeyValue[]|null); - - /** Exemplar timeUnixNano */ - timeUnixNano?: (number|Long|null); - - /** Exemplar asDouble */ - asDouble?: (number|null); - - /** Exemplar asInt */ - asInt?: (number|Long|null); - - /** Exemplar spanId */ - spanId?: (Uint8Array|null); - - /** Exemplar traceId */ - traceId?: (Uint8Array|null); - } - - /** Represents an Exemplar. */ - class Exemplar implements IExemplar { - - /** - * Constructs a new Exemplar. - * @param [properties] Properties to set - */ - constructor(properties?: opentelemetry.proto.metrics.v1.IExemplar); - - /** Exemplar filteredAttributes. */ - public filteredAttributes: opentelemetry.proto.common.v1.IKeyValue[]; - - /** Exemplar timeUnixNano. */ - public timeUnixNano?: (number|Long|null); - - /** Exemplar asDouble. */ - public asDouble?: (number|null); - - /** Exemplar asInt. */ - public asInt?: (number|Long|null); - - /** Exemplar spanId. */ - public spanId?: (Uint8Array|null); - - /** Exemplar traceId. */ - public traceId?: (Uint8Array|null); - - /** Exemplar value. */ - public value?: ("asDouble"|"asInt"); - - /** - * Creates a new Exemplar instance using the specified properties. - * @param [properties] Properties to set - * @returns Exemplar instance - */ - public static create(properties?: opentelemetry.proto.metrics.v1.IExemplar): opentelemetry.proto.metrics.v1.Exemplar; - - /** - * Encodes the specified Exemplar message. Does not implicitly {@link opentelemetry.proto.metrics.v1.Exemplar.verify|verify} messages. - * @param message Exemplar message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: opentelemetry.proto.metrics.v1.IExemplar, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified Exemplar message, length delimited. Does not implicitly {@link opentelemetry.proto.metrics.v1.Exemplar.verify|verify} messages. - * @param message Exemplar message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: opentelemetry.proto.metrics.v1.IExemplar, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes an Exemplar message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns Exemplar - * @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.metrics.v1.Exemplar; - - /** - * Decodes an Exemplar message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns Exemplar - * @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.metrics.v1.Exemplar; - - /** - * Verifies an Exemplar 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 Exemplar message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns Exemplar - */ - public static fromObject(object: { [k: string]: any }): opentelemetry.proto.metrics.v1.Exemplar; - - /** - * Creates a plain object from an Exemplar message. Also converts values to other types if specified. - * @param message Exemplar - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: opentelemetry.proto.metrics.v1.Exemplar, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this Exemplar to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for Exemplar - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - } - } - - /** Namespace logs. */ - namespace logs { - - /** Namespace v1. */ - namespace v1 { - - /** Properties of a LogsData. */ - interface ILogsData { - - /** LogsData resourceLogs */ - resourceLogs?: (opentelemetry.proto.logs.v1.IResourceLogs[]|null); - } - - /** Represents a LogsData. */ - class LogsData implements ILogsData { - - /** - * Constructs a new LogsData. - * @param [properties] Properties to set - */ - constructor(properties?: opentelemetry.proto.logs.v1.ILogsData); - - /** LogsData resourceLogs. */ - public resourceLogs: opentelemetry.proto.logs.v1.IResourceLogs[]; - - /** - * Creates a new LogsData instance using the specified properties. - * @param [properties] Properties to set - * @returns LogsData instance - */ - public static create(properties?: opentelemetry.proto.logs.v1.ILogsData): opentelemetry.proto.logs.v1.LogsData; - - /** - * Encodes the specified LogsData message. Does not implicitly {@link opentelemetry.proto.logs.v1.LogsData.verify|verify} messages. - * @param message LogsData message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: opentelemetry.proto.logs.v1.ILogsData, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified LogsData message, length delimited. Does not implicitly {@link opentelemetry.proto.logs.v1.LogsData.verify|verify} messages. - * @param message LogsData message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: opentelemetry.proto.logs.v1.ILogsData, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a LogsData message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns LogsData - * @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.logs.v1.LogsData; - - /** - * Decodes a LogsData message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns LogsData - * @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.logs.v1.LogsData; - - /** - * Verifies a LogsData 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 LogsData message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns LogsData - */ - public static fromObject(object: { [k: string]: any }): opentelemetry.proto.logs.v1.LogsData; - - /** - * Creates a plain object from a LogsData message. Also converts values to other types if specified. - * @param message LogsData - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: opentelemetry.proto.logs.v1.LogsData, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this LogsData to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for LogsData - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a ResourceLogs. */ - interface IResourceLogs { - - /** ResourceLogs resource */ - resource?: (opentelemetry.proto.resource.v1.IResource|null); - - /** ResourceLogs scopeLogs */ - scopeLogs?: (opentelemetry.proto.logs.v1.IScopeLogs[]|null); - - /** ResourceLogs schemaUrl */ - schemaUrl?: (string|null); - } - - /** Represents a ResourceLogs. */ - class ResourceLogs implements IResourceLogs { - - /** - * Constructs a new ResourceLogs. - * @param [properties] Properties to set - */ - constructor(properties?: opentelemetry.proto.logs.v1.IResourceLogs); - - /** ResourceLogs resource. */ - public resource?: (opentelemetry.proto.resource.v1.IResource|null); - - /** ResourceLogs scopeLogs. */ - public scopeLogs: opentelemetry.proto.logs.v1.IScopeLogs[]; - - /** ResourceLogs schemaUrl. */ - public schemaUrl?: (string|null); - - /** - * Creates a new ResourceLogs instance using the specified properties. - * @param [properties] Properties to set - * @returns ResourceLogs instance - */ - public static create(properties?: opentelemetry.proto.logs.v1.IResourceLogs): opentelemetry.proto.logs.v1.ResourceLogs; - - /** - * Encodes the specified ResourceLogs message. Does not implicitly {@link opentelemetry.proto.logs.v1.ResourceLogs.verify|verify} messages. - * @param message ResourceLogs message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: opentelemetry.proto.logs.v1.IResourceLogs, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified ResourceLogs message, length delimited. Does not implicitly {@link opentelemetry.proto.logs.v1.ResourceLogs.verify|verify} messages. - * @param message ResourceLogs message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: opentelemetry.proto.logs.v1.IResourceLogs, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a ResourceLogs message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns ResourceLogs - * @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.logs.v1.ResourceLogs; - - /** - * Decodes a ResourceLogs message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns ResourceLogs - * @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.logs.v1.ResourceLogs; - - /** - * Verifies a ResourceLogs 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 ResourceLogs message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ResourceLogs - */ - public static fromObject(object: { [k: string]: any }): opentelemetry.proto.logs.v1.ResourceLogs; - - /** - * Creates a plain object from a ResourceLogs message. Also converts values to other types if specified. - * @param message ResourceLogs - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: opentelemetry.proto.logs.v1.ResourceLogs, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this ResourceLogs to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for ResourceLogs - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a ScopeLogs. */ - interface IScopeLogs { - - /** ScopeLogs scope */ - scope?: (opentelemetry.proto.common.v1.IInstrumentationScope|null); - - /** ScopeLogs logRecords */ - logRecords?: (opentelemetry.proto.logs.v1.ILogRecord[]|null); - - /** ScopeLogs schemaUrl */ - schemaUrl?: (string|null); - } - - /** Represents a ScopeLogs. */ - class ScopeLogs implements IScopeLogs { - - /** - * Constructs a new ScopeLogs. - * @param [properties] Properties to set - */ - constructor(properties?: opentelemetry.proto.logs.v1.IScopeLogs); - - /** ScopeLogs scope. */ - public scope?: (opentelemetry.proto.common.v1.IInstrumentationScope|null); - - /** ScopeLogs logRecords. */ - public logRecords: opentelemetry.proto.logs.v1.ILogRecord[]; - - /** ScopeLogs schemaUrl. */ - public schemaUrl?: (string|null); - - /** - * Creates a new ScopeLogs instance using the specified properties. - * @param [properties] Properties to set - * @returns ScopeLogs instance - */ - public static create(properties?: opentelemetry.proto.logs.v1.IScopeLogs): opentelemetry.proto.logs.v1.ScopeLogs; - - /** - * Encodes the specified ScopeLogs message. Does not implicitly {@link opentelemetry.proto.logs.v1.ScopeLogs.verify|verify} messages. - * @param message ScopeLogs message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: opentelemetry.proto.logs.v1.IScopeLogs, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified ScopeLogs message, length delimited. Does not implicitly {@link opentelemetry.proto.logs.v1.ScopeLogs.verify|verify} messages. - * @param message ScopeLogs message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: opentelemetry.proto.logs.v1.IScopeLogs, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a ScopeLogs message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns ScopeLogs - * @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.logs.v1.ScopeLogs; - - /** - * Decodes a ScopeLogs message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns ScopeLogs - * @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.logs.v1.ScopeLogs; - - /** - * Verifies a ScopeLogs 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 ScopeLogs message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ScopeLogs - */ - public static fromObject(object: { [k: string]: any }): opentelemetry.proto.logs.v1.ScopeLogs; - - /** - * Creates a plain object from a ScopeLogs message. Also converts values to other types if specified. - * @param message ScopeLogs - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: opentelemetry.proto.logs.v1.ScopeLogs, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this ScopeLogs to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for ScopeLogs - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** SeverityNumber enum. */ - enum SeverityNumber { - SEVERITY_NUMBER_UNSPECIFIED = 0, - SEVERITY_NUMBER_TRACE = 1, - SEVERITY_NUMBER_TRACE2 = 2, - SEVERITY_NUMBER_TRACE3 = 3, - SEVERITY_NUMBER_TRACE4 = 4, - SEVERITY_NUMBER_DEBUG = 5, - SEVERITY_NUMBER_DEBUG2 = 6, - SEVERITY_NUMBER_DEBUG3 = 7, - SEVERITY_NUMBER_DEBUG4 = 8, - SEVERITY_NUMBER_INFO = 9, - SEVERITY_NUMBER_INFO2 = 10, - SEVERITY_NUMBER_INFO3 = 11, - SEVERITY_NUMBER_INFO4 = 12, - SEVERITY_NUMBER_WARN = 13, - SEVERITY_NUMBER_WARN2 = 14, - SEVERITY_NUMBER_WARN3 = 15, - SEVERITY_NUMBER_WARN4 = 16, - SEVERITY_NUMBER_ERROR = 17, - SEVERITY_NUMBER_ERROR2 = 18, - SEVERITY_NUMBER_ERROR3 = 19, - SEVERITY_NUMBER_ERROR4 = 20, - SEVERITY_NUMBER_FATAL = 21, - SEVERITY_NUMBER_FATAL2 = 22, - SEVERITY_NUMBER_FATAL3 = 23, - SEVERITY_NUMBER_FATAL4 = 24 - } - - /** LogRecordFlags enum. */ - enum LogRecordFlags { - LOG_RECORD_FLAGS_DO_NOT_USE = 0, - LOG_RECORD_FLAGS_TRACE_FLAGS_MASK = 255 - } - - /** Properties of a LogRecord. */ - interface ILogRecord { - - /** LogRecord timeUnixNano */ - timeUnixNano?: (number|Long|null); - - /** LogRecord observedTimeUnixNano */ - observedTimeUnixNano?: (number|Long|null); - - /** LogRecord severityNumber */ - severityNumber?: (opentelemetry.proto.logs.v1.SeverityNumber|null); - - /** LogRecord severityText */ - severityText?: (string|null); - - /** LogRecord body */ - body?: (opentelemetry.proto.common.v1.IAnyValue|null); - - /** LogRecord attributes */ - attributes?: (opentelemetry.proto.common.v1.IKeyValue[]|null); - - /** LogRecord droppedAttributesCount */ - droppedAttributesCount?: (number|null); - - /** LogRecord flags */ - flags?: (number|null); - - /** LogRecord traceId */ - traceId?: (Uint8Array|null); - - /** LogRecord spanId */ - spanId?: (Uint8Array|null); - } - - /** Represents a LogRecord. */ - class LogRecord implements ILogRecord { - - /** - * Constructs a new LogRecord. - * @param [properties] Properties to set - */ - constructor(properties?: opentelemetry.proto.logs.v1.ILogRecord); - - /** LogRecord timeUnixNano. */ - public timeUnixNano?: (number|Long|null); - - /** LogRecord observedTimeUnixNano. */ - public observedTimeUnixNano?: (number|Long|null); - - /** LogRecord severityNumber. */ - public severityNumber?: (opentelemetry.proto.logs.v1.SeverityNumber|null); - - /** LogRecord severityText. */ - public severityText?: (string|null); - - /** LogRecord body. */ - public body?: (opentelemetry.proto.common.v1.IAnyValue|null); - - /** LogRecord attributes. */ - public attributes: opentelemetry.proto.common.v1.IKeyValue[]; - - /** LogRecord droppedAttributesCount. */ - public droppedAttributesCount?: (number|null); - - /** LogRecord flags. */ - public flags?: (number|null); - - /** LogRecord traceId. */ - public traceId?: (Uint8Array|null); - - /** LogRecord spanId. */ - public spanId?: (Uint8Array|null); - - /** - * Creates a new LogRecord instance using the specified properties. - * @param [properties] Properties to set - * @returns LogRecord instance - */ - public static create(properties?: opentelemetry.proto.logs.v1.ILogRecord): opentelemetry.proto.logs.v1.LogRecord; - - /** - * Encodes the specified LogRecord message. Does not implicitly {@link opentelemetry.proto.logs.v1.LogRecord.verify|verify} messages. - * @param message LogRecord message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: opentelemetry.proto.logs.v1.ILogRecord, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified LogRecord message, length delimited. Does not implicitly {@link opentelemetry.proto.logs.v1.LogRecord.verify|verify} messages. - * @param message LogRecord message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: opentelemetry.proto.logs.v1.ILogRecord, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a LogRecord message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns LogRecord - * @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.logs.v1.LogRecord; - - /** - * Decodes a LogRecord message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns LogRecord - * @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.logs.v1.LogRecord; - - /** - * Verifies a LogRecord 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 LogRecord message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns LogRecord - */ - public static fromObject(object: { [k: string]: any }): opentelemetry.proto.logs.v1.LogRecord; - - /** - * Creates a plain object from a LogRecord message. Also converts values to other types if specified. - * @param message LogRecord - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: opentelemetry.proto.logs.v1.LogRecord, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this LogRecord to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for LogRecord - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - } - } - } -} diff --git a/experimental/packages/otlp-grpc-exporter-base/src/generated/root.js b/experimental/packages/otlp-grpc-exporter-base/src/generated/root.js deleted file mode 100644 index 9cba727456..0000000000 --- a/experimental/packages/otlp-grpc-exporter-base/src/generated/root.js +++ /dev/null @@ -1,13574 +0,0 @@ -/*eslint-disable block-scoped-var, id-length, no-control-regex, no-magic-numbers, no-prototype-builtins, no-redeclare, no-shadow, no-var, sort-vars*/ -"use strict"; - -var $protobuf = require("protobufjs/minimal"); - -// Common aliases -var $Reader = $protobuf.Reader, $Writer = $protobuf.Writer, $util = $protobuf.util; - -// Exported root namespace -var $root = $protobuf.roots["default"] || ($protobuf.roots["default"] = {}); - -$root.opentelemetry = (function() { - - /** - * Namespace opentelemetry. - * @exports opentelemetry - * @namespace - */ - var opentelemetry = {}; - - opentelemetry.proto = (function() { - - /** - * Namespace proto. - * @memberof opentelemetry - * @namespace - */ - var proto = {}; - - proto.common = (function() { - - /** - * Namespace common. - * @memberof opentelemetry.proto - * @namespace - */ - var common = {}; - - common.v1 = (function() { - - /** - * Namespace v1. - * @memberof opentelemetry.proto.common - * @namespace - */ - var v1 = {}; - - v1.AnyValue = (function() { - - /** - * Properties of an AnyValue. - * @memberof opentelemetry.proto.common.v1 - * @interface IAnyValue - * @property {string|null} [stringValue] AnyValue stringValue - * @property {boolean|null} [boolValue] AnyValue boolValue - * @property {number|Long|null} [intValue] AnyValue intValue - * @property {number|null} [doubleValue] AnyValue doubleValue - * @property {opentelemetry.proto.common.v1.IArrayValue|null} [arrayValue] AnyValue arrayValue - * @property {opentelemetry.proto.common.v1.IKeyValueList|null} [kvlistValue] AnyValue kvlistValue - * @property {Uint8Array|null} [bytesValue] AnyValue bytesValue - */ - - /** - * Constructs a new AnyValue. - * @memberof opentelemetry.proto.common.v1 - * @classdesc Represents an AnyValue. - * @implements IAnyValue - * @constructor - * @param {opentelemetry.proto.common.v1.IAnyValue=} [properties] Properties to set - */ - function AnyValue(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * AnyValue stringValue. - * @member {string|null|undefined} stringValue - * @memberof opentelemetry.proto.common.v1.AnyValue - * @instance - */ - AnyValue.prototype.stringValue = null; - - /** - * AnyValue boolValue. - * @member {boolean|null|undefined} boolValue - * @memberof opentelemetry.proto.common.v1.AnyValue - * @instance - */ - AnyValue.prototype.boolValue = null; - - /** - * AnyValue intValue. - * @member {number|Long|null|undefined} intValue - * @memberof opentelemetry.proto.common.v1.AnyValue - * @instance - */ - AnyValue.prototype.intValue = null; - - /** - * AnyValue doubleValue. - * @member {number|null|undefined} doubleValue - * @memberof opentelemetry.proto.common.v1.AnyValue - * @instance - */ - AnyValue.prototype.doubleValue = null; - - /** - * AnyValue arrayValue. - * @member {opentelemetry.proto.common.v1.IArrayValue|null|undefined} arrayValue - * @memberof opentelemetry.proto.common.v1.AnyValue - * @instance - */ - AnyValue.prototype.arrayValue = null; - - /** - * AnyValue kvlistValue. - * @member {opentelemetry.proto.common.v1.IKeyValueList|null|undefined} kvlistValue - * @memberof opentelemetry.proto.common.v1.AnyValue - * @instance - */ - AnyValue.prototype.kvlistValue = null; - - /** - * AnyValue bytesValue. - * @member {Uint8Array|null|undefined} bytesValue - * @memberof opentelemetry.proto.common.v1.AnyValue - * @instance - */ - AnyValue.prototype.bytesValue = null; - - // OneOf field names bound to virtual getters and setters - var $oneOfFields; - - /** - * AnyValue value. - * @member {"stringValue"|"boolValue"|"intValue"|"doubleValue"|"arrayValue"|"kvlistValue"|"bytesValue"|undefined} value - * @memberof opentelemetry.proto.common.v1.AnyValue - * @instance - */ - Object.defineProperty(AnyValue.prototype, "value", { - get: $util.oneOfGetter($oneOfFields = ["stringValue", "boolValue", "intValue", "doubleValue", "arrayValue", "kvlistValue", "bytesValue"]), - set: $util.oneOfSetter($oneOfFields) - }); - - /** - * Creates a new AnyValue instance using the specified properties. - * @function create - * @memberof opentelemetry.proto.common.v1.AnyValue - * @static - * @param {opentelemetry.proto.common.v1.IAnyValue=} [properties] Properties to set - * @returns {opentelemetry.proto.common.v1.AnyValue} AnyValue instance - */ - AnyValue.create = function create(properties) { - return new AnyValue(properties); - }; - - /** - * Encodes the specified AnyValue message. Does not implicitly {@link opentelemetry.proto.common.v1.AnyValue.verify|verify} messages. - * @function encode - * @memberof opentelemetry.proto.common.v1.AnyValue - * @static - * @param {opentelemetry.proto.common.v1.IAnyValue} message AnyValue message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - AnyValue.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.stringValue != null && Object.hasOwnProperty.call(message, "stringValue")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.stringValue); - if (message.boolValue != null && Object.hasOwnProperty.call(message, "boolValue")) - writer.uint32(/* id 2, wireType 0 =*/16).bool(message.boolValue); - if (message.intValue != null && Object.hasOwnProperty.call(message, "intValue")) - writer.uint32(/* id 3, wireType 0 =*/24).int64(message.intValue); - if (message.doubleValue != null && Object.hasOwnProperty.call(message, "doubleValue")) - writer.uint32(/* id 4, wireType 1 =*/33).double(message.doubleValue); - if (message.arrayValue != null && Object.hasOwnProperty.call(message, "arrayValue")) - $root.opentelemetry.proto.common.v1.ArrayValue.encode(message.arrayValue, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); - if (message.kvlistValue != null && Object.hasOwnProperty.call(message, "kvlistValue")) - $root.opentelemetry.proto.common.v1.KeyValueList.encode(message.kvlistValue, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); - if (message.bytesValue != null && Object.hasOwnProperty.call(message, "bytesValue")) - writer.uint32(/* id 7, wireType 2 =*/58).bytes(message.bytesValue); - return writer; - }; - - /** - * Encodes the specified AnyValue message, length delimited. Does not implicitly {@link opentelemetry.proto.common.v1.AnyValue.verify|verify} messages. - * @function encodeDelimited - * @memberof opentelemetry.proto.common.v1.AnyValue - * @static - * @param {opentelemetry.proto.common.v1.IAnyValue} message AnyValue message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - AnyValue.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an AnyValue message from the specified reader or buffer. - * @function decode - * @memberof opentelemetry.proto.common.v1.AnyValue - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {opentelemetry.proto.common.v1.AnyValue} AnyValue - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - AnyValue.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.opentelemetry.proto.common.v1.AnyValue(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.stringValue = reader.string(); - break; - } - case 2: { - message.boolValue = reader.bool(); - break; - } - case 3: { - message.intValue = reader.int64(); - break; - } - case 4: { - message.doubleValue = reader.double(); - break; - } - case 5: { - message.arrayValue = $root.opentelemetry.proto.common.v1.ArrayValue.decode(reader, reader.uint32()); - break; - } - case 6: { - message.kvlistValue = $root.opentelemetry.proto.common.v1.KeyValueList.decode(reader, reader.uint32()); - break; - } - case 7: { - message.bytesValue = reader.bytes(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an AnyValue message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof opentelemetry.proto.common.v1.AnyValue - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {opentelemetry.proto.common.v1.AnyValue} AnyValue - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - AnyValue.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an AnyValue message. - * @function verify - * @memberof opentelemetry.proto.common.v1.AnyValue - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - AnyValue.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - var properties = {}; - if (message.stringValue != null && message.hasOwnProperty("stringValue")) { - properties.value = 1; - if (!$util.isString(message.stringValue)) - return "stringValue: string expected"; - } - if (message.boolValue != null && message.hasOwnProperty("boolValue")) { - if (properties.value === 1) - return "value: multiple values"; - properties.value = 1; - if (typeof message.boolValue !== "boolean") - return "boolValue: boolean expected"; - } - if (message.intValue != null && message.hasOwnProperty("intValue")) { - if (properties.value === 1) - return "value: multiple values"; - properties.value = 1; - if (!$util.isInteger(message.intValue) && !(message.intValue && $util.isInteger(message.intValue.low) && $util.isInteger(message.intValue.high))) - return "intValue: integer|Long expected"; - } - if (message.doubleValue != null && message.hasOwnProperty("doubleValue")) { - if (properties.value === 1) - return "value: multiple values"; - properties.value = 1; - if (typeof message.doubleValue !== "number") - return "doubleValue: number expected"; - } - if (message.arrayValue != null && message.hasOwnProperty("arrayValue")) { - if (properties.value === 1) - return "value: multiple values"; - properties.value = 1; - { - var error = $root.opentelemetry.proto.common.v1.ArrayValue.verify(message.arrayValue); - if (error) - return "arrayValue." + error; - } - } - if (message.kvlistValue != null && message.hasOwnProperty("kvlistValue")) { - if (properties.value === 1) - return "value: multiple values"; - properties.value = 1; - { - var error = $root.opentelemetry.proto.common.v1.KeyValueList.verify(message.kvlistValue); - if (error) - return "kvlistValue." + error; - } - } - if (message.bytesValue != null && message.hasOwnProperty("bytesValue")) { - if (properties.value === 1) - return "value: multiple values"; - properties.value = 1; - if (!(message.bytesValue && typeof message.bytesValue.length === "number" || $util.isString(message.bytesValue))) - return "bytesValue: buffer expected"; - } - return null; - }; - - /** - * Creates an AnyValue message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof opentelemetry.proto.common.v1.AnyValue - * @static - * @param {Object.} object Plain object - * @returns {opentelemetry.proto.common.v1.AnyValue} AnyValue - */ - AnyValue.fromObject = function fromObject(object) { - if (object instanceof $root.opentelemetry.proto.common.v1.AnyValue) - return object; - var message = new $root.opentelemetry.proto.common.v1.AnyValue(); - if (object.stringValue != null) - message.stringValue = String(object.stringValue); - if (object.boolValue != null) - message.boolValue = Boolean(object.boolValue); - if (object.intValue != null) - if ($util.Long) - (message.intValue = $util.Long.fromValue(object.intValue)).unsigned = false; - else if (typeof object.intValue === "string") - message.intValue = parseInt(object.intValue, 10); - else if (typeof object.intValue === "number") - message.intValue = object.intValue; - else if (typeof object.intValue === "object") - message.intValue = new $util.LongBits(object.intValue.low >>> 0, object.intValue.high >>> 0).toNumber(); - if (object.doubleValue != null) - message.doubleValue = Number(object.doubleValue); - if (object.arrayValue != null) { - if (typeof object.arrayValue !== "object") - throw TypeError(".opentelemetry.proto.common.v1.AnyValue.arrayValue: object expected"); - message.arrayValue = $root.opentelemetry.proto.common.v1.ArrayValue.fromObject(object.arrayValue); - } - if (object.kvlistValue != null) { - if (typeof object.kvlistValue !== "object") - throw TypeError(".opentelemetry.proto.common.v1.AnyValue.kvlistValue: object expected"); - message.kvlistValue = $root.opentelemetry.proto.common.v1.KeyValueList.fromObject(object.kvlistValue); - } - if (object.bytesValue != null) - if (typeof object.bytesValue === "string") - $util.base64.decode(object.bytesValue, message.bytesValue = $util.newBuffer($util.base64.length(object.bytesValue)), 0); - else if (object.bytesValue.length >= 0) - message.bytesValue = object.bytesValue; - return message; - }; - - /** - * Creates a plain object from an AnyValue message. Also converts values to other types if specified. - * @function toObject - * @memberof opentelemetry.proto.common.v1.AnyValue - * @static - * @param {opentelemetry.proto.common.v1.AnyValue} message AnyValue - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - AnyValue.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (message.stringValue != null && message.hasOwnProperty("stringValue")) { - object.stringValue = message.stringValue; - if (options.oneofs) - object.value = "stringValue"; - } - if (message.boolValue != null && message.hasOwnProperty("boolValue")) { - object.boolValue = message.boolValue; - if (options.oneofs) - object.value = "boolValue"; - } - if (message.intValue != null && message.hasOwnProperty("intValue")) { - if (typeof message.intValue === "number") - object.intValue = options.longs === String ? String(message.intValue) : message.intValue; - else - object.intValue = options.longs === String ? $util.Long.prototype.toString.call(message.intValue) : options.longs === Number ? new $util.LongBits(message.intValue.low >>> 0, message.intValue.high >>> 0).toNumber() : message.intValue; - if (options.oneofs) - object.value = "intValue"; - } - if (message.doubleValue != null && message.hasOwnProperty("doubleValue")) { - object.doubleValue = options.json && !isFinite(message.doubleValue) ? String(message.doubleValue) : message.doubleValue; - if (options.oneofs) - object.value = "doubleValue"; - } - if (message.arrayValue != null && message.hasOwnProperty("arrayValue")) { - object.arrayValue = $root.opentelemetry.proto.common.v1.ArrayValue.toObject(message.arrayValue, options); - if (options.oneofs) - object.value = "arrayValue"; - } - if (message.kvlistValue != null && message.hasOwnProperty("kvlistValue")) { - object.kvlistValue = $root.opentelemetry.proto.common.v1.KeyValueList.toObject(message.kvlistValue, options); - if (options.oneofs) - object.value = "kvlistValue"; - } - if (message.bytesValue != null && message.hasOwnProperty("bytesValue")) { - object.bytesValue = options.bytes === String ? $util.base64.encode(message.bytesValue, 0, message.bytesValue.length) : options.bytes === Array ? Array.prototype.slice.call(message.bytesValue) : message.bytesValue; - if (options.oneofs) - object.value = "bytesValue"; - } - return object; - }; - - /** - * Converts this AnyValue to JSON. - * @function toJSON - * @memberof opentelemetry.proto.common.v1.AnyValue - * @instance - * @returns {Object.} 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 (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * ArrayValue values. - * @member {Array.} values - * @memberof opentelemetry.proto.common.v1.ArrayValue - * @instance - */ - ArrayValue.prototype.values = $util.emptyArray; - - /** - * Creates a new ArrayValue instance using the specified properties. - * @function create - * @memberof opentelemetry.proto.common.v1.ArrayValue - * @static - * @param {opentelemetry.proto.common.v1.IArrayValue=} [properties] Properties to set - * @returns {opentelemetry.proto.common.v1.ArrayValue} ArrayValue instance - */ - ArrayValue.create = function create(properties) { - return new ArrayValue(properties); - }; - - /** - * Encodes the specified ArrayValue message. Does not implicitly {@link opentelemetry.proto.common.v1.ArrayValue.verify|verify} messages. - * @function encode - * @memberof opentelemetry.proto.common.v1.ArrayValue - * @static - * @param {opentelemetry.proto.common.v1.IArrayValue} message ArrayValue message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ArrayValue.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.values != null && message.values.length) - for (var i = 0; i < message.values.length; ++i) - $root.opentelemetry.proto.common.v1.AnyValue.encode(message.values[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified ArrayValue message, length delimited. Does not implicitly {@link opentelemetry.proto.common.v1.ArrayValue.verify|verify} messages. - * @function encodeDelimited - * @memberof opentelemetry.proto.common.v1.ArrayValue - * @static - * @param {opentelemetry.proto.common.v1.IArrayValue} message ArrayValue message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ArrayValue.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an ArrayValue message from the specified reader or buffer. - * @function decode - * @memberof opentelemetry.proto.common.v1.ArrayValue - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {opentelemetry.proto.common.v1.ArrayValue} ArrayValue - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ArrayValue.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.opentelemetry.proto.common.v1.ArrayValue(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (!(message.values && message.values.length)) - message.values = []; - message.values.push($root.opentelemetry.proto.common.v1.AnyValue.decode(reader, reader.uint32())); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an ArrayValue message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof opentelemetry.proto.common.v1.ArrayValue - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {opentelemetry.proto.common.v1.ArrayValue} ArrayValue - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ArrayValue.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an ArrayValue message. - * @function verify - * @memberof opentelemetry.proto.common.v1.ArrayValue - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ArrayValue.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.values != null && message.hasOwnProperty("values")) { - if (!Array.isArray(message.values)) - return "values: array expected"; - for (var i = 0; i < message.values.length; ++i) { - var error = $root.opentelemetry.proto.common.v1.AnyValue.verify(message.values[i]); - if (error) - return "values." + error; - } - } - return null; - }; - - /** - * Creates an ArrayValue message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof opentelemetry.proto.common.v1.ArrayValue - * @static - * @param {Object.} object Plain object - * @returns {opentelemetry.proto.common.v1.ArrayValue} ArrayValue - */ - ArrayValue.fromObject = function fromObject(object) { - if (object instanceof $root.opentelemetry.proto.common.v1.ArrayValue) - return object; - var message = new $root.opentelemetry.proto.common.v1.ArrayValue(); - if (object.values) { - if (!Array.isArray(object.values)) - throw TypeError(".opentelemetry.proto.common.v1.ArrayValue.values: array expected"); - message.values = []; - for (var i = 0; i < object.values.length; ++i) { - if (typeof object.values[i] !== "object") - throw TypeError(".opentelemetry.proto.common.v1.ArrayValue.values: object expected"); - message.values[i] = $root.opentelemetry.proto.common.v1.AnyValue.fromObject(object.values[i]); - } - } - return message; - }; - - /** - * Creates a plain object from an ArrayValue message. Also converts values to other types if specified. - * @function toObject - * @memberof opentelemetry.proto.common.v1.ArrayValue - * @static - * @param {opentelemetry.proto.common.v1.ArrayValue} message ArrayValue - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ArrayValue.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.values = []; - if (message.values && message.values.length) { - object.values = []; - for (var j = 0; j < message.values.length; ++j) - object.values[j] = $root.opentelemetry.proto.common.v1.AnyValue.toObject(message.values[j], options); - } - return object; - }; - - /** - * Converts this ArrayValue to JSON. - * @function toJSON - * @memberof opentelemetry.proto.common.v1.ArrayValue - * @instance - * @returns {Object.} 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 (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * KeyValueList values. - * @member {Array.} values - * @memberof opentelemetry.proto.common.v1.KeyValueList - * @instance - */ - KeyValueList.prototype.values = $util.emptyArray; - - /** - * Creates a new KeyValueList instance using the specified properties. - * @function create - * @memberof opentelemetry.proto.common.v1.KeyValueList - * @static - * @param {opentelemetry.proto.common.v1.IKeyValueList=} [properties] Properties to set - * @returns {opentelemetry.proto.common.v1.KeyValueList} KeyValueList instance - */ - KeyValueList.create = function create(properties) { - return new KeyValueList(properties); - }; - - /** - * Encodes the specified KeyValueList message. Does not implicitly {@link opentelemetry.proto.common.v1.KeyValueList.verify|verify} messages. - * @function encode - * @memberof opentelemetry.proto.common.v1.KeyValueList - * @static - * @param {opentelemetry.proto.common.v1.IKeyValueList} message KeyValueList message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - KeyValueList.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.values != null && message.values.length) - for (var i = 0; i < message.values.length; ++i) - $root.opentelemetry.proto.common.v1.KeyValue.encode(message.values[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified KeyValueList message, length delimited. Does not implicitly {@link opentelemetry.proto.common.v1.KeyValueList.verify|verify} messages. - * @function encodeDelimited - * @memberof opentelemetry.proto.common.v1.KeyValueList - * @static - * @param {opentelemetry.proto.common.v1.IKeyValueList} message KeyValueList message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - KeyValueList.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a KeyValueList message from the specified reader or buffer. - * @function decode - * @memberof opentelemetry.proto.common.v1.KeyValueList - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {opentelemetry.proto.common.v1.KeyValueList} KeyValueList - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - KeyValueList.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.opentelemetry.proto.common.v1.KeyValueList(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (!(message.values && message.values.length)) - message.values = []; - message.values.push($root.opentelemetry.proto.common.v1.KeyValue.decode(reader, reader.uint32())); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a KeyValueList message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof opentelemetry.proto.common.v1.KeyValueList - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {opentelemetry.proto.common.v1.KeyValueList} KeyValueList - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - KeyValueList.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a KeyValueList message. - * @function verify - * @memberof opentelemetry.proto.common.v1.KeyValueList - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - KeyValueList.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.values != null && message.hasOwnProperty("values")) { - if (!Array.isArray(message.values)) - return "values: array expected"; - for (var i = 0; i < message.values.length; ++i) { - var error = $root.opentelemetry.proto.common.v1.KeyValue.verify(message.values[i]); - if (error) - return "values." + error; - } - } - return null; - }; - - /** - * Creates a KeyValueList message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof opentelemetry.proto.common.v1.KeyValueList - * @static - * @param {Object.} object Plain object - * @returns {opentelemetry.proto.common.v1.KeyValueList} KeyValueList - */ - KeyValueList.fromObject = function fromObject(object) { - if (object instanceof $root.opentelemetry.proto.common.v1.KeyValueList) - return object; - var message = new $root.opentelemetry.proto.common.v1.KeyValueList(); - if (object.values) { - if (!Array.isArray(object.values)) - throw TypeError(".opentelemetry.proto.common.v1.KeyValueList.values: array expected"); - message.values = []; - for (var i = 0; i < object.values.length; ++i) { - if (typeof object.values[i] !== "object") - throw TypeError(".opentelemetry.proto.common.v1.KeyValueList.values: object expected"); - message.values[i] = $root.opentelemetry.proto.common.v1.KeyValue.fromObject(object.values[i]); - } - } - return message; - }; - - /** - * Creates a plain object from a KeyValueList message. Also converts values to other types if specified. - * @function toObject - * @memberof opentelemetry.proto.common.v1.KeyValueList - * @static - * @param {opentelemetry.proto.common.v1.KeyValueList} message KeyValueList - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - KeyValueList.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.values = []; - if (message.values && message.values.length) { - object.values = []; - for (var j = 0; j < message.values.length; ++j) - object.values[j] = $root.opentelemetry.proto.common.v1.KeyValue.toObject(message.values[j], options); - } - return object; - }; - - /** - * Converts this KeyValueList to JSON. - * @function toJSON - * @memberof opentelemetry.proto.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 (var 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|null|undefined} key - * @memberof opentelemetry.proto.common.v1.KeyValue - * @instance - */ - KeyValue.prototype.key = null; - - /** - * 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); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.opentelemetry.proto.common.v1.KeyValue(); - while (reader.pos < end) { - var 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")) { - var 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; - var 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 = {}; - var 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 (var 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|null|undefined} name - * @memberof opentelemetry.proto.common.v1.InstrumentationScope - * @instance - */ - InstrumentationScope.prototype.name = null; - - /** - * InstrumentationScope version. - * @member {string|null|undefined} version - * @memberof opentelemetry.proto.common.v1.InstrumentationScope - * @instance - */ - InstrumentationScope.prototype.version = null; - - /** - * InstrumentationScope attributes. - * @member {Array.} attributes - * @memberof opentelemetry.proto.common.v1.InstrumentationScope - * @instance - */ - InstrumentationScope.prototype.attributes = $util.emptyArray; - - /** - * InstrumentationScope droppedAttributesCount. - * @member {number|null|undefined} droppedAttributesCount - * @memberof opentelemetry.proto.common.v1.InstrumentationScope - * @instance - */ - InstrumentationScope.prototype.droppedAttributesCount = null; - - /** - * 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 (var 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); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.opentelemetry.proto.common.v1.InstrumentationScope(); - while (reader.pos < end) { - var 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 (var i = 0; i < message.attributes.length; ++i) { - var 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; - var 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 (var 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 = {}; - var 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 (var 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; - })(); - - proto.resource = (function() { - - /** - * Namespace resource. - * @memberof opentelemetry.proto - * @namespace - */ - var resource = {}; - - resource.v1 = (function() { - - /** - * Namespace v1. - * @memberof opentelemetry.proto.resource - * @namespace - */ - var 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 (var 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|null|undefined} droppedAttributesCount - * @memberof opentelemetry.proto.resource.v1.Resource - * @instance - */ - Resource.prototype.droppedAttributesCount = null; - - /** - * 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 (var 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); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.opentelemetry.proto.resource.v1.Resource(); - while (reader.pos < end) { - var 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 (var i = 0; i < message.attributes.length; ++i) { - var 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; - var 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 (var 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 = {}; - var object = {}; - if (options.arrays || options.defaults) - object.attributes = []; - if (options.defaults) - object.droppedAttributesCount = 0; - if (message.attributes && message.attributes.length) { - object.attributes = []; - for (var 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; - })(); - - proto.trace = (function() { - - /** - * Namespace trace. - * @memberof opentelemetry.proto - * @namespace - */ - var trace = {}; - - trace.v1 = (function() { - - /** - * Namespace v1. - * @memberof opentelemetry.proto.trace - * @namespace - */ - var 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 (var 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 (var 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); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.opentelemetry.proto.trace.v1.TracesData(); - while (reader.pos < end) { - var 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 (var i = 0; i < message.resourceSpans.length; ++i) { - var 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; - var 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 (var 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 = {}; - var object = {}; - if (options.arrays || options.defaults) - object.resourceSpans = []; - if (message.resourceSpans && message.resourceSpans.length) { - object.resourceSpans = []; - for (var 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 (var 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|null|undefined} schemaUrl - * @memberof opentelemetry.proto.trace.v1.ResourceSpans - * @instance - */ - ResourceSpans.prototype.schemaUrl = null; - - /** - * 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 (var 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); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.opentelemetry.proto.trace.v1.ResourceSpans(); - while (reader.pos < end) { - var 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")) { - var 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 (var i = 0; i < message.scopeSpans.length; ++i) { - var 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; - var 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 (var 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 = {}; - var 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 (var 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 (var 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|null|undefined} schemaUrl - * @memberof opentelemetry.proto.trace.v1.ScopeSpans - * @instance - */ - ScopeSpans.prototype.schemaUrl = null; - - /** - * 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 (var 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); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.opentelemetry.proto.trace.v1.ScopeSpans(); - while (reader.pos < end) { - var 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")) { - var 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 (var i = 0; i < message.spans.length; ++i) { - var 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; - var 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 (var 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 = {}; - var 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 (var 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 (var 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|null|undefined} traceId - * @memberof opentelemetry.proto.trace.v1.Span - * @instance - */ - Span.prototype.traceId = null; - - /** - * Span spanId. - * @member {Uint8Array|null|undefined} spanId - * @memberof opentelemetry.proto.trace.v1.Span - * @instance - */ - Span.prototype.spanId = null; - - /** - * Span traceState. - * @member {string|null|undefined} traceState - * @memberof opentelemetry.proto.trace.v1.Span - * @instance - */ - Span.prototype.traceState = null; - - /** - * Span parentSpanId. - * @member {Uint8Array|null|undefined} parentSpanId - * @memberof opentelemetry.proto.trace.v1.Span - * @instance - */ - Span.prototype.parentSpanId = null; - - /** - * Span name. - * @member {string|null|undefined} name - * @memberof opentelemetry.proto.trace.v1.Span - * @instance - */ - Span.prototype.name = null; - - /** - * Span kind. - * @member {opentelemetry.proto.trace.v1.Span.SpanKind|null|undefined} kind - * @memberof opentelemetry.proto.trace.v1.Span - * @instance - */ - Span.prototype.kind = null; - - /** - * Span startTimeUnixNano. - * @member {number|Long|null|undefined} startTimeUnixNano - * @memberof opentelemetry.proto.trace.v1.Span - * @instance - */ - Span.prototype.startTimeUnixNano = null; - - /** - * Span endTimeUnixNano. - * @member {number|Long|null|undefined} endTimeUnixNano - * @memberof opentelemetry.proto.trace.v1.Span - * @instance - */ - Span.prototype.endTimeUnixNano = null; - - /** - * Span attributes. - * @member {Array.} attributes - * @memberof opentelemetry.proto.trace.v1.Span - * @instance - */ - Span.prototype.attributes = $util.emptyArray; - - /** - * Span droppedAttributesCount. - * @member {number|null|undefined} droppedAttributesCount - * @memberof opentelemetry.proto.trace.v1.Span - * @instance - */ - Span.prototype.droppedAttributesCount = null; - - /** - * Span events. - * @member {Array.} events - * @memberof opentelemetry.proto.trace.v1.Span - * @instance - */ - Span.prototype.events = $util.emptyArray; - - /** - * Span droppedEventsCount. - * @member {number|null|undefined} droppedEventsCount - * @memberof opentelemetry.proto.trace.v1.Span - * @instance - */ - Span.prototype.droppedEventsCount = null; - - /** - * Span links. - * @member {Array.} links - * @memberof opentelemetry.proto.trace.v1.Span - * @instance - */ - Span.prototype.links = $util.emptyArray; - - /** - * Span droppedLinksCount. - * @member {number|null|undefined} droppedLinksCount - * @memberof opentelemetry.proto.trace.v1.Span - * @instance - */ - Span.prototype.droppedLinksCount = null; - - /** - * 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 (var 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 (var 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 (var 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); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.opentelemetry.proto.trace.v1.Span(); - while (reader.pos < end) { - var 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 (var i = 0; i < message.attributes.length; ++i) { - var 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 (var i = 0; i < message.events.length; ++i) { - var 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 (var i = 0; i < message.links.length; ++i) { - var 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")) { - var 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; - var 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 (var 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 (var 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 (var 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 = {}; - var 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) { - var 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) { - var 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 (var 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 (var 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 (var 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() { - var 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 (var 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|null|undefined} timeUnixNano - * @memberof opentelemetry.proto.trace.v1.Span.Event - * @instance - */ - Event.prototype.timeUnixNano = null; - - /** - * Event name. - * @member {string|null|undefined} name - * @memberof opentelemetry.proto.trace.v1.Span.Event - * @instance - */ - Event.prototype.name = null; - - /** - * Event attributes. - * @member {Array.} attributes - * @memberof opentelemetry.proto.trace.v1.Span.Event - * @instance - */ - Event.prototype.attributes = $util.emptyArray; - - /** - * Event droppedAttributesCount. - * @member {number|null|undefined} droppedAttributesCount - * @memberof opentelemetry.proto.trace.v1.Span.Event - * @instance - */ - Event.prototype.droppedAttributesCount = null; - - /** - * 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 (var 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); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.opentelemetry.proto.trace.v1.Span.Event(); - while (reader.pos < end) { - var 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 (var i = 0; i < message.attributes.length; ++i) { - var 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; - var 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 (var 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 = {}; - var object = {}; - if (options.arrays || options.defaults) - object.attributes = []; - if (options.defaults) { - if ($util.Long) { - var 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 (var 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 (var 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|null|undefined} traceId - * @memberof opentelemetry.proto.trace.v1.Span.Link - * @instance - */ - Link.prototype.traceId = null; - - /** - * Link spanId. - * @member {Uint8Array|null|undefined} spanId - * @memberof opentelemetry.proto.trace.v1.Span.Link - * @instance - */ - Link.prototype.spanId = null; - - /** - * Link traceState. - * @member {string|null|undefined} traceState - * @memberof opentelemetry.proto.trace.v1.Span.Link - * @instance - */ - Link.prototype.traceState = null; - - /** - * Link attributes. - * @member {Array.} attributes - * @memberof opentelemetry.proto.trace.v1.Span.Link - * @instance - */ - Link.prototype.attributes = $util.emptyArray; - - /** - * Link droppedAttributesCount. - * @member {number|null|undefined} droppedAttributesCount - * @memberof opentelemetry.proto.trace.v1.Span.Link - * @instance - */ - Link.prototype.droppedAttributesCount = null; - - /** - * 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 (var 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); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.opentelemetry.proto.trace.v1.Span.Link(); - while (reader.pos < end) { - var 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 (var i = 0; i < message.attributes.length; ++i) { - var 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; - var 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 (var 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 = {}; - var 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 (var 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 (var 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|null|undefined} message - * @memberof opentelemetry.proto.trace.v1.Status - * @instance - */ - Status.prototype.message = null; - - /** - * Status code. - * @member {opentelemetry.proto.trace.v1.Status.StatusCode|null|undefined} code - * @memberof opentelemetry.proto.trace.v1.Status - * @instance - */ - Status.prototype.code = null; - - /** - * 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); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.opentelemetry.proto.trace.v1.Status(); - while (reader.pos < end) { - var 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; - var 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 = {}; - var 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() { - var 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.collector = (function() { - - /** - * Namespace collector. - * @memberof opentelemetry.proto - * @namespace - */ - var collector = {}; - - collector.trace = (function() { - - /** - * Namespace trace. - * @memberof opentelemetry.proto.collector - * @namespace - */ - var trace = {}; - - trace.v1 = (function() { - - /** - * Namespace v1. - * @memberof opentelemetry.proto.collector.trace - * @namespace - */ - var v1 = {}; - - v1.TraceService = (function() { - - /** - * Constructs a new TraceService service. - * @memberof opentelemetry.proto.collector.trace.v1 - * @classdesc Represents a TraceService - * @extends $protobuf.rpc.Service - * @constructor - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - */ - function TraceService(rpcImpl, requestDelimited, responseDelimited) { - $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); - } - - (TraceService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = TraceService; - - /** - * Creates new TraceService service using the specified rpc implementation. - * @function create - * @memberof opentelemetry.proto.collector.trace.v1.TraceService - * @static - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - * @returns {TraceService} RPC service. Useful where requests and/or responses are streamed. - */ - TraceService.create = function create(rpcImpl, requestDelimited, responseDelimited) { - return new this(rpcImpl, requestDelimited, responseDelimited); - }; - - /** - * Callback as used by {@link opentelemetry.proto.collector.trace.v1.TraceService#export_}. - * @memberof opentelemetry.proto.collector.trace.v1.TraceService - * @typedef ExportCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {opentelemetry.proto.collector.trace.v1.ExportTraceServiceResponse} [response] ExportTraceServiceResponse - */ - - /** - * Calls Export. - * @function export - * @memberof opentelemetry.proto.collector.trace.v1.TraceService - * @instance - * @param {opentelemetry.proto.collector.trace.v1.IExportTraceServiceRequest} request ExportTraceServiceRequest message or plain object - * @param {opentelemetry.proto.collector.trace.v1.TraceService.ExportCallback} callback Node-style callback called with the error, if any, and ExportTraceServiceResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(TraceService.prototype["export"] = function export_(request, callback) { - return this.rpcCall(export_, $root.opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest, $root.opentelemetry.proto.collector.trace.v1.ExportTraceServiceResponse, request, callback); - }, "name", { value: "Export" }); - - /** - * Calls Export. - * @function export - * @memberof opentelemetry.proto.collector.trace.v1.TraceService - * @instance - * @param {opentelemetry.proto.collector.trace.v1.IExportTraceServiceRequest} request ExportTraceServiceRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - return TraceService; - })(); - - v1.ExportTraceServiceRequest = (function() { - - /** - * Properties of an ExportTraceServiceRequest. - * @memberof opentelemetry.proto.collector.trace.v1 - * @interface IExportTraceServiceRequest - * @property {Array.|null} [resourceSpans] ExportTraceServiceRequest resourceSpans - */ - - /** - * Constructs a new ExportTraceServiceRequest. - * @memberof opentelemetry.proto.collector.trace.v1 - * @classdesc Represents an ExportTraceServiceRequest. - * @implements IExportTraceServiceRequest - * @constructor - * @param {opentelemetry.proto.collector.trace.v1.IExportTraceServiceRequest=} [properties] Properties to set - */ - function ExportTraceServiceRequest(properties) { - this.resourceSpans = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * ExportTraceServiceRequest resourceSpans. - * @member {Array.} resourceSpans - * @memberof opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest - * @instance - */ - ExportTraceServiceRequest.prototype.resourceSpans = $util.emptyArray; - - /** - * Creates a new ExportTraceServiceRequest instance using the specified properties. - * @function create - * @memberof opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest - * @static - * @param {opentelemetry.proto.collector.trace.v1.IExportTraceServiceRequest=} [properties] Properties to set - * @returns {opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest} ExportTraceServiceRequest instance - */ - ExportTraceServiceRequest.create = function create(properties) { - return new ExportTraceServiceRequest(properties); - }; - - /** - * Encodes the specified ExportTraceServiceRequest message. Does not implicitly {@link opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest.verify|verify} messages. - * @function encode - * @memberof opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest - * @static - * @param {opentelemetry.proto.collector.trace.v1.IExportTraceServiceRequest} message ExportTraceServiceRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ExportTraceServiceRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.resourceSpans != null && message.resourceSpans.length) - for (var 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 ExportTraceServiceRequest message, length delimited. Does not implicitly {@link opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest - * @static - * @param {opentelemetry.proto.collector.trace.v1.IExportTraceServiceRequest} message ExportTraceServiceRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ExportTraceServiceRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an ExportTraceServiceRequest message from the specified reader or buffer. - * @function decode - * @memberof opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest} ExportTraceServiceRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ExportTraceServiceRequest.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest(); - while (reader.pos < end) { - var 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 an ExportTraceServiceRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest} ExportTraceServiceRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ExportTraceServiceRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an ExportTraceServiceRequest message. - * @function verify - * @memberof opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ExportTraceServiceRequest.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 (var i = 0; i < message.resourceSpans.length; ++i) { - var error = $root.opentelemetry.proto.trace.v1.ResourceSpans.verify(message.resourceSpans[i]); - if (error) - return "resourceSpans." + error; - } - } - return null; - }; - - /** - * Creates an ExportTraceServiceRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest - * @static - * @param {Object.} object Plain object - * @returns {opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest} ExportTraceServiceRequest - */ - ExportTraceServiceRequest.fromObject = function fromObject(object) { - if (object instanceof $root.opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest) - return object; - var message = new $root.opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest(); - if (object.resourceSpans) { - if (!Array.isArray(object.resourceSpans)) - throw TypeError(".opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest.resourceSpans: array expected"); - message.resourceSpans = []; - for (var i = 0; i < object.resourceSpans.length; ++i) { - if (typeof object.resourceSpans[i] !== "object") - throw TypeError(".opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest.resourceSpans: object expected"); - message.resourceSpans[i] = $root.opentelemetry.proto.trace.v1.ResourceSpans.fromObject(object.resourceSpans[i]); - } - } - return message; - }; - - /** - * Creates a plain object from an ExportTraceServiceRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest - * @static - * @param {opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest} message ExportTraceServiceRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ExportTraceServiceRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.resourceSpans = []; - if (message.resourceSpans && message.resourceSpans.length) { - object.resourceSpans = []; - for (var 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 ExportTraceServiceRequest to JSON. - * @function toJSON - * @memberof opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest - * @instance - * @returns {Object.} JSON object - */ - ExportTraceServiceRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for ExportTraceServiceRequest - * @function getTypeUrl - * @memberof opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - ExportTraceServiceRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest"; - }; - - return ExportTraceServiceRequest; - })(); - - v1.ExportTraceServiceResponse = (function() { - - /** - * Properties of an ExportTraceServiceResponse. - * @memberof opentelemetry.proto.collector.trace.v1 - * @interface IExportTraceServiceResponse - * @property {opentelemetry.proto.collector.trace.v1.IExportTracePartialSuccess|null} [partialSuccess] ExportTraceServiceResponse partialSuccess - */ - - /** - * Constructs a new ExportTraceServiceResponse. - * @memberof opentelemetry.proto.collector.trace.v1 - * @classdesc Represents an ExportTraceServiceResponse. - * @implements IExportTraceServiceResponse - * @constructor - * @param {opentelemetry.proto.collector.trace.v1.IExportTraceServiceResponse=} [properties] Properties to set - */ - function ExportTraceServiceResponse(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * ExportTraceServiceResponse partialSuccess. - * @member {opentelemetry.proto.collector.trace.v1.IExportTracePartialSuccess|null|undefined} partialSuccess - * @memberof opentelemetry.proto.collector.trace.v1.ExportTraceServiceResponse - * @instance - */ - ExportTraceServiceResponse.prototype.partialSuccess = null; - - /** - * Creates a new ExportTraceServiceResponse instance using the specified properties. - * @function create - * @memberof opentelemetry.proto.collector.trace.v1.ExportTraceServiceResponse - * @static - * @param {opentelemetry.proto.collector.trace.v1.IExportTraceServiceResponse=} [properties] Properties to set - * @returns {opentelemetry.proto.collector.trace.v1.ExportTraceServiceResponse} ExportTraceServiceResponse instance - */ - ExportTraceServiceResponse.create = function create(properties) { - return new ExportTraceServiceResponse(properties); - }; - - /** - * Encodes the specified ExportTraceServiceResponse message. Does not implicitly {@link opentelemetry.proto.collector.trace.v1.ExportTraceServiceResponse.verify|verify} messages. - * @function encode - * @memberof opentelemetry.proto.collector.trace.v1.ExportTraceServiceResponse - * @static - * @param {opentelemetry.proto.collector.trace.v1.IExportTraceServiceResponse} message ExportTraceServiceResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ExportTraceServiceResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.partialSuccess != null && Object.hasOwnProperty.call(message, "partialSuccess")) - $root.opentelemetry.proto.collector.trace.v1.ExportTracePartialSuccess.encode(message.partialSuccess, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified ExportTraceServiceResponse message, length delimited. Does not implicitly {@link opentelemetry.proto.collector.trace.v1.ExportTraceServiceResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof opentelemetry.proto.collector.trace.v1.ExportTraceServiceResponse - * @static - * @param {opentelemetry.proto.collector.trace.v1.IExportTraceServiceResponse} message ExportTraceServiceResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ExportTraceServiceResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an ExportTraceServiceResponse message from the specified reader or buffer. - * @function decode - * @memberof opentelemetry.proto.collector.trace.v1.ExportTraceServiceResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {opentelemetry.proto.collector.trace.v1.ExportTraceServiceResponse} ExportTraceServiceResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ExportTraceServiceResponse.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.opentelemetry.proto.collector.trace.v1.ExportTraceServiceResponse(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.partialSuccess = $root.opentelemetry.proto.collector.trace.v1.ExportTracePartialSuccess.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an ExportTraceServiceResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof opentelemetry.proto.collector.trace.v1.ExportTraceServiceResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {opentelemetry.proto.collector.trace.v1.ExportTraceServiceResponse} ExportTraceServiceResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ExportTraceServiceResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an ExportTraceServiceResponse message. - * @function verify - * @memberof opentelemetry.proto.collector.trace.v1.ExportTraceServiceResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ExportTraceServiceResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.partialSuccess != null && message.hasOwnProperty("partialSuccess")) { - var error = $root.opentelemetry.proto.collector.trace.v1.ExportTracePartialSuccess.verify(message.partialSuccess); - if (error) - return "partialSuccess." + error; - } - return null; - }; - - /** - * Creates an ExportTraceServiceResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof opentelemetry.proto.collector.trace.v1.ExportTraceServiceResponse - * @static - * @param {Object.} object Plain object - * @returns {opentelemetry.proto.collector.trace.v1.ExportTraceServiceResponse} ExportTraceServiceResponse - */ - ExportTraceServiceResponse.fromObject = function fromObject(object) { - if (object instanceof $root.opentelemetry.proto.collector.trace.v1.ExportTraceServiceResponse) - return object; - var message = new $root.opentelemetry.proto.collector.trace.v1.ExportTraceServiceResponse(); - if (object.partialSuccess != null) { - if (typeof object.partialSuccess !== "object") - throw TypeError(".opentelemetry.proto.collector.trace.v1.ExportTraceServiceResponse.partialSuccess: object expected"); - message.partialSuccess = $root.opentelemetry.proto.collector.trace.v1.ExportTracePartialSuccess.fromObject(object.partialSuccess); - } - return message; - }; - - /** - * Creates a plain object from an ExportTraceServiceResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof opentelemetry.proto.collector.trace.v1.ExportTraceServiceResponse - * @static - * @param {opentelemetry.proto.collector.trace.v1.ExportTraceServiceResponse} message ExportTraceServiceResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ExportTraceServiceResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) - object.partialSuccess = null; - if (message.partialSuccess != null && message.hasOwnProperty("partialSuccess")) - object.partialSuccess = $root.opentelemetry.proto.collector.trace.v1.ExportTracePartialSuccess.toObject(message.partialSuccess, options); - return object; - }; - - /** - * Converts this ExportTraceServiceResponse to JSON. - * @function toJSON - * @memberof opentelemetry.proto.collector.trace.v1.ExportTraceServiceResponse - * @instance - * @returns {Object.} JSON object - */ - ExportTraceServiceResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for ExportTraceServiceResponse - * @function getTypeUrl - * @memberof opentelemetry.proto.collector.trace.v1.ExportTraceServiceResponse - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - ExportTraceServiceResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/opentelemetry.proto.collector.trace.v1.ExportTraceServiceResponse"; - }; - - return ExportTraceServiceResponse; - })(); - - v1.ExportTracePartialSuccess = (function() { - - /** - * Properties of an ExportTracePartialSuccess. - * @memberof opentelemetry.proto.collector.trace.v1 - * @interface IExportTracePartialSuccess - * @property {number|Long|null} [rejectedSpans] ExportTracePartialSuccess rejectedSpans - * @property {string|null} [errorMessage] ExportTracePartialSuccess errorMessage - */ - - /** - * Constructs a new ExportTracePartialSuccess. - * @memberof opentelemetry.proto.collector.trace.v1 - * @classdesc Represents an ExportTracePartialSuccess. - * @implements IExportTracePartialSuccess - * @constructor - * @param {opentelemetry.proto.collector.trace.v1.IExportTracePartialSuccess=} [properties] Properties to set - */ - function ExportTracePartialSuccess(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * ExportTracePartialSuccess rejectedSpans. - * @member {number|Long|null|undefined} rejectedSpans - * @memberof opentelemetry.proto.collector.trace.v1.ExportTracePartialSuccess - * @instance - */ - ExportTracePartialSuccess.prototype.rejectedSpans = null; - - /** - * ExportTracePartialSuccess errorMessage. - * @member {string|null|undefined} errorMessage - * @memberof opentelemetry.proto.collector.trace.v1.ExportTracePartialSuccess - * @instance - */ - ExportTracePartialSuccess.prototype.errorMessage = null; - - /** - * Creates a new ExportTracePartialSuccess instance using the specified properties. - * @function create - * @memberof opentelemetry.proto.collector.trace.v1.ExportTracePartialSuccess - * @static - * @param {opentelemetry.proto.collector.trace.v1.IExportTracePartialSuccess=} [properties] Properties to set - * @returns {opentelemetry.proto.collector.trace.v1.ExportTracePartialSuccess} ExportTracePartialSuccess instance - */ - ExportTracePartialSuccess.create = function create(properties) { - return new ExportTracePartialSuccess(properties); - }; - - /** - * Encodes the specified ExportTracePartialSuccess message. Does not implicitly {@link opentelemetry.proto.collector.trace.v1.ExportTracePartialSuccess.verify|verify} messages. - * @function encode - * @memberof opentelemetry.proto.collector.trace.v1.ExportTracePartialSuccess - * @static - * @param {opentelemetry.proto.collector.trace.v1.IExportTracePartialSuccess} message ExportTracePartialSuccess message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ExportTracePartialSuccess.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.rejectedSpans != null && Object.hasOwnProperty.call(message, "rejectedSpans")) - writer.uint32(/* id 1, wireType 0 =*/8).int64(message.rejectedSpans); - if (message.errorMessage != null && Object.hasOwnProperty.call(message, "errorMessage")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.errorMessage); - return writer; - }; - - /** - * Encodes the specified ExportTracePartialSuccess message, length delimited. Does not implicitly {@link opentelemetry.proto.collector.trace.v1.ExportTracePartialSuccess.verify|verify} messages. - * @function encodeDelimited - * @memberof opentelemetry.proto.collector.trace.v1.ExportTracePartialSuccess - * @static - * @param {opentelemetry.proto.collector.trace.v1.IExportTracePartialSuccess} message ExportTracePartialSuccess message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ExportTracePartialSuccess.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an ExportTracePartialSuccess message from the specified reader or buffer. - * @function decode - * @memberof opentelemetry.proto.collector.trace.v1.ExportTracePartialSuccess - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {opentelemetry.proto.collector.trace.v1.ExportTracePartialSuccess} ExportTracePartialSuccess - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ExportTracePartialSuccess.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.opentelemetry.proto.collector.trace.v1.ExportTracePartialSuccess(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.rejectedSpans = reader.int64(); - break; - } - case 2: { - message.errorMessage = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an ExportTracePartialSuccess message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof opentelemetry.proto.collector.trace.v1.ExportTracePartialSuccess - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {opentelemetry.proto.collector.trace.v1.ExportTracePartialSuccess} ExportTracePartialSuccess - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ExportTracePartialSuccess.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an ExportTracePartialSuccess message. - * @function verify - * @memberof opentelemetry.proto.collector.trace.v1.ExportTracePartialSuccess - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ExportTracePartialSuccess.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.rejectedSpans != null && message.hasOwnProperty("rejectedSpans")) - if (!$util.isInteger(message.rejectedSpans) && !(message.rejectedSpans && $util.isInteger(message.rejectedSpans.low) && $util.isInteger(message.rejectedSpans.high))) - return "rejectedSpans: integer|Long expected"; - if (message.errorMessage != null && message.hasOwnProperty("errorMessage")) - if (!$util.isString(message.errorMessage)) - return "errorMessage: string expected"; - return null; - }; - - /** - * Creates an ExportTracePartialSuccess message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof opentelemetry.proto.collector.trace.v1.ExportTracePartialSuccess - * @static - * @param {Object.} object Plain object - * @returns {opentelemetry.proto.collector.trace.v1.ExportTracePartialSuccess} ExportTracePartialSuccess - */ - ExportTracePartialSuccess.fromObject = function fromObject(object) { - if (object instanceof $root.opentelemetry.proto.collector.trace.v1.ExportTracePartialSuccess) - return object; - var message = new $root.opentelemetry.proto.collector.trace.v1.ExportTracePartialSuccess(); - if (object.rejectedSpans != null) - if ($util.Long) - (message.rejectedSpans = $util.Long.fromValue(object.rejectedSpans)).unsigned = false; - else if (typeof object.rejectedSpans === "string") - message.rejectedSpans = parseInt(object.rejectedSpans, 10); - else if (typeof object.rejectedSpans === "number") - message.rejectedSpans = object.rejectedSpans; - else if (typeof object.rejectedSpans === "object") - message.rejectedSpans = new $util.LongBits(object.rejectedSpans.low >>> 0, object.rejectedSpans.high >>> 0).toNumber(); - if (object.errorMessage != null) - message.errorMessage = String(object.errorMessage); - return message; - }; - - /** - * Creates a plain object from an ExportTracePartialSuccess message. Also converts values to other types if specified. - * @function toObject - * @memberof opentelemetry.proto.collector.trace.v1.ExportTracePartialSuccess - * @static - * @param {opentelemetry.proto.collector.trace.v1.ExportTracePartialSuccess} message ExportTracePartialSuccess - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ExportTracePartialSuccess.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.rejectedSpans = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.rejectedSpans = options.longs === String ? "0" : 0; - object.errorMessage = ""; - } - if (message.rejectedSpans != null && message.hasOwnProperty("rejectedSpans")) - if (typeof message.rejectedSpans === "number") - object.rejectedSpans = options.longs === String ? String(message.rejectedSpans) : message.rejectedSpans; - else - object.rejectedSpans = options.longs === String ? $util.Long.prototype.toString.call(message.rejectedSpans) : options.longs === Number ? new $util.LongBits(message.rejectedSpans.low >>> 0, message.rejectedSpans.high >>> 0).toNumber() : message.rejectedSpans; - if (message.errorMessage != null && message.hasOwnProperty("errorMessage")) - object.errorMessage = message.errorMessage; - return object; - }; - - /** - * Converts this ExportTracePartialSuccess to JSON. - * @function toJSON - * @memberof opentelemetry.proto.collector.trace.v1.ExportTracePartialSuccess - * @instance - * @returns {Object.} JSON object - */ - ExportTracePartialSuccess.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for ExportTracePartialSuccess - * @function getTypeUrl - * @memberof opentelemetry.proto.collector.trace.v1.ExportTracePartialSuccess - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - ExportTracePartialSuccess.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/opentelemetry.proto.collector.trace.v1.ExportTracePartialSuccess"; - }; - - return ExportTracePartialSuccess; - })(); - - return v1; - })(); - - return trace; - })(); - - collector.metrics = (function() { - - /** - * Namespace metrics. - * @memberof opentelemetry.proto.collector - * @namespace - */ - var metrics = {}; - - metrics.v1 = (function() { - - /** - * Namespace v1. - * @memberof opentelemetry.proto.collector.metrics - * @namespace - */ - var v1 = {}; - - v1.MetricsService = (function() { - - /** - * Constructs a new MetricsService service. - * @memberof opentelemetry.proto.collector.metrics.v1 - * @classdesc Represents a MetricsService - * @extends $protobuf.rpc.Service - * @constructor - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - */ - function MetricsService(rpcImpl, requestDelimited, responseDelimited) { - $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); - } - - (MetricsService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = MetricsService; - - /** - * Creates new MetricsService service using the specified rpc implementation. - * @function create - * @memberof opentelemetry.proto.collector.metrics.v1.MetricsService - * @static - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - * @returns {MetricsService} RPC service. Useful where requests and/or responses are streamed. - */ - MetricsService.create = function create(rpcImpl, requestDelimited, responseDelimited) { - return new this(rpcImpl, requestDelimited, responseDelimited); - }; - - /** - * Callback as used by {@link opentelemetry.proto.collector.metrics.v1.MetricsService#export_}. - * @memberof opentelemetry.proto.collector.metrics.v1.MetricsService - * @typedef ExportCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceResponse} [response] ExportMetricsServiceResponse - */ - - /** - * Calls Export. - * @function export - * @memberof opentelemetry.proto.collector.metrics.v1.MetricsService - * @instance - * @param {opentelemetry.proto.collector.metrics.v1.IExportMetricsServiceRequest} request ExportMetricsServiceRequest message or plain object - * @param {opentelemetry.proto.collector.metrics.v1.MetricsService.ExportCallback} callback Node-style callback called with the error, if any, and ExportMetricsServiceResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(MetricsService.prototype["export"] = function export_(request, callback) { - return this.rpcCall(export_, $root.opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceRequest, $root.opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceResponse, request, callback); - }, "name", { value: "Export" }); - - /** - * Calls Export. - * @function export - * @memberof opentelemetry.proto.collector.metrics.v1.MetricsService - * @instance - * @param {opentelemetry.proto.collector.metrics.v1.IExportMetricsServiceRequest} request ExportMetricsServiceRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - return MetricsService; - })(); - - v1.ExportMetricsServiceRequest = (function() { - - /** - * Properties of an ExportMetricsServiceRequest. - * @memberof opentelemetry.proto.collector.metrics.v1 - * @interface IExportMetricsServiceRequest - * @property {Array.|null} [resourceMetrics] ExportMetricsServiceRequest resourceMetrics - */ - - /** - * Constructs a new ExportMetricsServiceRequest. - * @memberof opentelemetry.proto.collector.metrics.v1 - * @classdesc Represents an ExportMetricsServiceRequest. - * @implements IExportMetricsServiceRequest - * @constructor - * @param {opentelemetry.proto.collector.metrics.v1.IExportMetricsServiceRequest=} [properties] Properties to set - */ - function ExportMetricsServiceRequest(properties) { - this.resourceMetrics = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * ExportMetricsServiceRequest resourceMetrics. - * @member {Array.} resourceMetrics - * @memberof opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceRequest - * @instance - */ - ExportMetricsServiceRequest.prototype.resourceMetrics = $util.emptyArray; - - /** - * Creates a new ExportMetricsServiceRequest instance using the specified properties. - * @function create - * @memberof opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceRequest - * @static - * @param {opentelemetry.proto.collector.metrics.v1.IExportMetricsServiceRequest=} [properties] Properties to set - * @returns {opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceRequest} ExportMetricsServiceRequest instance - */ - ExportMetricsServiceRequest.create = function create(properties) { - return new ExportMetricsServiceRequest(properties); - }; - - /** - * Encodes the specified ExportMetricsServiceRequest message. Does not implicitly {@link opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceRequest.verify|verify} messages. - * @function encode - * @memberof opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceRequest - * @static - * @param {opentelemetry.proto.collector.metrics.v1.IExportMetricsServiceRequest} message ExportMetricsServiceRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ExportMetricsServiceRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.resourceMetrics != null && message.resourceMetrics.length) - for (var i = 0; i < message.resourceMetrics.length; ++i) - $root.opentelemetry.proto.metrics.v1.ResourceMetrics.encode(message.resourceMetrics[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified ExportMetricsServiceRequest message, length delimited. Does not implicitly {@link opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceRequest - * @static - * @param {opentelemetry.proto.collector.metrics.v1.IExportMetricsServiceRequest} message ExportMetricsServiceRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ExportMetricsServiceRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an ExportMetricsServiceRequest message from the specified reader or buffer. - * @function decode - * @memberof opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceRequest} ExportMetricsServiceRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ExportMetricsServiceRequest.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (!(message.resourceMetrics && message.resourceMetrics.length)) - message.resourceMetrics = []; - message.resourceMetrics.push($root.opentelemetry.proto.metrics.v1.ResourceMetrics.decode(reader, reader.uint32())); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an ExportMetricsServiceRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceRequest} ExportMetricsServiceRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ExportMetricsServiceRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an ExportMetricsServiceRequest message. - * @function verify - * @memberof opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ExportMetricsServiceRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.resourceMetrics != null && message.hasOwnProperty("resourceMetrics")) { - if (!Array.isArray(message.resourceMetrics)) - return "resourceMetrics: array expected"; - for (var i = 0; i < message.resourceMetrics.length; ++i) { - var error = $root.opentelemetry.proto.metrics.v1.ResourceMetrics.verify(message.resourceMetrics[i]); - if (error) - return "resourceMetrics." + error; - } - } - return null; - }; - - /** - * Creates an ExportMetricsServiceRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceRequest - * @static - * @param {Object.} object Plain object - * @returns {opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceRequest} ExportMetricsServiceRequest - */ - ExportMetricsServiceRequest.fromObject = function fromObject(object) { - if (object instanceof $root.opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceRequest) - return object; - var message = new $root.opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceRequest(); - if (object.resourceMetrics) { - if (!Array.isArray(object.resourceMetrics)) - throw TypeError(".opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceRequest.resourceMetrics: array expected"); - message.resourceMetrics = []; - for (var i = 0; i < object.resourceMetrics.length; ++i) { - if (typeof object.resourceMetrics[i] !== "object") - throw TypeError(".opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceRequest.resourceMetrics: object expected"); - message.resourceMetrics[i] = $root.opentelemetry.proto.metrics.v1.ResourceMetrics.fromObject(object.resourceMetrics[i]); - } - } - return message; - }; - - /** - * Creates a plain object from an ExportMetricsServiceRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceRequest - * @static - * @param {opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceRequest} message ExportMetricsServiceRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ExportMetricsServiceRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.resourceMetrics = []; - if (message.resourceMetrics && message.resourceMetrics.length) { - object.resourceMetrics = []; - for (var j = 0; j < message.resourceMetrics.length; ++j) - object.resourceMetrics[j] = $root.opentelemetry.proto.metrics.v1.ResourceMetrics.toObject(message.resourceMetrics[j], options); - } - return object; - }; - - /** - * Converts this ExportMetricsServiceRequest to JSON. - * @function toJSON - * @memberof opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceRequest - * @instance - * @returns {Object.} JSON object - */ - ExportMetricsServiceRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for ExportMetricsServiceRequest - * @function getTypeUrl - * @memberof opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - ExportMetricsServiceRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceRequest"; - }; - - return ExportMetricsServiceRequest; - })(); - - v1.ExportMetricsServiceResponse = (function() { - - /** - * Properties of an ExportMetricsServiceResponse. - * @memberof opentelemetry.proto.collector.metrics.v1 - * @interface IExportMetricsServiceResponse - * @property {opentelemetry.proto.collector.metrics.v1.IExportMetricsPartialSuccess|null} [partialSuccess] ExportMetricsServiceResponse partialSuccess - */ - - /** - * Constructs a new ExportMetricsServiceResponse. - * @memberof opentelemetry.proto.collector.metrics.v1 - * @classdesc Represents an ExportMetricsServiceResponse. - * @implements IExportMetricsServiceResponse - * @constructor - * @param {opentelemetry.proto.collector.metrics.v1.IExportMetricsServiceResponse=} [properties] Properties to set - */ - function ExportMetricsServiceResponse(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * ExportMetricsServiceResponse partialSuccess. - * @member {opentelemetry.proto.collector.metrics.v1.IExportMetricsPartialSuccess|null|undefined} partialSuccess - * @memberof opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceResponse - * @instance - */ - ExportMetricsServiceResponse.prototype.partialSuccess = null; - - /** - * Creates a new ExportMetricsServiceResponse instance using the specified properties. - * @function create - * @memberof opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceResponse - * @static - * @param {opentelemetry.proto.collector.metrics.v1.IExportMetricsServiceResponse=} [properties] Properties to set - * @returns {opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceResponse} ExportMetricsServiceResponse instance - */ - ExportMetricsServiceResponse.create = function create(properties) { - return new ExportMetricsServiceResponse(properties); - }; - - /** - * Encodes the specified ExportMetricsServiceResponse message. Does not implicitly {@link opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceResponse.verify|verify} messages. - * @function encode - * @memberof opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceResponse - * @static - * @param {opentelemetry.proto.collector.metrics.v1.IExportMetricsServiceResponse} message ExportMetricsServiceResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ExportMetricsServiceResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.partialSuccess != null && Object.hasOwnProperty.call(message, "partialSuccess")) - $root.opentelemetry.proto.collector.metrics.v1.ExportMetricsPartialSuccess.encode(message.partialSuccess, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified ExportMetricsServiceResponse message, length delimited. Does not implicitly {@link opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceResponse - * @static - * @param {opentelemetry.proto.collector.metrics.v1.IExportMetricsServiceResponse} message ExportMetricsServiceResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ExportMetricsServiceResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an ExportMetricsServiceResponse message from the specified reader or buffer. - * @function decode - * @memberof opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceResponse} ExportMetricsServiceResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ExportMetricsServiceResponse.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceResponse(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.partialSuccess = $root.opentelemetry.proto.collector.metrics.v1.ExportMetricsPartialSuccess.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an ExportMetricsServiceResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceResponse} ExportMetricsServiceResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ExportMetricsServiceResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an ExportMetricsServiceResponse message. - * @function verify - * @memberof opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ExportMetricsServiceResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.partialSuccess != null && message.hasOwnProperty("partialSuccess")) { - var error = $root.opentelemetry.proto.collector.metrics.v1.ExportMetricsPartialSuccess.verify(message.partialSuccess); - if (error) - return "partialSuccess." + error; - } - return null; - }; - - /** - * Creates an ExportMetricsServiceResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceResponse - * @static - * @param {Object.} object Plain object - * @returns {opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceResponse} ExportMetricsServiceResponse - */ - ExportMetricsServiceResponse.fromObject = function fromObject(object) { - if (object instanceof $root.opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceResponse) - return object; - var message = new $root.opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceResponse(); - if (object.partialSuccess != null) { - if (typeof object.partialSuccess !== "object") - throw TypeError(".opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceResponse.partialSuccess: object expected"); - message.partialSuccess = $root.opentelemetry.proto.collector.metrics.v1.ExportMetricsPartialSuccess.fromObject(object.partialSuccess); - } - return message; - }; - - /** - * Creates a plain object from an ExportMetricsServiceResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceResponse - * @static - * @param {opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceResponse} message ExportMetricsServiceResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ExportMetricsServiceResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) - object.partialSuccess = null; - if (message.partialSuccess != null && message.hasOwnProperty("partialSuccess")) - object.partialSuccess = $root.opentelemetry.proto.collector.metrics.v1.ExportMetricsPartialSuccess.toObject(message.partialSuccess, options); - return object; - }; - - /** - * Converts this ExportMetricsServiceResponse to JSON. - * @function toJSON - * @memberof opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceResponse - * @instance - * @returns {Object.} JSON object - */ - ExportMetricsServiceResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for ExportMetricsServiceResponse - * @function getTypeUrl - * @memberof opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceResponse - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - ExportMetricsServiceResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceResponse"; - }; - - return ExportMetricsServiceResponse; - })(); - - v1.ExportMetricsPartialSuccess = (function() { - - /** - * Properties of an ExportMetricsPartialSuccess. - * @memberof opentelemetry.proto.collector.metrics.v1 - * @interface IExportMetricsPartialSuccess - * @property {number|Long|null} [rejectedDataPoints] ExportMetricsPartialSuccess rejectedDataPoints - * @property {string|null} [errorMessage] ExportMetricsPartialSuccess errorMessage - */ - - /** - * Constructs a new ExportMetricsPartialSuccess. - * @memberof opentelemetry.proto.collector.metrics.v1 - * @classdesc Represents an ExportMetricsPartialSuccess. - * @implements IExportMetricsPartialSuccess - * @constructor - * @param {opentelemetry.proto.collector.metrics.v1.IExportMetricsPartialSuccess=} [properties] Properties to set - */ - function ExportMetricsPartialSuccess(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * ExportMetricsPartialSuccess rejectedDataPoints. - * @member {number|Long|null|undefined} rejectedDataPoints - * @memberof opentelemetry.proto.collector.metrics.v1.ExportMetricsPartialSuccess - * @instance - */ - ExportMetricsPartialSuccess.prototype.rejectedDataPoints = null; - - /** - * ExportMetricsPartialSuccess errorMessage. - * @member {string|null|undefined} errorMessage - * @memberof opentelemetry.proto.collector.metrics.v1.ExportMetricsPartialSuccess - * @instance - */ - ExportMetricsPartialSuccess.prototype.errorMessage = null; - - /** - * Creates a new ExportMetricsPartialSuccess instance using the specified properties. - * @function create - * @memberof opentelemetry.proto.collector.metrics.v1.ExportMetricsPartialSuccess - * @static - * @param {opentelemetry.proto.collector.metrics.v1.IExportMetricsPartialSuccess=} [properties] Properties to set - * @returns {opentelemetry.proto.collector.metrics.v1.ExportMetricsPartialSuccess} ExportMetricsPartialSuccess instance - */ - ExportMetricsPartialSuccess.create = function create(properties) { - return new ExportMetricsPartialSuccess(properties); - }; - - /** - * Encodes the specified ExportMetricsPartialSuccess message. Does not implicitly {@link opentelemetry.proto.collector.metrics.v1.ExportMetricsPartialSuccess.verify|verify} messages. - * @function encode - * @memberof opentelemetry.proto.collector.metrics.v1.ExportMetricsPartialSuccess - * @static - * @param {opentelemetry.proto.collector.metrics.v1.IExportMetricsPartialSuccess} message ExportMetricsPartialSuccess message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ExportMetricsPartialSuccess.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.rejectedDataPoints != null && Object.hasOwnProperty.call(message, "rejectedDataPoints")) - writer.uint32(/* id 1, wireType 0 =*/8).int64(message.rejectedDataPoints); - if (message.errorMessage != null && Object.hasOwnProperty.call(message, "errorMessage")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.errorMessage); - return writer; - }; - - /** - * Encodes the specified ExportMetricsPartialSuccess message, length delimited. Does not implicitly {@link opentelemetry.proto.collector.metrics.v1.ExportMetricsPartialSuccess.verify|verify} messages. - * @function encodeDelimited - * @memberof opentelemetry.proto.collector.metrics.v1.ExportMetricsPartialSuccess - * @static - * @param {opentelemetry.proto.collector.metrics.v1.IExportMetricsPartialSuccess} message ExportMetricsPartialSuccess message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ExportMetricsPartialSuccess.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an ExportMetricsPartialSuccess message from the specified reader or buffer. - * @function decode - * @memberof opentelemetry.proto.collector.metrics.v1.ExportMetricsPartialSuccess - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {opentelemetry.proto.collector.metrics.v1.ExportMetricsPartialSuccess} ExportMetricsPartialSuccess - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ExportMetricsPartialSuccess.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.opentelemetry.proto.collector.metrics.v1.ExportMetricsPartialSuccess(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.rejectedDataPoints = reader.int64(); - break; - } - case 2: { - message.errorMessage = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an ExportMetricsPartialSuccess message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof opentelemetry.proto.collector.metrics.v1.ExportMetricsPartialSuccess - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {opentelemetry.proto.collector.metrics.v1.ExportMetricsPartialSuccess} ExportMetricsPartialSuccess - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ExportMetricsPartialSuccess.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an ExportMetricsPartialSuccess message. - * @function verify - * @memberof opentelemetry.proto.collector.metrics.v1.ExportMetricsPartialSuccess - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ExportMetricsPartialSuccess.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.rejectedDataPoints != null && message.hasOwnProperty("rejectedDataPoints")) - if (!$util.isInteger(message.rejectedDataPoints) && !(message.rejectedDataPoints && $util.isInteger(message.rejectedDataPoints.low) && $util.isInteger(message.rejectedDataPoints.high))) - return "rejectedDataPoints: integer|Long expected"; - if (message.errorMessage != null && message.hasOwnProperty("errorMessage")) - if (!$util.isString(message.errorMessage)) - return "errorMessage: string expected"; - return null; - }; - - /** - * Creates an ExportMetricsPartialSuccess message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof opentelemetry.proto.collector.metrics.v1.ExportMetricsPartialSuccess - * @static - * @param {Object.} object Plain object - * @returns {opentelemetry.proto.collector.metrics.v1.ExportMetricsPartialSuccess} ExportMetricsPartialSuccess - */ - ExportMetricsPartialSuccess.fromObject = function fromObject(object) { - if (object instanceof $root.opentelemetry.proto.collector.metrics.v1.ExportMetricsPartialSuccess) - return object; - var message = new $root.opentelemetry.proto.collector.metrics.v1.ExportMetricsPartialSuccess(); - if (object.rejectedDataPoints != null) - if ($util.Long) - (message.rejectedDataPoints = $util.Long.fromValue(object.rejectedDataPoints)).unsigned = false; - else if (typeof object.rejectedDataPoints === "string") - message.rejectedDataPoints = parseInt(object.rejectedDataPoints, 10); - else if (typeof object.rejectedDataPoints === "number") - message.rejectedDataPoints = object.rejectedDataPoints; - else if (typeof object.rejectedDataPoints === "object") - message.rejectedDataPoints = new $util.LongBits(object.rejectedDataPoints.low >>> 0, object.rejectedDataPoints.high >>> 0).toNumber(); - if (object.errorMessage != null) - message.errorMessage = String(object.errorMessage); - return message; - }; - - /** - * Creates a plain object from an ExportMetricsPartialSuccess message. Also converts values to other types if specified. - * @function toObject - * @memberof opentelemetry.proto.collector.metrics.v1.ExportMetricsPartialSuccess - * @static - * @param {opentelemetry.proto.collector.metrics.v1.ExportMetricsPartialSuccess} message ExportMetricsPartialSuccess - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ExportMetricsPartialSuccess.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.rejectedDataPoints = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.rejectedDataPoints = options.longs === String ? "0" : 0; - object.errorMessage = ""; - } - if (message.rejectedDataPoints != null && message.hasOwnProperty("rejectedDataPoints")) - if (typeof message.rejectedDataPoints === "number") - object.rejectedDataPoints = options.longs === String ? String(message.rejectedDataPoints) : message.rejectedDataPoints; - else - object.rejectedDataPoints = options.longs === String ? $util.Long.prototype.toString.call(message.rejectedDataPoints) : options.longs === Number ? new $util.LongBits(message.rejectedDataPoints.low >>> 0, message.rejectedDataPoints.high >>> 0).toNumber() : message.rejectedDataPoints; - if (message.errorMessage != null && message.hasOwnProperty("errorMessage")) - object.errorMessage = message.errorMessage; - return object; - }; - - /** - * Converts this ExportMetricsPartialSuccess to JSON. - * @function toJSON - * @memberof opentelemetry.proto.collector.metrics.v1.ExportMetricsPartialSuccess - * @instance - * @returns {Object.} JSON object - */ - ExportMetricsPartialSuccess.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for ExportMetricsPartialSuccess - * @function getTypeUrl - * @memberof opentelemetry.proto.collector.metrics.v1.ExportMetricsPartialSuccess - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - ExportMetricsPartialSuccess.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/opentelemetry.proto.collector.metrics.v1.ExportMetricsPartialSuccess"; - }; - - return ExportMetricsPartialSuccess; - })(); - - return v1; - })(); - - return metrics; - })(); - - collector.logs = (function() { - - /** - * Namespace logs. - * @memberof opentelemetry.proto.collector - * @namespace - */ - var logs = {}; - - logs.v1 = (function() { - - /** - * Namespace v1. - * @memberof opentelemetry.proto.collector.logs - * @namespace - */ - var v1 = {}; - - v1.LogsService = (function() { - - /** - * Constructs a new LogsService service. - * @memberof opentelemetry.proto.collector.logs.v1 - * @classdesc Represents a LogsService - * @extends $protobuf.rpc.Service - * @constructor - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - */ - function LogsService(rpcImpl, requestDelimited, responseDelimited) { - $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); - } - - (LogsService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = LogsService; - - /** - * Creates new LogsService service using the specified rpc implementation. - * @function create - * @memberof opentelemetry.proto.collector.logs.v1.LogsService - * @static - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - * @returns {LogsService} RPC service. Useful where requests and/or responses are streamed. - */ - LogsService.create = function create(rpcImpl, requestDelimited, responseDelimited) { - return new this(rpcImpl, requestDelimited, responseDelimited); - }; - - /** - * Callback as used by {@link opentelemetry.proto.collector.logs.v1.LogsService#export_}. - * @memberof opentelemetry.proto.collector.logs.v1.LogsService - * @typedef ExportCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {opentelemetry.proto.collector.logs.v1.ExportLogsServiceResponse} [response] ExportLogsServiceResponse - */ - - /** - * Calls Export. - * @function export - * @memberof opentelemetry.proto.collector.logs.v1.LogsService - * @instance - * @param {opentelemetry.proto.collector.logs.v1.IExportLogsServiceRequest} request ExportLogsServiceRequest message or plain object - * @param {opentelemetry.proto.collector.logs.v1.LogsService.ExportCallback} callback Node-style callback called with the error, if any, and ExportLogsServiceResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(LogsService.prototype["export"] = function export_(request, callback) { - return this.rpcCall(export_, $root.opentelemetry.proto.collector.logs.v1.ExportLogsServiceRequest, $root.opentelemetry.proto.collector.logs.v1.ExportLogsServiceResponse, request, callback); - }, "name", { value: "Export" }); - - /** - * Calls Export. - * @function export - * @memberof opentelemetry.proto.collector.logs.v1.LogsService - * @instance - * @param {opentelemetry.proto.collector.logs.v1.IExportLogsServiceRequest} request ExportLogsServiceRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - return LogsService; - })(); - - v1.ExportLogsServiceRequest = (function() { - - /** - * Properties of an ExportLogsServiceRequest. - * @memberof opentelemetry.proto.collector.logs.v1 - * @interface IExportLogsServiceRequest - * @property {Array.|null} [resourceLogs] ExportLogsServiceRequest resourceLogs - */ - - /** - * Constructs a new ExportLogsServiceRequest. - * @memberof opentelemetry.proto.collector.logs.v1 - * @classdesc Represents an ExportLogsServiceRequest. - * @implements IExportLogsServiceRequest - * @constructor - * @param {opentelemetry.proto.collector.logs.v1.IExportLogsServiceRequest=} [properties] Properties to set - */ - function ExportLogsServiceRequest(properties) { - this.resourceLogs = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * ExportLogsServiceRequest resourceLogs. - * @member {Array.} resourceLogs - * @memberof opentelemetry.proto.collector.logs.v1.ExportLogsServiceRequest - * @instance - */ - ExportLogsServiceRequest.prototype.resourceLogs = $util.emptyArray; - - /** - * Creates a new ExportLogsServiceRequest instance using the specified properties. - * @function create - * @memberof opentelemetry.proto.collector.logs.v1.ExportLogsServiceRequest - * @static - * @param {opentelemetry.proto.collector.logs.v1.IExportLogsServiceRequest=} [properties] Properties to set - * @returns {opentelemetry.proto.collector.logs.v1.ExportLogsServiceRequest} ExportLogsServiceRequest instance - */ - ExportLogsServiceRequest.create = function create(properties) { - return new ExportLogsServiceRequest(properties); - }; - - /** - * Encodes the specified ExportLogsServiceRequest message. Does not implicitly {@link opentelemetry.proto.collector.logs.v1.ExportLogsServiceRequest.verify|verify} messages. - * @function encode - * @memberof opentelemetry.proto.collector.logs.v1.ExportLogsServiceRequest - * @static - * @param {opentelemetry.proto.collector.logs.v1.IExportLogsServiceRequest} message ExportLogsServiceRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ExportLogsServiceRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.resourceLogs != null && message.resourceLogs.length) - for (var i = 0; i < message.resourceLogs.length; ++i) - $root.opentelemetry.proto.logs.v1.ResourceLogs.encode(message.resourceLogs[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified ExportLogsServiceRequest message, length delimited. Does not implicitly {@link opentelemetry.proto.collector.logs.v1.ExportLogsServiceRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof opentelemetry.proto.collector.logs.v1.ExportLogsServiceRequest - * @static - * @param {opentelemetry.proto.collector.logs.v1.IExportLogsServiceRequest} message ExportLogsServiceRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ExportLogsServiceRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an ExportLogsServiceRequest message from the specified reader or buffer. - * @function decode - * @memberof opentelemetry.proto.collector.logs.v1.ExportLogsServiceRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {opentelemetry.proto.collector.logs.v1.ExportLogsServiceRequest} ExportLogsServiceRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ExportLogsServiceRequest.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.opentelemetry.proto.collector.logs.v1.ExportLogsServiceRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (!(message.resourceLogs && message.resourceLogs.length)) - message.resourceLogs = []; - message.resourceLogs.push($root.opentelemetry.proto.logs.v1.ResourceLogs.decode(reader, reader.uint32())); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an ExportLogsServiceRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof opentelemetry.proto.collector.logs.v1.ExportLogsServiceRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {opentelemetry.proto.collector.logs.v1.ExportLogsServiceRequest} ExportLogsServiceRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ExportLogsServiceRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an ExportLogsServiceRequest message. - * @function verify - * @memberof opentelemetry.proto.collector.logs.v1.ExportLogsServiceRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ExportLogsServiceRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.resourceLogs != null && message.hasOwnProperty("resourceLogs")) { - if (!Array.isArray(message.resourceLogs)) - return "resourceLogs: array expected"; - for (var i = 0; i < message.resourceLogs.length; ++i) { - var error = $root.opentelemetry.proto.logs.v1.ResourceLogs.verify(message.resourceLogs[i]); - if (error) - return "resourceLogs." + error; - } - } - return null; - }; - - /** - * Creates an ExportLogsServiceRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof opentelemetry.proto.collector.logs.v1.ExportLogsServiceRequest - * @static - * @param {Object.} object Plain object - * @returns {opentelemetry.proto.collector.logs.v1.ExportLogsServiceRequest} ExportLogsServiceRequest - */ - ExportLogsServiceRequest.fromObject = function fromObject(object) { - if (object instanceof $root.opentelemetry.proto.collector.logs.v1.ExportLogsServiceRequest) - return object; - var message = new $root.opentelemetry.proto.collector.logs.v1.ExportLogsServiceRequest(); - if (object.resourceLogs) { - if (!Array.isArray(object.resourceLogs)) - throw TypeError(".opentelemetry.proto.collector.logs.v1.ExportLogsServiceRequest.resourceLogs: array expected"); - message.resourceLogs = []; - for (var i = 0; i < object.resourceLogs.length; ++i) { - if (typeof object.resourceLogs[i] !== "object") - throw TypeError(".opentelemetry.proto.collector.logs.v1.ExportLogsServiceRequest.resourceLogs: object expected"); - message.resourceLogs[i] = $root.opentelemetry.proto.logs.v1.ResourceLogs.fromObject(object.resourceLogs[i]); - } - } - return message; - }; - - /** - * Creates a plain object from an ExportLogsServiceRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof opentelemetry.proto.collector.logs.v1.ExportLogsServiceRequest - * @static - * @param {opentelemetry.proto.collector.logs.v1.ExportLogsServiceRequest} message ExportLogsServiceRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ExportLogsServiceRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.resourceLogs = []; - if (message.resourceLogs && message.resourceLogs.length) { - object.resourceLogs = []; - for (var j = 0; j < message.resourceLogs.length; ++j) - object.resourceLogs[j] = $root.opentelemetry.proto.logs.v1.ResourceLogs.toObject(message.resourceLogs[j], options); - } - return object; - }; - - /** - * Converts this ExportLogsServiceRequest to JSON. - * @function toJSON - * @memberof opentelemetry.proto.collector.logs.v1.ExportLogsServiceRequest - * @instance - * @returns {Object.} JSON object - */ - ExportLogsServiceRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for ExportLogsServiceRequest - * @function getTypeUrl - * @memberof opentelemetry.proto.collector.logs.v1.ExportLogsServiceRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - ExportLogsServiceRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/opentelemetry.proto.collector.logs.v1.ExportLogsServiceRequest"; - }; - - return ExportLogsServiceRequest; - })(); - - v1.ExportLogsServiceResponse = (function() { - - /** - * Properties of an ExportLogsServiceResponse. - * @memberof opentelemetry.proto.collector.logs.v1 - * @interface IExportLogsServiceResponse - * @property {opentelemetry.proto.collector.logs.v1.IExportLogsPartialSuccess|null} [partialSuccess] ExportLogsServiceResponse partialSuccess - */ - - /** - * Constructs a new ExportLogsServiceResponse. - * @memberof opentelemetry.proto.collector.logs.v1 - * @classdesc Represents an ExportLogsServiceResponse. - * @implements IExportLogsServiceResponse - * @constructor - * @param {opentelemetry.proto.collector.logs.v1.IExportLogsServiceResponse=} [properties] Properties to set - */ - function ExportLogsServiceResponse(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * ExportLogsServiceResponse partialSuccess. - * @member {opentelemetry.proto.collector.logs.v1.IExportLogsPartialSuccess|null|undefined} partialSuccess - * @memberof opentelemetry.proto.collector.logs.v1.ExportLogsServiceResponse - * @instance - */ - ExportLogsServiceResponse.prototype.partialSuccess = null; - - /** - * Creates a new ExportLogsServiceResponse instance using the specified properties. - * @function create - * @memberof opentelemetry.proto.collector.logs.v1.ExportLogsServiceResponse - * @static - * @param {opentelemetry.proto.collector.logs.v1.IExportLogsServiceResponse=} [properties] Properties to set - * @returns {opentelemetry.proto.collector.logs.v1.ExportLogsServiceResponse} ExportLogsServiceResponse instance - */ - ExportLogsServiceResponse.create = function create(properties) { - return new ExportLogsServiceResponse(properties); - }; - - /** - * Encodes the specified ExportLogsServiceResponse message. Does not implicitly {@link opentelemetry.proto.collector.logs.v1.ExportLogsServiceResponse.verify|verify} messages. - * @function encode - * @memberof opentelemetry.proto.collector.logs.v1.ExportLogsServiceResponse - * @static - * @param {opentelemetry.proto.collector.logs.v1.IExportLogsServiceResponse} message ExportLogsServiceResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ExportLogsServiceResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.partialSuccess != null && Object.hasOwnProperty.call(message, "partialSuccess")) - $root.opentelemetry.proto.collector.logs.v1.ExportLogsPartialSuccess.encode(message.partialSuccess, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified ExportLogsServiceResponse message, length delimited. Does not implicitly {@link opentelemetry.proto.collector.logs.v1.ExportLogsServiceResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof opentelemetry.proto.collector.logs.v1.ExportLogsServiceResponse - * @static - * @param {opentelemetry.proto.collector.logs.v1.IExportLogsServiceResponse} message ExportLogsServiceResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ExportLogsServiceResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an ExportLogsServiceResponse message from the specified reader or buffer. - * @function decode - * @memberof opentelemetry.proto.collector.logs.v1.ExportLogsServiceResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {opentelemetry.proto.collector.logs.v1.ExportLogsServiceResponse} ExportLogsServiceResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ExportLogsServiceResponse.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.opentelemetry.proto.collector.logs.v1.ExportLogsServiceResponse(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.partialSuccess = $root.opentelemetry.proto.collector.logs.v1.ExportLogsPartialSuccess.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an ExportLogsServiceResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof opentelemetry.proto.collector.logs.v1.ExportLogsServiceResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {opentelemetry.proto.collector.logs.v1.ExportLogsServiceResponse} ExportLogsServiceResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ExportLogsServiceResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an ExportLogsServiceResponse message. - * @function verify - * @memberof opentelemetry.proto.collector.logs.v1.ExportLogsServiceResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ExportLogsServiceResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.partialSuccess != null && message.hasOwnProperty("partialSuccess")) { - var error = $root.opentelemetry.proto.collector.logs.v1.ExportLogsPartialSuccess.verify(message.partialSuccess); - if (error) - return "partialSuccess." + error; - } - return null; - }; - - /** - * Creates an ExportLogsServiceResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof opentelemetry.proto.collector.logs.v1.ExportLogsServiceResponse - * @static - * @param {Object.} object Plain object - * @returns {opentelemetry.proto.collector.logs.v1.ExportLogsServiceResponse} ExportLogsServiceResponse - */ - ExportLogsServiceResponse.fromObject = function fromObject(object) { - if (object instanceof $root.opentelemetry.proto.collector.logs.v1.ExportLogsServiceResponse) - return object; - var message = new $root.opentelemetry.proto.collector.logs.v1.ExportLogsServiceResponse(); - if (object.partialSuccess != null) { - if (typeof object.partialSuccess !== "object") - throw TypeError(".opentelemetry.proto.collector.logs.v1.ExportLogsServiceResponse.partialSuccess: object expected"); - message.partialSuccess = $root.opentelemetry.proto.collector.logs.v1.ExportLogsPartialSuccess.fromObject(object.partialSuccess); - } - return message; - }; - - /** - * Creates a plain object from an ExportLogsServiceResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof opentelemetry.proto.collector.logs.v1.ExportLogsServiceResponse - * @static - * @param {opentelemetry.proto.collector.logs.v1.ExportLogsServiceResponse} message ExportLogsServiceResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ExportLogsServiceResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) - object.partialSuccess = null; - if (message.partialSuccess != null && message.hasOwnProperty("partialSuccess")) - object.partialSuccess = $root.opentelemetry.proto.collector.logs.v1.ExportLogsPartialSuccess.toObject(message.partialSuccess, options); - return object; - }; - - /** - * Converts this ExportLogsServiceResponse to JSON. - * @function toJSON - * @memberof opentelemetry.proto.collector.logs.v1.ExportLogsServiceResponse - * @instance - * @returns {Object.} JSON object - */ - ExportLogsServiceResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for ExportLogsServiceResponse - * @function getTypeUrl - * @memberof opentelemetry.proto.collector.logs.v1.ExportLogsServiceResponse - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - ExportLogsServiceResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/opentelemetry.proto.collector.logs.v1.ExportLogsServiceResponse"; - }; - - return ExportLogsServiceResponse; - })(); - - v1.ExportLogsPartialSuccess = (function() { - - /** - * Properties of an ExportLogsPartialSuccess. - * @memberof opentelemetry.proto.collector.logs.v1 - * @interface IExportLogsPartialSuccess - * @property {number|Long|null} [rejectedLogRecords] ExportLogsPartialSuccess rejectedLogRecords - * @property {string|null} [errorMessage] ExportLogsPartialSuccess errorMessage - */ - - /** - * Constructs a new ExportLogsPartialSuccess. - * @memberof opentelemetry.proto.collector.logs.v1 - * @classdesc Represents an ExportLogsPartialSuccess. - * @implements IExportLogsPartialSuccess - * @constructor - * @param {opentelemetry.proto.collector.logs.v1.IExportLogsPartialSuccess=} [properties] Properties to set - */ - function ExportLogsPartialSuccess(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * ExportLogsPartialSuccess rejectedLogRecords. - * @member {number|Long|null|undefined} rejectedLogRecords - * @memberof opentelemetry.proto.collector.logs.v1.ExportLogsPartialSuccess - * @instance - */ - ExportLogsPartialSuccess.prototype.rejectedLogRecords = null; - - /** - * ExportLogsPartialSuccess errorMessage. - * @member {string|null|undefined} errorMessage - * @memberof opentelemetry.proto.collector.logs.v1.ExportLogsPartialSuccess - * @instance - */ - ExportLogsPartialSuccess.prototype.errorMessage = null; - - /** - * Creates a new ExportLogsPartialSuccess instance using the specified properties. - * @function create - * @memberof opentelemetry.proto.collector.logs.v1.ExportLogsPartialSuccess - * @static - * @param {opentelemetry.proto.collector.logs.v1.IExportLogsPartialSuccess=} [properties] Properties to set - * @returns {opentelemetry.proto.collector.logs.v1.ExportLogsPartialSuccess} ExportLogsPartialSuccess instance - */ - ExportLogsPartialSuccess.create = function create(properties) { - return new ExportLogsPartialSuccess(properties); - }; - - /** - * Encodes the specified ExportLogsPartialSuccess message. Does not implicitly {@link opentelemetry.proto.collector.logs.v1.ExportLogsPartialSuccess.verify|verify} messages. - * @function encode - * @memberof opentelemetry.proto.collector.logs.v1.ExportLogsPartialSuccess - * @static - * @param {opentelemetry.proto.collector.logs.v1.IExportLogsPartialSuccess} message ExportLogsPartialSuccess message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ExportLogsPartialSuccess.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.rejectedLogRecords != null && Object.hasOwnProperty.call(message, "rejectedLogRecords")) - writer.uint32(/* id 1, wireType 0 =*/8).int64(message.rejectedLogRecords); - if (message.errorMessage != null && Object.hasOwnProperty.call(message, "errorMessage")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.errorMessage); - return writer; - }; - - /** - * Encodes the specified ExportLogsPartialSuccess message, length delimited. Does not implicitly {@link opentelemetry.proto.collector.logs.v1.ExportLogsPartialSuccess.verify|verify} messages. - * @function encodeDelimited - * @memberof opentelemetry.proto.collector.logs.v1.ExportLogsPartialSuccess - * @static - * @param {opentelemetry.proto.collector.logs.v1.IExportLogsPartialSuccess} message ExportLogsPartialSuccess message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ExportLogsPartialSuccess.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an ExportLogsPartialSuccess message from the specified reader or buffer. - * @function decode - * @memberof opentelemetry.proto.collector.logs.v1.ExportLogsPartialSuccess - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {opentelemetry.proto.collector.logs.v1.ExportLogsPartialSuccess} ExportLogsPartialSuccess - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ExportLogsPartialSuccess.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.opentelemetry.proto.collector.logs.v1.ExportLogsPartialSuccess(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.rejectedLogRecords = reader.int64(); - break; - } - case 2: { - message.errorMessage = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an ExportLogsPartialSuccess message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof opentelemetry.proto.collector.logs.v1.ExportLogsPartialSuccess - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {opentelemetry.proto.collector.logs.v1.ExportLogsPartialSuccess} ExportLogsPartialSuccess - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ExportLogsPartialSuccess.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an ExportLogsPartialSuccess message. - * @function verify - * @memberof opentelemetry.proto.collector.logs.v1.ExportLogsPartialSuccess - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ExportLogsPartialSuccess.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.rejectedLogRecords != null && message.hasOwnProperty("rejectedLogRecords")) - if (!$util.isInteger(message.rejectedLogRecords) && !(message.rejectedLogRecords && $util.isInteger(message.rejectedLogRecords.low) && $util.isInteger(message.rejectedLogRecords.high))) - return "rejectedLogRecords: integer|Long expected"; - if (message.errorMessage != null && message.hasOwnProperty("errorMessage")) - if (!$util.isString(message.errorMessage)) - return "errorMessage: string expected"; - return null; - }; - - /** - * Creates an ExportLogsPartialSuccess message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof opentelemetry.proto.collector.logs.v1.ExportLogsPartialSuccess - * @static - * @param {Object.} object Plain object - * @returns {opentelemetry.proto.collector.logs.v1.ExportLogsPartialSuccess} ExportLogsPartialSuccess - */ - ExportLogsPartialSuccess.fromObject = function fromObject(object) { - if (object instanceof $root.opentelemetry.proto.collector.logs.v1.ExportLogsPartialSuccess) - return object; - var message = new $root.opentelemetry.proto.collector.logs.v1.ExportLogsPartialSuccess(); - if (object.rejectedLogRecords != null) - if ($util.Long) - (message.rejectedLogRecords = $util.Long.fromValue(object.rejectedLogRecords)).unsigned = false; - else if (typeof object.rejectedLogRecords === "string") - message.rejectedLogRecords = parseInt(object.rejectedLogRecords, 10); - else if (typeof object.rejectedLogRecords === "number") - message.rejectedLogRecords = object.rejectedLogRecords; - else if (typeof object.rejectedLogRecords === "object") - message.rejectedLogRecords = new $util.LongBits(object.rejectedLogRecords.low >>> 0, object.rejectedLogRecords.high >>> 0).toNumber(); - if (object.errorMessage != null) - message.errorMessage = String(object.errorMessage); - return message; - }; - - /** - * Creates a plain object from an ExportLogsPartialSuccess message. Also converts values to other types if specified. - * @function toObject - * @memberof opentelemetry.proto.collector.logs.v1.ExportLogsPartialSuccess - * @static - * @param {opentelemetry.proto.collector.logs.v1.ExportLogsPartialSuccess} message ExportLogsPartialSuccess - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ExportLogsPartialSuccess.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.rejectedLogRecords = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.rejectedLogRecords = options.longs === String ? "0" : 0; - object.errorMessage = ""; - } - if (message.rejectedLogRecords != null && message.hasOwnProperty("rejectedLogRecords")) - if (typeof message.rejectedLogRecords === "number") - object.rejectedLogRecords = options.longs === String ? String(message.rejectedLogRecords) : message.rejectedLogRecords; - else - object.rejectedLogRecords = options.longs === String ? $util.Long.prototype.toString.call(message.rejectedLogRecords) : options.longs === Number ? new $util.LongBits(message.rejectedLogRecords.low >>> 0, message.rejectedLogRecords.high >>> 0).toNumber() : message.rejectedLogRecords; - if (message.errorMessage != null && message.hasOwnProperty("errorMessage")) - object.errorMessage = message.errorMessage; - return object; - }; - - /** - * Converts this ExportLogsPartialSuccess to JSON. - * @function toJSON - * @memberof opentelemetry.proto.collector.logs.v1.ExportLogsPartialSuccess - * @instance - * @returns {Object.} JSON object - */ - ExportLogsPartialSuccess.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for ExportLogsPartialSuccess - * @function getTypeUrl - * @memberof opentelemetry.proto.collector.logs.v1.ExportLogsPartialSuccess - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - ExportLogsPartialSuccess.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/opentelemetry.proto.collector.logs.v1.ExportLogsPartialSuccess"; - }; - - return ExportLogsPartialSuccess; - })(); - - return v1; - })(); - - return logs; - })(); - - return collector; - })(); - - proto.metrics = (function() { - - /** - * Namespace metrics. - * @memberof opentelemetry.proto - * @namespace - */ - var metrics = {}; - - metrics.v1 = (function() { - - /** - * Namespace v1. - * @memberof opentelemetry.proto.metrics - * @namespace - */ - var v1 = {}; - - v1.MetricsData = (function() { - - /** - * Properties of a MetricsData. - * @memberof opentelemetry.proto.metrics.v1 - * @interface IMetricsData - * @property {Array.|null} [resourceMetrics] MetricsData resourceMetrics - */ - - /** - * Constructs a new MetricsData. - * @memberof opentelemetry.proto.metrics.v1 - * @classdesc Represents a MetricsData. - * @implements IMetricsData - * @constructor - * @param {opentelemetry.proto.metrics.v1.IMetricsData=} [properties] Properties to set - */ - function MetricsData(properties) { - this.resourceMetrics = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * MetricsData resourceMetrics. - * @member {Array.} resourceMetrics - * @memberof opentelemetry.proto.metrics.v1.MetricsData - * @instance - */ - MetricsData.prototype.resourceMetrics = $util.emptyArray; - - /** - * Creates a new MetricsData instance using the specified properties. - * @function create - * @memberof opentelemetry.proto.metrics.v1.MetricsData - * @static - * @param {opentelemetry.proto.metrics.v1.IMetricsData=} [properties] Properties to set - * @returns {opentelemetry.proto.metrics.v1.MetricsData} MetricsData instance - */ - MetricsData.create = function create(properties) { - return new MetricsData(properties); - }; - - /** - * Encodes the specified MetricsData message. Does not implicitly {@link opentelemetry.proto.metrics.v1.MetricsData.verify|verify} messages. - * @function encode - * @memberof opentelemetry.proto.metrics.v1.MetricsData - * @static - * @param {opentelemetry.proto.metrics.v1.IMetricsData} message MetricsData message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MetricsData.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.resourceMetrics != null && message.resourceMetrics.length) - for (var i = 0; i < message.resourceMetrics.length; ++i) - $root.opentelemetry.proto.metrics.v1.ResourceMetrics.encode(message.resourceMetrics[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified MetricsData message, length delimited. Does not implicitly {@link opentelemetry.proto.metrics.v1.MetricsData.verify|verify} messages. - * @function encodeDelimited - * @memberof opentelemetry.proto.metrics.v1.MetricsData - * @static - * @param {opentelemetry.proto.metrics.v1.IMetricsData} message MetricsData message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MetricsData.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a MetricsData message from the specified reader or buffer. - * @function decode - * @memberof opentelemetry.proto.metrics.v1.MetricsData - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {opentelemetry.proto.metrics.v1.MetricsData} MetricsData - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MetricsData.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.opentelemetry.proto.metrics.v1.MetricsData(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (!(message.resourceMetrics && message.resourceMetrics.length)) - message.resourceMetrics = []; - message.resourceMetrics.push($root.opentelemetry.proto.metrics.v1.ResourceMetrics.decode(reader, reader.uint32())); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a MetricsData message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof opentelemetry.proto.metrics.v1.MetricsData - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {opentelemetry.proto.metrics.v1.MetricsData} MetricsData - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MetricsData.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a MetricsData message. - * @function verify - * @memberof opentelemetry.proto.metrics.v1.MetricsData - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - MetricsData.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.resourceMetrics != null && message.hasOwnProperty("resourceMetrics")) { - if (!Array.isArray(message.resourceMetrics)) - return "resourceMetrics: array expected"; - for (var i = 0; i < message.resourceMetrics.length; ++i) { - var error = $root.opentelemetry.proto.metrics.v1.ResourceMetrics.verify(message.resourceMetrics[i]); - if (error) - return "resourceMetrics." + error; - } - } - return null; - }; - - /** - * Creates a MetricsData message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof opentelemetry.proto.metrics.v1.MetricsData - * @static - * @param {Object.} object Plain object - * @returns {opentelemetry.proto.metrics.v1.MetricsData} MetricsData - */ - MetricsData.fromObject = function fromObject(object) { - if (object instanceof $root.opentelemetry.proto.metrics.v1.MetricsData) - return object; - var message = new $root.opentelemetry.proto.metrics.v1.MetricsData(); - if (object.resourceMetrics) { - if (!Array.isArray(object.resourceMetrics)) - throw TypeError(".opentelemetry.proto.metrics.v1.MetricsData.resourceMetrics: array expected"); - message.resourceMetrics = []; - for (var i = 0; i < object.resourceMetrics.length; ++i) { - if (typeof object.resourceMetrics[i] !== "object") - throw TypeError(".opentelemetry.proto.metrics.v1.MetricsData.resourceMetrics: object expected"); - message.resourceMetrics[i] = $root.opentelemetry.proto.metrics.v1.ResourceMetrics.fromObject(object.resourceMetrics[i]); - } - } - return message; - }; - - /** - * Creates a plain object from a MetricsData message. Also converts values to other types if specified. - * @function toObject - * @memberof opentelemetry.proto.metrics.v1.MetricsData - * @static - * @param {opentelemetry.proto.metrics.v1.MetricsData} message MetricsData - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - MetricsData.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.resourceMetrics = []; - if (message.resourceMetrics && message.resourceMetrics.length) { - object.resourceMetrics = []; - for (var j = 0; j < message.resourceMetrics.length; ++j) - object.resourceMetrics[j] = $root.opentelemetry.proto.metrics.v1.ResourceMetrics.toObject(message.resourceMetrics[j], options); - } - return object; - }; - - /** - * Converts this MetricsData to JSON. - * @function toJSON - * @memberof opentelemetry.proto.metrics.v1.MetricsData - * @instance - * @returns {Object.} JSON object - */ - MetricsData.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for MetricsData - * @function getTypeUrl - * @memberof opentelemetry.proto.metrics.v1.MetricsData - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - MetricsData.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/opentelemetry.proto.metrics.v1.MetricsData"; - }; - - return MetricsData; - })(); - - v1.ResourceMetrics = (function() { - - /** - * Properties of a ResourceMetrics. - * @memberof opentelemetry.proto.metrics.v1 - * @interface IResourceMetrics - * @property {opentelemetry.proto.resource.v1.IResource|null} [resource] ResourceMetrics resource - * @property {Array.|null} [scopeMetrics] ResourceMetrics scopeMetrics - * @property {string|null} [schemaUrl] ResourceMetrics schemaUrl - */ - - /** - * Constructs a new ResourceMetrics. - * @memberof opentelemetry.proto.metrics.v1 - * @classdesc Represents a ResourceMetrics. - * @implements IResourceMetrics - * @constructor - * @param {opentelemetry.proto.metrics.v1.IResourceMetrics=} [properties] Properties to set - */ - function ResourceMetrics(properties) { - this.scopeMetrics = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * ResourceMetrics resource. - * @member {opentelemetry.proto.resource.v1.IResource|null|undefined} resource - * @memberof opentelemetry.proto.metrics.v1.ResourceMetrics - * @instance - */ - ResourceMetrics.prototype.resource = null; - - /** - * ResourceMetrics scopeMetrics. - * @member {Array.} scopeMetrics - * @memberof opentelemetry.proto.metrics.v1.ResourceMetrics - * @instance - */ - ResourceMetrics.prototype.scopeMetrics = $util.emptyArray; - - /** - * ResourceMetrics schemaUrl. - * @member {string|null|undefined} schemaUrl - * @memberof opentelemetry.proto.metrics.v1.ResourceMetrics - * @instance - */ - ResourceMetrics.prototype.schemaUrl = null; - - /** - * Creates a new ResourceMetrics instance using the specified properties. - * @function create - * @memberof opentelemetry.proto.metrics.v1.ResourceMetrics - * @static - * @param {opentelemetry.proto.metrics.v1.IResourceMetrics=} [properties] Properties to set - * @returns {opentelemetry.proto.metrics.v1.ResourceMetrics} ResourceMetrics instance - */ - ResourceMetrics.create = function create(properties) { - return new ResourceMetrics(properties); - }; - - /** - * Encodes the specified ResourceMetrics message. Does not implicitly {@link opentelemetry.proto.metrics.v1.ResourceMetrics.verify|verify} messages. - * @function encode - * @memberof opentelemetry.proto.metrics.v1.ResourceMetrics - * @static - * @param {opentelemetry.proto.metrics.v1.IResourceMetrics} message ResourceMetrics message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ResourceMetrics.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.scopeMetrics != null && message.scopeMetrics.length) - for (var i = 0; i < message.scopeMetrics.length; ++i) - $root.opentelemetry.proto.metrics.v1.ScopeMetrics.encode(message.scopeMetrics[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 ResourceMetrics message, length delimited. Does not implicitly {@link opentelemetry.proto.metrics.v1.ResourceMetrics.verify|verify} messages. - * @function encodeDelimited - * @memberof opentelemetry.proto.metrics.v1.ResourceMetrics - * @static - * @param {opentelemetry.proto.metrics.v1.IResourceMetrics} message ResourceMetrics message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ResourceMetrics.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a ResourceMetrics message from the specified reader or buffer. - * @function decode - * @memberof opentelemetry.proto.metrics.v1.ResourceMetrics - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {opentelemetry.proto.metrics.v1.ResourceMetrics} ResourceMetrics - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ResourceMetrics.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.opentelemetry.proto.metrics.v1.ResourceMetrics(); - while (reader.pos < end) { - var 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.scopeMetrics && message.scopeMetrics.length)) - message.scopeMetrics = []; - message.scopeMetrics.push($root.opentelemetry.proto.metrics.v1.ScopeMetrics.decode(reader, reader.uint32())); - break; - } - case 3: { - message.schemaUrl = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a ResourceMetrics message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof opentelemetry.proto.metrics.v1.ResourceMetrics - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {opentelemetry.proto.metrics.v1.ResourceMetrics} ResourceMetrics - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ResourceMetrics.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a ResourceMetrics message. - * @function verify - * @memberof opentelemetry.proto.metrics.v1.ResourceMetrics - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ResourceMetrics.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.resource != null && message.hasOwnProperty("resource")) { - var error = $root.opentelemetry.proto.resource.v1.Resource.verify(message.resource); - if (error) - return "resource." + error; - } - if (message.scopeMetrics != null && message.hasOwnProperty("scopeMetrics")) { - if (!Array.isArray(message.scopeMetrics)) - return "scopeMetrics: array expected"; - for (var i = 0; i < message.scopeMetrics.length; ++i) { - var error = $root.opentelemetry.proto.metrics.v1.ScopeMetrics.verify(message.scopeMetrics[i]); - if (error) - return "scopeMetrics." + error; - } - } - if (message.schemaUrl != null && message.hasOwnProperty("schemaUrl")) - if (!$util.isString(message.schemaUrl)) - return "schemaUrl: string expected"; - return null; - }; - - /** - * Creates a ResourceMetrics message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof opentelemetry.proto.metrics.v1.ResourceMetrics - * @static - * @param {Object.} object Plain object - * @returns {opentelemetry.proto.metrics.v1.ResourceMetrics} ResourceMetrics - */ - ResourceMetrics.fromObject = function fromObject(object) { - if (object instanceof $root.opentelemetry.proto.metrics.v1.ResourceMetrics) - return object; - var message = new $root.opentelemetry.proto.metrics.v1.ResourceMetrics(); - if (object.resource != null) { - if (typeof object.resource !== "object") - throw TypeError(".opentelemetry.proto.metrics.v1.ResourceMetrics.resource: object expected"); - message.resource = $root.opentelemetry.proto.resource.v1.Resource.fromObject(object.resource); - } - if (object.scopeMetrics) { - if (!Array.isArray(object.scopeMetrics)) - throw TypeError(".opentelemetry.proto.metrics.v1.ResourceMetrics.scopeMetrics: array expected"); - message.scopeMetrics = []; - for (var i = 0; i < object.scopeMetrics.length; ++i) { - if (typeof object.scopeMetrics[i] !== "object") - throw TypeError(".opentelemetry.proto.metrics.v1.ResourceMetrics.scopeMetrics: object expected"); - message.scopeMetrics[i] = $root.opentelemetry.proto.metrics.v1.ScopeMetrics.fromObject(object.scopeMetrics[i]); - } - } - if (object.schemaUrl != null) - message.schemaUrl = String(object.schemaUrl); - return message; - }; - - /** - * Creates a plain object from a ResourceMetrics message. Also converts values to other types if specified. - * @function toObject - * @memberof opentelemetry.proto.metrics.v1.ResourceMetrics - * @static - * @param {opentelemetry.proto.metrics.v1.ResourceMetrics} message ResourceMetrics - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ResourceMetrics.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.scopeMetrics = []; - 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.scopeMetrics && message.scopeMetrics.length) { - object.scopeMetrics = []; - for (var j = 0; j < message.scopeMetrics.length; ++j) - object.scopeMetrics[j] = $root.opentelemetry.proto.metrics.v1.ScopeMetrics.toObject(message.scopeMetrics[j], options); - } - if (message.schemaUrl != null && message.hasOwnProperty("schemaUrl")) - object.schemaUrl = message.schemaUrl; - return object; - }; - - /** - * Converts this ResourceMetrics to JSON. - * @function toJSON - * @memberof opentelemetry.proto.metrics.v1.ResourceMetrics - * @instance - * @returns {Object.} JSON object - */ - ResourceMetrics.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for ResourceMetrics - * @function getTypeUrl - * @memberof opentelemetry.proto.metrics.v1.ResourceMetrics - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - ResourceMetrics.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/opentelemetry.proto.metrics.v1.ResourceMetrics"; - }; - - return ResourceMetrics; - })(); - - v1.ScopeMetrics = (function() { - - /** - * Properties of a ScopeMetrics. - * @memberof opentelemetry.proto.metrics.v1 - * @interface IScopeMetrics - * @property {opentelemetry.proto.common.v1.IInstrumentationScope|null} [scope] ScopeMetrics scope - * @property {Array.|null} [metrics] ScopeMetrics metrics - * @property {string|null} [schemaUrl] ScopeMetrics schemaUrl - */ - - /** - * Constructs a new ScopeMetrics. - * @memberof opentelemetry.proto.metrics.v1 - * @classdesc Represents a ScopeMetrics. - * @implements IScopeMetrics - * @constructor - * @param {opentelemetry.proto.metrics.v1.IScopeMetrics=} [properties] Properties to set - */ - function ScopeMetrics(properties) { - this.metrics = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * ScopeMetrics scope. - * @member {opentelemetry.proto.common.v1.IInstrumentationScope|null|undefined} scope - * @memberof opentelemetry.proto.metrics.v1.ScopeMetrics - * @instance - */ - ScopeMetrics.prototype.scope = null; - - /** - * ScopeMetrics metrics. - * @member {Array.} metrics - * @memberof opentelemetry.proto.metrics.v1.ScopeMetrics - * @instance - */ - ScopeMetrics.prototype.metrics = $util.emptyArray; - - /** - * ScopeMetrics schemaUrl. - * @member {string|null|undefined} schemaUrl - * @memberof opentelemetry.proto.metrics.v1.ScopeMetrics - * @instance - */ - ScopeMetrics.prototype.schemaUrl = null; - - /** - * Creates a new ScopeMetrics instance using the specified properties. - * @function create - * @memberof opentelemetry.proto.metrics.v1.ScopeMetrics - * @static - * @param {opentelemetry.proto.metrics.v1.IScopeMetrics=} [properties] Properties to set - * @returns {opentelemetry.proto.metrics.v1.ScopeMetrics} ScopeMetrics instance - */ - ScopeMetrics.create = function create(properties) { - return new ScopeMetrics(properties); - }; - - /** - * Encodes the specified ScopeMetrics message. Does not implicitly {@link opentelemetry.proto.metrics.v1.ScopeMetrics.verify|verify} messages. - * @function encode - * @memberof opentelemetry.proto.metrics.v1.ScopeMetrics - * @static - * @param {opentelemetry.proto.metrics.v1.IScopeMetrics} message ScopeMetrics message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ScopeMetrics.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.metrics != null && message.metrics.length) - for (var i = 0; i < message.metrics.length; ++i) - $root.opentelemetry.proto.metrics.v1.Metric.encode(message.metrics[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 ScopeMetrics message, length delimited. Does not implicitly {@link opentelemetry.proto.metrics.v1.ScopeMetrics.verify|verify} messages. - * @function encodeDelimited - * @memberof opentelemetry.proto.metrics.v1.ScopeMetrics - * @static - * @param {opentelemetry.proto.metrics.v1.IScopeMetrics} message ScopeMetrics message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ScopeMetrics.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a ScopeMetrics message from the specified reader or buffer. - * @function decode - * @memberof opentelemetry.proto.metrics.v1.ScopeMetrics - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {opentelemetry.proto.metrics.v1.ScopeMetrics} ScopeMetrics - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ScopeMetrics.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.opentelemetry.proto.metrics.v1.ScopeMetrics(); - while (reader.pos < end) { - var 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.metrics && message.metrics.length)) - message.metrics = []; - message.metrics.push($root.opentelemetry.proto.metrics.v1.Metric.decode(reader, reader.uint32())); - break; - } - case 3: { - message.schemaUrl = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a ScopeMetrics message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof opentelemetry.proto.metrics.v1.ScopeMetrics - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {opentelemetry.proto.metrics.v1.ScopeMetrics} ScopeMetrics - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ScopeMetrics.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a ScopeMetrics message. - * @function verify - * @memberof opentelemetry.proto.metrics.v1.ScopeMetrics - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ScopeMetrics.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.scope != null && message.hasOwnProperty("scope")) { - var error = $root.opentelemetry.proto.common.v1.InstrumentationScope.verify(message.scope); - if (error) - return "scope." + error; - } - if (message.metrics != null && message.hasOwnProperty("metrics")) { - if (!Array.isArray(message.metrics)) - return "metrics: array expected"; - for (var i = 0; i < message.metrics.length; ++i) { - var error = $root.opentelemetry.proto.metrics.v1.Metric.verify(message.metrics[i]); - if (error) - return "metrics." + error; - } - } - if (message.schemaUrl != null && message.hasOwnProperty("schemaUrl")) - if (!$util.isString(message.schemaUrl)) - return "schemaUrl: string expected"; - return null; - }; - - /** - * Creates a ScopeMetrics message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof opentelemetry.proto.metrics.v1.ScopeMetrics - * @static - * @param {Object.} object Plain object - * @returns {opentelemetry.proto.metrics.v1.ScopeMetrics} ScopeMetrics - */ - ScopeMetrics.fromObject = function fromObject(object) { - if (object instanceof $root.opentelemetry.proto.metrics.v1.ScopeMetrics) - return object; - var message = new $root.opentelemetry.proto.metrics.v1.ScopeMetrics(); - if (object.scope != null) { - if (typeof object.scope !== "object") - throw TypeError(".opentelemetry.proto.metrics.v1.ScopeMetrics.scope: object expected"); - message.scope = $root.opentelemetry.proto.common.v1.InstrumentationScope.fromObject(object.scope); - } - if (object.metrics) { - if (!Array.isArray(object.metrics)) - throw TypeError(".opentelemetry.proto.metrics.v1.ScopeMetrics.metrics: array expected"); - message.metrics = []; - for (var i = 0; i < object.metrics.length; ++i) { - if (typeof object.metrics[i] !== "object") - throw TypeError(".opentelemetry.proto.metrics.v1.ScopeMetrics.metrics: object expected"); - message.metrics[i] = $root.opentelemetry.proto.metrics.v1.Metric.fromObject(object.metrics[i]); - } - } - if (object.schemaUrl != null) - message.schemaUrl = String(object.schemaUrl); - return message; - }; - - /** - * Creates a plain object from a ScopeMetrics message. Also converts values to other types if specified. - * @function toObject - * @memberof opentelemetry.proto.metrics.v1.ScopeMetrics - * @static - * @param {opentelemetry.proto.metrics.v1.ScopeMetrics} message ScopeMetrics - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ScopeMetrics.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.metrics = []; - 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.metrics && message.metrics.length) { - object.metrics = []; - for (var j = 0; j < message.metrics.length; ++j) - object.metrics[j] = $root.opentelemetry.proto.metrics.v1.Metric.toObject(message.metrics[j], options); - } - if (message.schemaUrl != null && message.hasOwnProperty("schemaUrl")) - object.schemaUrl = message.schemaUrl; - return object; - }; - - /** - * Converts this ScopeMetrics to JSON. - * @function toJSON - * @memberof opentelemetry.proto.metrics.v1.ScopeMetrics - * @instance - * @returns {Object.} JSON object - */ - ScopeMetrics.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for ScopeMetrics - * @function getTypeUrl - * @memberof opentelemetry.proto.metrics.v1.ScopeMetrics - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - ScopeMetrics.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/opentelemetry.proto.metrics.v1.ScopeMetrics"; - }; - - return ScopeMetrics; - })(); - - v1.Metric = (function() { - - /** - * Properties of a Metric. - * @memberof opentelemetry.proto.metrics.v1 - * @interface IMetric - * @property {string|null} [name] Metric name - * @property {string|null} [description] Metric description - * @property {string|null} [unit] Metric unit - * @property {opentelemetry.proto.metrics.v1.IGauge|null} [gauge] Metric gauge - * @property {opentelemetry.proto.metrics.v1.ISum|null} [sum] Metric sum - * @property {opentelemetry.proto.metrics.v1.IHistogram|null} [histogram] Metric histogram - * @property {opentelemetry.proto.metrics.v1.IExponentialHistogram|null} [exponentialHistogram] Metric exponentialHistogram - * @property {opentelemetry.proto.metrics.v1.ISummary|null} [summary] Metric summary - */ - - /** - * Constructs a new Metric. - * @memberof opentelemetry.proto.metrics.v1 - * @classdesc Represents a Metric. - * @implements IMetric - * @constructor - * @param {opentelemetry.proto.metrics.v1.IMetric=} [properties] Properties to set - */ - function Metric(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Metric name. - * @member {string|null|undefined} name - * @memberof opentelemetry.proto.metrics.v1.Metric - * @instance - */ - Metric.prototype.name = null; - - /** - * Metric description. - * @member {string|null|undefined} description - * @memberof opentelemetry.proto.metrics.v1.Metric - * @instance - */ - Metric.prototype.description = null; - - /** - * Metric unit. - * @member {string|null|undefined} unit - * @memberof opentelemetry.proto.metrics.v1.Metric - * @instance - */ - Metric.prototype.unit = null; - - /** - * Metric gauge. - * @member {opentelemetry.proto.metrics.v1.IGauge|null|undefined} gauge - * @memberof opentelemetry.proto.metrics.v1.Metric - * @instance - */ - Metric.prototype.gauge = null; - - /** - * Metric sum. - * @member {opentelemetry.proto.metrics.v1.ISum|null|undefined} sum - * @memberof opentelemetry.proto.metrics.v1.Metric - * @instance - */ - Metric.prototype.sum = null; - - /** - * Metric histogram. - * @member {opentelemetry.proto.metrics.v1.IHistogram|null|undefined} histogram - * @memberof opentelemetry.proto.metrics.v1.Metric - * @instance - */ - Metric.prototype.histogram = null; - - /** - * Metric exponentialHistogram. - * @member {opentelemetry.proto.metrics.v1.IExponentialHistogram|null|undefined} exponentialHistogram - * @memberof opentelemetry.proto.metrics.v1.Metric - * @instance - */ - Metric.prototype.exponentialHistogram = null; - - /** - * Metric summary. - * @member {opentelemetry.proto.metrics.v1.ISummary|null|undefined} summary - * @memberof opentelemetry.proto.metrics.v1.Metric - * @instance - */ - Metric.prototype.summary = null; - - // OneOf field names bound to virtual getters and setters - var $oneOfFields; - - /** - * Metric data. - * @member {"gauge"|"sum"|"histogram"|"exponentialHistogram"|"summary"|undefined} data - * @memberof opentelemetry.proto.metrics.v1.Metric - * @instance - */ - Object.defineProperty(Metric.prototype, "data", { - get: $util.oneOfGetter($oneOfFields = ["gauge", "sum", "histogram", "exponentialHistogram", "summary"]), - set: $util.oneOfSetter($oneOfFields) - }); - - /** - * Creates a new Metric instance using the specified properties. - * @function create - * @memberof opentelemetry.proto.metrics.v1.Metric - * @static - * @param {opentelemetry.proto.metrics.v1.IMetric=} [properties] Properties to set - * @returns {opentelemetry.proto.metrics.v1.Metric} Metric instance - */ - Metric.create = function create(properties) { - return new Metric(properties); - }; - - /** - * Encodes the specified Metric message. Does not implicitly {@link opentelemetry.proto.metrics.v1.Metric.verify|verify} messages. - * @function encode - * @memberof opentelemetry.proto.metrics.v1.Metric - * @static - * @param {opentelemetry.proto.metrics.v1.IMetric} message Metric message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Metric.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.description != null && Object.hasOwnProperty.call(message, "description")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.description); - if (message.unit != null && Object.hasOwnProperty.call(message, "unit")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.unit); - if (message.gauge != null && Object.hasOwnProperty.call(message, "gauge")) - $root.opentelemetry.proto.metrics.v1.Gauge.encode(message.gauge, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); - if (message.sum != null && Object.hasOwnProperty.call(message, "sum")) - $root.opentelemetry.proto.metrics.v1.Sum.encode(message.sum, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); - if (message.histogram != null && Object.hasOwnProperty.call(message, "histogram")) - $root.opentelemetry.proto.metrics.v1.Histogram.encode(message.histogram, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); - if (message.exponentialHistogram != null && Object.hasOwnProperty.call(message, "exponentialHistogram")) - $root.opentelemetry.proto.metrics.v1.ExponentialHistogram.encode(message.exponentialHistogram, writer.uint32(/* id 10, wireType 2 =*/82).fork()).ldelim(); - if (message.summary != null && Object.hasOwnProperty.call(message, "summary")) - $root.opentelemetry.proto.metrics.v1.Summary.encode(message.summary, writer.uint32(/* id 11, wireType 2 =*/90).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified Metric message, length delimited. Does not implicitly {@link opentelemetry.proto.metrics.v1.Metric.verify|verify} messages. - * @function encodeDelimited - * @memberof opentelemetry.proto.metrics.v1.Metric - * @static - * @param {opentelemetry.proto.metrics.v1.IMetric} message Metric message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Metric.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a Metric message from the specified reader or buffer. - * @function decode - * @memberof opentelemetry.proto.metrics.v1.Metric - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {opentelemetry.proto.metrics.v1.Metric} Metric - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Metric.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.opentelemetry.proto.metrics.v1.Metric(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.name = reader.string(); - break; - } - case 2: { - message.description = reader.string(); - break; - } - case 3: { - message.unit = reader.string(); - break; - } - case 5: { - message.gauge = $root.opentelemetry.proto.metrics.v1.Gauge.decode(reader, reader.uint32()); - break; - } - case 7: { - message.sum = $root.opentelemetry.proto.metrics.v1.Sum.decode(reader, reader.uint32()); - break; - } - case 9: { - message.histogram = $root.opentelemetry.proto.metrics.v1.Histogram.decode(reader, reader.uint32()); - break; - } - case 10: { - message.exponentialHistogram = $root.opentelemetry.proto.metrics.v1.ExponentialHistogram.decode(reader, reader.uint32()); - break; - } - case 11: { - message.summary = $root.opentelemetry.proto.metrics.v1.Summary.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a Metric message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof opentelemetry.proto.metrics.v1.Metric - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {opentelemetry.proto.metrics.v1.Metric} Metric - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Metric.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a Metric message. - * @function verify - * @memberof opentelemetry.proto.metrics.v1.Metric - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Metric.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - var properties = {}; - if (message.name != null && message.hasOwnProperty("name")) - if (!$util.isString(message.name)) - return "name: string expected"; - if (message.description != null && message.hasOwnProperty("description")) - if (!$util.isString(message.description)) - return "description: string expected"; - if (message.unit != null && message.hasOwnProperty("unit")) - if (!$util.isString(message.unit)) - return "unit: string expected"; - if (message.gauge != null && message.hasOwnProperty("gauge")) { - properties.data = 1; - { - var error = $root.opentelemetry.proto.metrics.v1.Gauge.verify(message.gauge); - if (error) - return "gauge." + error; - } - } - if (message.sum != null && message.hasOwnProperty("sum")) { - if (properties.data === 1) - return "data: multiple values"; - properties.data = 1; - { - var error = $root.opentelemetry.proto.metrics.v1.Sum.verify(message.sum); - if (error) - return "sum." + error; - } - } - if (message.histogram != null && message.hasOwnProperty("histogram")) { - if (properties.data === 1) - return "data: multiple values"; - properties.data = 1; - { - var error = $root.opentelemetry.proto.metrics.v1.Histogram.verify(message.histogram); - if (error) - return "histogram." + error; - } - } - if (message.exponentialHistogram != null && message.hasOwnProperty("exponentialHistogram")) { - if (properties.data === 1) - return "data: multiple values"; - properties.data = 1; - { - var error = $root.opentelemetry.proto.metrics.v1.ExponentialHistogram.verify(message.exponentialHistogram); - if (error) - return "exponentialHistogram." + error; - } - } - if (message.summary != null && message.hasOwnProperty("summary")) { - if (properties.data === 1) - return "data: multiple values"; - properties.data = 1; - { - var error = $root.opentelemetry.proto.metrics.v1.Summary.verify(message.summary); - if (error) - return "summary." + error; - } - } - return null; - }; - - /** - * Creates a Metric message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof opentelemetry.proto.metrics.v1.Metric - * @static - * @param {Object.} object Plain object - * @returns {opentelemetry.proto.metrics.v1.Metric} Metric - */ - Metric.fromObject = function fromObject(object) { - if (object instanceof $root.opentelemetry.proto.metrics.v1.Metric) - return object; - var message = new $root.opentelemetry.proto.metrics.v1.Metric(); - if (object.name != null) - message.name = String(object.name); - if (object.description != null) - message.description = String(object.description); - if (object.unit != null) - message.unit = String(object.unit); - if (object.gauge != null) { - if (typeof object.gauge !== "object") - throw TypeError(".opentelemetry.proto.metrics.v1.Metric.gauge: object expected"); - message.gauge = $root.opentelemetry.proto.metrics.v1.Gauge.fromObject(object.gauge); - } - if (object.sum != null) { - if (typeof object.sum !== "object") - throw TypeError(".opentelemetry.proto.metrics.v1.Metric.sum: object expected"); - message.sum = $root.opentelemetry.proto.metrics.v1.Sum.fromObject(object.sum); - } - if (object.histogram != null) { - if (typeof object.histogram !== "object") - throw TypeError(".opentelemetry.proto.metrics.v1.Metric.histogram: object expected"); - message.histogram = $root.opentelemetry.proto.metrics.v1.Histogram.fromObject(object.histogram); - } - if (object.exponentialHistogram != null) { - if (typeof object.exponentialHistogram !== "object") - throw TypeError(".opentelemetry.proto.metrics.v1.Metric.exponentialHistogram: object expected"); - message.exponentialHistogram = $root.opentelemetry.proto.metrics.v1.ExponentialHistogram.fromObject(object.exponentialHistogram); - } - if (object.summary != null) { - if (typeof object.summary !== "object") - throw TypeError(".opentelemetry.proto.metrics.v1.Metric.summary: object expected"); - message.summary = $root.opentelemetry.proto.metrics.v1.Summary.fromObject(object.summary); - } - return message; - }; - - /** - * Creates a plain object from a Metric message. Also converts values to other types if specified. - * @function toObject - * @memberof opentelemetry.proto.metrics.v1.Metric - * @static - * @param {opentelemetry.proto.metrics.v1.Metric} message Metric - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Metric.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.name = ""; - object.description = ""; - object.unit = ""; - } - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; - if (message.description != null && message.hasOwnProperty("description")) - object.description = message.description; - if (message.unit != null && message.hasOwnProperty("unit")) - object.unit = message.unit; - if (message.gauge != null && message.hasOwnProperty("gauge")) { - object.gauge = $root.opentelemetry.proto.metrics.v1.Gauge.toObject(message.gauge, options); - if (options.oneofs) - object.data = "gauge"; - } - if (message.sum != null && message.hasOwnProperty("sum")) { - object.sum = $root.opentelemetry.proto.metrics.v1.Sum.toObject(message.sum, options); - if (options.oneofs) - object.data = "sum"; - } - if (message.histogram != null && message.hasOwnProperty("histogram")) { - object.histogram = $root.opentelemetry.proto.metrics.v1.Histogram.toObject(message.histogram, options); - if (options.oneofs) - object.data = "histogram"; - } - if (message.exponentialHistogram != null && message.hasOwnProperty("exponentialHistogram")) { - object.exponentialHistogram = $root.opentelemetry.proto.metrics.v1.ExponentialHistogram.toObject(message.exponentialHistogram, options); - if (options.oneofs) - object.data = "exponentialHistogram"; - } - if (message.summary != null && message.hasOwnProperty("summary")) { - object.summary = $root.opentelemetry.proto.metrics.v1.Summary.toObject(message.summary, options); - if (options.oneofs) - object.data = "summary"; - } - return object; - }; - - /** - * Converts this Metric to JSON. - * @function toJSON - * @memberof opentelemetry.proto.metrics.v1.Metric - * @instance - * @returns {Object.} JSON object - */ - Metric.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for Metric - * @function getTypeUrl - * @memberof opentelemetry.proto.metrics.v1.Metric - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - Metric.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/opentelemetry.proto.metrics.v1.Metric"; - }; - - return Metric; - })(); - - v1.Gauge = (function() { - - /** - * Properties of a Gauge. - * @memberof opentelemetry.proto.metrics.v1 - * @interface IGauge - * @property {Array.|null} [dataPoints] Gauge dataPoints - */ - - /** - * Constructs a new Gauge. - * @memberof opentelemetry.proto.metrics.v1 - * @classdesc Represents a Gauge. - * @implements IGauge - * @constructor - * @param {opentelemetry.proto.metrics.v1.IGauge=} [properties] Properties to set - */ - function Gauge(properties) { - this.dataPoints = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Gauge dataPoints. - * @member {Array.} dataPoints - * @memberof opentelemetry.proto.metrics.v1.Gauge - * @instance - */ - Gauge.prototype.dataPoints = $util.emptyArray; - - /** - * Creates a new Gauge instance using the specified properties. - * @function create - * @memberof opentelemetry.proto.metrics.v1.Gauge - * @static - * @param {opentelemetry.proto.metrics.v1.IGauge=} [properties] Properties to set - * @returns {opentelemetry.proto.metrics.v1.Gauge} Gauge instance - */ - Gauge.create = function create(properties) { - return new Gauge(properties); - }; - - /** - * Encodes the specified Gauge message. Does not implicitly {@link opentelemetry.proto.metrics.v1.Gauge.verify|verify} messages. - * @function encode - * @memberof opentelemetry.proto.metrics.v1.Gauge - * @static - * @param {opentelemetry.proto.metrics.v1.IGauge} message Gauge message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Gauge.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.dataPoints != null && message.dataPoints.length) - for (var i = 0; i < message.dataPoints.length; ++i) - $root.opentelemetry.proto.metrics.v1.NumberDataPoint.encode(message.dataPoints[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified Gauge message, length delimited. Does not implicitly {@link opentelemetry.proto.metrics.v1.Gauge.verify|verify} messages. - * @function encodeDelimited - * @memberof opentelemetry.proto.metrics.v1.Gauge - * @static - * @param {opentelemetry.proto.metrics.v1.IGauge} message Gauge message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Gauge.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a Gauge message from the specified reader or buffer. - * @function decode - * @memberof opentelemetry.proto.metrics.v1.Gauge - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {opentelemetry.proto.metrics.v1.Gauge} Gauge - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Gauge.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.opentelemetry.proto.metrics.v1.Gauge(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (!(message.dataPoints && message.dataPoints.length)) - message.dataPoints = []; - message.dataPoints.push($root.opentelemetry.proto.metrics.v1.NumberDataPoint.decode(reader, reader.uint32())); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a Gauge message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof opentelemetry.proto.metrics.v1.Gauge - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {opentelemetry.proto.metrics.v1.Gauge} Gauge - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Gauge.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a Gauge message. - * @function verify - * @memberof opentelemetry.proto.metrics.v1.Gauge - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Gauge.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.dataPoints != null && message.hasOwnProperty("dataPoints")) { - if (!Array.isArray(message.dataPoints)) - return "dataPoints: array expected"; - for (var i = 0; i < message.dataPoints.length; ++i) { - var error = $root.opentelemetry.proto.metrics.v1.NumberDataPoint.verify(message.dataPoints[i]); - if (error) - return "dataPoints." + error; - } - } - return null; - }; - - /** - * Creates a Gauge message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof opentelemetry.proto.metrics.v1.Gauge - * @static - * @param {Object.} object Plain object - * @returns {opentelemetry.proto.metrics.v1.Gauge} Gauge - */ - Gauge.fromObject = function fromObject(object) { - if (object instanceof $root.opentelemetry.proto.metrics.v1.Gauge) - return object; - var message = new $root.opentelemetry.proto.metrics.v1.Gauge(); - if (object.dataPoints) { - if (!Array.isArray(object.dataPoints)) - throw TypeError(".opentelemetry.proto.metrics.v1.Gauge.dataPoints: array expected"); - message.dataPoints = []; - for (var i = 0; i < object.dataPoints.length; ++i) { - if (typeof object.dataPoints[i] !== "object") - throw TypeError(".opentelemetry.proto.metrics.v1.Gauge.dataPoints: object expected"); - message.dataPoints[i] = $root.opentelemetry.proto.metrics.v1.NumberDataPoint.fromObject(object.dataPoints[i]); - } - } - return message; - }; - - /** - * Creates a plain object from a Gauge message. Also converts values to other types if specified. - * @function toObject - * @memberof opentelemetry.proto.metrics.v1.Gauge - * @static - * @param {opentelemetry.proto.metrics.v1.Gauge} message Gauge - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Gauge.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.dataPoints = []; - if (message.dataPoints && message.dataPoints.length) { - object.dataPoints = []; - for (var j = 0; j < message.dataPoints.length; ++j) - object.dataPoints[j] = $root.opentelemetry.proto.metrics.v1.NumberDataPoint.toObject(message.dataPoints[j], options); - } - return object; - }; - - /** - * Converts this Gauge to JSON. - * @function toJSON - * @memberof opentelemetry.proto.metrics.v1.Gauge - * @instance - * @returns {Object.} JSON object - */ - Gauge.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for Gauge - * @function getTypeUrl - * @memberof opentelemetry.proto.metrics.v1.Gauge - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - Gauge.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/opentelemetry.proto.metrics.v1.Gauge"; - }; - - return Gauge; - })(); - - v1.Sum = (function() { - - /** - * Properties of a Sum. - * @memberof opentelemetry.proto.metrics.v1 - * @interface ISum - * @property {Array.|null} [dataPoints] Sum dataPoints - * @property {opentelemetry.proto.metrics.v1.AggregationTemporality|null} [aggregationTemporality] Sum aggregationTemporality - * @property {boolean|null} [isMonotonic] Sum isMonotonic - */ - - /** - * Constructs a new Sum. - * @memberof opentelemetry.proto.metrics.v1 - * @classdesc Represents a Sum. - * @implements ISum - * @constructor - * @param {opentelemetry.proto.metrics.v1.ISum=} [properties] Properties to set - */ - function Sum(properties) { - this.dataPoints = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Sum dataPoints. - * @member {Array.} dataPoints - * @memberof opentelemetry.proto.metrics.v1.Sum - * @instance - */ - Sum.prototype.dataPoints = $util.emptyArray; - - /** - * Sum aggregationTemporality. - * @member {opentelemetry.proto.metrics.v1.AggregationTemporality|null|undefined} aggregationTemporality - * @memberof opentelemetry.proto.metrics.v1.Sum - * @instance - */ - Sum.prototype.aggregationTemporality = null; - - /** - * Sum isMonotonic. - * @member {boolean|null|undefined} isMonotonic - * @memberof opentelemetry.proto.metrics.v1.Sum - * @instance - */ - Sum.prototype.isMonotonic = null; - - /** - * Creates a new Sum instance using the specified properties. - * @function create - * @memberof opentelemetry.proto.metrics.v1.Sum - * @static - * @param {opentelemetry.proto.metrics.v1.ISum=} [properties] Properties to set - * @returns {opentelemetry.proto.metrics.v1.Sum} Sum instance - */ - Sum.create = function create(properties) { - return new Sum(properties); - }; - - /** - * Encodes the specified Sum message. Does not implicitly {@link opentelemetry.proto.metrics.v1.Sum.verify|verify} messages. - * @function encode - * @memberof opentelemetry.proto.metrics.v1.Sum - * @static - * @param {opentelemetry.proto.metrics.v1.ISum} message Sum message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Sum.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.dataPoints != null && message.dataPoints.length) - for (var i = 0; i < message.dataPoints.length; ++i) - $root.opentelemetry.proto.metrics.v1.NumberDataPoint.encode(message.dataPoints[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.aggregationTemporality != null && Object.hasOwnProperty.call(message, "aggregationTemporality")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.aggregationTemporality); - if (message.isMonotonic != null && Object.hasOwnProperty.call(message, "isMonotonic")) - writer.uint32(/* id 3, wireType 0 =*/24).bool(message.isMonotonic); - return writer; - }; - - /** - * Encodes the specified Sum message, length delimited. Does not implicitly {@link opentelemetry.proto.metrics.v1.Sum.verify|verify} messages. - * @function encodeDelimited - * @memberof opentelemetry.proto.metrics.v1.Sum - * @static - * @param {opentelemetry.proto.metrics.v1.ISum} message Sum message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Sum.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a Sum message from the specified reader or buffer. - * @function decode - * @memberof opentelemetry.proto.metrics.v1.Sum - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {opentelemetry.proto.metrics.v1.Sum} Sum - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Sum.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.opentelemetry.proto.metrics.v1.Sum(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (!(message.dataPoints && message.dataPoints.length)) - message.dataPoints = []; - message.dataPoints.push($root.opentelemetry.proto.metrics.v1.NumberDataPoint.decode(reader, reader.uint32())); - break; - } - case 2: { - message.aggregationTemporality = reader.int32(); - break; - } - case 3: { - message.isMonotonic = reader.bool(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a Sum message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof opentelemetry.proto.metrics.v1.Sum - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {opentelemetry.proto.metrics.v1.Sum} Sum - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Sum.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a Sum message. - * @function verify - * @memberof opentelemetry.proto.metrics.v1.Sum - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Sum.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.dataPoints != null && message.hasOwnProperty("dataPoints")) { - if (!Array.isArray(message.dataPoints)) - return "dataPoints: array expected"; - for (var i = 0; i < message.dataPoints.length; ++i) { - var error = $root.opentelemetry.proto.metrics.v1.NumberDataPoint.verify(message.dataPoints[i]); - if (error) - return "dataPoints." + error; - } - } - if (message.aggregationTemporality != null && message.hasOwnProperty("aggregationTemporality")) - switch (message.aggregationTemporality) { - default: - return "aggregationTemporality: enum value expected"; - case 0: - case 1: - case 2: - break; - } - if (message.isMonotonic != null && message.hasOwnProperty("isMonotonic")) - if (typeof message.isMonotonic !== "boolean") - return "isMonotonic: boolean expected"; - return null; - }; - - /** - * Creates a Sum message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof opentelemetry.proto.metrics.v1.Sum - * @static - * @param {Object.} object Plain object - * @returns {opentelemetry.proto.metrics.v1.Sum} Sum - */ - Sum.fromObject = function fromObject(object) { - if (object instanceof $root.opentelemetry.proto.metrics.v1.Sum) - return object; - var message = new $root.opentelemetry.proto.metrics.v1.Sum(); - if (object.dataPoints) { - if (!Array.isArray(object.dataPoints)) - throw TypeError(".opentelemetry.proto.metrics.v1.Sum.dataPoints: array expected"); - message.dataPoints = []; - for (var i = 0; i < object.dataPoints.length; ++i) { - if (typeof object.dataPoints[i] !== "object") - throw TypeError(".opentelemetry.proto.metrics.v1.Sum.dataPoints: object expected"); - message.dataPoints[i] = $root.opentelemetry.proto.metrics.v1.NumberDataPoint.fromObject(object.dataPoints[i]); - } - } - switch (object.aggregationTemporality) { - default: - if (typeof object.aggregationTemporality === "number") { - message.aggregationTemporality = object.aggregationTemporality; - break; - } - break; - case "AGGREGATION_TEMPORALITY_UNSPECIFIED": - case 0: - message.aggregationTemporality = 0; - break; - case "AGGREGATION_TEMPORALITY_DELTA": - case 1: - message.aggregationTemporality = 1; - break; - case "AGGREGATION_TEMPORALITY_CUMULATIVE": - case 2: - message.aggregationTemporality = 2; - break; - } - if (object.isMonotonic != null) - message.isMonotonic = Boolean(object.isMonotonic); - return message; - }; - - /** - * Creates a plain object from a Sum message. Also converts values to other types if specified. - * @function toObject - * @memberof opentelemetry.proto.metrics.v1.Sum - * @static - * @param {opentelemetry.proto.metrics.v1.Sum} message Sum - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Sum.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.dataPoints = []; - if (options.defaults) { - object.aggregationTemporality = options.enums === String ? "AGGREGATION_TEMPORALITY_UNSPECIFIED" : 0; - object.isMonotonic = false; - } - if (message.dataPoints && message.dataPoints.length) { - object.dataPoints = []; - for (var j = 0; j < message.dataPoints.length; ++j) - object.dataPoints[j] = $root.opentelemetry.proto.metrics.v1.NumberDataPoint.toObject(message.dataPoints[j], options); - } - if (message.aggregationTemporality != null && message.hasOwnProperty("aggregationTemporality")) - object.aggregationTemporality = options.enums === String ? $root.opentelemetry.proto.metrics.v1.AggregationTemporality[message.aggregationTemporality] === undefined ? message.aggregationTemporality : $root.opentelemetry.proto.metrics.v1.AggregationTemporality[message.aggregationTemporality] : message.aggregationTemporality; - if (message.isMonotonic != null && message.hasOwnProperty("isMonotonic")) - object.isMonotonic = message.isMonotonic; - return object; - }; - - /** - * Converts this Sum to JSON. - * @function toJSON - * @memberof opentelemetry.proto.metrics.v1.Sum - * @instance - * @returns {Object.} JSON object - */ - Sum.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for Sum - * @function getTypeUrl - * @memberof opentelemetry.proto.metrics.v1.Sum - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - Sum.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/opentelemetry.proto.metrics.v1.Sum"; - }; - - return Sum; - })(); - - v1.Histogram = (function() { - - /** - * Properties of a Histogram. - * @memberof opentelemetry.proto.metrics.v1 - * @interface IHistogram - * @property {Array.|null} [dataPoints] Histogram dataPoints - * @property {opentelemetry.proto.metrics.v1.AggregationTemporality|null} [aggregationTemporality] Histogram aggregationTemporality - */ - - /** - * Constructs a new Histogram. - * @memberof opentelemetry.proto.metrics.v1 - * @classdesc Represents a Histogram. - * @implements IHistogram - * @constructor - * @param {opentelemetry.proto.metrics.v1.IHistogram=} [properties] Properties to set - */ - function Histogram(properties) { - this.dataPoints = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Histogram dataPoints. - * @member {Array.} dataPoints - * @memberof opentelemetry.proto.metrics.v1.Histogram - * @instance - */ - Histogram.prototype.dataPoints = $util.emptyArray; - - /** - * Histogram aggregationTemporality. - * @member {opentelemetry.proto.metrics.v1.AggregationTemporality|null|undefined} aggregationTemporality - * @memberof opentelemetry.proto.metrics.v1.Histogram - * @instance - */ - Histogram.prototype.aggregationTemporality = null; - - /** - * Creates a new Histogram instance using the specified properties. - * @function create - * @memberof opentelemetry.proto.metrics.v1.Histogram - * @static - * @param {opentelemetry.proto.metrics.v1.IHistogram=} [properties] Properties to set - * @returns {opentelemetry.proto.metrics.v1.Histogram} Histogram instance - */ - Histogram.create = function create(properties) { - return new Histogram(properties); - }; - - /** - * Encodes the specified Histogram message. Does not implicitly {@link opentelemetry.proto.metrics.v1.Histogram.verify|verify} messages. - * @function encode - * @memberof opentelemetry.proto.metrics.v1.Histogram - * @static - * @param {opentelemetry.proto.metrics.v1.IHistogram} message Histogram message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Histogram.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.dataPoints != null && message.dataPoints.length) - for (var i = 0; i < message.dataPoints.length; ++i) - $root.opentelemetry.proto.metrics.v1.HistogramDataPoint.encode(message.dataPoints[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.aggregationTemporality != null && Object.hasOwnProperty.call(message, "aggregationTemporality")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.aggregationTemporality); - return writer; - }; - - /** - * Encodes the specified Histogram message, length delimited. Does not implicitly {@link opentelemetry.proto.metrics.v1.Histogram.verify|verify} messages. - * @function encodeDelimited - * @memberof opentelemetry.proto.metrics.v1.Histogram - * @static - * @param {opentelemetry.proto.metrics.v1.IHistogram} message Histogram message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Histogram.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a Histogram message from the specified reader or buffer. - * @function decode - * @memberof opentelemetry.proto.metrics.v1.Histogram - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {opentelemetry.proto.metrics.v1.Histogram} Histogram - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Histogram.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.opentelemetry.proto.metrics.v1.Histogram(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (!(message.dataPoints && message.dataPoints.length)) - message.dataPoints = []; - message.dataPoints.push($root.opentelemetry.proto.metrics.v1.HistogramDataPoint.decode(reader, reader.uint32())); - break; - } - case 2: { - message.aggregationTemporality = reader.int32(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a Histogram message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof opentelemetry.proto.metrics.v1.Histogram - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {opentelemetry.proto.metrics.v1.Histogram} Histogram - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Histogram.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a Histogram message. - * @function verify - * @memberof opentelemetry.proto.metrics.v1.Histogram - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Histogram.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.dataPoints != null && message.hasOwnProperty("dataPoints")) { - if (!Array.isArray(message.dataPoints)) - return "dataPoints: array expected"; - for (var i = 0; i < message.dataPoints.length; ++i) { - var error = $root.opentelemetry.proto.metrics.v1.HistogramDataPoint.verify(message.dataPoints[i]); - if (error) - return "dataPoints." + error; - } - } - if (message.aggregationTemporality != null && message.hasOwnProperty("aggregationTemporality")) - switch (message.aggregationTemporality) { - default: - return "aggregationTemporality: enum value expected"; - case 0: - case 1: - case 2: - break; - } - return null; - }; - - /** - * Creates a Histogram message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof opentelemetry.proto.metrics.v1.Histogram - * @static - * @param {Object.} object Plain object - * @returns {opentelemetry.proto.metrics.v1.Histogram} Histogram - */ - Histogram.fromObject = function fromObject(object) { - if (object instanceof $root.opentelemetry.proto.metrics.v1.Histogram) - return object; - var message = new $root.opentelemetry.proto.metrics.v1.Histogram(); - if (object.dataPoints) { - if (!Array.isArray(object.dataPoints)) - throw TypeError(".opentelemetry.proto.metrics.v1.Histogram.dataPoints: array expected"); - message.dataPoints = []; - for (var i = 0; i < object.dataPoints.length; ++i) { - if (typeof object.dataPoints[i] !== "object") - throw TypeError(".opentelemetry.proto.metrics.v1.Histogram.dataPoints: object expected"); - message.dataPoints[i] = $root.opentelemetry.proto.metrics.v1.HistogramDataPoint.fromObject(object.dataPoints[i]); - } - } - switch (object.aggregationTemporality) { - default: - if (typeof object.aggregationTemporality === "number") { - message.aggregationTemporality = object.aggregationTemporality; - break; - } - break; - case "AGGREGATION_TEMPORALITY_UNSPECIFIED": - case 0: - message.aggregationTemporality = 0; - break; - case "AGGREGATION_TEMPORALITY_DELTA": - case 1: - message.aggregationTemporality = 1; - break; - case "AGGREGATION_TEMPORALITY_CUMULATIVE": - case 2: - message.aggregationTemporality = 2; - break; - } - return message; - }; - - /** - * Creates a plain object from a Histogram message. Also converts values to other types if specified. - * @function toObject - * @memberof opentelemetry.proto.metrics.v1.Histogram - * @static - * @param {opentelemetry.proto.metrics.v1.Histogram} message Histogram - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Histogram.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.dataPoints = []; - if (options.defaults) - object.aggregationTemporality = options.enums === String ? "AGGREGATION_TEMPORALITY_UNSPECIFIED" : 0; - if (message.dataPoints && message.dataPoints.length) { - object.dataPoints = []; - for (var j = 0; j < message.dataPoints.length; ++j) - object.dataPoints[j] = $root.opentelemetry.proto.metrics.v1.HistogramDataPoint.toObject(message.dataPoints[j], options); - } - if (message.aggregationTemporality != null && message.hasOwnProperty("aggregationTemporality")) - object.aggregationTemporality = options.enums === String ? $root.opentelemetry.proto.metrics.v1.AggregationTemporality[message.aggregationTemporality] === undefined ? message.aggregationTemporality : $root.opentelemetry.proto.metrics.v1.AggregationTemporality[message.aggregationTemporality] : message.aggregationTemporality; - return object; - }; - - /** - * Converts this Histogram to JSON. - * @function toJSON - * @memberof opentelemetry.proto.metrics.v1.Histogram - * @instance - * @returns {Object.} JSON object - */ - Histogram.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for Histogram - * @function getTypeUrl - * @memberof opentelemetry.proto.metrics.v1.Histogram - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - Histogram.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/opentelemetry.proto.metrics.v1.Histogram"; - }; - - return Histogram; - })(); - - v1.ExponentialHistogram = (function() { - - /** - * Properties of an ExponentialHistogram. - * @memberof opentelemetry.proto.metrics.v1 - * @interface IExponentialHistogram - * @property {Array.|null} [dataPoints] ExponentialHistogram dataPoints - * @property {opentelemetry.proto.metrics.v1.AggregationTemporality|null} [aggregationTemporality] ExponentialHistogram aggregationTemporality - */ - - /** - * Constructs a new ExponentialHistogram. - * @memberof opentelemetry.proto.metrics.v1 - * @classdesc Represents an ExponentialHistogram. - * @implements IExponentialHistogram - * @constructor - * @param {opentelemetry.proto.metrics.v1.IExponentialHistogram=} [properties] Properties to set - */ - function ExponentialHistogram(properties) { - this.dataPoints = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * ExponentialHistogram dataPoints. - * @member {Array.} dataPoints - * @memberof opentelemetry.proto.metrics.v1.ExponentialHistogram - * @instance - */ - ExponentialHistogram.prototype.dataPoints = $util.emptyArray; - - /** - * ExponentialHistogram aggregationTemporality. - * @member {opentelemetry.proto.metrics.v1.AggregationTemporality|null|undefined} aggregationTemporality - * @memberof opentelemetry.proto.metrics.v1.ExponentialHistogram - * @instance - */ - ExponentialHistogram.prototype.aggregationTemporality = null; - - /** - * Creates a new ExponentialHistogram instance using the specified properties. - * @function create - * @memberof opentelemetry.proto.metrics.v1.ExponentialHistogram - * @static - * @param {opentelemetry.proto.metrics.v1.IExponentialHistogram=} [properties] Properties to set - * @returns {opentelemetry.proto.metrics.v1.ExponentialHistogram} ExponentialHistogram instance - */ - ExponentialHistogram.create = function create(properties) { - return new ExponentialHistogram(properties); - }; - - /** - * Encodes the specified ExponentialHistogram message. Does not implicitly {@link opentelemetry.proto.metrics.v1.ExponentialHistogram.verify|verify} messages. - * @function encode - * @memberof opentelemetry.proto.metrics.v1.ExponentialHistogram - * @static - * @param {opentelemetry.proto.metrics.v1.IExponentialHistogram} message ExponentialHistogram message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ExponentialHistogram.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.dataPoints != null && message.dataPoints.length) - for (var i = 0; i < message.dataPoints.length; ++i) - $root.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.encode(message.dataPoints[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.aggregationTemporality != null && Object.hasOwnProperty.call(message, "aggregationTemporality")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.aggregationTemporality); - return writer; - }; - - /** - * Encodes the specified ExponentialHistogram message, length delimited. Does not implicitly {@link opentelemetry.proto.metrics.v1.ExponentialHistogram.verify|verify} messages. - * @function encodeDelimited - * @memberof opentelemetry.proto.metrics.v1.ExponentialHistogram - * @static - * @param {opentelemetry.proto.metrics.v1.IExponentialHistogram} message ExponentialHistogram message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ExponentialHistogram.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an ExponentialHistogram message from the specified reader or buffer. - * @function decode - * @memberof opentelemetry.proto.metrics.v1.ExponentialHistogram - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {opentelemetry.proto.metrics.v1.ExponentialHistogram} ExponentialHistogram - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ExponentialHistogram.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.opentelemetry.proto.metrics.v1.ExponentialHistogram(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (!(message.dataPoints && message.dataPoints.length)) - message.dataPoints = []; - message.dataPoints.push($root.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.decode(reader, reader.uint32())); - break; - } - case 2: { - message.aggregationTemporality = reader.int32(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an ExponentialHistogram message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof opentelemetry.proto.metrics.v1.ExponentialHistogram - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {opentelemetry.proto.metrics.v1.ExponentialHistogram} ExponentialHistogram - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ExponentialHistogram.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an ExponentialHistogram message. - * @function verify - * @memberof opentelemetry.proto.metrics.v1.ExponentialHistogram - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ExponentialHistogram.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.dataPoints != null && message.hasOwnProperty("dataPoints")) { - if (!Array.isArray(message.dataPoints)) - return "dataPoints: array expected"; - for (var i = 0; i < message.dataPoints.length; ++i) { - var error = $root.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.verify(message.dataPoints[i]); - if (error) - return "dataPoints." + error; - } - } - if (message.aggregationTemporality != null && message.hasOwnProperty("aggregationTemporality")) - switch (message.aggregationTemporality) { - default: - return "aggregationTemporality: enum value expected"; - case 0: - case 1: - case 2: - break; - } - return null; - }; - - /** - * Creates an ExponentialHistogram message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof opentelemetry.proto.metrics.v1.ExponentialHistogram - * @static - * @param {Object.} object Plain object - * @returns {opentelemetry.proto.metrics.v1.ExponentialHistogram} ExponentialHistogram - */ - ExponentialHistogram.fromObject = function fromObject(object) { - if (object instanceof $root.opentelemetry.proto.metrics.v1.ExponentialHistogram) - return object; - var message = new $root.opentelemetry.proto.metrics.v1.ExponentialHistogram(); - if (object.dataPoints) { - if (!Array.isArray(object.dataPoints)) - throw TypeError(".opentelemetry.proto.metrics.v1.ExponentialHistogram.dataPoints: array expected"); - message.dataPoints = []; - for (var i = 0; i < object.dataPoints.length; ++i) { - if (typeof object.dataPoints[i] !== "object") - throw TypeError(".opentelemetry.proto.metrics.v1.ExponentialHistogram.dataPoints: object expected"); - message.dataPoints[i] = $root.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.fromObject(object.dataPoints[i]); - } - } - switch (object.aggregationTemporality) { - default: - if (typeof object.aggregationTemporality === "number") { - message.aggregationTemporality = object.aggregationTemporality; - break; - } - break; - case "AGGREGATION_TEMPORALITY_UNSPECIFIED": - case 0: - message.aggregationTemporality = 0; - break; - case "AGGREGATION_TEMPORALITY_DELTA": - case 1: - message.aggregationTemporality = 1; - break; - case "AGGREGATION_TEMPORALITY_CUMULATIVE": - case 2: - message.aggregationTemporality = 2; - break; - } - return message; - }; - - /** - * Creates a plain object from an ExponentialHistogram message. Also converts values to other types if specified. - * @function toObject - * @memberof opentelemetry.proto.metrics.v1.ExponentialHistogram - * @static - * @param {opentelemetry.proto.metrics.v1.ExponentialHistogram} message ExponentialHistogram - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ExponentialHistogram.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.dataPoints = []; - if (options.defaults) - object.aggregationTemporality = options.enums === String ? "AGGREGATION_TEMPORALITY_UNSPECIFIED" : 0; - if (message.dataPoints && message.dataPoints.length) { - object.dataPoints = []; - for (var j = 0; j < message.dataPoints.length; ++j) - object.dataPoints[j] = $root.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.toObject(message.dataPoints[j], options); - } - if (message.aggregationTemporality != null && message.hasOwnProperty("aggregationTemporality")) - object.aggregationTemporality = options.enums === String ? $root.opentelemetry.proto.metrics.v1.AggregationTemporality[message.aggregationTemporality] === undefined ? message.aggregationTemporality : $root.opentelemetry.proto.metrics.v1.AggregationTemporality[message.aggregationTemporality] : message.aggregationTemporality; - return object; - }; - - /** - * Converts this ExponentialHistogram to JSON. - * @function toJSON - * @memberof opentelemetry.proto.metrics.v1.ExponentialHistogram - * @instance - * @returns {Object.} JSON object - */ - ExponentialHistogram.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for ExponentialHistogram - * @function getTypeUrl - * @memberof opentelemetry.proto.metrics.v1.ExponentialHistogram - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - ExponentialHistogram.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/opentelemetry.proto.metrics.v1.ExponentialHistogram"; - }; - - return ExponentialHistogram; - })(); - - v1.Summary = (function() { - - /** - * Properties of a Summary. - * @memberof opentelemetry.proto.metrics.v1 - * @interface ISummary - * @property {Array.|null} [dataPoints] Summary dataPoints - */ - - /** - * Constructs a new Summary. - * @memberof opentelemetry.proto.metrics.v1 - * @classdesc Represents a Summary. - * @implements ISummary - * @constructor - * @param {opentelemetry.proto.metrics.v1.ISummary=} [properties] Properties to set - */ - function Summary(properties) { - this.dataPoints = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Summary dataPoints. - * @member {Array.} dataPoints - * @memberof opentelemetry.proto.metrics.v1.Summary - * @instance - */ - Summary.prototype.dataPoints = $util.emptyArray; - - /** - * Creates a new Summary instance using the specified properties. - * @function create - * @memberof opentelemetry.proto.metrics.v1.Summary - * @static - * @param {opentelemetry.proto.metrics.v1.ISummary=} [properties] Properties to set - * @returns {opentelemetry.proto.metrics.v1.Summary} Summary instance - */ - Summary.create = function create(properties) { - return new Summary(properties); - }; - - /** - * Encodes the specified Summary message. Does not implicitly {@link opentelemetry.proto.metrics.v1.Summary.verify|verify} messages. - * @function encode - * @memberof opentelemetry.proto.metrics.v1.Summary - * @static - * @param {opentelemetry.proto.metrics.v1.ISummary} message Summary message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Summary.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.dataPoints != null && message.dataPoints.length) - for (var i = 0; i < message.dataPoints.length; ++i) - $root.opentelemetry.proto.metrics.v1.SummaryDataPoint.encode(message.dataPoints[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified Summary message, length delimited. Does not implicitly {@link opentelemetry.proto.metrics.v1.Summary.verify|verify} messages. - * @function encodeDelimited - * @memberof opentelemetry.proto.metrics.v1.Summary - * @static - * @param {opentelemetry.proto.metrics.v1.ISummary} message Summary message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Summary.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a Summary message from the specified reader or buffer. - * @function decode - * @memberof opentelemetry.proto.metrics.v1.Summary - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {opentelemetry.proto.metrics.v1.Summary} Summary - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Summary.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.opentelemetry.proto.metrics.v1.Summary(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (!(message.dataPoints && message.dataPoints.length)) - message.dataPoints = []; - message.dataPoints.push($root.opentelemetry.proto.metrics.v1.SummaryDataPoint.decode(reader, reader.uint32())); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a Summary message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof opentelemetry.proto.metrics.v1.Summary - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {opentelemetry.proto.metrics.v1.Summary} Summary - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Summary.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a Summary message. - * @function verify - * @memberof opentelemetry.proto.metrics.v1.Summary - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Summary.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.dataPoints != null && message.hasOwnProperty("dataPoints")) { - if (!Array.isArray(message.dataPoints)) - return "dataPoints: array expected"; - for (var i = 0; i < message.dataPoints.length; ++i) { - var error = $root.opentelemetry.proto.metrics.v1.SummaryDataPoint.verify(message.dataPoints[i]); - if (error) - return "dataPoints." + error; - } - } - return null; - }; - - /** - * Creates a Summary message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof opentelemetry.proto.metrics.v1.Summary - * @static - * @param {Object.} object Plain object - * @returns {opentelemetry.proto.metrics.v1.Summary} Summary - */ - Summary.fromObject = function fromObject(object) { - if (object instanceof $root.opentelemetry.proto.metrics.v1.Summary) - return object; - var message = new $root.opentelemetry.proto.metrics.v1.Summary(); - if (object.dataPoints) { - if (!Array.isArray(object.dataPoints)) - throw TypeError(".opentelemetry.proto.metrics.v1.Summary.dataPoints: array expected"); - message.dataPoints = []; - for (var i = 0; i < object.dataPoints.length; ++i) { - if (typeof object.dataPoints[i] !== "object") - throw TypeError(".opentelemetry.proto.metrics.v1.Summary.dataPoints: object expected"); - message.dataPoints[i] = $root.opentelemetry.proto.metrics.v1.SummaryDataPoint.fromObject(object.dataPoints[i]); - } - } - return message; - }; - - /** - * Creates a plain object from a Summary message. Also converts values to other types if specified. - * @function toObject - * @memberof opentelemetry.proto.metrics.v1.Summary - * @static - * @param {opentelemetry.proto.metrics.v1.Summary} message Summary - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Summary.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.dataPoints = []; - if (message.dataPoints && message.dataPoints.length) { - object.dataPoints = []; - for (var j = 0; j < message.dataPoints.length; ++j) - object.dataPoints[j] = $root.opentelemetry.proto.metrics.v1.SummaryDataPoint.toObject(message.dataPoints[j], options); - } - return object; - }; - - /** - * Converts this Summary to JSON. - * @function toJSON - * @memberof opentelemetry.proto.metrics.v1.Summary - * @instance - * @returns {Object.} JSON object - */ - Summary.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for Summary - * @function getTypeUrl - * @memberof opentelemetry.proto.metrics.v1.Summary - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - Summary.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/opentelemetry.proto.metrics.v1.Summary"; - }; - - return Summary; - })(); - - /** - * AggregationTemporality enum. - * @name opentelemetry.proto.metrics.v1.AggregationTemporality - * @enum {number} - * @property {number} AGGREGATION_TEMPORALITY_UNSPECIFIED=0 AGGREGATION_TEMPORALITY_UNSPECIFIED value - * @property {number} AGGREGATION_TEMPORALITY_DELTA=1 AGGREGATION_TEMPORALITY_DELTA value - * @property {number} AGGREGATION_TEMPORALITY_CUMULATIVE=2 AGGREGATION_TEMPORALITY_CUMULATIVE value - */ - v1.AggregationTemporality = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "AGGREGATION_TEMPORALITY_UNSPECIFIED"] = 0; - values[valuesById[1] = "AGGREGATION_TEMPORALITY_DELTA"] = 1; - values[valuesById[2] = "AGGREGATION_TEMPORALITY_CUMULATIVE"] = 2; - return values; - })(); - - /** - * DataPointFlags enum. - * @name opentelemetry.proto.metrics.v1.DataPointFlags - * @enum {number} - * @property {number} DATA_POINT_FLAGS_DO_NOT_USE=0 DATA_POINT_FLAGS_DO_NOT_USE value - * @property {number} DATA_POINT_FLAGS_NO_RECORDED_VALUE_MASK=1 DATA_POINT_FLAGS_NO_RECORDED_VALUE_MASK value - */ - v1.DataPointFlags = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "DATA_POINT_FLAGS_DO_NOT_USE"] = 0; - values[valuesById[1] = "DATA_POINT_FLAGS_NO_RECORDED_VALUE_MASK"] = 1; - return values; - })(); - - v1.NumberDataPoint = (function() { - - /** - * Properties of a NumberDataPoint. - * @memberof opentelemetry.proto.metrics.v1 - * @interface INumberDataPoint - * @property {Array.|null} [attributes] NumberDataPoint attributes - * @property {number|Long|null} [startTimeUnixNano] NumberDataPoint startTimeUnixNano - * @property {number|Long|null} [timeUnixNano] NumberDataPoint timeUnixNano - * @property {number|null} [asDouble] NumberDataPoint asDouble - * @property {number|Long|null} [asInt] NumberDataPoint asInt - * @property {Array.|null} [exemplars] NumberDataPoint exemplars - * @property {number|null} [flags] NumberDataPoint flags - */ - - /** - * Constructs a new NumberDataPoint. - * @memberof opentelemetry.proto.metrics.v1 - * @classdesc Represents a NumberDataPoint. - * @implements INumberDataPoint - * @constructor - * @param {opentelemetry.proto.metrics.v1.INumberDataPoint=} [properties] Properties to set - */ - function NumberDataPoint(properties) { - this.attributes = []; - this.exemplars = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * NumberDataPoint attributes. - * @member {Array.} attributes - * @memberof opentelemetry.proto.metrics.v1.NumberDataPoint - * @instance - */ - NumberDataPoint.prototype.attributes = $util.emptyArray; - - /** - * NumberDataPoint startTimeUnixNano. - * @member {number|Long|null|undefined} startTimeUnixNano - * @memberof opentelemetry.proto.metrics.v1.NumberDataPoint - * @instance - */ - NumberDataPoint.prototype.startTimeUnixNano = null; - - /** - * NumberDataPoint timeUnixNano. - * @member {number|Long|null|undefined} timeUnixNano - * @memberof opentelemetry.proto.metrics.v1.NumberDataPoint - * @instance - */ - NumberDataPoint.prototype.timeUnixNano = null; - - /** - * NumberDataPoint asDouble. - * @member {number|null|undefined} asDouble - * @memberof opentelemetry.proto.metrics.v1.NumberDataPoint - * @instance - */ - NumberDataPoint.prototype.asDouble = null; - - /** - * NumberDataPoint asInt. - * @member {number|Long|null|undefined} asInt - * @memberof opentelemetry.proto.metrics.v1.NumberDataPoint - * @instance - */ - NumberDataPoint.prototype.asInt = null; - - /** - * NumberDataPoint exemplars. - * @member {Array.} exemplars - * @memberof opentelemetry.proto.metrics.v1.NumberDataPoint - * @instance - */ - NumberDataPoint.prototype.exemplars = $util.emptyArray; - - /** - * NumberDataPoint flags. - * @member {number|null|undefined} flags - * @memberof opentelemetry.proto.metrics.v1.NumberDataPoint - * @instance - */ - NumberDataPoint.prototype.flags = null; - - // OneOf field names bound to virtual getters and setters - var $oneOfFields; - - /** - * NumberDataPoint value. - * @member {"asDouble"|"asInt"|undefined} value - * @memberof opentelemetry.proto.metrics.v1.NumberDataPoint - * @instance - */ - Object.defineProperty(NumberDataPoint.prototype, "value", { - get: $util.oneOfGetter($oneOfFields = ["asDouble", "asInt"]), - set: $util.oneOfSetter($oneOfFields) - }); - - /** - * Creates a new NumberDataPoint instance using the specified properties. - * @function create - * @memberof opentelemetry.proto.metrics.v1.NumberDataPoint - * @static - * @param {opentelemetry.proto.metrics.v1.INumberDataPoint=} [properties] Properties to set - * @returns {opentelemetry.proto.metrics.v1.NumberDataPoint} NumberDataPoint instance - */ - NumberDataPoint.create = function create(properties) { - return new NumberDataPoint(properties); - }; - - /** - * Encodes the specified NumberDataPoint message. Does not implicitly {@link opentelemetry.proto.metrics.v1.NumberDataPoint.verify|verify} messages. - * @function encode - * @memberof opentelemetry.proto.metrics.v1.NumberDataPoint - * @static - * @param {opentelemetry.proto.metrics.v1.INumberDataPoint} message NumberDataPoint message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - NumberDataPoint.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.startTimeUnixNano != null && Object.hasOwnProperty.call(message, "startTimeUnixNano")) - writer.uint32(/* id 2, wireType 1 =*/17).fixed64(message.startTimeUnixNano); - if (message.timeUnixNano != null && Object.hasOwnProperty.call(message, "timeUnixNano")) - writer.uint32(/* id 3, wireType 1 =*/25).fixed64(message.timeUnixNano); - if (message.asDouble != null && Object.hasOwnProperty.call(message, "asDouble")) - writer.uint32(/* id 4, wireType 1 =*/33).double(message.asDouble); - if (message.exemplars != null && message.exemplars.length) - for (var i = 0; i < message.exemplars.length; ++i) - $root.opentelemetry.proto.metrics.v1.Exemplar.encode(message.exemplars[i], writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); - if (message.asInt != null && Object.hasOwnProperty.call(message, "asInt")) - writer.uint32(/* id 6, wireType 1 =*/49).sfixed64(message.asInt); - if (message.attributes != null && message.attributes.length) - for (var i = 0; i < message.attributes.length; ++i) - $root.opentelemetry.proto.common.v1.KeyValue.encode(message.attributes[i], writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); - if (message.flags != null && Object.hasOwnProperty.call(message, "flags")) - writer.uint32(/* id 8, wireType 0 =*/64).uint32(message.flags); - return writer; - }; - - /** - * Encodes the specified NumberDataPoint message, length delimited. Does not implicitly {@link opentelemetry.proto.metrics.v1.NumberDataPoint.verify|verify} messages. - * @function encodeDelimited - * @memberof opentelemetry.proto.metrics.v1.NumberDataPoint - * @static - * @param {opentelemetry.proto.metrics.v1.INumberDataPoint} message NumberDataPoint message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - NumberDataPoint.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a NumberDataPoint message from the specified reader or buffer. - * @function decode - * @memberof opentelemetry.proto.metrics.v1.NumberDataPoint - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {opentelemetry.proto.metrics.v1.NumberDataPoint} NumberDataPoint - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - NumberDataPoint.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.opentelemetry.proto.metrics.v1.NumberDataPoint(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 7: { - 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.startTimeUnixNano = reader.fixed64(); - break; - } - case 3: { - message.timeUnixNano = reader.fixed64(); - break; - } - case 4: { - message.asDouble = reader.double(); - break; - } - case 6: { - message.asInt = reader.sfixed64(); - break; - } - case 5: { - if (!(message.exemplars && message.exemplars.length)) - message.exemplars = []; - message.exemplars.push($root.opentelemetry.proto.metrics.v1.Exemplar.decode(reader, reader.uint32())); - break; - } - case 8: { - message.flags = reader.uint32(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a NumberDataPoint message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof opentelemetry.proto.metrics.v1.NumberDataPoint - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {opentelemetry.proto.metrics.v1.NumberDataPoint} NumberDataPoint - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - NumberDataPoint.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a NumberDataPoint message. - * @function verify - * @memberof opentelemetry.proto.metrics.v1.NumberDataPoint - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - NumberDataPoint.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - var properties = {}; - if (message.attributes != null && message.hasOwnProperty("attributes")) { - if (!Array.isArray(message.attributes)) - return "attributes: array expected"; - for (var i = 0; i < message.attributes.length; ++i) { - var error = $root.opentelemetry.proto.common.v1.KeyValue.verify(message.attributes[i]); - if (error) - return "attributes." + error; - } - } - 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.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.asDouble != null && message.hasOwnProperty("asDouble")) { - properties.value = 1; - if (typeof message.asDouble !== "number") - return "asDouble: number expected"; - } - if (message.asInt != null && message.hasOwnProperty("asInt")) { - if (properties.value === 1) - return "value: multiple values"; - properties.value = 1; - if (!$util.isInteger(message.asInt) && !(message.asInt && $util.isInteger(message.asInt.low) && $util.isInteger(message.asInt.high))) - return "asInt: integer|Long expected"; - } - if (message.exemplars != null && message.hasOwnProperty("exemplars")) { - if (!Array.isArray(message.exemplars)) - return "exemplars: array expected"; - for (var i = 0; i < message.exemplars.length; ++i) { - var error = $root.opentelemetry.proto.metrics.v1.Exemplar.verify(message.exemplars[i]); - if (error) - return "exemplars." + error; - } - } - if (message.flags != null && message.hasOwnProperty("flags")) - if (!$util.isInteger(message.flags)) - return "flags: integer expected"; - return null; - }; - - /** - * Creates a NumberDataPoint message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof opentelemetry.proto.metrics.v1.NumberDataPoint - * @static - * @param {Object.} object Plain object - * @returns {opentelemetry.proto.metrics.v1.NumberDataPoint} NumberDataPoint - */ - NumberDataPoint.fromObject = function fromObject(object) { - if (object instanceof $root.opentelemetry.proto.metrics.v1.NumberDataPoint) - return object; - var message = new $root.opentelemetry.proto.metrics.v1.NumberDataPoint(); - if (object.attributes) { - if (!Array.isArray(object.attributes)) - throw TypeError(".opentelemetry.proto.metrics.v1.NumberDataPoint.attributes: array expected"); - message.attributes = []; - for (var i = 0; i < object.attributes.length; ++i) { - if (typeof object.attributes[i] !== "object") - throw TypeError(".opentelemetry.proto.metrics.v1.NumberDataPoint.attributes: object expected"); - message.attributes[i] = $root.opentelemetry.proto.common.v1.KeyValue.fromObject(object.attributes[i]); - } - } - 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.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.asDouble != null) - message.asDouble = Number(object.asDouble); - if (object.asInt != null) - if ($util.Long) - (message.asInt = $util.Long.fromValue(object.asInt)).unsigned = false; - else if (typeof object.asInt === "string") - message.asInt = parseInt(object.asInt, 10); - else if (typeof object.asInt === "number") - message.asInt = object.asInt; - else if (typeof object.asInt === "object") - message.asInt = new $util.LongBits(object.asInt.low >>> 0, object.asInt.high >>> 0).toNumber(); - if (object.exemplars) { - if (!Array.isArray(object.exemplars)) - throw TypeError(".opentelemetry.proto.metrics.v1.NumberDataPoint.exemplars: array expected"); - message.exemplars = []; - for (var i = 0; i < object.exemplars.length; ++i) { - if (typeof object.exemplars[i] !== "object") - throw TypeError(".opentelemetry.proto.metrics.v1.NumberDataPoint.exemplars: object expected"); - message.exemplars[i] = $root.opentelemetry.proto.metrics.v1.Exemplar.fromObject(object.exemplars[i]); - } - } - if (object.flags != null) - message.flags = object.flags >>> 0; - return message; - }; - - /** - * Creates a plain object from a NumberDataPoint message. Also converts values to other types if specified. - * @function toObject - * @memberof opentelemetry.proto.metrics.v1.NumberDataPoint - * @static - * @param {opentelemetry.proto.metrics.v1.NumberDataPoint} message NumberDataPoint - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - NumberDataPoint.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) { - object.exemplars = []; - object.attributes = []; - } - if (options.defaults) { - if ($util.Long) { - var 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) { - var 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.flags = 0; - } - 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.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.asDouble != null && message.hasOwnProperty("asDouble")) { - object.asDouble = options.json && !isFinite(message.asDouble) ? String(message.asDouble) : message.asDouble; - if (options.oneofs) - object.value = "asDouble"; - } - if (message.exemplars && message.exemplars.length) { - object.exemplars = []; - for (var j = 0; j < message.exemplars.length; ++j) - object.exemplars[j] = $root.opentelemetry.proto.metrics.v1.Exemplar.toObject(message.exemplars[j], options); - } - if (message.asInt != null && message.hasOwnProperty("asInt")) { - if (typeof message.asInt === "number") - object.asInt = options.longs === String ? String(message.asInt) : message.asInt; - else - object.asInt = options.longs === String ? $util.Long.prototype.toString.call(message.asInt) : options.longs === Number ? new $util.LongBits(message.asInt.low >>> 0, message.asInt.high >>> 0).toNumber() : message.asInt; - if (options.oneofs) - object.value = "asInt"; - } - if (message.attributes && message.attributes.length) { - object.attributes = []; - for (var j = 0; j < message.attributes.length; ++j) - object.attributes[j] = $root.opentelemetry.proto.common.v1.KeyValue.toObject(message.attributes[j], options); - } - if (message.flags != null && message.hasOwnProperty("flags")) - object.flags = message.flags; - return object; - }; - - /** - * Converts this NumberDataPoint to JSON. - * @function toJSON - * @memberof opentelemetry.proto.metrics.v1.NumberDataPoint - * @instance - * @returns {Object.} JSON object - */ - NumberDataPoint.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for NumberDataPoint - * @function getTypeUrl - * @memberof opentelemetry.proto.metrics.v1.NumberDataPoint - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - NumberDataPoint.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/opentelemetry.proto.metrics.v1.NumberDataPoint"; - }; - - return NumberDataPoint; - })(); - - v1.HistogramDataPoint = (function() { - - /** - * Properties of a HistogramDataPoint. - * @memberof opentelemetry.proto.metrics.v1 - * @interface IHistogramDataPoint - * @property {Array.|null} [attributes] HistogramDataPoint attributes - * @property {number|Long|null} [startTimeUnixNano] HistogramDataPoint startTimeUnixNano - * @property {number|Long|null} [timeUnixNano] HistogramDataPoint timeUnixNano - * @property {number|Long|null} [count] HistogramDataPoint count - * @property {number|null} [sum] HistogramDataPoint sum - * @property {Array.|null} [bucketCounts] HistogramDataPoint bucketCounts - * @property {Array.|null} [explicitBounds] HistogramDataPoint explicitBounds - * @property {Array.|null} [exemplars] HistogramDataPoint exemplars - * @property {number|null} [flags] HistogramDataPoint flags - * @property {number|null} [min] HistogramDataPoint min - * @property {number|null} [max] HistogramDataPoint max - */ - - /** - * Constructs a new HistogramDataPoint. - * @memberof opentelemetry.proto.metrics.v1 - * @classdesc Represents a HistogramDataPoint. - * @implements IHistogramDataPoint - * @constructor - * @param {opentelemetry.proto.metrics.v1.IHistogramDataPoint=} [properties] Properties to set - */ - function HistogramDataPoint(properties) { - this.attributes = []; - this.bucketCounts = []; - this.explicitBounds = []; - this.exemplars = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * HistogramDataPoint attributes. - * @member {Array.} attributes - * @memberof opentelemetry.proto.metrics.v1.HistogramDataPoint - * @instance - */ - HistogramDataPoint.prototype.attributes = $util.emptyArray; - - /** - * HistogramDataPoint startTimeUnixNano. - * @member {number|Long|null|undefined} startTimeUnixNano - * @memberof opentelemetry.proto.metrics.v1.HistogramDataPoint - * @instance - */ - HistogramDataPoint.prototype.startTimeUnixNano = null; - - /** - * HistogramDataPoint timeUnixNano. - * @member {number|Long|null|undefined} timeUnixNano - * @memberof opentelemetry.proto.metrics.v1.HistogramDataPoint - * @instance - */ - HistogramDataPoint.prototype.timeUnixNano = null; - - /** - * HistogramDataPoint count. - * @member {number|Long|null|undefined} count - * @memberof opentelemetry.proto.metrics.v1.HistogramDataPoint - * @instance - */ - HistogramDataPoint.prototype.count = null; - - /** - * HistogramDataPoint sum. - * @member {number|null|undefined} sum - * @memberof opentelemetry.proto.metrics.v1.HistogramDataPoint - * @instance - */ - HistogramDataPoint.prototype.sum = null; - - /** - * HistogramDataPoint bucketCounts. - * @member {Array.} bucketCounts - * @memberof opentelemetry.proto.metrics.v1.HistogramDataPoint - * @instance - */ - HistogramDataPoint.prototype.bucketCounts = $util.emptyArray; - - /** - * HistogramDataPoint explicitBounds. - * @member {Array.} explicitBounds - * @memberof opentelemetry.proto.metrics.v1.HistogramDataPoint - * @instance - */ - HistogramDataPoint.prototype.explicitBounds = $util.emptyArray; - - /** - * HistogramDataPoint exemplars. - * @member {Array.} exemplars - * @memberof opentelemetry.proto.metrics.v1.HistogramDataPoint - * @instance - */ - HistogramDataPoint.prototype.exemplars = $util.emptyArray; - - /** - * HistogramDataPoint flags. - * @member {number|null|undefined} flags - * @memberof opentelemetry.proto.metrics.v1.HistogramDataPoint - * @instance - */ - HistogramDataPoint.prototype.flags = null; - - /** - * HistogramDataPoint min. - * @member {number|null|undefined} min - * @memberof opentelemetry.proto.metrics.v1.HistogramDataPoint - * @instance - */ - HistogramDataPoint.prototype.min = null; - - /** - * HistogramDataPoint max. - * @member {number|null|undefined} max - * @memberof opentelemetry.proto.metrics.v1.HistogramDataPoint - * @instance - */ - HistogramDataPoint.prototype.max = null; - - // OneOf field names bound to virtual getters and setters - var $oneOfFields; - - /** - * HistogramDataPoint _sum. - * @member {"sum"|undefined} _sum - * @memberof opentelemetry.proto.metrics.v1.HistogramDataPoint - * @instance - */ - Object.defineProperty(HistogramDataPoint.prototype, "_sum", { - get: $util.oneOfGetter($oneOfFields = ["sum"]), - set: $util.oneOfSetter($oneOfFields) - }); - - /** - * HistogramDataPoint _min. - * @member {"min"|undefined} _min - * @memberof opentelemetry.proto.metrics.v1.HistogramDataPoint - * @instance - */ - Object.defineProperty(HistogramDataPoint.prototype, "_min", { - get: $util.oneOfGetter($oneOfFields = ["min"]), - set: $util.oneOfSetter($oneOfFields) - }); - - /** - * HistogramDataPoint _max. - * @member {"max"|undefined} _max - * @memberof opentelemetry.proto.metrics.v1.HistogramDataPoint - * @instance - */ - Object.defineProperty(HistogramDataPoint.prototype, "_max", { - get: $util.oneOfGetter($oneOfFields = ["max"]), - set: $util.oneOfSetter($oneOfFields) - }); - - /** - * Creates a new HistogramDataPoint instance using the specified properties. - * @function create - * @memberof opentelemetry.proto.metrics.v1.HistogramDataPoint - * @static - * @param {opentelemetry.proto.metrics.v1.IHistogramDataPoint=} [properties] Properties to set - * @returns {opentelemetry.proto.metrics.v1.HistogramDataPoint} HistogramDataPoint instance - */ - HistogramDataPoint.create = function create(properties) { - return new HistogramDataPoint(properties); - }; - - /** - * Encodes the specified HistogramDataPoint message. Does not implicitly {@link opentelemetry.proto.metrics.v1.HistogramDataPoint.verify|verify} messages. - * @function encode - * @memberof opentelemetry.proto.metrics.v1.HistogramDataPoint - * @static - * @param {opentelemetry.proto.metrics.v1.IHistogramDataPoint} message HistogramDataPoint message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - HistogramDataPoint.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.startTimeUnixNano != null && Object.hasOwnProperty.call(message, "startTimeUnixNano")) - writer.uint32(/* id 2, wireType 1 =*/17).fixed64(message.startTimeUnixNano); - if (message.timeUnixNano != null && Object.hasOwnProperty.call(message, "timeUnixNano")) - writer.uint32(/* id 3, wireType 1 =*/25).fixed64(message.timeUnixNano); - if (message.count != null && Object.hasOwnProperty.call(message, "count")) - writer.uint32(/* id 4, wireType 1 =*/33).fixed64(message.count); - if (message.sum != null && Object.hasOwnProperty.call(message, "sum")) - writer.uint32(/* id 5, wireType 1 =*/41).double(message.sum); - if (message.bucketCounts != null && message.bucketCounts.length) { - writer.uint32(/* id 6, wireType 2 =*/50).fork(); - for (var i = 0; i < message.bucketCounts.length; ++i) - writer.fixed64(message.bucketCounts[i]); - writer.ldelim(); - } - if (message.explicitBounds != null && message.explicitBounds.length) { - writer.uint32(/* id 7, wireType 2 =*/58).fork(); - for (var i = 0; i < message.explicitBounds.length; ++i) - writer.double(message.explicitBounds[i]); - writer.ldelim(); - } - if (message.exemplars != null && message.exemplars.length) - for (var i = 0; i < message.exemplars.length; ++i) - $root.opentelemetry.proto.metrics.v1.Exemplar.encode(message.exemplars[i], writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); - if (message.attributes != null && message.attributes.length) - for (var 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.flags != null && Object.hasOwnProperty.call(message, "flags")) - writer.uint32(/* id 10, wireType 0 =*/80).uint32(message.flags); - if (message.min != null && Object.hasOwnProperty.call(message, "min")) - writer.uint32(/* id 11, wireType 1 =*/89).double(message.min); - if (message.max != null && Object.hasOwnProperty.call(message, "max")) - writer.uint32(/* id 12, wireType 1 =*/97).double(message.max); - return writer; - }; - - /** - * Encodes the specified HistogramDataPoint message, length delimited. Does not implicitly {@link opentelemetry.proto.metrics.v1.HistogramDataPoint.verify|verify} messages. - * @function encodeDelimited - * @memberof opentelemetry.proto.metrics.v1.HistogramDataPoint - * @static - * @param {opentelemetry.proto.metrics.v1.IHistogramDataPoint} message HistogramDataPoint message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - HistogramDataPoint.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a HistogramDataPoint message from the specified reader or buffer. - * @function decode - * @memberof opentelemetry.proto.metrics.v1.HistogramDataPoint - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {opentelemetry.proto.metrics.v1.HistogramDataPoint} HistogramDataPoint - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - HistogramDataPoint.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.opentelemetry.proto.metrics.v1.HistogramDataPoint(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - 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 2: { - message.startTimeUnixNano = reader.fixed64(); - break; - } - case 3: { - message.timeUnixNano = reader.fixed64(); - break; - } - case 4: { - message.count = reader.fixed64(); - break; - } - case 5: { - message.sum = reader.double(); - break; - } - case 6: { - if (!(message.bucketCounts && message.bucketCounts.length)) - message.bucketCounts = []; - if ((tag & 7) === 2) { - var end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) - message.bucketCounts.push(reader.fixed64()); - } else - message.bucketCounts.push(reader.fixed64()); - break; - } - case 7: { - if (!(message.explicitBounds && message.explicitBounds.length)) - message.explicitBounds = []; - if ((tag & 7) === 2) { - var end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) - message.explicitBounds.push(reader.double()); - } else - message.explicitBounds.push(reader.double()); - break; - } - case 8: { - if (!(message.exemplars && message.exemplars.length)) - message.exemplars = []; - message.exemplars.push($root.opentelemetry.proto.metrics.v1.Exemplar.decode(reader, reader.uint32())); - break; - } - case 10: { - message.flags = reader.uint32(); - break; - } - case 11: { - message.min = reader.double(); - break; - } - case 12: { - message.max = reader.double(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a HistogramDataPoint message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof opentelemetry.proto.metrics.v1.HistogramDataPoint - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {opentelemetry.proto.metrics.v1.HistogramDataPoint} HistogramDataPoint - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - HistogramDataPoint.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a HistogramDataPoint message. - * @function verify - * @memberof opentelemetry.proto.metrics.v1.HistogramDataPoint - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - HistogramDataPoint.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - var properties = {}; - if (message.attributes != null && message.hasOwnProperty("attributes")) { - if (!Array.isArray(message.attributes)) - return "attributes: array expected"; - for (var i = 0; i < message.attributes.length; ++i) { - var error = $root.opentelemetry.proto.common.v1.KeyValue.verify(message.attributes[i]); - if (error) - return "attributes." + error; - } - } - 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.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.count != null && message.hasOwnProperty("count")) - if (!$util.isInteger(message.count) && !(message.count && $util.isInteger(message.count.low) && $util.isInteger(message.count.high))) - return "count: integer|Long expected"; - if (message.sum != null && message.hasOwnProperty("sum")) { - properties._sum = 1; - if (typeof message.sum !== "number") - return "sum: number expected"; - } - if (message.bucketCounts != null && message.hasOwnProperty("bucketCounts")) { - if (!Array.isArray(message.bucketCounts)) - return "bucketCounts: array expected"; - for (var i = 0; i < message.bucketCounts.length; ++i) - if (!$util.isInteger(message.bucketCounts[i]) && !(message.bucketCounts[i] && $util.isInteger(message.bucketCounts[i].low) && $util.isInteger(message.bucketCounts[i].high))) - return "bucketCounts: integer|Long[] expected"; - } - if (message.explicitBounds != null && message.hasOwnProperty("explicitBounds")) { - if (!Array.isArray(message.explicitBounds)) - return "explicitBounds: array expected"; - for (var i = 0; i < message.explicitBounds.length; ++i) - if (typeof message.explicitBounds[i] !== "number") - return "explicitBounds: number[] expected"; - } - if (message.exemplars != null && message.hasOwnProperty("exemplars")) { - if (!Array.isArray(message.exemplars)) - return "exemplars: array expected"; - for (var i = 0; i < message.exemplars.length; ++i) { - var error = $root.opentelemetry.proto.metrics.v1.Exemplar.verify(message.exemplars[i]); - if (error) - return "exemplars." + error; - } - } - if (message.flags != null && message.hasOwnProperty("flags")) - if (!$util.isInteger(message.flags)) - return "flags: integer expected"; - if (message.min != null && message.hasOwnProperty("min")) { - properties._min = 1; - if (typeof message.min !== "number") - return "min: number expected"; - } - if (message.max != null && message.hasOwnProperty("max")) { - properties._max = 1; - if (typeof message.max !== "number") - return "max: number expected"; - } - return null; - }; - - /** - * Creates a HistogramDataPoint message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof opentelemetry.proto.metrics.v1.HistogramDataPoint - * @static - * @param {Object.} object Plain object - * @returns {opentelemetry.proto.metrics.v1.HistogramDataPoint} HistogramDataPoint - */ - HistogramDataPoint.fromObject = function fromObject(object) { - if (object instanceof $root.opentelemetry.proto.metrics.v1.HistogramDataPoint) - return object; - var message = new $root.opentelemetry.proto.metrics.v1.HistogramDataPoint(); - if (object.attributes) { - if (!Array.isArray(object.attributes)) - throw TypeError(".opentelemetry.proto.metrics.v1.HistogramDataPoint.attributes: array expected"); - message.attributes = []; - for (var i = 0; i < object.attributes.length; ++i) { - if (typeof object.attributes[i] !== "object") - throw TypeError(".opentelemetry.proto.metrics.v1.HistogramDataPoint.attributes: object expected"); - message.attributes[i] = $root.opentelemetry.proto.common.v1.KeyValue.fromObject(object.attributes[i]); - } - } - 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.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.count != null) - if ($util.Long) - (message.count = $util.Long.fromValue(object.count)).unsigned = false; - else if (typeof object.count === "string") - message.count = parseInt(object.count, 10); - else if (typeof object.count === "number") - message.count = object.count; - else if (typeof object.count === "object") - message.count = new $util.LongBits(object.count.low >>> 0, object.count.high >>> 0).toNumber(); - if (object.sum != null) - message.sum = Number(object.sum); - if (object.bucketCounts) { - if (!Array.isArray(object.bucketCounts)) - throw TypeError(".opentelemetry.proto.metrics.v1.HistogramDataPoint.bucketCounts: array expected"); - message.bucketCounts = []; - for (var i = 0; i < object.bucketCounts.length; ++i) - if ($util.Long) - (message.bucketCounts[i] = $util.Long.fromValue(object.bucketCounts[i])).unsigned = false; - else if (typeof object.bucketCounts[i] === "string") - message.bucketCounts[i] = parseInt(object.bucketCounts[i], 10); - else if (typeof object.bucketCounts[i] === "number") - message.bucketCounts[i] = object.bucketCounts[i]; - else if (typeof object.bucketCounts[i] === "object") - message.bucketCounts[i] = new $util.LongBits(object.bucketCounts[i].low >>> 0, object.bucketCounts[i].high >>> 0).toNumber(); - } - if (object.explicitBounds) { - if (!Array.isArray(object.explicitBounds)) - throw TypeError(".opentelemetry.proto.metrics.v1.HistogramDataPoint.explicitBounds: array expected"); - message.explicitBounds = []; - for (var i = 0; i < object.explicitBounds.length; ++i) - message.explicitBounds[i] = Number(object.explicitBounds[i]); - } - if (object.exemplars) { - if (!Array.isArray(object.exemplars)) - throw TypeError(".opentelemetry.proto.metrics.v1.HistogramDataPoint.exemplars: array expected"); - message.exemplars = []; - for (var i = 0; i < object.exemplars.length; ++i) { - if (typeof object.exemplars[i] !== "object") - throw TypeError(".opentelemetry.proto.metrics.v1.HistogramDataPoint.exemplars: object expected"); - message.exemplars[i] = $root.opentelemetry.proto.metrics.v1.Exemplar.fromObject(object.exemplars[i]); - } - } - if (object.flags != null) - message.flags = object.flags >>> 0; - if (object.min != null) - message.min = Number(object.min); - if (object.max != null) - message.max = Number(object.max); - return message; - }; - - /** - * Creates a plain object from a HistogramDataPoint message. Also converts values to other types if specified. - * @function toObject - * @memberof opentelemetry.proto.metrics.v1.HistogramDataPoint - * @static - * @param {opentelemetry.proto.metrics.v1.HistogramDataPoint} message HistogramDataPoint - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - HistogramDataPoint.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) { - object.bucketCounts = []; - object.explicitBounds = []; - object.exemplars = []; - object.attributes = []; - } - if (options.defaults) { - if ($util.Long) { - var 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) { - var 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; - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.count = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.count = options.longs === String ? "0" : 0; - object.flags = 0; - } - 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.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.count != null && message.hasOwnProperty("count")) - if (typeof message.count === "number") - object.count = options.longs === String ? String(message.count) : message.count; - else - object.count = options.longs === String ? $util.Long.prototype.toString.call(message.count) : options.longs === Number ? new $util.LongBits(message.count.low >>> 0, message.count.high >>> 0).toNumber() : message.count; - if (message.sum != null && message.hasOwnProperty("sum")) { - object.sum = options.json && !isFinite(message.sum) ? String(message.sum) : message.sum; - if (options.oneofs) - object._sum = "sum"; - } - if (message.bucketCounts && message.bucketCounts.length) { - object.bucketCounts = []; - for (var j = 0; j < message.bucketCounts.length; ++j) - if (typeof message.bucketCounts[j] === "number") - object.bucketCounts[j] = options.longs === String ? String(message.bucketCounts[j]) : message.bucketCounts[j]; - else - object.bucketCounts[j] = options.longs === String ? $util.Long.prototype.toString.call(message.bucketCounts[j]) : options.longs === Number ? new $util.LongBits(message.bucketCounts[j].low >>> 0, message.bucketCounts[j].high >>> 0).toNumber() : message.bucketCounts[j]; - } - if (message.explicitBounds && message.explicitBounds.length) { - object.explicitBounds = []; - for (var j = 0; j < message.explicitBounds.length; ++j) - object.explicitBounds[j] = options.json && !isFinite(message.explicitBounds[j]) ? String(message.explicitBounds[j]) : message.explicitBounds[j]; - } - if (message.exemplars && message.exemplars.length) { - object.exemplars = []; - for (var j = 0; j < message.exemplars.length; ++j) - object.exemplars[j] = $root.opentelemetry.proto.metrics.v1.Exemplar.toObject(message.exemplars[j], options); - } - if (message.attributes && message.attributes.length) { - object.attributes = []; - for (var j = 0; j < message.attributes.length; ++j) - object.attributes[j] = $root.opentelemetry.proto.common.v1.KeyValue.toObject(message.attributes[j], options); - } - if (message.flags != null && message.hasOwnProperty("flags")) - object.flags = message.flags; - if (message.min != null && message.hasOwnProperty("min")) { - object.min = options.json && !isFinite(message.min) ? String(message.min) : message.min; - if (options.oneofs) - object._min = "min"; - } - if (message.max != null && message.hasOwnProperty("max")) { - object.max = options.json && !isFinite(message.max) ? String(message.max) : message.max; - if (options.oneofs) - object._max = "max"; - } - return object; - }; - - /** - * Converts this HistogramDataPoint to JSON. - * @function toJSON - * @memberof opentelemetry.proto.metrics.v1.HistogramDataPoint - * @instance - * @returns {Object.} JSON object - */ - HistogramDataPoint.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for HistogramDataPoint - * @function getTypeUrl - * @memberof opentelemetry.proto.metrics.v1.HistogramDataPoint - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - HistogramDataPoint.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/opentelemetry.proto.metrics.v1.HistogramDataPoint"; - }; - - return HistogramDataPoint; - })(); - - v1.ExponentialHistogramDataPoint = (function() { - - /** - * Properties of an ExponentialHistogramDataPoint. - * @memberof opentelemetry.proto.metrics.v1 - * @interface IExponentialHistogramDataPoint - * @property {Array.|null} [attributes] ExponentialHistogramDataPoint attributes - * @property {number|Long|null} [startTimeUnixNano] ExponentialHistogramDataPoint startTimeUnixNano - * @property {number|Long|null} [timeUnixNano] ExponentialHistogramDataPoint timeUnixNano - * @property {number|Long|null} [count] ExponentialHistogramDataPoint count - * @property {number|null} [sum] ExponentialHistogramDataPoint sum - * @property {number|null} [scale] ExponentialHistogramDataPoint scale - * @property {number|Long|null} [zeroCount] ExponentialHistogramDataPoint zeroCount - * @property {opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.IBuckets|null} [positive] ExponentialHistogramDataPoint positive - * @property {opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.IBuckets|null} [negative] ExponentialHistogramDataPoint negative - * @property {number|null} [flags] ExponentialHistogramDataPoint flags - * @property {Array.|null} [exemplars] ExponentialHistogramDataPoint exemplars - * @property {number|null} [min] ExponentialHistogramDataPoint min - * @property {number|null} [max] ExponentialHistogramDataPoint max - * @property {number|null} [zeroThreshold] ExponentialHistogramDataPoint zeroThreshold - */ - - /** - * Constructs a new ExponentialHistogramDataPoint. - * @memberof opentelemetry.proto.metrics.v1 - * @classdesc Represents an ExponentialHistogramDataPoint. - * @implements IExponentialHistogramDataPoint - * @constructor - * @param {opentelemetry.proto.metrics.v1.IExponentialHistogramDataPoint=} [properties] Properties to set - */ - function ExponentialHistogramDataPoint(properties) { - this.attributes = []; - this.exemplars = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * ExponentialHistogramDataPoint attributes. - * @member {Array.} attributes - * @memberof opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint - * @instance - */ - ExponentialHistogramDataPoint.prototype.attributes = $util.emptyArray; - - /** - * ExponentialHistogramDataPoint startTimeUnixNano. - * @member {number|Long|null|undefined} startTimeUnixNano - * @memberof opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint - * @instance - */ - ExponentialHistogramDataPoint.prototype.startTimeUnixNano = null; - - /** - * ExponentialHistogramDataPoint timeUnixNano. - * @member {number|Long|null|undefined} timeUnixNano - * @memberof opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint - * @instance - */ - ExponentialHistogramDataPoint.prototype.timeUnixNano = null; - - /** - * ExponentialHistogramDataPoint count. - * @member {number|Long|null|undefined} count - * @memberof opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint - * @instance - */ - ExponentialHistogramDataPoint.prototype.count = null; - - /** - * ExponentialHistogramDataPoint sum. - * @member {number|null|undefined} sum - * @memberof opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint - * @instance - */ - ExponentialHistogramDataPoint.prototype.sum = null; - - /** - * ExponentialHistogramDataPoint scale. - * @member {number|null|undefined} scale - * @memberof opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint - * @instance - */ - ExponentialHistogramDataPoint.prototype.scale = null; - - /** - * ExponentialHistogramDataPoint zeroCount. - * @member {number|Long|null|undefined} zeroCount - * @memberof opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint - * @instance - */ - ExponentialHistogramDataPoint.prototype.zeroCount = null; - - /** - * ExponentialHistogramDataPoint positive. - * @member {opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.IBuckets|null|undefined} positive - * @memberof opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint - * @instance - */ - ExponentialHistogramDataPoint.prototype.positive = null; - - /** - * ExponentialHistogramDataPoint negative. - * @member {opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.IBuckets|null|undefined} negative - * @memberof opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint - * @instance - */ - ExponentialHistogramDataPoint.prototype.negative = null; - - /** - * ExponentialHistogramDataPoint flags. - * @member {number|null|undefined} flags - * @memberof opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint - * @instance - */ - ExponentialHistogramDataPoint.prototype.flags = null; - - /** - * ExponentialHistogramDataPoint exemplars. - * @member {Array.} exemplars - * @memberof opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint - * @instance - */ - ExponentialHistogramDataPoint.prototype.exemplars = $util.emptyArray; - - /** - * ExponentialHistogramDataPoint min. - * @member {number|null|undefined} min - * @memberof opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint - * @instance - */ - ExponentialHistogramDataPoint.prototype.min = null; - - /** - * ExponentialHistogramDataPoint max. - * @member {number|null|undefined} max - * @memberof opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint - * @instance - */ - ExponentialHistogramDataPoint.prototype.max = null; - - /** - * ExponentialHistogramDataPoint zeroThreshold. - * @member {number|null|undefined} zeroThreshold - * @memberof opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint - * @instance - */ - ExponentialHistogramDataPoint.prototype.zeroThreshold = null; - - // OneOf field names bound to virtual getters and setters - var $oneOfFields; - - /** - * ExponentialHistogramDataPoint _sum. - * @member {"sum"|undefined} _sum - * @memberof opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint - * @instance - */ - Object.defineProperty(ExponentialHistogramDataPoint.prototype, "_sum", { - get: $util.oneOfGetter($oneOfFields = ["sum"]), - set: $util.oneOfSetter($oneOfFields) - }); - - /** - * ExponentialHistogramDataPoint _min. - * @member {"min"|undefined} _min - * @memberof opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint - * @instance - */ - Object.defineProperty(ExponentialHistogramDataPoint.prototype, "_min", { - get: $util.oneOfGetter($oneOfFields = ["min"]), - set: $util.oneOfSetter($oneOfFields) - }); - - /** - * ExponentialHistogramDataPoint _max. - * @member {"max"|undefined} _max - * @memberof opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint - * @instance - */ - Object.defineProperty(ExponentialHistogramDataPoint.prototype, "_max", { - get: $util.oneOfGetter($oneOfFields = ["max"]), - set: $util.oneOfSetter($oneOfFields) - }); - - /** - * Creates a new ExponentialHistogramDataPoint instance using the specified properties. - * @function create - * @memberof opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint - * @static - * @param {opentelemetry.proto.metrics.v1.IExponentialHistogramDataPoint=} [properties] Properties to set - * @returns {opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint} ExponentialHistogramDataPoint instance - */ - ExponentialHistogramDataPoint.create = function create(properties) { - return new ExponentialHistogramDataPoint(properties); - }; - - /** - * Encodes the specified ExponentialHistogramDataPoint message. Does not implicitly {@link opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.verify|verify} messages. - * @function encode - * @memberof opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint - * @static - * @param {opentelemetry.proto.metrics.v1.IExponentialHistogramDataPoint} message ExponentialHistogramDataPoint message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ExponentialHistogramDataPoint.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.attributes != null && message.attributes.length) - for (var 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.startTimeUnixNano != null && Object.hasOwnProperty.call(message, "startTimeUnixNano")) - writer.uint32(/* id 2, wireType 1 =*/17).fixed64(message.startTimeUnixNano); - if (message.timeUnixNano != null && Object.hasOwnProperty.call(message, "timeUnixNano")) - writer.uint32(/* id 3, wireType 1 =*/25).fixed64(message.timeUnixNano); - if (message.count != null && Object.hasOwnProperty.call(message, "count")) - writer.uint32(/* id 4, wireType 1 =*/33).fixed64(message.count); - if (message.sum != null && Object.hasOwnProperty.call(message, "sum")) - writer.uint32(/* id 5, wireType 1 =*/41).double(message.sum); - if (message.scale != null && Object.hasOwnProperty.call(message, "scale")) - writer.uint32(/* id 6, wireType 0 =*/48).sint32(message.scale); - if (message.zeroCount != null && Object.hasOwnProperty.call(message, "zeroCount")) - writer.uint32(/* id 7, wireType 1 =*/57).fixed64(message.zeroCount); - if (message.positive != null && Object.hasOwnProperty.call(message, "positive")) - $root.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets.encode(message.positive, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); - if (message.negative != null && Object.hasOwnProperty.call(message, "negative")) - $root.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets.encode(message.negative, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); - if (message.flags != null && Object.hasOwnProperty.call(message, "flags")) - writer.uint32(/* id 10, wireType 0 =*/80).uint32(message.flags); - if (message.exemplars != null && message.exemplars.length) - for (var i = 0; i < message.exemplars.length; ++i) - $root.opentelemetry.proto.metrics.v1.Exemplar.encode(message.exemplars[i], writer.uint32(/* id 11, wireType 2 =*/90).fork()).ldelim(); - if (message.min != null && Object.hasOwnProperty.call(message, "min")) - writer.uint32(/* id 12, wireType 1 =*/97).double(message.min); - if (message.max != null && Object.hasOwnProperty.call(message, "max")) - writer.uint32(/* id 13, wireType 1 =*/105).double(message.max); - if (message.zeroThreshold != null && Object.hasOwnProperty.call(message, "zeroThreshold")) - writer.uint32(/* id 14, wireType 1 =*/113).double(message.zeroThreshold); - return writer; - }; - - /** - * Encodes the specified ExponentialHistogramDataPoint message, length delimited. Does not implicitly {@link opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.verify|verify} messages. - * @function encodeDelimited - * @memberof opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint - * @static - * @param {opentelemetry.proto.metrics.v1.IExponentialHistogramDataPoint} message ExponentialHistogramDataPoint message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ExponentialHistogramDataPoint.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an ExponentialHistogramDataPoint message from the specified reader or buffer. - * @function decode - * @memberof opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint} ExponentialHistogramDataPoint - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ExponentialHistogramDataPoint.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint(); - while (reader.pos < end) { - var 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.startTimeUnixNano = reader.fixed64(); - break; - } - case 3: { - message.timeUnixNano = reader.fixed64(); - break; - } - case 4: { - message.count = reader.fixed64(); - break; - } - case 5: { - message.sum = reader.double(); - break; - } - case 6: { - message.scale = reader.sint32(); - break; - } - case 7: { - message.zeroCount = reader.fixed64(); - break; - } - case 8: { - message.positive = $root.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets.decode(reader, reader.uint32()); - break; - } - case 9: { - message.negative = $root.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets.decode(reader, reader.uint32()); - break; - } - case 10: { - message.flags = reader.uint32(); - break; - } - case 11: { - if (!(message.exemplars && message.exemplars.length)) - message.exemplars = []; - message.exemplars.push($root.opentelemetry.proto.metrics.v1.Exemplar.decode(reader, reader.uint32())); - break; - } - case 12: { - message.min = reader.double(); - break; - } - case 13: { - message.max = reader.double(); - break; - } - case 14: { - message.zeroThreshold = reader.double(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an ExponentialHistogramDataPoint message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint} ExponentialHistogramDataPoint - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ExponentialHistogramDataPoint.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an ExponentialHistogramDataPoint message. - * @function verify - * @memberof opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ExponentialHistogramDataPoint.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - var properties = {}; - if (message.attributes != null && message.hasOwnProperty("attributes")) { - if (!Array.isArray(message.attributes)) - return "attributes: array expected"; - for (var i = 0; i < message.attributes.length; ++i) { - var error = $root.opentelemetry.proto.common.v1.KeyValue.verify(message.attributes[i]); - if (error) - return "attributes." + error; - } - } - 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.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.count != null && message.hasOwnProperty("count")) - if (!$util.isInteger(message.count) && !(message.count && $util.isInteger(message.count.low) && $util.isInteger(message.count.high))) - return "count: integer|Long expected"; - if (message.sum != null && message.hasOwnProperty("sum")) { - properties._sum = 1; - if (typeof message.sum !== "number") - return "sum: number expected"; - } - if (message.scale != null && message.hasOwnProperty("scale")) - if (!$util.isInteger(message.scale)) - return "scale: integer expected"; - if (message.zeroCount != null && message.hasOwnProperty("zeroCount")) - if (!$util.isInteger(message.zeroCount) && !(message.zeroCount && $util.isInteger(message.zeroCount.low) && $util.isInteger(message.zeroCount.high))) - return "zeroCount: integer|Long expected"; - if (message.positive != null && message.hasOwnProperty("positive")) { - var error = $root.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets.verify(message.positive); - if (error) - return "positive." + error; - } - if (message.negative != null && message.hasOwnProperty("negative")) { - var error = $root.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets.verify(message.negative); - if (error) - return "negative." + error; - } - if (message.flags != null && message.hasOwnProperty("flags")) - if (!$util.isInteger(message.flags)) - return "flags: integer expected"; - if (message.exemplars != null && message.hasOwnProperty("exemplars")) { - if (!Array.isArray(message.exemplars)) - return "exemplars: array expected"; - for (var i = 0; i < message.exemplars.length; ++i) { - var error = $root.opentelemetry.proto.metrics.v1.Exemplar.verify(message.exemplars[i]); - if (error) - return "exemplars." + error; - } - } - if (message.min != null && message.hasOwnProperty("min")) { - properties._min = 1; - if (typeof message.min !== "number") - return "min: number expected"; - } - if (message.max != null && message.hasOwnProperty("max")) { - properties._max = 1; - if (typeof message.max !== "number") - return "max: number expected"; - } - if (message.zeroThreshold != null && message.hasOwnProperty("zeroThreshold")) - if (typeof message.zeroThreshold !== "number") - return "zeroThreshold: number expected"; - return null; - }; - - /** - * Creates an ExponentialHistogramDataPoint message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint - * @static - * @param {Object.} object Plain object - * @returns {opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint} ExponentialHistogramDataPoint - */ - ExponentialHistogramDataPoint.fromObject = function fromObject(object) { - if (object instanceof $root.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint) - return object; - var message = new $root.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint(); - if (object.attributes) { - if (!Array.isArray(object.attributes)) - throw TypeError(".opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.attributes: array expected"); - message.attributes = []; - for (var i = 0; i < object.attributes.length; ++i) { - if (typeof object.attributes[i] !== "object") - throw TypeError(".opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.attributes: object expected"); - message.attributes[i] = $root.opentelemetry.proto.common.v1.KeyValue.fromObject(object.attributes[i]); - } - } - 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.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.count != null) - if ($util.Long) - (message.count = $util.Long.fromValue(object.count)).unsigned = false; - else if (typeof object.count === "string") - message.count = parseInt(object.count, 10); - else if (typeof object.count === "number") - message.count = object.count; - else if (typeof object.count === "object") - message.count = new $util.LongBits(object.count.low >>> 0, object.count.high >>> 0).toNumber(); - if (object.sum != null) - message.sum = Number(object.sum); - if (object.scale != null) - message.scale = object.scale | 0; - if (object.zeroCount != null) - if ($util.Long) - (message.zeroCount = $util.Long.fromValue(object.zeroCount)).unsigned = false; - else if (typeof object.zeroCount === "string") - message.zeroCount = parseInt(object.zeroCount, 10); - else if (typeof object.zeroCount === "number") - message.zeroCount = object.zeroCount; - else if (typeof object.zeroCount === "object") - message.zeroCount = new $util.LongBits(object.zeroCount.low >>> 0, object.zeroCount.high >>> 0).toNumber(); - if (object.positive != null) { - if (typeof object.positive !== "object") - throw TypeError(".opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.positive: object expected"); - message.positive = $root.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets.fromObject(object.positive); - } - if (object.negative != null) { - if (typeof object.negative !== "object") - throw TypeError(".opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.negative: object expected"); - message.negative = $root.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets.fromObject(object.negative); - } - if (object.flags != null) - message.flags = object.flags >>> 0; - if (object.exemplars) { - if (!Array.isArray(object.exemplars)) - throw TypeError(".opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.exemplars: array expected"); - message.exemplars = []; - for (var i = 0; i < object.exemplars.length; ++i) { - if (typeof object.exemplars[i] !== "object") - throw TypeError(".opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.exemplars: object expected"); - message.exemplars[i] = $root.opentelemetry.proto.metrics.v1.Exemplar.fromObject(object.exemplars[i]); - } - } - if (object.min != null) - message.min = Number(object.min); - if (object.max != null) - message.max = Number(object.max); - if (object.zeroThreshold != null) - message.zeroThreshold = Number(object.zeroThreshold); - return message; - }; - - /** - * Creates a plain object from an ExponentialHistogramDataPoint message. Also converts values to other types if specified. - * @function toObject - * @memberof opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint - * @static - * @param {opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint} message ExponentialHistogramDataPoint - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ExponentialHistogramDataPoint.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) { - object.attributes = []; - object.exemplars = []; - } - if (options.defaults) { - if ($util.Long) { - var 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) { - var 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; - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.count = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.count = options.longs === String ? "0" : 0; - object.scale = 0; - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.zeroCount = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.zeroCount = options.longs === String ? "0" : 0; - object.positive = null; - object.negative = null; - object.flags = 0; - object.zeroThreshold = 0; - } - if (message.attributes && message.attributes.length) { - object.attributes = []; - for (var j = 0; j < message.attributes.length; ++j) - object.attributes[j] = $root.opentelemetry.proto.common.v1.KeyValue.toObject(message.attributes[j], options); - } - 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.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.count != null && message.hasOwnProperty("count")) - if (typeof message.count === "number") - object.count = options.longs === String ? String(message.count) : message.count; - else - object.count = options.longs === String ? $util.Long.prototype.toString.call(message.count) : options.longs === Number ? new $util.LongBits(message.count.low >>> 0, message.count.high >>> 0).toNumber() : message.count; - if (message.sum != null && message.hasOwnProperty("sum")) { - object.sum = options.json && !isFinite(message.sum) ? String(message.sum) : message.sum; - if (options.oneofs) - object._sum = "sum"; - } - if (message.scale != null && message.hasOwnProperty("scale")) - object.scale = message.scale; - if (message.zeroCount != null && message.hasOwnProperty("zeroCount")) - if (typeof message.zeroCount === "number") - object.zeroCount = options.longs === String ? String(message.zeroCount) : message.zeroCount; - else - object.zeroCount = options.longs === String ? $util.Long.prototype.toString.call(message.zeroCount) : options.longs === Number ? new $util.LongBits(message.zeroCount.low >>> 0, message.zeroCount.high >>> 0).toNumber() : message.zeroCount; - if (message.positive != null && message.hasOwnProperty("positive")) - object.positive = $root.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets.toObject(message.positive, options); - if (message.negative != null && message.hasOwnProperty("negative")) - object.negative = $root.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets.toObject(message.negative, options); - if (message.flags != null && message.hasOwnProperty("flags")) - object.flags = message.flags; - if (message.exemplars && message.exemplars.length) { - object.exemplars = []; - for (var j = 0; j < message.exemplars.length; ++j) - object.exemplars[j] = $root.opentelemetry.proto.metrics.v1.Exemplar.toObject(message.exemplars[j], options); - } - if (message.min != null && message.hasOwnProperty("min")) { - object.min = options.json && !isFinite(message.min) ? String(message.min) : message.min; - if (options.oneofs) - object._min = "min"; - } - if (message.max != null && message.hasOwnProperty("max")) { - object.max = options.json && !isFinite(message.max) ? String(message.max) : message.max; - if (options.oneofs) - object._max = "max"; - } - if (message.zeroThreshold != null && message.hasOwnProperty("zeroThreshold")) - object.zeroThreshold = options.json && !isFinite(message.zeroThreshold) ? String(message.zeroThreshold) : message.zeroThreshold; - return object; - }; - - /** - * Converts this ExponentialHistogramDataPoint to JSON. - * @function toJSON - * @memberof opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint - * @instance - * @returns {Object.} JSON object - */ - ExponentialHistogramDataPoint.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for ExponentialHistogramDataPoint - * @function getTypeUrl - * @memberof opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - ExponentialHistogramDataPoint.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint"; - }; - - ExponentialHistogramDataPoint.Buckets = (function() { - - /** - * Properties of a Buckets. - * @memberof opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint - * @interface IBuckets - * @property {number|null} [offset] Buckets offset - * @property {Array.|null} [bucketCounts] Buckets bucketCounts - */ - - /** - * Constructs a new Buckets. - * @memberof opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint - * @classdesc Represents a Buckets. - * @implements IBuckets - * @constructor - * @param {opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.IBuckets=} [properties] Properties to set - */ - function Buckets(properties) { - this.bucketCounts = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Buckets offset. - * @member {number|null|undefined} offset - * @memberof opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets - * @instance - */ - Buckets.prototype.offset = null; - - /** - * Buckets bucketCounts. - * @member {Array.} bucketCounts - * @memberof opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets - * @instance - */ - Buckets.prototype.bucketCounts = $util.emptyArray; - - /** - * Creates a new Buckets instance using the specified properties. - * @function create - * @memberof opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets - * @static - * @param {opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.IBuckets=} [properties] Properties to set - * @returns {opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets} Buckets instance - */ - Buckets.create = function create(properties) { - return new Buckets(properties); - }; - - /** - * Encodes the specified Buckets message. Does not implicitly {@link opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets.verify|verify} messages. - * @function encode - * @memberof opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets - * @static - * @param {opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.IBuckets} message Buckets message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Buckets.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.offset != null && Object.hasOwnProperty.call(message, "offset")) - writer.uint32(/* id 1, wireType 0 =*/8).sint32(message.offset); - if (message.bucketCounts != null && message.bucketCounts.length) { - writer.uint32(/* id 2, wireType 2 =*/18).fork(); - for (var i = 0; i < message.bucketCounts.length; ++i) - writer.uint64(message.bucketCounts[i]); - writer.ldelim(); - } - return writer; - }; - - /** - * Encodes the specified Buckets message, length delimited. Does not implicitly {@link opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets.verify|verify} messages. - * @function encodeDelimited - * @memberof opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets - * @static - * @param {opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.IBuckets} message Buckets message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Buckets.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a Buckets message from the specified reader or buffer. - * @function decode - * @memberof opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets} Buckets - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Buckets.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.offset = reader.sint32(); - break; - } - case 2: { - if (!(message.bucketCounts && message.bucketCounts.length)) - message.bucketCounts = []; - if ((tag & 7) === 2) { - var end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) - message.bucketCounts.push(reader.uint64()); - } else - message.bucketCounts.push(reader.uint64()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a Buckets message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets} Buckets - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Buckets.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a Buckets message. - * @function verify - * @memberof opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Buckets.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.offset != null && message.hasOwnProperty("offset")) - if (!$util.isInteger(message.offset)) - return "offset: integer expected"; - if (message.bucketCounts != null && message.hasOwnProperty("bucketCounts")) { - if (!Array.isArray(message.bucketCounts)) - return "bucketCounts: array expected"; - for (var i = 0; i < message.bucketCounts.length; ++i) - if (!$util.isInteger(message.bucketCounts[i]) && !(message.bucketCounts[i] && $util.isInteger(message.bucketCounts[i].low) && $util.isInteger(message.bucketCounts[i].high))) - return "bucketCounts: integer|Long[] expected"; - } - return null; - }; - - /** - * Creates a Buckets message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets - * @static - * @param {Object.} object Plain object - * @returns {opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets} Buckets - */ - Buckets.fromObject = function fromObject(object) { - if (object instanceof $root.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets) - return object; - var message = new $root.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets(); - if (object.offset != null) - message.offset = object.offset | 0; - if (object.bucketCounts) { - if (!Array.isArray(object.bucketCounts)) - throw TypeError(".opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets.bucketCounts: array expected"); - message.bucketCounts = []; - for (var i = 0; i < object.bucketCounts.length; ++i) - if ($util.Long) - (message.bucketCounts[i] = $util.Long.fromValue(object.bucketCounts[i])).unsigned = true; - else if (typeof object.bucketCounts[i] === "string") - message.bucketCounts[i] = parseInt(object.bucketCounts[i], 10); - else if (typeof object.bucketCounts[i] === "number") - message.bucketCounts[i] = object.bucketCounts[i]; - else if (typeof object.bucketCounts[i] === "object") - message.bucketCounts[i] = new $util.LongBits(object.bucketCounts[i].low >>> 0, object.bucketCounts[i].high >>> 0).toNumber(true); - } - return message; - }; - - /** - * Creates a plain object from a Buckets message. Also converts values to other types if specified. - * @function toObject - * @memberof opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets - * @static - * @param {opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets} message Buckets - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Buckets.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.bucketCounts = []; - if (options.defaults) - object.offset = 0; - if (message.offset != null && message.hasOwnProperty("offset")) - object.offset = message.offset; - if (message.bucketCounts && message.bucketCounts.length) { - object.bucketCounts = []; - for (var j = 0; j < message.bucketCounts.length; ++j) - if (typeof message.bucketCounts[j] === "number") - object.bucketCounts[j] = options.longs === String ? String(message.bucketCounts[j]) : message.bucketCounts[j]; - else - object.bucketCounts[j] = options.longs === String ? $util.Long.prototype.toString.call(message.bucketCounts[j]) : options.longs === Number ? new $util.LongBits(message.bucketCounts[j].low >>> 0, message.bucketCounts[j].high >>> 0).toNumber(true) : message.bucketCounts[j]; - } - return object; - }; - - /** - * Converts this Buckets to JSON. - * @function toJSON - * @memberof opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets - * @instance - * @returns {Object.} JSON object - */ - Buckets.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for Buckets - * @function getTypeUrl - * @memberof opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - Buckets.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets"; - }; - - return Buckets; - })(); - - return ExponentialHistogramDataPoint; - })(); - - v1.SummaryDataPoint = (function() { - - /** - * Properties of a SummaryDataPoint. - * @memberof opentelemetry.proto.metrics.v1 - * @interface ISummaryDataPoint - * @property {Array.|null} [attributes] SummaryDataPoint attributes - * @property {number|Long|null} [startTimeUnixNano] SummaryDataPoint startTimeUnixNano - * @property {number|Long|null} [timeUnixNano] SummaryDataPoint timeUnixNano - * @property {number|Long|null} [count] SummaryDataPoint count - * @property {number|null} [sum] SummaryDataPoint sum - * @property {Array.|null} [quantileValues] SummaryDataPoint quantileValues - * @property {number|null} [flags] SummaryDataPoint flags - */ - - /** - * Constructs a new SummaryDataPoint. - * @memberof opentelemetry.proto.metrics.v1 - * @classdesc Represents a SummaryDataPoint. - * @implements ISummaryDataPoint - * @constructor - * @param {opentelemetry.proto.metrics.v1.ISummaryDataPoint=} [properties] Properties to set - */ - function SummaryDataPoint(properties) { - this.attributes = []; - this.quantileValues = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SummaryDataPoint attributes. - * @member {Array.} attributes - * @memberof opentelemetry.proto.metrics.v1.SummaryDataPoint - * @instance - */ - SummaryDataPoint.prototype.attributes = $util.emptyArray; - - /** - * SummaryDataPoint startTimeUnixNano. - * @member {number|Long|null|undefined} startTimeUnixNano - * @memberof opentelemetry.proto.metrics.v1.SummaryDataPoint - * @instance - */ - SummaryDataPoint.prototype.startTimeUnixNano = null; - - /** - * SummaryDataPoint timeUnixNano. - * @member {number|Long|null|undefined} timeUnixNano - * @memberof opentelemetry.proto.metrics.v1.SummaryDataPoint - * @instance - */ - SummaryDataPoint.prototype.timeUnixNano = null; - - /** - * SummaryDataPoint count. - * @member {number|Long|null|undefined} count - * @memberof opentelemetry.proto.metrics.v1.SummaryDataPoint - * @instance - */ - SummaryDataPoint.prototype.count = null; - - /** - * SummaryDataPoint sum. - * @member {number|null|undefined} sum - * @memberof opentelemetry.proto.metrics.v1.SummaryDataPoint - * @instance - */ - SummaryDataPoint.prototype.sum = null; - - /** - * SummaryDataPoint quantileValues. - * @member {Array.} quantileValues - * @memberof opentelemetry.proto.metrics.v1.SummaryDataPoint - * @instance - */ - SummaryDataPoint.prototype.quantileValues = $util.emptyArray; - - /** - * SummaryDataPoint flags. - * @member {number|null|undefined} flags - * @memberof opentelemetry.proto.metrics.v1.SummaryDataPoint - * @instance - */ - SummaryDataPoint.prototype.flags = null; - - /** - * Creates a new SummaryDataPoint instance using the specified properties. - * @function create - * @memberof opentelemetry.proto.metrics.v1.SummaryDataPoint - * @static - * @param {opentelemetry.proto.metrics.v1.ISummaryDataPoint=} [properties] Properties to set - * @returns {opentelemetry.proto.metrics.v1.SummaryDataPoint} SummaryDataPoint instance - */ - SummaryDataPoint.create = function create(properties) { - return new SummaryDataPoint(properties); - }; - - /** - * Encodes the specified SummaryDataPoint message. Does not implicitly {@link opentelemetry.proto.metrics.v1.SummaryDataPoint.verify|verify} messages. - * @function encode - * @memberof opentelemetry.proto.metrics.v1.SummaryDataPoint - * @static - * @param {opentelemetry.proto.metrics.v1.ISummaryDataPoint} message SummaryDataPoint message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SummaryDataPoint.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.startTimeUnixNano != null && Object.hasOwnProperty.call(message, "startTimeUnixNano")) - writer.uint32(/* id 2, wireType 1 =*/17).fixed64(message.startTimeUnixNano); - if (message.timeUnixNano != null && Object.hasOwnProperty.call(message, "timeUnixNano")) - writer.uint32(/* id 3, wireType 1 =*/25).fixed64(message.timeUnixNano); - if (message.count != null && Object.hasOwnProperty.call(message, "count")) - writer.uint32(/* id 4, wireType 1 =*/33).fixed64(message.count); - if (message.sum != null && Object.hasOwnProperty.call(message, "sum")) - writer.uint32(/* id 5, wireType 1 =*/41).double(message.sum); - if (message.quantileValues != null && message.quantileValues.length) - for (var i = 0; i < message.quantileValues.length; ++i) - $root.opentelemetry.proto.metrics.v1.SummaryDataPoint.ValueAtQuantile.encode(message.quantileValues[i], writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); - if (message.attributes != null && message.attributes.length) - for (var i = 0; i < message.attributes.length; ++i) - $root.opentelemetry.proto.common.v1.KeyValue.encode(message.attributes[i], writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); - if (message.flags != null && Object.hasOwnProperty.call(message, "flags")) - writer.uint32(/* id 8, wireType 0 =*/64).uint32(message.flags); - return writer; - }; - - /** - * Encodes the specified SummaryDataPoint message, length delimited. Does not implicitly {@link opentelemetry.proto.metrics.v1.SummaryDataPoint.verify|verify} messages. - * @function encodeDelimited - * @memberof opentelemetry.proto.metrics.v1.SummaryDataPoint - * @static - * @param {opentelemetry.proto.metrics.v1.ISummaryDataPoint} message SummaryDataPoint message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SummaryDataPoint.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SummaryDataPoint message from the specified reader or buffer. - * @function decode - * @memberof opentelemetry.proto.metrics.v1.SummaryDataPoint - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {opentelemetry.proto.metrics.v1.SummaryDataPoint} SummaryDataPoint - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SummaryDataPoint.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.opentelemetry.proto.metrics.v1.SummaryDataPoint(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 7: { - 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.startTimeUnixNano = reader.fixed64(); - break; - } - case 3: { - message.timeUnixNano = reader.fixed64(); - break; - } - case 4: { - message.count = reader.fixed64(); - break; - } - case 5: { - message.sum = reader.double(); - break; - } - case 6: { - if (!(message.quantileValues && message.quantileValues.length)) - message.quantileValues = []; - message.quantileValues.push($root.opentelemetry.proto.metrics.v1.SummaryDataPoint.ValueAtQuantile.decode(reader, reader.uint32())); - break; - } - case 8: { - message.flags = reader.uint32(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SummaryDataPoint message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof opentelemetry.proto.metrics.v1.SummaryDataPoint - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {opentelemetry.proto.metrics.v1.SummaryDataPoint} SummaryDataPoint - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SummaryDataPoint.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SummaryDataPoint message. - * @function verify - * @memberof opentelemetry.proto.metrics.v1.SummaryDataPoint - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SummaryDataPoint.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 (var i = 0; i < message.attributes.length; ++i) { - var error = $root.opentelemetry.proto.common.v1.KeyValue.verify(message.attributes[i]); - if (error) - return "attributes." + error; - } - } - 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.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.count != null && message.hasOwnProperty("count")) - if (!$util.isInteger(message.count) && !(message.count && $util.isInteger(message.count.low) && $util.isInteger(message.count.high))) - return "count: integer|Long expected"; - if (message.sum != null && message.hasOwnProperty("sum")) - if (typeof message.sum !== "number") - return "sum: number expected"; - if (message.quantileValues != null && message.hasOwnProperty("quantileValues")) { - if (!Array.isArray(message.quantileValues)) - return "quantileValues: array expected"; - for (var i = 0; i < message.quantileValues.length; ++i) { - var error = $root.opentelemetry.proto.metrics.v1.SummaryDataPoint.ValueAtQuantile.verify(message.quantileValues[i]); - if (error) - return "quantileValues." + error; - } - } - if (message.flags != null && message.hasOwnProperty("flags")) - if (!$util.isInteger(message.flags)) - return "flags: integer expected"; - return null; - }; - - /** - * Creates a SummaryDataPoint message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof opentelemetry.proto.metrics.v1.SummaryDataPoint - * @static - * @param {Object.} object Plain object - * @returns {opentelemetry.proto.metrics.v1.SummaryDataPoint} SummaryDataPoint - */ - SummaryDataPoint.fromObject = function fromObject(object) { - if (object instanceof $root.opentelemetry.proto.metrics.v1.SummaryDataPoint) - return object; - var message = new $root.opentelemetry.proto.metrics.v1.SummaryDataPoint(); - if (object.attributes) { - if (!Array.isArray(object.attributes)) - throw TypeError(".opentelemetry.proto.metrics.v1.SummaryDataPoint.attributes: array expected"); - message.attributes = []; - for (var i = 0; i < object.attributes.length; ++i) { - if (typeof object.attributes[i] !== "object") - throw TypeError(".opentelemetry.proto.metrics.v1.SummaryDataPoint.attributes: object expected"); - message.attributes[i] = $root.opentelemetry.proto.common.v1.KeyValue.fromObject(object.attributes[i]); - } - } - 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.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.count != null) - if ($util.Long) - (message.count = $util.Long.fromValue(object.count)).unsigned = false; - else if (typeof object.count === "string") - message.count = parseInt(object.count, 10); - else if (typeof object.count === "number") - message.count = object.count; - else if (typeof object.count === "object") - message.count = new $util.LongBits(object.count.low >>> 0, object.count.high >>> 0).toNumber(); - if (object.sum != null) - message.sum = Number(object.sum); - if (object.quantileValues) { - if (!Array.isArray(object.quantileValues)) - throw TypeError(".opentelemetry.proto.metrics.v1.SummaryDataPoint.quantileValues: array expected"); - message.quantileValues = []; - for (var i = 0; i < object.quantileValues.length; ++i) { - if (typeof object.quantileValues[i] !== "object") - throw TypeError(".opentelemetry.proto.metrics.v1.SummaryDataPoint.quantileValues: object expected"); - message.quantileValues[i] = $root.opentelemetry.proto.metrics.v1.SummaryDataPoint.ValueAtQuantile.fromObject(object.quantileValues[i]); - } - } - if (object.flags != null) - message.flags = object.flags >>> 0; - return message; - }; - - /** - * Creates a plain object from a SummaryDataPoint message. Also converts values to other types if specified. - * @function toObject - * @memberof opentelemetry.proto.metrics.v1.SummaryDataPoint - * @static - * @param {opentelemetry.proto.metrics.v1.SummaryDataPoint} message SummaryDataPoint - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SummaryDataPoint.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) { - object.quantileValues = []; - object.attributes = []; - } - if (options.defaults) { - if ($util.Long) { - var 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) { - var 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; - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.count = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.count = options.longs === String ? "0" : 0; - object.sum = 0; - object.flags = 0; - } - 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.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.count != null && message.hasOwnProperty("count")) - if (typeof message.count === "number") - object.count = options.longs === String ? String(message.count) : message.count; - else - object.count = options.longs === String ? $util.Long.prototype.toString.call(message.count) : options.longs === Number ? new $util.LongBits(message.count.low >>> 0, message.count.high >>> 0).toNumber() : message.count; - if (message.sum != null && message.hasOwnProperty("sum")) - object.sum = options.json && !isFinite(message.sum) ? String(message.sum) : message.sum; - if (message.quantileValues && message.quantileValues.length) { - object.quantileValues = []; - for (var j = 0; j < message.quantileValues.length; ++j) - object.quantileValues[j] = $root.opentelemetry.proto.metrics.v1.SummaryDataPoint.ValueAtQuantile.toObject(message.quantileValues[j], options); - } - if (message.attributes && message.attributes.length) { - object.attributes = []; - for (var j = 0; j < message.attributes.length; ++j) - object.attributes[j] = $root.opentelemetry.proto.common.v1.KeyValue.toObject(message.attributes[j], options); - } - if (message.flags != null && message.hasOwnProperty("flags")) - object.flags = message.flags; - return object; - }; - - /** - * Converts this SummaryDataPoint to JSON. - * @function toJSON - * @memberof opentelemetry.proto.metrics.v1.SummaryDataPoint - * @instance - * @returns {Object.} JSON object - */ - SummaryDataPoint.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SummaryDataPoint - * @function getTypeUrl - * @memberof opentelemetry.proto.metrics.v1.SummaryDataPoint - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SummaryDataPoint.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/opentelemetry.proto.metrics.v1.SummaryDataPoint"; - }; - - SummaryDataPoint.ValueAtQuantile = (function() { - - /** - * Properties of a ValueAtQuantile. - * @memberof opentelemetry.proto.metrics.v1.SummaryDataPoint - * @interface IValueAtQuantile - * @property {number|null} [quantile] ValueAtQuantile quantile - * @property {number|null} [value] ValueAtQuantile value - */ - - /** - * Constructs a new ValueAtQuantile. - * @memberof opentelemetry.proto.metrics.v1.SummaryDataPoint - * @classdesc Represents a ValueAtQuantile. - * @implements IValueAtQuantile - * @constructor - * @param {opentelemetry.proto.metrics.v1.SummaryDataPoint.IValueAtQuantile=} [properties] Properties to set - */ - function ValueAtQuantile(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * ValueAtQuantile quantile. - * @member {number|null|undefined} quantile - * @memberof opentelemetry.proto.metrics.v1.SummaryDataPoint.ValueAtQuantile - * @instance - */ - ValueAtQuantile.prototype.quantile = null; - - /** - * ValueAtQuantile value. - * @member {number|null|undefined} value - * @memberof opentelemetry.proto.metrics.v1.SummaryDataPoint.ValueAtQuantile - * @instance - */ - ValueAtQuantile.prototype.value = null; - - /** - * Creates a new ValueAtQuantile instance using the specified properties. - * @function create - * @memberof opentelemetry.proto.metrics.v1.SummaryDataPoint.ValueAtQuantile - * @static - * @param {opentelemetry.proto.metrics.v1.SummaryDataPoint.IValueAtQuantile=} [properties] Properties to set - * @returns {opentelemetry.proto.metrics.v1.SummaryDataPoint.ValueAtQuantile} ValueAtQuantile instance - */ - ValueAtQuantile.create = function create(properties) { - return new ValueAtQuantile(properties); - }; - - /** - * Encodes the specified ValueAtQuantile message. Does not implicitly {@link opentelemetry.proto.metrics.v1.SummaryDataPoint.ValueAtQuantile.verify|verify} messages. - * @function encode - * @memberof opentelemetry.proto.metrics.v1.SummaryDataPoint.ValueAtQuantile - * @static - * @param {opentelemetry.proto.metrics.v1.SummaryDataPoint.IValueAtQuantile} message ValueAtQuantile message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ValueAtQuantile.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.quantile != null && Object.hasOwnProperty.call(message, "quantile")) - writer.uint32(/* id 1, wireType 1 =*/9).double(message.quantile); - if (message.value != null && Object.hasOwnProperty.call(message, "value")) - writer.uint32(/* id 2, wireType 1 =*/17).double(message.value); - return writer; - }; - - /** - * Encodes the specified ValueAtQuantile message, length delimited. Does not implicitly {@link opentelemetry.proto.metrics.v1.SummaryDataPoint.ValueAtQuantile.verify|verify} messages. - * @function encodeDelimited - * @memberof opentelemetry.proto.metrics.v1.SummaryDataPoint.ValueAtQuantile - * @static - * @param {opentelemetry.proto.metrics.v1.SummaryDataPoint.IValueAtQuantile} message ValueAtQuantile message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ValueAtQuantile.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a ValueAtQuantile message from the specified reader or buffer. - * @function decode - * @memberof opentelemetry.proto.metrics.v1.SummaryDataPoint.ValueAtQuantile - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {opentelemetry.proto.metrics.v1.SummaryDataPoint.ValueAtQuantile} ValueAtQuantile - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ValueAtQuantile.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.opentelemetry.proto.metrics.v1.SummaryDataPoint.ValueAtQuantile(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.quantile = reader.double(); - break; - } - case 2: { - message.value = reader.double(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a ValueAtQuantile message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof opentelemetry.proto.metrics.v1.SummaryDataPoint.ValueAtQuantile - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {opentelemetry.proto.metrics.v1.SummaryDataPoint.ValueAtQuantile} ValueAtQuantile - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ValueAtQuantile.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a ValueAtQuantile message. - * @function verify - * @memberof opentelemetry.proto.metrics.v1.SummaryDataPoint.ValueAtQuantile - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ValueAtQuantile.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.quantile != null && message.hasOwnProperty("quantile")) - if (typeof message.quantile !== "number") - return "quantile: number expected"; - if (message.value != null && message.hasOwnProperty("value")) - if (typeof message.value !== "number") - return "value: number expected"; - return null; - }; - - /** - * Creates a ValueAtQuantile message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof opentelemetry.proto.metrics.v1.SummaryDataPoint.ValueAtQuantile - * @static - * @param {Object.} object Plain object - * @returns {opentelemetry.proto.metrics.v1.SummaryDataPoint.ValueAtQuantile} ValueAtQuantile - */ - ValueAtQuantile.fromObject = function fromObject(object) { - if (object instanceof $root.opentelemetry.proto.metrics.v1.SummaryDataPoint.ValueAtQuantile) - return object; - var message = new $root.opentelemetry.proto.metrics.v1.SummaryDataPoint.ValueAtQuantile(); - if (object.quantile != null) - message.quantile = Number(object.quantile); - if (object.value != null) - message.value = Number(object.value); - return message; - }; - - /** - * Creates a plain object from a ValueAtQuantile message. Also converts values to other types if specified. - * @function toObject - * @memberof opentelemetry.proto.metrics.v1.SummaryDataPoint.ValueAtQuantile - * @static - * @param {opentelemetry.proto.metrics.v1.SummaryDataPoint.ValueAtQuantile} message ValueAtQuantile - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ValueAtQuantile.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.quantile = 0; - object.value = 0; - } - if (message.quantile != null && message.hasOwnProperty("quantile")) - object.quantile = options.json && !isFinite(message.quantile) ? String(message.quantile) : message.quantile; - if (message.value != null && message.hasOwnProperty("value")) - object.value = options.json && !isFinite(message.value) ? String(message.value) : message.value; - return object; - }; - - /** - * Converts this ValueAtQuantile to JSON. - * @function toJSON - * @memberof opentelemetry.proto.metrics.v1.SummaryDataPoint.ValueAtQuantile - * @instance - * @returns {Object.} JSON object - */ - ValueAtQuantile.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for ValueAtQuantile - * @function getTypeUrl - * @memberof opentelemetry.proto.metrics.v1.SummaryDataPoint.ValueAtQuantile - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - ValueAtQuantile.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/opentelemetry.proto.metrics.v1.SummaryDataPoint.ValueAtQuantile"; - }; - - return ValueAtQuantile; - })(); - - return SummaryDataPoint; - })(); - - v1.Exemplar = (function() { - - /** - * Properties of an Exemplar. - * @memberof opentelemetry.proto.metrics.v1 - * @interface IExemplar - * @property {Array.|null} [filteredAttributes] Exemplar filteredAttributes - * @property {number|Long|null} [timeUnixNano] Exemplar timeUnixNano - * @property {number|null} [asDouble] Exemplar asDouble - * @property {number|Long|null} [asInt] Exemplar asInt - * @property {Uint8Array|null} [spanId] Exemplar spanId - * @property {Uint8Array|null} [traceId] Exemplar traceId - */ - - /** - * Constructs a new Exemplar. - * @memberof opentelemetry.proto.metrics.v1 - * @classdesc Represents an Exemplar. - * @implements IExemplar - * @constructor - * @param {opentelemetry.proto.metrics.v1.IExemplar=} [properties] Properties to set - */ - function Exemplar(properties) { - this.filteredAttributes = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Exemplar filteredAttributes. - * @member {Array.} filteredAttributes - * @memberof opentelemetry.proto.metrics.v1.Exemplar - * @instance - */ - Exemplar.prototype.filteredAttributes = $util.emptyArray; - - /** - * Exemplar timeUnixNano. - * @member {number|Long|null|undefined} timeUnixNano - * @memberof opentelemetry.proto.metrics.v1.Exemplar - * @instance - */ - Exemplar.prototype.timeUnixNano = null; - - /** - * Exemplar asDouble. - * @member {number|null|undefined} asDouble - * @memberof opentelemetry.proto.metrics.v1.Exemplar - * @instance - */ - Exemplar.prototype.asDouble = null; - - /** - * Exemplar asInt. - * @member {number|Long|null|undefined} asInt - * @memberof opentelemetry.proto.metrics.v1.Exemplar - * @instance - */ - Exemplar.prototype.asInt = null; - - /** - * Exemplar spanId. - * @member {Uint8Array|null|undefined} spanId - * @memberof opentelemetry.proto.metrics.v1.Exemplar - * @instance - */ - Exemplar.prototype.spanId = null; - - /** - * Exemplar traceId. - * @member {Uint8Array|null|undefined} traceId - * @memberof opentelemetry.proto.metrics.v1.Exemplar - * @instance - */ - Exemplar.prototype.traceId = null; - - // OneOf field names bound to virtual getters and setters - var $oneOfFields; - - /** - * Exemplar value. - * @member {"asDouble"|"asInt"|undefined} value - * @memberof opentelemetry.proto.metrics.v1.Exemplar - * @instance - */ - Object.defineProperty(Exemplar.prototype, "value", { - get: $util.oneOfGetter($oneOfFields = ["asDouble", "asInt"]), - set: $util.oneOfSetter($oneOfFields) - }); - - /** - * Creates a new Exemplar instance using the specified properties. - * @function create - * @memberof opentelemetry.proto.metrics.v1.Exemplar - * @static - * @param {opentelemetry.proto.metrics.v1.IExemplar=} [properties] Properties to set - * @returns {opentelemetry.proto.metrics.v1.Exemplar} Exemplar instance - */ - Exemplar.create = function create(properties) { - return new Exemplar(properties); - }; - - /** - * Encodes the specified Exemplar message. Does not implicitly {@link opentelemetry.proto.metrics.v1.Exemplar.verify|verify} messages. - * @function encode - * @memberof opentelemetry.proto.metrics.v1.Exemplar - * @static - * @param {opentelemetry.proto.metrics.v1.IExemplar} message Exemplar message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Exemplar.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.timeUnixNano != null && Object.hasOwnProperty.call(message, "timeUnixNano")) - writer.uint32(/* id 2, wireType 1 =*/17).fixed64(message.timeUnixNano); - if (message.asDouble != null && Object.hasOwnProperty.call(message, "asDouble")) - writer.uint32(/* id 3, wireType 1 =*/25).double(message.asDouble); - if (message.spanId != null && Object.hasOwnProperty.call(message, "spanId")) - writer.uint32(/* id 4, wireType 2 =*/34).bytes(message.spanId); - if (message.traceId != null && Object.hasOwnProperty.call(message, "traceId")) - writer.uint32(/* id 5, wireType 2 =*/42).bytes(message.traceId); - if (message.asInt != null && Object.hasOwnProperty.call(message, "asInt")) - writer.uint32(/* id 6, wireType 1 =*/49).sfixed64(message.asInt); - if (message.filteredAttributes != null && message.filteredAttributes.length) - for (var i = 0; i < message.filteredAttributes.length; ++i) - $root.opentelemetry.proto.common.v1.KeyValue.encode(message.filteredAttributes[i], writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified Exemplar message, length delimited. Does not implicitly {@link opentelemetry.proto.metrics.v1.Exemplar.verify|verify} messages. - * @function encodeDelimited - * @memberof opentelemetry.proto.metrics.v1.Exemplar - * @static - * @param {opentelemetry.proto.metrics.v1.IExemplar} message Exemplar message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Exemplar.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an Exemplar message from the specified reader or buffer. - * @function decode - * @memberof opentelemetry.proto.metrics.v1.Exemplar - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {opentelemetry.proto.metrics.v1.Exemplar} Exemplar - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Exemplar.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.opentelemetry.proto.metrics.v1.Exemplar(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 7: { - if (!(message.filteredAttributes && message.filteredAttributes.length)) - message.filteredAttributes = []; - message.filteredAttributes.push($root.opentelemetry.proto.common.v1.KeyValue.decode(reader, reader.uint32())); - break; - } - case 2: { - message.timeUnixNano = reader.fixed64(); - break; - } - case 3: { - message.asDouble = reader.double(); - break; - } - case 6: { - message.asInt = reader.sfixed64(); - break; - } - case 4: { - message.spanId = reader.bytes(); - break; - } - case 5: { - message.traceId = reader.bytes(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an Exemplar message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof opentelemetry.proto.metrics.v1.Exemplar - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {opentelemetry.proto.metrics.v1.Exemplar} Exemplar - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Exemplar.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an Exemplar message. - * @function verify - * @memberof opentelemetry.proto.metrics.v1.Exemplar - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Exemplar.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - var properties = {}; - if (message.filteredAttributes != null && message.hasOwnProperty("filteredAttributes")) { - if (!Array.isArray(message.filteredAttributes)) - return "filteredAttributes: array expected"; - for (var i = 0; i < message.filteredAttributes.length; ++i) { - var error = $root.opentelemetry.proto.common.v1.KeyValue.verify(message.filteredAttributes[i]); - if (error) - return "filteredAttributes." + error; - } - } - 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.asDouble != null && message.hasOwnProperty("asDouble")) { - properties.value = 1; - if (typeof message.asDouble !== "number") - return "asDouble: number expected"; - } - if (message.asInt != null && message.hasOwnProperty("asInt")) { - if (properties.value === 1) - return "value: multiple values"; - properties.value = 1; - if (!$util.isInteger(message.asInt) && !(message.asInt && $util.isInteger(message.asInt.low) && $util.isInteger(message.asInt.high))) - return "asInt: integer|Long 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.traceId != null && message.hasOwnProperty("traceId")) - if (!(message.traceId && typeof message.traceId.length === "number" || $util.isString(message.traceId))) - return "traceId: buffer expected"; - return null; - }; - - /** - * Creates an Exemplar message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof opentelemetry.proto.metrics.v1.Exemplar - * @static - * @param {Object.} object Plain object - * @returns {opentelemetry.proto.metrics.v1.Exemplar} Exemplar - */ - Exemplar.fromObject = function fromObject(object) { - if (object instanceof $root.opentelemetry.proto.metrics.v1.Exemplar) - return object; - var message = new $root.opentelemetry.proto.metrics.v1.Exemplar(); - if (object.filteredAttributes) { - if (!Array.isArray(object.filteredAttributes)) - throw TypeError(".opentelemetry.proto.metrics.v1.Exemplar.filteredAttributes: array expected"); - message.filteredAttributes = []; - for (var i = 0; i < object.filteredAttributes.length; ++i) { - if (typeof object.filteredAttributes[i] !== "object") - throw TypeError(".opentelemetry.proto.metrics.v1.Exemplar.filteredAttributes: object expected"); - message.filteredAttributes[i] = $root.opentelemetry.proto.common.v1.KeyValue.fromObject(object.filteredAttributes[i]); - } - } - 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.asDouble != null) - message.asDouble = Number(object.asDouble); - if (object.asInt != null) - if ($util.Long) - (message.asInt = $util.Long.fromValue(object.asInt)).unsigned = false; - else if (typeof object.asInt === "string") - message.asInt = parseInt(object.asInt, 10); - else if (typeof object.asInt === "number") - message.asInt = object.asInt; - else if (typeof object.asInt === "object") - message.asInt = new $util.LongBits(object.asInt.low >>> 0, object.asInt.high >>> 0).toNumber(); - 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.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; - return message; - }; - - /** - * Creates a plain object from an Exemplar message. Also converts values to other types if specified. - * @function toObject - * @memberof opentelemetry.proto.metrics.v1.Exemplar - * @static - * @param {opentelemetry.proto.metrics.v1.Exemplar} message Exemplar - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Exemplar.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.filteredAttributes = []; - if (options.defaults) { - if ($util.Long) { - var 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; - if (options.bytes === String) - object.spanId = ""; - else { - object.spanId = []; - if (options.bytes !== Array) - object.spanId = $util.newBuffer(object.spanId); - } - if (options.bytes === String) - object.traceId = ""; - else { - object.traceId = []; - if (options.bytes !== Array) - object.traceId = $util.newBuffer(object.traceId); - } - } - 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.asDouble != null && message.hasOwnProperty("asDouble")) { - object.asDouble = options.json && !isFinite(message.asDouble) ? String(message.asDouble) : message.asDouble; - if (options.oneofs) - object.value = "asDouble"; - } - 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.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.asInt != null && message.hasOwnProperty("asInt")) { - if (typeof message.asInt === "number") - object.asInt = options.longs === String ? String(message.asInt) : message.asInt; - else - object.asInt = options.longs === String ? $util.Long.prototype.toString.call(message.asInt) : options.longs === Number ? new $util.LongBits(message.asInt.low >>> 0, message.asInt.high >>> 0).toNumber() : message.asInt; - if (options.oneofs) - object.value = "asInt"; - } - if (message.filteredAttributes && message.filteredAttributes.length) { - object.filteredAttributes = []; - for (var j = 0; j < message.filteredAttributes.length; ++j) - object.filteredAttributes[j] = $root.opentelemetry.proto.common.v1.KeyValue.toObject(message.filteredAttributes[j], options); - } - return object; - }; - - /** - * Converts this Exemplar to JSON. - * @function toJSON - * @memberof opentelemetry.proto.metrics.v1.Exemplar - * @instance - * @returns {Object.} JSON object - */ - Exemplar.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for Exemplar - * @function getTypeUrl - * @memberof opentelemetry.proto.metrics.v1.Exemplar - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - Exemplar.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/opentelemetry.proto.metrics.v1.Exemplar"; - }; - - return Exemplar; - })(); - - return v1; - })(); - - return metrics; - })(); - - proto.logs = (function() { - - /** - * Namespace logs. - * @memberof opentelemetry.proto - * @namespace - */ - var logs = {}; - - logs.v1 = (function() { - - /** - * Namespace v1. - * @memberof opentelemetry.proto.logs - * @namespace - */ - var v1 = {}; - - v1.LogsData = (function() { - - /** - * Properties of a LogsData. - * @memberof opentelemetry.proto.logs.v1 - * @interface ILogsData - * @property {Array.|null} [resourceLogs] LogsData resourceLogs - */ - - /** - * Constructs a new LogsData. - * @memberof opentelemetry.proto.logs.v1 - * @classdesc Represents a LogsData. - * @implements ILogsData - * @constructor - * @param {opentelemetry.proto.logs.v1.ILogsData=} [properties] Properties to set - */ - function LogsData(properties) { - this.resourceLogs = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * LogsData resourceLogs. - * @member {Array.} resourceLogs - * @memberof opentelemetry.proto.logs.v1.LogsData - * @instance - */ - LogsData.prototype.resourceLogs = $util.emptyArray; - - /** - * Creates a new LogsData instance using the specified properties. - * @function create - * @memberof opentelemetry.proto.logs.v1.LogsData - * @static - * @param {opentelemetry.proto.logs.v1.ILogsData=} [properties] Properties to set - * @returns {opentelemetry.proto.logs.v1.LogsData} LogsData instance - */ - LogsData.create = function create(properties) { - return new LogsData(properties); - }; - - /** - * Encodes the specified LogsData message. Does not implicitly {@link opentelemetry.proto.logs.v1.LogsData.verify|verify} messages. - * @function encode - * @memberof opentelemetry.proto.logs.v1.LogsData - * @static - * @param {opentelemetry.proto.logs.v1.ILogsData} message LogsData message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - LogsData.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.resourceLogs != null && message.resourceLogs.length) - for (var i = 0; i < message.resourceLogs.length; ++i) - $root.opentelemetry.proto.logs.v1.ResourceLogs.encode(message.resourceLogs[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified LogsData message, length delimited. Does not implicitly {@link opentelemetry.proto.logs.v1.LogsData.verify|verify} messages. - * @function encodeDelimited - * @memberof opentelemetry.proto.logs.v1.LogsData - * @static - * @param {opentelemetry.proto.logs.v1.ILogsData} message LogsData message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - LogsData.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a LogsData message from the specified reader or buffer. - * @function decode - * @memberof opentelemetry.proto.logs.v1.LogsData - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {opentelemetry.proto.logs.v1.LogsData} LogsData - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - LogsData.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.opentelemetry.proto.logs.v1.LogsData(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (!(message.resourceLogs && message.resourceLogs.length)) - message.resourceLogs = []; - message.resourceLogs.push($root.opentelemetry.proto.logs.v1.ResourceLogs.decode(reader, reader.uint32())); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a LogsData message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof opentelemetry.proto.logs.v1.LogsData - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {opentelemetry.proto.logs.v1.LogsData} LogsData - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - LogsData.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a LogsData message. - * @function verify - * @memberof opentelemetry.proto.logs.v1.LogsData - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - LogsData.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.resourceLogs != null && message.hasOwnProperty("resourceLogs")) { - if (!Array.isArray(message.resourceLogs)) - return "resourceLogs: array expected"; - for (var i = 0; i < message.resourceLogs.length; ++i) { - var error = $root.opentelemetry.proto.logs.v1.ResourceLogs.verify(message.resourceLogs[i]); - if (error) - return "resourceLogs." + error; - } - } - return null; - }; - - /** - * Creates a LogsData message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof opentelemetry.proto.logs.v1.LogsData - * @static - * @param {Object.} object Plain object - * @returns {opentelemetry.proto.logs.v1.LogsData} LogsData - */ - LogsData.fromObject = function fromObject(object) { - if (object instanceof $root.opentelemetry.proto.logs.v1.LogsData) - return object; - var message = new $root.opentelemetry.proto.logs.v1.LogsData(); - if (object.resourceLogs) { - if (!Array.isArray(object.resourceLogs)) - throw TypeError(".opentelemetry.proto.logs.v1.LogsData.resourceLogs: array expected"); - message.resourceLogs = []; - for (var i = 0; i < object.resourceLogs.length; ++i) { - if (typeof object.resourceLogs[i] !== "object") - throw TypeError(".opentelemetry.proto.logs.v1.LogsData.resourceLogs: object expected"); - message.resourceLogs[i] = $root.opentelemetry.proto.logs.v1.ResourceLogs.fromObject(object.resourceLogs[i]); - } - } - return message; - }; - - /** - * Creates a plain object from a LogsData message. Also converts values to other types if specified. - * @function toObject - * @memberof opentelemetry.proto.logs.v1.LogsData - * @static - * @param {opentelemetry.proto.logs.v1.LogsData} message LogsData - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - LogsData.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.resourceLogs = []; - if (message.resourceLogs && message.resourceLogs.length) { - object.resourceLogs = []; - for (var j = 0; j < message.resourceLogs.length; ++j) - object.resourceLogs[j] = $root.opentelemetry.proto.logs.v1.ResourceLogs.toObject(message.resourceLogs[j], options); - } - return object; - }; - - /** - * Converts this LogsData to JSON. - * @function toJSON - * @memberof opentelemetry.proto.logs.v1.LogsData - * @instance - * @returns {Object.} JSON object - */ - LogsData.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for LogsData - * @function getTypeUrl - * @memberof opentelemetry.proto.logs.v1.LogsData - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - LogsData.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/opentelemetry.proto.logs.v1.LogsData"; - }; - - return LogsData; - })(); - - v1.ResourceLogs = (function() { - - /** - * Properties of a ResourceLogs. - * @memberof opentelemetry.proto.logs.v1 - * @interface IResourceLogs - * @property {opentelemetry.proto.resource.v1.IResource|null} [resource] ResourceLogs resource - * @property {Array.|null} [scopeLogs] ResourceLogs scopeLogs - * @property {string|null} [schemaUrl] ResourceLogs schemaUrl - */ - - /** - * Constructs a new ResourceLogs. - * @memberof opentelemetry.proto.logs.v1 - * @classdesc Represents a ResourceLogs. - * @implements IResourceLogs - * @constructor - * @param {opentelemetry.proto.logs.v1.IResourceLogs=} [properties] Properties to set - */ - function ResourceLogs(properties) { - this.scopeLogs = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * ResourceLogs resource. - * @member {opentelemetry.proto.resource.v1.IResource|null|undefined} resource - * @memberof opentelemetry.proto.logs.v1.ResourceLogs - * @instance - */ - ResourceLogs.prototype.resource = null; - - /** - * ResourceLogs scopeLogs. - * @member {Array.} scopeLogs - * @memberof opentelemetry.proto.logs.v1.ResourceLogs - * @instance - */ - ResourceLogs.prototype.scopeLogs = $util.emptyArray; - - /** - * ResourceLogs schemaUrl. - * @member {string|null|undefined} schemaUrl - * @memberof opentelemetry.proto.logs.v1.ResourceLogs - * @instance - */ - ResourceLogs.prototype.schemaUrl = null; - - /** - * Creates a new ResourceLogs instance using the specified properties. - * @function create - * @memberof opentelemetry.proto.logs.v1.ResourceLogs - * @static - * @param {opentelemetry.proto.logs.v1.IResourceLogs=} [properties] Properties to set - * @returns {opentelemetry.proto.logs.v1.ResourceLogs} ResourceLogs instance - */ - ResourceLogs.create = function create(properties) { - return new ResourceLogs(properties); - }; - - /** - * Encodes the specified ResourceLogs message. Does not implicitly {@link opentelemetry.proto.logs.v1.ResourceLogs.verify|verify} messages. - * @function encode - * @memberof opentelemetry.proto.logs.v1.ResourceLogs - * @static - * @param {opentelemetry.proto.logs.v1.IResourceLogs} message ResourceLogs message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ResourceLogs.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.scopeLogs != null && message.scopeLogs.length) - for (var i = 0; i < message.scopeLogs.length; ++i) - $root.opentelemetry.proto.logs.v1.ScopeLogs.encode(message.scopeLogs[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 ResourceLogs message, length delimited. Does not implicitly {@link opentelemetry.proto.logs.v1.ResourceLogs.verify|verify} messages. - * @function encodeDelimited - * @memberof opentelemetry.proto.logs.v1.ResourceLogs - * @static - * @param {opentelemetry.proto.logs.v1.IResourceLogs} message ResourceLogs message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ResourceLogs.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a ResourceLogs message from the specified reader or buffer. - * @function decode - * @memberof opentelemetry.proto.logs.v1.ResourceLogs - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {opentelemetry.proto.logs.v1.ResourceLogs} ResourceLogs - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ResourceLogs.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.opentelemetry.proto.logs.v1.ResourceLogs(); - while (reader.pos < end) { - var 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.scopeLogs && message.scopeLogs.length)) - message.scopeLogs = []; - message.scopeLogs.push($root.opentelemetry.proto.logs.v1.ScopeLogs.decode(reader, reader.uint32())); - break; - } - case 3: { - message.schemaUrl = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a ResourceLogs message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof opentelemetry.proto.logs.v1.ResourceLogs - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {opentelemetry.proto.logs.v1.ResourceLogs} ResourceLogs - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ResourceLogs.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a ResourceLogs message. - * @function verify - * @memberof opentelemetry.proto.logs.v1.ResourceLogs - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ResourceLogs.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.resource != null && message.hasOwnProperty("resource")) { - var error = $root.opentelemetry.proto.resource.v1.Resource.verify(message.resource); - if (error) - return "resource." + error; - } - if (message.scopeLogs != null && message.hasOwnProperty("scopeLogs")) { - if (!Array.isArray(message.scopeLogs)) - return "scopeLogs: array expected"; - for (var i = 0; i < message.scopeLogs.length; ++i) { - var error = $root.opentelemetry.proto.logs.v1.ScopeLogs.verify(message.scopeLogs[i]); - if (error) - return "scopeLogs." + error; - } - } - if (message.schemaUrl != null && message.hasOwnProperty("schemaUrl")) - if (!$util.isString(message.schemaUrl)) - return "schemaUrl: string expected"; - return null; - }; - - /** - * Creates a ResourceLogs message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof opentelemetry.proto.logs.v1.ResourceLogs - * @static - * @param {Object.} object Plain object - * @returns {opentelemetry.proto.logs.v1.ResourceLogs} ResourceLogs - */ - ResourceLogs.fromObject = function fromObject(object) { - if (object instanceof $root.opentelemetry.proto.logs.v1.ResourceLogs) - return object; - var message = new $root.opentelemetry.proto.logs.v1.ResourceLogs(); - if (object.resource != null) { - if (typeof object.resource !== "object") - throw TypeError(".opentelemetry.proto.logs.v1.ResourceLogs.resource: object expected"); - message.resource = $root.opentelemetry.proto.resource.v1.Resource.fromObject(object.resource); - } - if (object.scopeLogs) { - if (!Array.isArray(object.scopeLogs)) - throw TypeError(".opentelemetry.proto.logs.v1.ResourceLogs.scopeLogs: array expected"); - message.scopeLogs = []; - for (var i = 0; i < object.scopeLogs.length; ++i) { - if (typeof object.scopeLogs[i] !== "object") - throw TypeError(".opentelemetry.proto.logs.v1.ResourceLogs.scopeLogs: object expected"); - message.scopeLogs[i] = $root.opentelemetry.proto.logs.v1.ScopeLogs.fromObject(object.scopeLogs[i]); - } - } - if (object.schemaUrl != null) - message.schemaUrl = String(object.schemaUrl); - return message; - }; - - /** - * Creates a plain object from a ResourceLogs message. Also converts values to other types if specified. - * @function toObject - * @memberof opentelemetry.proto.logs.v1.ResourceLogs - * @static - * @param {opentelemetry.proto.logs.v1.ResourceLogs} message ResourceLogs - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ResourceLogs.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.scopeLogs = []; - 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.scopeLogs && message.scopeLogs.length) { - object.scopeLogs = []; - for (var j = 0; j < message.scopeLogs.length; ++j) - object.scopeLogs[j] = $root.opentelemetry.proto.logs.v1.ScopeLogs.toObject(message.scopeLogs[j], options); - } - if (message.schemaUrl != null && message.hasOwnProperty("schemaUrl")) - object.schemaUrl = message.schemaUrl; - return object; - }; - - /** - * Converts this ResourceLogs to JSON. - * @function toJSON - * @memberof opentelemetry.proto.logs.v1.ResourceLogs - * @instance - * @returns {Object.} JSON object - */ - ResourceLogs.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for ResourceLogs - * @function getTypeUrl - * @memberof opentelemetry.proto.logs.v1.ResourceLogs - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - ResourceLogs.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/opentelemetry.proto.logs.v1.ResourceLogs"; - }; - - return ResourceLogs; - })(); - - v1.ScopeLogs = (function() { - - /** - * Properties of a ScopeLogs. - * @memberof opentelemetry.proto.logs.v1 - * @interface IScopeLogs - * @property {opentelemetry.proto.common.v1.IInstrumentationScope|null} [scope] ScopeLogs scope - * @property {Array.|null} [logRecords] ScopeLogs logRecords - * @property {string|null} [schemaUrl] ScopeLogs schemaUrl - */ - - /** - * Constructs a new ScopeLogs. - * @memberof opentelemetry.proto.logs.v1 - * @classdesc Represents a ScopeLogs. - * @implements IScopeLogs - * @constructor - * @param {opentelemetry.proto.logs.v1.IScopeLogs=} [properties] Properties to set - */ - function ScopeLogs(properties) { - this.logRecords = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * ScopeLogs scope. - * @member {opentelemetry.proto.common.v1.IInstrumentationScope|null|undefined} scope - * @memberof opentelemetry.proto.logs.v1.ScopeLogs - * @instance - */ - ScopeLogs.prototype.scope = null; - - /** - * ScopeLogs logRecords. - * @member {Array.} logRecords - * @memberof opentelemetry.proto.logs.v1.ScopeLogs - * @instance - */ - ScopeLogs.prototype.logRecords = $util.emptyArray; - - /** - * ScopeLogs schemaUrl. - * @member {string|null|undefined} schemaUrl - * @memberof opentelemetry.proto.logs.v1.ScopeLogs - * @instance - */ - ScopeLogs.prototype.schemaUrl = null; - - /** - * Creates a new ScopeLogs instance using the specified properties. - * @function create - * @memberof opentelemetry.proto.logs.v1.ScopeLogs - * @static - * @param {opentelemetry.proto.logs.v1.IScopeLogs=} [properties] Properties to set - * @returns {opentelemetry.proto.logs.v1.ScopeLogs} ScopeLogs instance - */ - ScopeLogs.create = function create(properties) { - return new ScopeLogs(properties); - }; - - /** - * Encodes the specified ScopeLogs message. Does not implicitly {@link opentelemetry.proto.logs.v1.ScopeLogs.verify|verify} messages. - * @function encode - * @memberof opentelemetry.proto.logs.v1.ScopeLogs - * @static - * @param {opentelemetry.proto.logs.v1.IScopeLogs} message ScopeLogs message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ScopeLogs.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.logRecords != null && message.logRecords.length) - for (var i = 0; i < message.logRecords.length; ++i) - $root.opentelemetry.proto.logs.v1.LogRecord.encode(message.logRecords[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 ScopeLogs message, length delimited. Does not implicitly {@link opentelemetry.proto.logs.v1.ScopeLogs.verify|verify} messages. - * @function encodeDelimited - * @memberof opentelemetry.proto.logs.v1.ScopeLogs - * @static - * @param {opentelemetry.proto.logs.v1.IScopeLogs} message ScopeLogs message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ScopeLogs.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a ScopeLogs message from the specified reader or buffer. - * @function decode - * @memberof opentelemetry.proto.logs.v1.ScopeLogs - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {opentelemetry.proto.logs.v1.ScopeLogs} ScopeLogs - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ScopeLogs.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.opentelemetry.proto.logs.v1.ScopeLogs(); - while (reader.pos < end) { - var 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.logRecords && message.logRecords.length)) - message.logRecords = []; - message.logRecords.push($root.opentelemetry.proto.logs.v1.LogRecord.decode(reader, reader.uint32())); - break; - } - case 3: { - message.schemaUrl = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a ScopeLogs message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof opentelemetry.proto.logs.v1.ScopeLogs - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {opentelemetry.proto.logs.v1.ScopeLogs} ScopeLogs - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ScopeLogs.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a ScopeLogs message. - * @function verify - * @memberof opentelemetry.proto.logs.v1.ScopeLogs - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ScopeLogs.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.scope != null && message.hasOwnProperty("scope")) { - var error = $root.opentelemetry.proto.common.v1.InstrumentationScope.verify(message.scope); - if (error) - return "scope." + error; - } - if (message.logRecords != null && message.hasOwnProperty("logRecords")) { - if (!Array.isArray(message.logRecords)) - return "logRecords: array expected"; - for (var i = 0; i < message.logRecords.length; ++i) { - var error = $root.opentelemetry.proto.logs.v1.LogRecord.verify(message.logRecords[i]); - if (error) - return "logRecords." + error; - } - } - if (message.schemaUrl != null && message.hasOwnProperty("schemaUrl")) - if (!$util.isString(message.schemaUrl)) - return "schemaUrl: string expected"; - return null; - }; - - /** - * Creates a ScopeLogs message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof opentelemetry.proto.logs.v1.ScopeLogs - * @static - * @param {Object.} object Plain object - * @returns {opentelemetry.proto.logs.v1.ScopeLogs} ScopeLogs - */ - ScopeLogs.fromObject = function fromObject(object) { - if (object instanceof $root.opentelemetry.proto.logs.v1.ScopeLogs) - return object; - var message = new $root.opentelemetry.proto.logs.v1.ScopeLogs(); - if (object.scope != null) { - if (typeof object.scope !== "object") - throw TypeError(".opentelemetry.proto.logs.v1.ScopeLogs.scope: object expected"); - message.scope = $root.opentelemetry.proto.common.v1.InstrumentationScope.fromObject(object.scope); - } - if (object.logRecords) { - if (!Array.isArray(object.logRecords)) - throw TypeError(".opentelemetry.proto.logs.v1.ScopeLogs.logRecords: array expected"); - message.logRecords = []; - for (var i = 0; i < object.logRecords.length; ++i) { - if (typeof object.logRecords[i] !== "object") - throw TypeError(".opentelemetry.proto.logs.v1.ScopeLogs.logRecords: object expected"); - message.logRecords[i] = $root.opentelemetry.proto.logs.v1.LogRecord.fromObject(object.logRecords[i]); - } - } - if (object.schemaUrl != null) - message.schemaUrl = String(object.schemaUrl); - return message; - }; - - /** - * Creates a plain object from a ScopeLogs message. Also converts values to other types if specified. - * @function toObject - * @memberof opentelemetry.proto.logs.v1.ScopeLogs - * @static - * @param {opentelemetry.proto.logs.v1.ScopeLogs} message ScopeLogs - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ScopeLogs.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.logRecords = []; - 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.logRecords && message.logRecords.length) { - object.logRecords = []; - for (var j = 0; j < message.logRecords.length; ++j) - object.logRecords[j] = $root.opentelemetry.proto.logs.v1.LogRecord.toObject(message.logRecords[j], options); - } - if (message.schemaUrl != null && message.hasOwnProperty("schemaUrl")) - object.schemaUrl = message.schemaUrl; - return object; - }; - - /** - * Converts this ScopeLogs to JSON. - * @function toJSON - * @memberof opentelemetry.proto.logs.v1.ScopeLogs - * @instance - * @returns {Object.} JSON object - */ - ScopeLogs.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for ScopeLogs - * @function getTypeUrl - * @memberof opentelemetry.proto.logs.v1.ScopeLogs - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - ScopeLogs.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/opentelemetry.proto.logs.v1.ScopeLogs"; - }; - - return ScopeLogs; - })(); - - /** - * SeverityNumber enum. - * @name opentelemetry.proto.logs.v1.SeverityNumber - * @enum {number} - * @property {number} SEVERITY_NUMBER_UNSPECIFIED=0 SEVERITY_NUMBER_UNSPECIFIED value - * @property {number} SEVERITY_NUMBER_TRACE=1 SEVERITY_NUMBER_TRACE value - * @property {number} SEVERITY_NUMBER_TRACE2=2 SEVERITY_NUMBER_TRACE2 value - * @property {number} SEVERITY_NUMBER_TRACE3=3 SEVERITY_NUMBER_TRACE3 value - * @property {number} SEVERITY_NUMBER_TRACE4=4 SEVERITY_NUMBER_TRACE4 value - * @property {number} SEVERITY_NUMBER_DEBUG=5 SEVERITY_NUMBER_DEBUG value - * @property {number} SEVERITY_NUMBER_DEBUG2=6 SEVERITY_NUMBER_DEBUG2 value - * @property {number} SEVERITY_NUMBER_DEBUG3=7 SEVERITY_NUMBER_DEBUG3 value - * @property {number} SEVERITY_NUMBER_DEBUG4=8 SEVERITY_NUMBER_DEBUG4 value - * @property {number} SEVERITY_NUMBER_INFO=9 SEVERITY_NUMBER_INFO value - * @property {number} SEVERITY_NUMBER_INFO2=10 SEVERITY_NUMBER_INFO2 value - * @property {number} SEVERITY_NUMBER_INFO3=11 SEVERITY_NUMBER_INFO3 value - * @property {number} SEVERITY_NUMBER_INFO4=12 SEVERITY_NUMBER_INFO4 value - * @property {number} SEVERITY_NUMBER_WARN=13 SEVERITY_NUMBER_WARN value - * @property {number} SEVERITY_NUMBER_WARN2=14 SEVERITY_NUMBER_WARN2 value - * @property {number} SEVERITY_NUMBER_WARN3=15 SEVERITY_NUMBER_WARN3 value - * @property {number} SEVERITY_NUMBER_WARN4=16 SEVERITY_NUMBER_WARN4 value - * @property {number} SEVERITY_NUMBER_ERROR=17 SEVERITY_NUMBER_ERROR value - * @property {number} SEVERITY_NUMBER_ERROR2=18 SEVERITY_NUMBER_ERROR2 value - * @property {number} SEVERITY_NUMBER_ERROR3=19 SEVERITY_NUMBER_ERROR3 value - * @property {number} SEVERITY_NUMBER_ERROR4=20 SEVERITY_NUMBER_ERROR4 value - * @property {number} SEVERITY_NUMBER_FATAL=21 SEVERITY_NUMBER_FATAL value - * @property {number} SEVERITY_NUMBER_FATAL2=22 SEVERITY_NUMBER_FATAL2 value - * @property {number} SEVERITY_NUMBER_FATAL3=23 SEVERITY_NUMBER_FATAL3 value - * @property {number} SEVERITY_NUMBER_FATAL4=24 SEVERITY_NUMBER_FATAL4 value - */ - v1.SeverityNumber = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "SEVERITY_NUMBER_UNSPECIFIED"] = 0; - values[valuesById[1] = "SEVERITY_NUMBER_TRACE"] = 1; - values[valuesById[2] = "SEVERITY_NUMBER_TRACE2"] = 2; - values[valuesById[3] = "SEVERITY_NUMBER_TRACE3"] = 3; - values[valuesById[4] = "SEVERITY_NUMBER_TRACE4"] = 4; - values[valuesById[5] = "SEVERITY_NUMBER_DEBUG"] = 5; - values[valuesById[6] = "SEVERITY_NUMBER_DEBUG2"] = 6; - values[valuesById[7] = "SEVERITY_NUMBER_DEBUG3"] = 7; - values[valuesById[8] = "SEVERITY_NUMBER_DEBUG4"] = 8; - values[valuesById[9] = "SEVERITY_NUMBER_INFO"] = 9; - values[valuesById[10] = "SEVERITY_NUMBER_INFO2"] = 10; - values[valuesById[11] = "SEVERITY_NUMBER_INFO3"] = 11; - values[valuesById[12] = "SEVERITY_NUMBER_INFO4"] = 12; - values[valuesById[13] = "SEVERITY_NUMBER_WARN"] = 13; - values[valuesById[14] = "SEVERITY_NUMBER_WARN2"] = 14; - values[valuesById[15] = "SEVERITY_NUMBER_WARN3"] = 15; - values[valuesById[16] = "SEVERITY_NUMBER_WARN4"] = 16; - values[valuesById[17] = "SEVERITY_NUMBER_ERROR"] = 17; - values[valuesById[18] = "SEVERITY_NUMBER_ERROR2"] = 18; - values[valuesById[19] = "SEVERITY_NUMBER_ERROR3"] = 19; - values[valuesById[20] = "SEVERITY_NUMBER_ERROR4"] = 20; - values[valuesById[21] = "SEVERITY_NUMBER_FATAL"] = 21; - values[valuesById[22] = "SEVERITY_NUMBER_FATAL2"] = 22; - values[valuesById[23] = "SEVERITY_NUMBER_FATAL3"] = 23; - values[valuesById[24] = "SEVERITY_NUMBER_FATAL4"] = 24; - return values; - })(); - - /** - * LogRecordFlags enum. - * @name opentelemetry.proto.logs.v1.LogRecordFlags - * @enum {number} - * @property {number} LOG_RECORD_FLAGS_DO_NOT_USE=0 LOG_RECORD_FLAGS_DO_NOT_USE value - * @property {number} LOG_RECORD_FLAGS_TRACE_FLAGS_MASK=255 LOG_RECORD_FLAGS_TRACE_FLAGS_MASK value - */ - v1.LogRecordFlags = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "LOG_RECORD_FLAGS_DO_NOT_USE"] = 0; - values[valuesById[255] = "LOG_RECORD_FLAGS_TRACE_FLAGS_MASK"] = 255; - return values; - })(); - - v1.LogRecord = (function() { - - /** - * Properties of a LogRecord. - * @memberof opentelemetry.proto.logs.v1 - * @interface ILogRecord - * @property {number|Long|null} [timeUnixNano] LogRecord timeUnixNano - * @property {number|Long|null} [observedTimeUnixNano] LogRecord observedTimeUnixNano - * @property {opentelemetry.proto.logs.v1.SeverityNumber|null} [severityNumber] LogRecord severityNumber - * @property {string|null} [severityText] LogRecord severityText - * @property {opentelemetry.proto.common.v1.IAnyValue|null} [body] LogRecord body - * @property {Array.|null} [attributes] LogRecord attributes - * @property {number|null} [droppedAttributesCount] LogRecord droppedAttributesCount - * @property {number|null} [flags] LogRecord flags - * @property {Uint8Array|null} [traceId] LogRecord traceId - * @property {Uint8Array|null} [spanId] LogRecord spanId - */ - - /** - * Constructs a new LogRecord. - * @memberof opentelemetry.proto.logs.v1 - * @classdesc Represents a LogRecord. - * @implements ILogRecord - * @constructor - * @param {opentelemetry.proto.logs.v1.ILogRecord=} [properties] Properties to set - */ - function LogRecord(properties) { - this.attributes = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * LogRecord timeUnixNano. - * @member {number|Long|null|undefined} timeUnixNano - * @memberof opentelemetry.proto.logs.v1.LogRecord - * @instance - */ - LogRecord.prototype.timeUnixNano = null; - - /** - * LogRecord observedTimeUnixNano. - * @member {number|Long|null|undefined} observedTimeUnixNano - * @memberof opentelemetry.proto.logs.v1.LogRecord - * @instance - */ - LogRecord.prototype.observedTimeUnixNano = null; - - /** - * LogRecord severityNumber. - * @member {opentelemetry.proto.logs.v1.SeverityNumber|null|undefined} severityNumber - * @memberof opentelemetry.proto.logs.v1.LogRecord - * @instance - */ - LogRecord.prototype.severityNumber = null; - - /** - * LogRecord severityText. - * @member {string|null|undefined} severityText - * @memberof opentelemetry.proto.logs.v1.LogRecord - * @instance - */ - LogRecord.prototype.severityText = null; - - /** - * LogRecord body. - * @member {opentelemetry.proto.common.v1.IAnyValue|null|undefined} body - * @memberof opentelemetry.proto.logs.v1.LogRecord - * @instance - */ - LogRecord.prototype.body = null; - - /** - * LogRecord attributes. - * @member {Array.} attributes - * @memberof opentelemetry.proto.logs.v1.LogRecord - * @instance - */ - LogRecord.prototype.attributes = $util.emptyArray; - - /** - * LogRecord droppedAttributesCount. - * @member {number|null|undefined} droppedAttributesCount - * @memberof opentelemetry.proto.logs.v1.LogRecord - * @instance - */ - LogRecord.prototype.droppedAttributesCount = null; - - /** - * LogRecord flags. - * @member {number|null|undefined} flags - * @memberof opentelemetry.proto.logs.v1.LogRecord - * @instance - */ - LogRecord.prototype.flags = null; - - /** - * LogRecord traceId. - * @member {Uint8Array|null|undefined} traceId - * @memberof opentelemetry.proto.logs.v1.LogRecord - * @instance - */ - LogRecord.prototype.traceId = null; - - /** - * LogRecord spanId. - * @member {Uint8Array|null|undefined} spanId - * @memberof opentelemetry.proto.logs.v1.LogRecord - * @instance - */ - LogRecord.prototype.spanId = null; - - /** - * Creates a new LogRecord instance using the specified properties. - * @function create - * @memberof opentelemetry.proto.logs.v1.LogRecord - * @static - * @param {opentelemetry.proto.logs.v1.ILogRecord=} [properties] Properties to set - * @returns {opentelemetry.proto.logs.v1.LogRecord} LogRecord instance - */ - LogRecord.create = function create(properties) { - return new LogRecord(properties); - }; - - /** - * Encodes the specified LogRecord message. Does not implicitly {@link opentelemetry.proto.logs.v1.LogRecord.verify|verify} messages. - * @function encode - * @memberof opentelemetry.proto.logs.v1.LogRecord - * @static - * @param {opentelemetry.proto.logs.v1.ILogRecord} message LogRecord message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - LogRecord.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.severityNumber != null && Object.hasOwnProperty.call(message, "severityNumber")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.severityNumber); - if (message.severityText != null && Object.hasOwnProperty.call(message, "severityText")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.severityText); - if (message.body != null && Object.hasOwnProperty.call(message, "body")) - $root.opentelemetry.proto.common.v1.AnyValue.encode(message.body, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); - if (message.attributes != null && message.attributes.length) - for (var i = 0; i < message.attributes.length; ++i) - $root.opentelemetry.proto.common.v1.KeyValue.encode(message.attributes[i], writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); - if (message.droppedAttributesCount != null && Object.hasOwnProperty.call(message, "droppedAttributesCount")) - writer.uint32(/* id 7, wireType 0 =*/56).uint32(message.droppedAttributesCount); - if (message.flags != null && Object.hasOwnProperty.call(message, "flags")) - writer.uint32(/* id 8, wireType 5 =*/69).fixed32(message.flags); - if (message.traceId != null && Object.hasOwnProperty.call(message, "traceId")) - writer.uint32(/* id 9, wireType 2 =*/74).bytes(message.traceId); - if (message.spanId != null && Object.hasOwnProperty.call(message, "spanId")) - writer.uint32(/* id 10, wireType 2 =*/82).bytes(message.spanId); - if (message.observedTimeUnixNano != null && Object.hasOwnProperty.call(message, "observedTimeUnixNano")) - writer.uint32(/* id 11, wireType 1 =*/89).fixed64(message.observedTimeUnixNano); - return writer; - }; - - /** - * Encodes the specified LogRecord message, length delimited. Does not implicitly {@link opentelemetry.proto.logs.v1.LogRecord.verify|verify} messages. - * @function encodeDelimited - * @memberof opentelemetry.proto.logs.v1.LogRecord - * @static - * @param {opentelemetry.proto.logs.v1.ILogRecord} message LogRecord message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - LogRecord.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a LogRecord message from the specified reader or buffer. - * @function decode - * @memberof opentelemetry.proto.logs.v1.LogRecord - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {opentelemetry.proto.logs.v1.LogRecord} LogRecord - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - LogRecord.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.opentelemetry.proto.logs.v1.LogRecord(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.timeUnixNano = reader.fixed64(); - break; - } - case 11: { - message.observedTimeUnixNano = reader.fixed64(); - break; - } - case 2: { - message.severityNumber = reader.int32(); - break; - } - case 3: { - message.severityText = reader.string(); - break; - } - case 5: { - message.body = $root.opentelemetry.proto.common.v1.AnyValue.decode(reader, reader.uint32()); - break; - } - case 6: { - if (!(message.attributes && message.attributes.length)) - message.attributes = []; - message.attributes.push($root.opentelemetry.proto.common.v1.KeyValue.decode(reader, reader.uint32())); - break; - } - case 7: { - message.droppedAttributesCount = reader.uint32(); - break; - } - case 8: { - message.flags = reader.fixed32(); - break; - } - case 9: { - message.traceId = reader.bytes(); - break; - } - case 10: { - message.spanId = reader.bytes(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a LogRecord message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof opentelemetry.proto.logs.v1.LogRecord - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {opentelemetry.proto.logs.v1.LogRecord} LogRecord - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - LogRecord.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a LogRecord message. - * @function verify - * @memberof opentelemetry.proto.logs.v1.LogRecord - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - LogRecord.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.observedTimeUnixNano != null && message.hasOwnProperty("observedTimeUnixNano")) - if (!$util.isInteger(message.observedTimeUnixNano) && !(message.observedTimeUnixNano && $util.isInteger(message.observedTimeUnixNano.low) && $util.isInteger(message.observedTimeUnixNano.high))) - return "observedTimeUnixNano: integer|Long expected"; - if (message.severityNumber != null && message.hasOwnProperty("severityNumber")) - switch (message.severityNumber) { - default: - return "severityNumber: enum value expected"; - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - case 6: - case 7: - case 8: - case 9: - case 10: - case 11: - case 12: - case 13: - case 14: - case 15: - case 16: - case 17: - case 18: - case 19: - case 20: - case 21: - case 22: - case 23: - case 24: - break; - } - if (message.severityText != null && message.hasOwnProperty("severityText")) - if (!$util.isString(message.severityText)) - return "severityText: string expected"; - if (message.body != null && message.hasOwnProperty("body")) { - var error = $root.opentelemetry.proto.common.v1.AnyValue.verify(message.body); - if (error) - return "body." + error; - } - if (message.attributes != null && message.hasOwnProperty("attributes")) { - if (!Array.isArray(message.attributes)) - return "attributes: array expected"; - for (var i = 0; i < message.attributes.length; ++i) { - var 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.flags != null && message.hasOwnProperty("flags")) - if (!$util.isInteger(message.flags)) - return "flags: integer 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"; - return null; - }; - - /** - * Creates a LogRecord message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof opentelemetry.proto.logs.v1.LogRecord - * @static - * @param {Object.} object Plain object - * @returns {opentelemetry.proto.logs.v1.LogRecord} LogRecord - */ - LogRecord.fromObject = function fromObject(object) { - if (object instanceof $root.opentelemetry.proto.logs.v1.LogRecord) - return object; - var message = new $root.opentelemetry.proto.logs.v1.LogRecord(); - 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.observedTimeUnixNano != null) - if ($util.Long) - (message.observedTimeUnixNano = $util.Long.fromValue(object.observedTimeUnixNano)).unsigned = false; - else if (typeof object.observedTimeUnixNano === "string") - message.observedTimeUnixNano = parseInt(object.observedTimeUnixNano, 10); - else if (typeof object.observedTimeUnixNano === "number") - message.observedTimeUnixNano = object.observedTimeUnixNano; - else if (typeof object.observedTimeUnixNano === "object") - message.observedTimeUnixNano = new $util.LongBits(object.observedTimeUnixNano.low >>> 0, object.observedTimeUnixNano.high >>> 0).toNumber(); - switch (object.severityNumber) { - default: - if (typeof object.severityNumber === "number") { - message.severityNumber = object.severityNumber; - break; - } - break; - case "SEVERITY_NUMBER_UNSPECIFIED": - case 0: - message.severityNumber = 0; - break; - case "SEVERITY_NUMBER_TRACE": - case 1: - message.severityNumber = 1; - break; - case "SEVERITY_NUMBER_TRACE2": - case 2: - message.severityNumber = 2; - break; - case "SEVERITY_NUMBER_TRACE3": - case 3: - message.severityNumber = 3; - break; - case "SEVERITY_NUMBER_TRACE4": - case 4: - message.severityNumber = 4; - break; - case "SEVERITY_NUMBER_DEBUG": - case 5: - message.severityNumber = 5; - break; - case "SEVERITY_NUMBER_DEBUG2": - case 6: - message.severityNumber = 6; - break; - case "SEVERITY_NUMBER_DEBUG3": - case 7: - message.severityNumber = 7; - break; - case "SEVERITY_NUMBER_DEBUG4": - case 8: - message.severityNumber = 8; - break; - case "SEVERITY_NUMBER_INFO": - case 9: - message.severityNumber = 9; - break; - case "SEVERITY_NUMBER_INFO2": - case 10: - message.severityNumber = 10; - break; - case "SEVERITY_NUMBER_INFO3": - case 11: - message.severityNumber = 11; - break; - case "SEVERITY_NUMBER_INFO4": - case 12: - message.severityNumber = 12; - break; - case "SEVERITY_NUMBER_WARN": - case 13: - message.severityNumber = 13; - break; - case "SEVERITY_NUMBER_WARN2": - case 14: - message.severityNumber = 14; - break; - case "SEVERITY_NUMBER_WARN3": - case 15: - message.severityNumber = 15; - break; - case "SEVERITY_NUMBER_WARN4": - case 16: - message.severityNumber = 16; - break; - case "SEVERITY_NUMBER_ERROR": - case 17: - message.severityNumber = 17; - break; - case "SEVERITY_NUMBER_ERROR2": - case 18: - message.severityNumber = 18; - break; - case "SEVERITY_NUMBER_ERROR3": - case 19: - message.severityNumber = 19; - break; - case "SEVERITY_NUMBER_ERROR4": - case 20: - message.severityNumber = 20; - break; - case "SEVERITY_NUMBER_FATAL": - case 21: - message.severityNumber = 21; - break; - case "SEVERITY_NUMBER_FATAL2": - case 22: - message.severityNumber = 22; - break; - case "SEVERITY_NUMBER_FATAL3": - case 23: - message.severityNumber = 23; - break; - case "SEVERITY_NUMBER_FATAL4": - case 24: - message.severityNumber = 24; - break; - } - if (object.severityText != null) - message.severityText = String(object.severityText); - if (object.body != null) { - if (typeof object.body !== "object") - throw TypeError(".opentelemetry.proto.logs.v1.LogRecord.body: object expected"); - message.body = $root.opentelemetry.proto.common.v1.AnyValue.fromObject(object.body); - } - if (object.attributes) { - if (!Array.isArray(object.attributes)) - throw TypeError(".opentelemetry.proto.logs.v1.LogRecord.attributes: array expected"); - message.attributes = []; - for (var i = 0; i < object.attributes.length; ++i) { - if (typeof object.attributes[i] !== "object") - throw TypeError(".opentelemetry.proto.logs.v1.LogRecord.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.flags != null) - message.flags = object.flags >>> 0; - 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; - return message; - }; - - /** - * Creates a plain object from a LogRecord message. Also converts values to other types if specified. - * @function toObject - * @memberof opentelemetry.proto.logs.v1.LogRecord - * @static - * @param {opentelemetry.proto.logs.v1.LogRecord} message LogRecord - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - LogRecord.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.attributes = []; - if (options.defaults) { - if ($util.Long) { - var 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.severityNumber = options.enums === String ? "SEVERITY_NUMBER_UNSPECIFIED" : 0; - object.severityText = ""; - object.body = null; - object.droppedAttributesCount = 0; - object.flags = 0; - 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); - } - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.observedTimeUnixNano = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.observedTimeUnixNano = options.longs === String ? "0" : 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.severityNumber != null && message.hasOwnProperty("severityNumber")) - object.severityNumber = options.enums === String ? $root.opentelemetry.proto.logs.v1.SeverityNumber[message.severityNumber] === undefined ? message.severityNumber : $root.opentelemetry.proto.logs.v1.SeverityNumber[message.severityNumber] : message.severityNumber; - if (message.severityText != null && message.hasOwnProperty("severityText")) - object.severityText = message.severityText; - if (message.body != null && message.hasOwnProperty("body")) - object.body = $root.opentelemetry.proto.common.v1.AnyValue.toObject(message.body, options); - if (message.attributes && message.attributes.length) { - object.attributes = []; - for (var 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.flags != null && message.hasOwnProperty("flags")) - object.flags = message.flags; - 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.observedTimeUnixNano != null && message.hasOwnProperty("observedTimeUnixNano")) - if (typeof message.observedTimeUnixNano === "number") - object.observedTimeUnixNano = options.longs === String ? String(message.observedTimeUnixNano) : message.observedTimeUnixNano; - else - object.observedTimeUnixNano = options.longs === String ? $util.Long.prototype.toString.call(message.observedTimeUnixNano) : options.longs === Number ? new $util.LongBits(message.observedTimeUnixNano.low >>> 0, message.observedTimeUnixNano.high >>> 0).toNumber() : message.observedTimeUnixNano; - return object; - }; - - /** - * Converts this LogRecord to JSON. - * @function toJSON - * @memberof opentelemetry.proto.logs.v1.LogRecord - * @instance - * @returns {Object.} JSON object - */ - LogRecord.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for LogRecord - * @function getTypeUrl - * @memberof opentelemetry.proto.logs.v1.LogRecord - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - LogRecord.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/opentelemetry.proto.logs.v1.LogRecord"; - }; - - return LogRecord; - })(); - - return v1; - })(); - - return logs; - })(); - - return proto; - })(); - - return opentelemetry; -})(); - -module.exports = $root;