From ca515814645f002d0dd61a863e34eccfce43e707 Mon Sep 17 00:00:00 2001 From: Bartlomiej Obecny Date: Mon, 23 Mar 2020 22:24:10 +0100 Subject: [PATCH 01/14] feat: send data using grpc for collector exporter --- .../package.json | 10 +- .../src/CollectorExporter.ts | 19 +- .../src/platform/browser/sendSpans.ts | 30 ++- .../src/platform/node/grpc/types/index.ts | 18 ++ .../platform/node/grpc/types/opentelemetry.ts | 164 ++++++++++++++ .../src/platform/node/grpc/types/types.ts | 41 ++++ .../src/platform/node/sendSpans.ts | 182 +++++++++------- .../src/platform/node/transform.ts | 183 ++++++++++++++++ .../src/transform.ts | 23 +- .../src/types.ts | 3 + .../test/browser/CollectorExporter.test.ts | 15 ++ .../test/common/CollectorExporter.test.ts | 11 +- .../test/helper.ts | 175 ++++++++++++++- .../test/node/CollectorExporter.test.ts | 204 ++++++++---------- 14 files changed, 844 insertions(+), 234 deletions(-) create mode 100644 packages/opentelemetry-exporter-collector/src/platform/node/grpc/types/index.ts create mode 100644 packages/opentelemetry-exporter-collector/src/platform/node/grpc/types/opentelemetry.ts create mode 100644 packages/opentelemetry-exporter-collector/src/platform/node/grpc/types/types.ts create mode 100644 packages/opentelemetry-exporter-collector/src/platform/node/transform.ts diff --git a/packages/opentelemetry-exporter-collector/package.json b/packages/opentelemetry-exporter-collector/package.json index 0332817811..f7b32a8bec 100644 --- a/packages/opentelemetry-exporter-collector/package.json +++ b/packages/opentelemetry-exporter-collector/package.json @@ -16,13 +16,15 @@ "codecov:browser": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../", "precompile": "tsc --version", "compile": "npm run version:update && tsc -p .", + "postcompile": "npm run protos:copy", "prepare": "npm run compile", + "protos:copy": "cpx src/platform/node/grpc/protos/**/*.* build/src/platform/node/grpc/protos", "tdd": "npm run test -- --watch-extensions ts --watch", "tdd:browser": "karma start", "test": "nyc ts-mocha -p tsconfig.json 'test/**/*.test.ts' --exclude 'test/browser/**/*.ts'", "test:browser": "nyc karma start --single-run", "version:update": "node ../../scripts/version-update.js", - "watch": "tsc -w" + "watch": "npm run protos:copy && tsc -w" }, "keywords": [ "opentelemetry", @@ -56,6 +58,7 @@ "@types/webpack-env": "1.13.9", "babel-loader": "^8.0.6", "codecov": "^3.1.0", + "cpx": "^1.5.0", "gts": "^1.0.0", "istanbul-instrumenter-loader": "^3.0.1", "karma": "^4.4.1", @@ -79,10 +82,13 @@ "webpack-merge": "^4.2.2" }, "dependencies": { + "@grpc/proto-loader": "^0.5.3", "@opentelemetry/api": "^0.5.1", "@opentelemetry/base": "^0.5.1", "@opentelemetry/core": "^0.5.1", "@opentelemetry/resources": "^0.5.1", - "@opentelemetry/tracing": "^0.5.1" + "@opentelemetry/tracing": "^0.5.1", + "google-protobuf": "^3.11.4", + "grpc": "^1.24.2" } } diff --git a/packages/opentelemetry-exporter-collector/src/CollectorExporter.ts b/packages/opentelemetry-exporter-collector/src/CollectorExporter.ts index 2bbc989cc8..72e802cf0f 100644 --- a/packages/opentelemetry-exporter-collector/src/CollectorExporter.ts +++ b/packages/opentelemetry-exporter-collector/src/CollectorExporter.ts @@ -18,10 +18,7 @@ import { ExportResult } from '@opentelemetry/base'; import { NoopLogger } from '@opentelemetry/core'; import { ReadableSpan, SpanExporter } from '@opentelemetry/tracing'; import { Attributes, Logger } from '@opentelemetry/api'; -import * as collectorTypes from './types'; -import { toCollectorSpan, toCollectorResource } from './transform'; import { onInit, onShutdown, sendSpans } from './platform/index'; -import { Resource } from '@opentelemetry/resources'; /** * Collector Exporter Config @@ -65,7 +62,7 @@ export class CollectorExporter implements SpanExporter { this.shutdown = this.shutdown.bind(this); // platform dependent - onInit(this.shutdown); + onInit(this); } /** @@ -81,6 +78,7 @@ export class CollectorExporter implements SpanExporter { resultCallback(ExportResult.FAILED_NOT_RETRYABLE); return; } + this._exportSpans(spans) .then(() => { resultCallback(ExportResult.SUCCESS); @@ -97,17 +95,10 @@ export class CollectorExporter implements SpanExporter { private _exportSpans(spans: ReadableSpan[]): Promise { return new Promise((resolve, reject) => { try { - const spansToBeSent: collectorTypes.Span[] = spans.map(span => - toCollectorSpan(span) - ); - this.logger.debug('spans to be sent', spansToBeSent); - const resource = toCollectorResource( - spansToBeSent.length > 0 ? spans[0].resource : Resource.empty() - ); - + this.logger.debug('spans to be sent', spans); // Send spans to [opentelemetry collector]{@link https://github.com/open-telemetry/opentelemetry-collector} // it will use the appropriate transport layer automatically depends on platform - sendSpans(spansToBeSent, resolve, reject, this, resource); + sendSpans(spans, resolve, reject, this); } catch (e) { reject(e); } @@ -126,6 +117,6 @@ export class CollectorExporter implements SpanExporter { this.logger.debug('shutdown started'); // platform dependent - onShutdown(this.shutdown); + onShutdown(this); } } diff --git a/packages/opentelemetry-exporter-collector/src/platform/browser/sendSpans.ts b/packages/opentelemetry-exporter-collector/src/platform/browser/sendSpans.ts index a41faa3bf6..be7e17537d 100644 --- a/packages/opentelemetry-exporter-collector/src/platform/browser/sendSpans.ts +++ b/packages/opentelemetry-exporter-collector/src/platform/browser/sendSpans.ts @@ -16,24 +16,27 @@ import * as core from '@opentelemetry/core'; import { Logger } from '@opentelemetry/api'; +import { Resource } from '@opentelemetry/resources'; +import { ReadableSpan } from '@opentelemetry/tracing'; import { CollectorExporter } from '../../CollectorExporter'; +import { toCollectorResource, toCollectorSpan } from '../../transform'; import * as collectorTypes from '../../types'; import { VERSION } from '../../version'; /** * function that is called once when {@link ExporterCollector} is initialised - * @param shutdownF shutdown method of {@link ExporterCollector} + * @param collectorExporter CollectorExporter {@link ExporterCollector} */ -export function onInit(shutdownF: EventListener) { - window.addEventListener('unload', shutdownF); +export function onInit(collectorExporter: CollectorExporter) { + window.addEventListener('unload', collectorExporter.shutdown); } /** * function to be called once when {@link ExporterCollector} is shutdown - * @param shutdownF - shutdown method of {@link ExporterCollector} + * @param collectorExporter CollectorExporter {@link ExporterCollector} */ -export function onShutdown(shutdownF: EventListener) { - window.removeEventListener('unload', shutdownF); +export function onShutdown(collectorExporter: CollectorExporter) { + window.removeEventListener('unload', collectorExporter.shutdown); } /** @@ -43,15 +46,20 @@ export function onShutdown(shutdownF: EventListener) { * @param onSuccess * @param onError * @param collectorExporter - * @param resource */ export function sendSpans( - spans: collectorTypes.Span[], + spans: ReadableSpan[], onSuccess: () => void, onError: (status?: number) => void, - collectorExporter: CollectorExporter, - resource: collectorTypes.Resource + collectorExporter: CollectorExporter ) { + const resource = toCollectorResource( + spans.length > 0 ? spans[0].resource : Resource.empty() + ); + const spansToBeSent: collectorTypes.Span[] = spans.map(span => + toCollectorSpan(span) + ); + const exportTraceServiceRequest: collectorTypes.ExportTraceServiceRequest = { node: { identifier: { @@ -69,7 +77,7 @@ export function sendSpans( attributes: collectorExporter.attributes, }, resource, - spans, + spans: spansToBeSent, }; const body = JSON.stringify(exportTraceServiceRequest); diff --git a/packages/opentelemetry-exporter-collector/src/platform/node/grpc/types/index.ts b/packages/opentelemetry-exporter-collector/src/platform/node/grpc/types/index.ts new file mode 100644 index 0000000000..bb1e4e32c9 --- /dev/null +++ b/packages/opentelemetry-exporter-collector/src/platform/node/grpc/types/index.ts @@ -0,0 +1,18 @@ +/*! + * Copyright 2020, 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 * from './opentelemetry'; +export * from './types'; diff --git a/packages/opentelemetry-exporter-collector/src/platform/node/grpc/types/opentelemetry.ts b/packages/opentelemetry-exporter-collector/src/platform/node/grpc/types/opentelemetry.ts new file mode 100644 index 0000000000..4f98afa91e --- /dev/null +++ b/packages/opentelemetry-exporter-collector/src/platform/node/grpc/types/opentelemetry.ts @@ -0,0 +1,164 @@ +/*! + * Copyright 2020, 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 api from '@opentelemetry/api'; + +export namespace opentelemetry.proto { + export namespace collector { + export namespace trace.v1 { + export interface TraceService { + service: opentelemetry.proto.collector.trace.v1.TraceService; + } + + export interface ExportTraceServiceRequest { + resourceSpans: opentelemetry.proto.trace.v1.ResourceSpans[]; + } + + export interface ExportTraceServiceResponse {} + + export interface ExportTraceServiceError { + code: number; + details: string; + metadata: { [key: string]: unknown }; + message: string; + stack: string; + } + } + } + + export namespace resource.v1 { + export interface Resource { + attributes: opentelemetry.proto.common.v1.AttributeKeyValue[]; + droppedAttributesCount: number; + } + } + + export namespace trace.v1 { + export namespace ConstantSampler { + export enum ConstantDecision { + ALWAYS_OFF = 0, + ALWAYS_ON = 1, + ALWAYS_PARENT = 2, + } + } + export namespace Span { + export interface Event { + timeUnixNano: number; + name: string; + attributes?: opentelemetry.proto.common.v1.AttributeKeyValue[]; + droppedAttributesCount: number; + } + + export interface Link { + traceId: Uint8Array; + spanId: Uint8Array; + traceState?: TraceState; + attributes?: opentelemetry.proto.common.v1.AttributeKeyValue[]; + droppedAttributesCount: number; + } + + export enum SpanKind { + SPAN_KIND_UNSPECIFIED, + INTERNAL, + SERVER, + CLIENT, + PRODUCER, + CONSUMER, + } + export type TraceState = string | undefined; + } + + export interface ConstantSampler { + decision?: opentelemetry.proto.trace.v1.ConstantSampler.ConstantDecision; + } + + export interface InstrumentationLibrarySpans { + instrumentationLibrary: opentelemetry.proto.common.v1.InstrumentationLibrary | null; + spans: opentelemetry.proto.trace.v1.Span[]; + } + + export interface ProbabilitySampler { + samplingProbability?: number | null; + } + + export interface RateLimitingSampler { + qps?: number | null; + } + + export interface ResourceSpans { + resource?: opentelemetry.proto.resource.v1.Resource; + instrumentationLibrarySpans: opentelemetry.proto.trace.v1.InstrumentationLibrarySpans[]; + } + + export interface Span { + traceId: Uint8Array; + spanId: Uint8Array; + traceState: opentelemetry.proto.trace.v1.Span.TraceState; + parentSpanId?: Uint8Array; + name?: opentelemetry.proto.trace.v1.TruncatableString; + kind?: opentelemetry.proto.trace.v1.Span.SpanKind; + startTimeUnixNano?: number; + endTimeUnixNano?: number; + attributes?: opentelemetry.proto.common.v1.AttributeKeyValue[]; + droppedAttributesCount: number; + events?: opentelemetry.proto.trace.v1.Span.Event[]; + droppedEventsCount: number; + links?: opentelemetry.proto.trace.v1.Span.Link[]; + droppedLinksCount: number; + status?: Status; + } + + export interface Status extends api.Status {} + + export interface TraceConfig { + constantSampler?: ConstantSampler | null; + probabilitySampler?: ProbabilitySampler | null; + rateLimitingSampler?: RateLimitingSampler | null; + } + + export interface TruncatableString { + value?: string | null; + truncatedByteCount?: number | null; + } + } + export namespace common.v1 { + export interface AttributeKeyValue { + key: string; + type: opentelemetry.proto.common.v1.ValueType; + stringValue?: string; + intValue?: number; + doubleValue?: number; + boolValue?: boolean; + } + + export interface InstrumentationLibrary { + name: string; + version: string; + } + + export interface StringKeyValue { + key: string; + value: string; + } + + export enum ValueType { + STRING, + INT, + DOUBLE, + BOOL, + } + } +} diff --git a/packages/opentelemetry-exporter-collector/src/platform/node/grpc/types/types.ts b/packages/opentelemetry-exporter-collector/src/platform/node/grpc/types/types.ts new file mode 100644 index 0000000000..58db742e20 --- /dev/null +++ b/packages/opentelemetry-exporter-collector/src/platform/node/grpc/types/types.ts @@ -0,0 +1,41 @@ +/*! + * Copyright 2020, 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 grpc from 'grpc'; +import { ReadableSpan } from '@opentelemetry/tracing'; + +/** + * Queue item to be used to save temporary spans in case the GRPC service + * hasn't been fully initialised yet + */ +export interface GRPCQueueItem { + spans: ReadableSpan[]; + onSuccess: () => void; + onError: (status?: number) => void; +} + +/** + * Trace Service Client for sending spans + */ +export interface TraceServiceClient extends grpc.Client { + export: (request: any, callback: Function) => {}; +} + +export interface CollectorData { + traceServiceClient?: TraceServiceClient; + isShutDown: boolean; + grpcSpansQueue: GRPCQueueItem[]; +} diff --git a/packages/opentelemetry-exporter-collector/src/platform/node/sendSpans.ts b/packages/opentelemetry-exporter-collector/src/platform/node/sendSpans.ts index 18faf59bce..815d77ebf1 100644 --- a/packages/opentelemetry-exporter-collector/src/platform/node/sendSpans.ts +++ b/packages/opentelemetry-exporter-collector/src/platform/node/sendSpans.ts @@ -14,31 +14,88 @@ * limitations under the License. */ -import * as http from 'http'; -import * as https from 'https'; +import * as protoLoader from '@grpc/proto-loader'; +import { Resource } from '@opentelemetry/resources'; +import { ReadableSpan } from '@opentelemetry/tracing'; +import * as grpc from 'grpc'; -import { IncomingMessage } from 'http'; -import * as core from '@opentelemetry/core'; import { CollectorExporter } from '../../CollectorExporter'; +import { + toCollectorProtoExportTraceServiceRequest, + toCollectorProtoResource, + toCollectorProtoSpan, +} from './transform'; +import { CollectorData, GRPCQueueItem, opentelemetry } from './grpc/types'; -import * as collectorTypes from '../../types'; - -import * as url from 'url'; -import { VERSION } from '../../version'; +const traceServiceClients: WeakMap< + CollectorExporter, + CollectorData +> = new WeakMap(); /** * function that is called once when {@link ExporterCollector} is initialised - * in node version this is not used - * @param shutdownF shutdown method of {@link ExporterCollector} + * @param collectorExporter CollectorExporter {@link ExporterCollector} */ -export function onInit(shutdownF: Function) {} +export function onInit(collectorExporter: CollectorExporter) { + traceServiceClients.set(collectorExporter, { + isShutDown: false, + grpcSpansQueue: [], + }); + const serverAddress = collectorExporter.url; + const credentials: grpc.ChannelCredentials = grpc.credentials.createInsecure(); + + const traceServiceProtoPath = + 'opentelemetry/proto/collector/trace/v1/trace_service.proto'; + const includeDirs = [__dirname + '/grpc/protos']; + + protoLoader + .load(traceServiceProtoPath, { + keepCase: false, + longs: String, + enums: String, + defaults: true, + oneofs: true, + includeDirs, + }) + .then(packageDefinition => { + const packageObject: any = grpc.loadPackageDefinition(packageDefinition); + const exporter = traceServiceClients.get(collectorExporter); + if (!exporter) { + return; + } + exporter.traceServiceClient = new packageObject.opentelemetry.proto.collector.trace.v1.TraceService( + serverAddress, + credentials + ); + if (exporter.grpcSpansQueue.length > 0) { + const queue = exporter.grpcSpansQueue.splice(0); + queue.forEach((item: GRPCQueueItem) => { + sendSpans( + item.spans, + item.onSuccess, + item.onError, + collectorExporter + ); + }); + } + }); +} /** * function to be called once when {@link ExporterCollector} is shutdown - * in node version this is not used - * @param shutdownF - shutdown method of {@link ExporterCollector} + * @param collectorExporter CollectorExporter {@link ExporterCollector} */ -export function onShutdown(shutdownF: Function) {} +export function onShutdown(collectorExporter: CollectorExporter) { + const exporter = traceServiceClients.get(collectorExporter); + if (!exporter) { + return; + } + exporter.isShutDown = true; + + if (exporter.traceServiceClient) { + exporter.traceServiceClient.close(); + } +} /** * function to send spans to the [opentelemetry collector]{@link https://github.com/open-telemetry/opentelemetry-collector} @@ -47,75 +104,44 @@ export function onShutdown(shutdownF: Function) {} * @param onSuccess * @param onError * @param collectorExporter - * @param resource */ export function sendSpans( - spans: collectorTypes.Span[], + spans: ReadableSpan[], onSuccess: () => void, onError: (status?: number) => void, - collectorExporter: CollectorExporter, - resource: collectorTypes.Resource + collectorExporter: CollectorExporter ) { - const exportTraceServiceRequest = toCollectorTraceServiceRequest( - spans, - collectorExporter, - resource - ); - const body = JSON.stringify(exportTraceServiceRequest); - const parsedUrl = url.parse(collectorExporter.url); - - const options = { - hostname: parsedUrl.hostname, - port: parsedUrl.port, - path: parsedUrl.path, - method: 'POST', - headers: { - 'Content-Length': Buffer.byteLength(body), - [collectorTypes.OT_REQUEST_HEADER]: 1, - }, - }; - - const request = parsedUrl.protocol === 'http:' ? http.request : https.request; - const req = request(options, (res: IncomingMessage) => { - if (res.statusCode && res.statusCode < 299) { - collectorExporter.logger.debug(`statusCode: ${res.statusCode}`); - onSuccess(); - } else { - collectorExporter.logger.error(`statusCode: ${res.statusCode}`); - onError(res.statusCode); - } - }); + const exporter = traceServiceClients.get(collectorExporter); + if (!exporter || exporter.isShutDown) { + return; + } + if (exporter.traceServiceClient) { + const spansToBeSent: opentelemetry.proto.trace.v1.Span[] = spans.map(span => + toCollectorProtoSpan(span) + ); + const resource: Resource | undefined = + spans.length > 0 ? spans[0].resource : undefined; - req.on('error', (error: Error) => { - collectorExporter.logger.error('error', error.message); - onError(); - }); - req.write(body); - req.end(); -} + const exportTraceServiceRequest = toCollectorProtoExportTraceServiceRequest( + spansToBeSent, + toCollectorProtoResource(resource) + ); -export function toCollectorTraceServiceRequest( - spans: collectorTypes.Span[], - collectorExporter: CollectorExporter, - resource: collectorTypes.Resource -): collectorTypes.ExportTraceServiceRequest { - return { - node: { - identifier: { - hostName: collectorExporter.hostName, - startTimestamp: core.hrTimeToTimeStamp(core.hrTime()), - }, - libraryInfo: { - language: collectorTypes.LibraryInfoLanguage.NODE_JS, - coreLibraryVersion: core.VERSION, - exporterVersion: VERSION, - }, - serviceInfo: { - name: collectorExporter.serviceName, - }, - attributes: collectorExporter.attributes, - }, - resource, - spans, - }; + exporter.traceServiceClient.export( + exportTraceServiceRequest, + (err: opentelemetry.proto.collector.trace.v1.ExportTraceServiceError) => { + if (err) { + onError(err.code); + } else { + onSuccess(); + } + } + ); + } else { + exporter.grpcSpansQueue.push({ + spans, + onSuccess, + onError, + }); + } } diff --git a/packages/opentelemetry-exporter-collector/src/platform/node/transform.ts b/packages/opentelemetry-exporter-collector/src/platform/node/transform.ts new file mode 100644 index 0000000000..714168bf86 --- /dev/null +++ b/packages/opentelemetry-exporter-collector/src/platform/node/transform.ts @@ -0,0 +1,183 @@ +/*! + * Copyright 2020, 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 { Attributes, Link, TimedEvent, TraceState } from '@opentelemetry/api'; +import * as core from '@opentelemetry/core'; +import { Resource } from '@opentelemetry/resources'; +import { ReadableSpan } from '@opentelemetry/tracing'; +import { toCollectorTruncatableString } from '../../transform'; +import { VERSION } from '../../version'; +import { opentelemetry } from './grpc/types'; +import ValueType = opentelemetry.proto.common.v1.ValueType; + +/** + * convert attributes to proto + * @param attributes + */ +export function toCollectorProtoAttributes( + attributes: Attributes +): opentelemetry.proto.common.v1.AttributeKeyValue[] { + const keys = Object.keys(attributes); + const protoAttributes: opentelemetry.proto.common.v1.AttributeKeyValue[] = []; + keys.forEach(key => { + protoAttributes.push(toCollectorEventProtoValue(key, attributes[key])); + }); + + return protoAttributes; +} + +/** + * convert event value + * @param value event value + */ +export function toCollectorEventProtoValue( + key: string, + value: unknown +): opentelemetry.proto.common.v1.AttributeKeyValue { + let aType: opentelemetry.proto.common.v1.ValueType = ValueType.STRING; + const attributeValue: opentelemetry.proto.common.v1.AttributeKeyValue = { + key, + type: 0, + }; + if (typeof value === 'string') { + attributeValue.stringValue = value; + } else if (typeof value === 'boolean') { + aType = ValueType.BOOL; + attributeValue.boolValue = value; + } else if (typeof value === 'number') { + // all numbers will be treated as double + aType = ValueType.DOUBLE; + attributeValue.doubleValue = value; + } + + attributeValue.type = aType; + + return attributeValue; +} + +/** + * + * convert events to proto + * @param events array of events + */ +export function toCollectorProtoEvents( + timedEvents: TimedEvent[] +): opentelemetry.proto.trace.v1.Span.Event[] { + const protoEvents: opentelemetry.proto.trace.v1.Span.Event[] = []; + timedEvents.forEach(timedEvent => { + const timeUnixNano = core.hrTimeToNanoseconds(timedEvent.time); + const name = timedEvent.name; + const attributes = toCollectorProtoAttributes(timedEvent.attributes || {}); + const droppedAttributesCount = 0; + + const protoEvent: opentelemetry.proto.trace.v1.Span.Event = { + timeUnixNano, + name, + attributes, + droppedAttributesCount, + }; + + protoEvents.push(protoEvent); + }); + return protoEvents; +} + +export function toCollectorProtoLinks( + span: ReadableSpan +): opentelemetry.proto.trace.v1.Span.Link[] { + const protoLinks: opentelemetry.proto.trace.v1.Span.Link[] = span.links.map( + (link: Link) => { + const protoLink: opentelemetry.proto.trace.v1.Span.Link = { + traceId: Buffer.from(core.hexToBase64(link.context.traceId), 'base64'), + spanId: Buffer.from(core.hexToBase64(link.context.spanId), 'base64'), + attributes: toCollectorProtoAttributes(link.attributes || {}), + droppedAttributesCount: 0, + }; + return protoLink; + } + ); + return protoLinks; +} + +export function toCollectorProtoSpan( + span: ReadableSpan +): opentelemetry.proto.trace.v1.Span { + return { + traceId: Buffer.from(core.hexToBase64(span.spanContext.traceId), 'base64'), + spanId: Buffer.from(core.hexToBase64(span.spanContext.spanId), 'base64'), + parentSpanId: span.parentSpanId + ? Buffer.from(core.hexToBase64(span.parentSpanId), 'base64') + : undefined, + traceState: toCollectorProtoTraceState(span.spanContext.traceState), + name: toCollectorTruncatableString(span.name), + kind: span.kind + 1, + startTimeUnixNano: core.hrTimeToNanoseconds(span.startTime), + endTimeUnixNano: core.hrTimeToNanoseconds(span.endTime), + attributes: toCollectorProtoAttributes(span.attributes), + droppedAttributesCount: 0, + events: toCollectorProtoEvents(span.events), + droppedEventsCount: 0, + status: span.status, + links: toCollectorProtoLinks(span), + droppedLinksCount: 0, + }; +} + +export function toCollectorProtoResource( + resource?: Resource +): opentelemetry.proto.resource.v1.Resource { + const resourceProto: opentelemetry.proto.resource.v1.Resource = { + attributes: toCollectorProtoAttributes(resource ? resource.labels : {}), + droppedAttributesCount: 0, + }; + + return resourceProto; +} + +/** + * @param traceState + */ +export function toCollectorProtoTraceState( + traceState?: TraceState +): opentelemetry.proto.trace.v1.Span.TraceState | undefined { + if (!traceState) return undefined; + return traceState.serialize(); +} + +/** + * + * @param spans + */ +export function toCollectorProtoExportTraceServiceRequest( + spans: opentelemetry.proto.trace.v1.Span[], + resource: opentelemetry.proto.resource.v1.Resource +): opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest { + const instrumentationLibrarySpans: opentelemetry.proto.trace.v1.InstrumentationLibrarySpans = { + spans, + instrumentationLibrary: { + name: '', + version: VERSION, + }, + }; + const resourceSpan: opentelemetry.proto.trace.v1.ResourceSpans = { + resource, + instrumentationLibrarySpans: [instrumentationLibrarySpans], + }; + + return { + resourceSpans: [resourceSpan], + }; +} diff --git a/packages/opentelemetry-exporter-collector/src/transform.ts b/packages/opentelemetry-exporter-collector/src/transform.ts index 84fb97f3d9..a77ccb502d 100644 --- a/packages/opentelemetry-exporter-collector/src/transform.ts +++ b/packages/opentelemetry-exporter-collector/src/transform.ts @@ -14,11 +14,11 @@ * limitations under the License. */ -import { hexToBase64, hrTimeToTimeStamp } from '@opentelemetry/core'; -import { ReadableSpan } from '@opentelemetry/tracing'; import { Attributes, Link, TimedEvent, TraceState } from '@opentelemetry/api'; -import * as collectorTypes from './types'; +import * as core from '@opentelemetry/core'; +import { ReadableSpan } from '@opentelemetry/tracing'; import { Resource } from '@opentelemetry/resources'; +import * as collectorTypes from './types'; const OT_MAX_STRING_LENGTH = 128; @@ -78,7 +78,6 @@ export function toCollectorEventValue( /** * convert events * @param events array of events - * @param maxAttributes - maximum number of event attributes to be converted */ export function toCollectorEvents( events: TimedEvent[] @@ -112,7 +111,7 @@ export function toCollectorEvents( // const messageEvent: collectorTypes.MessageEvent; const timeEvent: collectorTypes.TimeEvent = { - time: hrTimeToTimeStamp(event.time), + time: core.hrTimeToTimeStamp(event.time), // messageEvent, }; @@ -159,8 +158,8 @@ export function toCollectorLinkType( export function toCollectorLinks(span: ReadableSpan): collectorTypes.Links { const collectorLinks: collectorTypes.Link[] = span.links.map((link: Link) => { const collectorLink: collectorTypes.Link = { - traceId: hexToBase64(link.context.traceId), - spanId: hexToBase64(link.context.spanId), + traceId: core.hexToBase64(link.context.traceId), + spanId: core.hexToBase64(link.context.spanId), type: toCollectorLinkType(span, link), }; @@ -182,16 +181,16 @@ export function toCollectorLinks(span: ReadableSpan): collectorTypes.Links { */ export function toCollectorSpan(span: ReadableSpan): collectorTypes.Span { return { - traceId: hexToBase64(span.spanContext.traceId), - spanId: hexToBase64(span.spanContext.spanId), + traceId: core.hexToBase64(span.spanContext.traceId), + spanId: core.hexToBase64(span.spanContext.spanId), parentSpanId: span.parentSpanId - ? hexToBase64(span.parentSpanId) + ? core.hexToBase64(span.parentSpanId) : undefined, tracestate: toCollectorTraceState(span.spanContext.traceState), name: toCollectorTruncatableString(span.name), kind: span.kind, - startTime: hrTimeToTimeStamp(span.startTime), - endTime: hrTimeToTimeStamp(span.endTime), + startTime: core.hrTimeToTimeStamp(span.startTime), + endTime: core.hrTimeToTimeStamp(span.endTime), attributes: toCollectorAttributes(span.attributes), // stackTrace: // not implemented timeEvents: toCollectorEvents(span.events), diff --git a/packages/opentelemetry-exporter-collector/src/types.ts b/packages/opentelemetry-exporter-collector/src/types.ts index 1960000d33..914a17750a 100644 --- a/packages/opentelemetry-exporter-collector/src/types.ts +++ b/packages/opentelemetry-exporter-collector/src/types.ts @@ -515,6 +515,9 @@ export interface TruncatableString { truncatedByteCount?: number; } +/** + * Interface to represent a trace state + */ export interface TraceState { [key: string]: string; } diff --git a/packages/opentelemetry-exporter-collector/test/browser/CollectorExporter.test.ts b/packages/opentelemetry-exporter-collector/test/browser/CollectorExporter.test.ts index 0a11981256..0f19fbe34a 100644 --- a/packages/opentelemetry-exporter-collector/test/browser/CollectorExporter.test.ts +++ b/packages/opentelemetry-exporter-collector/test/browser/CollectorExporter.test.ts @@ -26,6 +26,7 @@ import * as collectorTypes from '../../src/types'; import { ensureExportTraceServiceRequestIsSet, + ensureResourceIsCorrect, ensureSpanIsCorrect, mockedReadableSpan, } from '../helper'; @@ -80,6 +81,13 @@ describe('CollectorExporter - web', () => { if (span1) { ensureSpanIsCorrect(span1); } + + const resource = json.resource; + assert.ok(typeof resource !== 'undefined', "resource doesn't exist"); + if (resource) { + ensureResourceIsCorrect(resource); + } + assert.strictEqual(url, 'http://foo.bar.com'); assert.strictEqual(spyBeacon.callCount, 1); @@ -155,6 +163,13 @@ describe('CollectorExporter - web', () => { if (span1) { ensureSpanIsCorrect(span1); } + + const resource = json.resource; + assert.ok(typeof resource !== 'undefined', "resource doesn't exist"); + if (resource) { + ensureResourceIsCorrect(resource); + } + assert.strictEqual(spyBeacon.callCount, 0); ensureExportTraceServiceRequestIsSet(json, 10); diff --git a/packages/opentelemetry-exporter-collector/test/common/CollectorExporter.test.ts b/packages/opentelemetry-exporter-collector/test/common/CollectorExporter.test.ts index 1c37f37b8e..175222f0e4 100644 --- a/packages/opentelemetry-exporter-collector/test/common/CollectorExporter.test.ts +++ b/packages/opentelemetry-exporter-collector/test/common/CollectorExporter.test.ts @@ -23,10 +23,9 @@ import { CollectorExporter, CollectorExporterConfig, } from '../../src/CollectorExporter'; -import * as collectorTypes from '../../src/types'; import * as platform from '../../src/platform/index'; -import { ensureSpanIsCorrect, mockedReadableSpan } from '../helper'; +import { mockedReadableSpan } from '../helper'; describe('CollectorExporter - common', () => { let collectorExporter: CollectorExporter; @@ -55,7 +54,7 @@ describe('CollectorExporter - common', () => { it('should call onInit', () => { assert.strictEqual(onInitSpy.callCount, 1); - assert.ok(onInitSpy.args[0][0] === collectorExporter.shutdown); + assert.ok(onInitSpy.args[0][0] === collectorExporter); }); describe('when config contains certain params', () => { @@ -107,8 +106,8 @@ describe('CollectorExporter - common', () => { collectorExporter.export(spans, function() {}); setTimeout(() => { - const span1 = spySend.args[0][0][0] as collectorTypes.Span; - ensureSpanIsCorrect(span1); + const span1 = spySend.args[0][0][0] as ReadableSpan; + assert.deepStrictEqual(spans[0], span1); done(); }); assert.strictEqual(spySend.callCount, 1); @@ -155,7 +154,7 @@ describe('CollectorExporter - common', () => { it('should call onShutdown', done => { collectorExporter.shutdown(); setTimeout(() => { - assert.ok(onShutdownSpy.args[0][0] === collectorExporter.shutdown); + assert.ok(onShutdownSpy.args[0][0] === collectorExporter); done(); }); }); diff --git a/packages/opentelemetry-exporter-collector/test/helper.ts b/packages/opentelemetry-exporter-collector/test/helper.ts index 043865b86a..419c5a1292 100644 --- a/packages/opentelemetry-exporter-collector/test/helper.ts +++ b/packages/opentelemetry-exporter-collector/test/helper.ts @@ -19,7 +19,7 @@ import * as core from '@opentelemetry/core'; import { ReadableSpan } from '@opentelemetry/tracing'; import { Resource } from '@opentelemetry/resources'; import * as assert from 'assert'; -import * as transform from '../src/transform'; +import { opentelemetry } from '../src/platform/node/grpc/types'; import * as collectorTypes from '../src/types'; import { VERSION } from '../src/version'; @@ -76,8 +76,179 @@ export const mockedReadableSpan: ReadableSpan = { }), }; +export function ensureProtoSpanIsCorrect( + span: opentelemetry.proto.trace.v1.Span +) { + assert.deepStrictEqual(span, { + attributes: [ + { + key: 'component', + type: 'STRING', + stringValue: 'document-load', + intValue: '0', + doubleValue: 0, + boolValue: false, + }, + ], + events: [ + { + attributes: [], + timeUnixNano: '1574120165429803008', + name: 'fetchStart', + droppedAttributesCount: 0, + }, + { + attributes: [], + timeUnixNano: '1574120165429803008', + name: 'domainLookupStart', + droppedAttributesCount: 0, + }, + { + attributes: [], + timeUnixNano: '1574120165429803008', + name: 'domainLookupEnd', + droppedAttributesCount: 0, + }, + { + attributes: [], + timeUnixNano: '1574120165429803008', + name: 'connectStart', + droppedAttributesCount: 0, + }, + { + attributes: [], + timeUnixNano: '1574120165429803008', + name: 'connectEnd', + droppedAttributesCount: 0, + }, + { + attributes: [], + timeUnixNano: '1574120165435513088', + name: 'requestStart', + droppedAttributesCount: 0, + }, + { + attributes: [], + timeUnixNano: '1574120165436923136', + name: 'responseStart', + droppedAttributesCount: 0, + }, + { + attributes: [], + timeUnixNano: '1574120165438688000', + name: 'responseEnd', + droppedAttributesCount: 0, + }, + ], + links: [ + { + attributes: [ + { + key: 'component', + type: 'STRING', + stringValue: 'document-load', + intValue: '0', + doubleValue: 0, + boolValue: false, + }, + ], + traceId: Buffer.from([ + 31, + 16, + 8, + 220, + 142, + 39, + 14, + 133, + 196, + 10, + 13, + 124, + 57, + 57, + 178, + 120, + ]), + spanId: Buffer.from([120, 168, 145, 80, 152, 134, 67, 136]), + traceState: '', + droppedAttributesCount: 0, + }, + ], + traceId: Buffer.from([ + 31, + 16, + 8, + 220, + 142, + 39, + 14, + 133, + 196, + 10, + 13, + 124, + 57, + 57, + 178, + 120, + ]), + spanId: Buffer.from([94, 16, 114, 97, 246, 79, 165, 62]), + traceState: '', + parentSpanId: Buffer.from([120, 168, 145, 80, 152, 134, 67, 136]), + name: '[object Object]', + kind: 'INTERNAL', + startTimeUnixNano: '1574120165429803008', + endTimeUnixNano: '1574120165438688000', + droppedAttributesCount: 0, + droppedEventsCount: 0, + droppedLinksCount: 0, + status: { code: 'Ok', message: '' }, + }); +} + +export function ensureResourceIsCorrect(resource: collectorTypes.Resource) { + assert.deepStrictEqual(resource, { + labels: { service: 'ui', version: '1', cost: '112.12' }, + }); +} + +export function ensureProtoResourceIsCorrect( + resource: opentelemetry.proto.resource.v1.Resource +) { + assert.deepStrictEqual(resource, { + attributes: [ + { + key: 'service', + type: 'STRING', + stringValue: 'ui', + intValue: '0', + doubleValue: 0, + boolValue: false, + }, + { + key: 'version', + type: 'DOUBLE', + stringValue: '', + intValue: '0', + doubleValue: 1, + boolValue: false, + }, + { + key: 'cost', + type: 'DOUBLE', + stringValue: '', + intValue: '0', + doubleValue: 112.12, + boolValue: false, + }, + ], + droppedAttributesCount: 0, + }); +} + export function ensureSpanIsCorrect(span: collectorTypes.Span) { - assert.deepStrictEqual(transform.toCollectorSpan(mockedReadableSpan), { + assert.deepStrictEqual(span, { traceId: 'HxAI3I4nDoXECg18OTmyeA==', spanId: 'XhByYfZPpT4=', parentSpanId: 'eKiRUJiGQ4g=', diff --git a/packages/opentelemetry-exporter-collector/test/node/CollectorExporter.test.ts b/packages/opentelemetry-exporter-collector/test/node/CollectorExporter.test.ts index f057ce471d..70013944ca 100644 --- a/packages/opentelemetry-exporter-collector/test/node/CollectorExporter.test.ts +++ b/packages/opentelemetry-exporter-collector/test/node/CollectorExporter.test.ts @@ -14,136 +14,122 @@ * limitations under the License. */ -import * as core from '@opentelemetry/core'; -import { ReadableSpan } from '@opentelemetry/tracing'; -import * as http from 'http'; +import * as protoLoader from '@grpc/proto-loader'; +import * as grpc from 'grpc'; +import * as path from 'path'; +import { + BasicTracerProvider, + SimpleSpanProcessor, +} from '@opentelemetry/tracing'; + import * as assert from 'assert'; import * as sinon from 'sinon'; -import { - CollectorExporter, - CollectorExporterConfig, -} from '../../src/CollectorExporter'; -import * as collectorTypes from '../../src/types'; +import { CollectorExporter } from '../../src/CollectorExporter'; +import { opentelemetry } from '../../src/platform/node/grpc/types'; import { - ensureExportTraceServiceRequestIsSet, - ensureSpanIsCorrect, + ensureProtoResourceIsCorrect, + ensureProtoSpanIsCorrect, mockedReadableSpan, } from '../helper'; -const fakeRequest = { - end: function() {}, - on: function() {}, - write: function() {}, -}; +const traceServiceProtoPath = + 'opentelemetry/proto/collector/trace/v1/trace_service.proto'; +const includeDirs = [ + path.resolve(__dirname, '../../src/platform/node/grpc/protos'), +]; -const mockRes = { - statusCode: 200, -}; - -const mockResError = { - statusCode: 400, -}; +// const address = '127.0.0.1:55679'; +const address = '127.0.0.1:1501'; describe('CollectorExporter - node', () => { let collectorExporter: CollectorExporter; - let collectorExporterConfig: CollectorExporterConfig; - let spyRequest: any; - let spyWrite: any; - let spans: ReadableSpan[]; - describe('export', () => { - beforeEach(() => { - spyRequest = sinon.stub(http, 'request').returns(fakeRequest as any); - spyWrite = sinon.stub(fakeRequest, 'write'); - collectorExporterConfig = { - hostName: 'foo', - logger: new core.NoopLogger(), - serviceName: 'bar', - attributes: {}, - url: 'http://foo.bar.com', - }; - collectorExporter = new CollectorExporter(collectorExporterConfig); - spans = []; - spans.push(Object.assign({}, mockedReadableSpan)); - }); - afterEach(() => { - spyRequest.restore(); - spyWrite.restore(); - }); - - it('should open the connection', done => { - collectorExporter.export(spans, function() {}); - - setTimeout(() => { - const args = spyRequest.args[0]; - const options = args[0]; - - assert.strictEqual(options.hostname, 'foo.bar.com'); - assert.strictEqual(options.method, 'POST'); - assert.strictEqual(options.path, '/'); - done(); + let server: grpc.Server; + let exportedData: opentelemetry.proto.trace.v1.ResourceSpans | undefined; + + before(done => { + server = new grpc.Server(); + protoLoader + .load(traceServiceProtoPath, { + keepCase: false, + longs: String, + enums: String, + defaults: true, + oneofs: true, + includeDirs, + }) + .then((packageDefinition: protoLoader.PackageDefinition) => { + const packageObject: any = grpc.loadPackageDefinition( + packageDefinition + ); + server.addService( + packageObject.opentelemetry.proto.collector.trace.v1.TraceService + .service, + { + Export: (data: { + request: opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest; + }) => { + try { + exportedData = data.request.resourceSpans[0]; + } catch (e) { + exportedData = undefined; + } + }, + } + ); + server.bind(address, grpc.ServerCredentials.createInsecure()); + server.start(); + setTimeout(() => { + done(); + }, 200); }); - }); - - it('should successfully send the spans', done => { - collectorExporter.export(spans, function() {}); - - setTimeout(() => { - const writeArgs = spyWrite.args[0]; - const json = JSON.parse( - writeArgs[0] - ) as collectorTypes.ExportTraceServiceRequest; - const span1 = json.spans && json.spans[0]; - assert.ok(typeof span1 !== 'undefined', "span doesn't exist"); - if (span1) { - ensureSpanIsCorrect(span1); - } + }); - ensureExportTraceServiceRequestIsSet(json, 6); + after(() => { + server.forceShutdown(); + }); - done(); - }); + beforeEach(done => { + collectorExporter = new CollectorExporter({ + serviceName: 'basic-service', + url: address, }); - it('should log the successful message', done => { - const spyLoggerDebug = sinon.stub(collectorExporter.logger, 'debug'); - const spyLoggerError = sinon.stub(collectorExporter.logger, 'error'); - - const responseSpy = sinon.spy(); - collectorExporter.export(spans, responseSpy); - - setTimeout(() => { - const args = spyRequest.args[0]; - const callback = args[1]; - callback(mockRes); - setTimeout(() => { - const response: any = spyLoggerDebug.args[1][0]; - assert.strictEqual(response, 'statusCode: 200'); - assert.strictEqual(spyLoggerError.args.length, 0); - assert.strictEqual(responseSpy.args[0][0], 0); - done(); - }); - }); - }); + const provider = new BasicTracerProvider(); + provider.addSpanProcessor(new SimpleSpanProcessor(collectorExporter)); + setTimeout(() => { + done(); + }, 200); + }); - it('should log the error message', done => { - const spyLoggerError = sinon.stub(collectorExporter.logger, 'error'); + afterEach(() => { + exportedData = undefined; + }); + describe('export', () => { + it('should export spans', done => { const responseSpy = sinon.spy(); + const spans = [Object.assign({}, mockedReadableSpan)]; collectorExporter.export(spans, responseSpy); - setTimeout(() => { - const args = spyRequest.args[0]; - const callback = args[1]; - callback(mockResError); - setTimeout(() => { - const response: any = spyLoggerError.args[0][0]; - assert.strictEqual(response, 'statusCode: 400'); - - assert.strictEqual(responseSpy.args[0][0], 1); - done(); - }); - }); + assert.ok( + typeof exportedData !== 'undefined', + 'resource' + " doesn't exist" + ); + let spans; + let resource; + if (exportedData) { + spans = exportedData.instrumentationLibrarySpans[0].spans; + resource = exportedData.resource; + ensureProtoSpanIsCorrect(spans[0]); + + assert.ok(typeof resource !== 'undefined', "resource doesn't exist"); + if (resource) { + ensureProtoResourceIsCorrect(resource); + } + } + done(); + }, 200); }); }); }); From 58abdb25cf9cf3e68e63aef2b28e35a462c31017 Mon Sep 17 00:00:00 2001 From: Bartlomiej Obecny Date: Mon, 23 Mar 2020 22:24:28 +0100 Subject: [PATCH 02/14] chore: proto submodule --- .gitmodules | 3 +++ .../src/platform/node/grpc/protos | 1 + 2 files changed, 4 insertions(+) create mode 100644 .gitmodules create mode 160000 packages/opentelemetry-exporter-collector/src/platform/node/grpc/protos diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000000..29bb6e2c4d --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "packages/opentelemetry-exporter-collector/src/platform/node/grpc/protos"] + path = packages/opentelemetry-exporter-collector/src/platform/node/grpc/protos + url = git@github.com:open-telemetry/opentelemetry-proto.git diff --git a/packages/opentelemetry-exporter-collector/src/platform/node/grpc/protos b/packages/opentelemetry-exporter-collector/src/platform/node/grpc/protos new file mode 160000 index 0000000000..6a4eb2fa6f --- /dev/null +++ b/packages/opentelemetry-exporter-collector/src/platform/node/grpc/protos @@ -0,0 +1 @@ +Subproject commit 6a4eb2fa6f25569910f7b17216e3a2087496bbce From 34e087e172b849d9c49644924fbddcc1a93e7586 Mon Sep 17 00:00:00 2001 From: Bartlomiej Obecny Date: Wed, 25 Mar 2020 19:58:32 +0100 Subject: [PATCH 03/14] chore: using new proto format for browser --- .gitmodules | 4 +- .../docker/ot/collector-config.yaml | 4 +- .../src/platform/browser/hex-to-bytes.ts | 30 + .../src/platform/browser/index.ts | 1 + .../src/platform/node/hex-to-bytes.ts} | 17 +- .../src/platform/node/index.ts | 1 + .../README.md | 1 + .../package.json | 2 +- .../src/CollectorExporter.ts | 8 +- .../src/platform/browser/sendSpans.ts | 56 +- .../src/platform/node/grpc/protos | 1 - .../platform/node/grpc/types/opentelemetry.ts | 164 --- .../src/platform/node/protos/.gitattributes | 1 + .../src/platform/node/protos/.gitignore | 19 + .../src/platform/node/protos/.travis.yml | 10 + .../src/platform/node/protos/CHANGELOG.md | 5 + .../src/platform/node/protos/CODEOWNERS | 15 + .../src/platform/node/protos/CONTRIBUTING.md | 24 + .../src/platform/node/protos/LICENSE | 201 ++++ .../src/platform/node/protos/README.md | 22 + .../src/platform/node/protos/RELEASING.md | 94 ++ .../metrics/v1/metrics_service.pb.go | 215 ++++ .../metrics/v1/metrics_service.pb.gw.go | 115 ++ .../go/collector/trace/v1/trace_config.pb.go | 368 ++++++ .../go/collector/trace/v1/trace_service.pb.go | 215 ++++ .../collector/trace/v1/trace_service.pb.gw.go | 115 ++ .../node/protos/gen/go/common/v1/common.pb.go | 273 +++++ .../protos/gen/go/metrics/v1/metrics.pb.go | 1045 +++++++++++++++++ .../protos/gen/go/resource/v1/resource.pb.go | 100 ++ .../node/protos/gen/go/trace/v1/trace.pb.go | 767 ++++++++++++ .../platform/node/protos/install-proto-osx.sh | 23 + .../src/platform/node/protos/install-proto.sh | 23 + .../src/platform/node/protos/makefile | 46 + .../opentelemetry/proto/collector/README.md | 9 + .../metrics/v1/metrics_service.proto | 45 + .../metrics/v1/metrics_service_http.yaml | 9 + .../collector/trace/v1/trace_service.proto | 48 + .../trace/v1/trace_service_http.yaml | 9 + .../proto/common/v1/common.proto | 62 + .../proto/metrics/v1/metrics.proto | 372 ++++++ .../proto/resource/v1/resource.proto | 34 + .../opentelemetry/proto/trace/v1/trace.proto | 261 ++++ .../proto/trace/v1/trace_config.proto | 78 ++ .../src/platform/node/protos/verify-go.sh | 32 + .../src/platform/node/sendSpans.ts | 36 +- .../node/{transform.ts => transform.ts.old} | 0 .../platform/node/{grpc/types => }/types.ts | 6 +- .../src/transform.ts | 255 ++-- .../src/types.ts | 630 +++------- .../test/browser/CollectorExporter.test.ts | 30 +- .../test/common/transform.test.ts | 112 +- .../test/helper.ts | 430 +++++-- .../test/node/CollectorExporter.test.ts | 21 +- 53 files changed, 5402 insertions(+), 1062 deletions(-) create mode 100644 packages/opentelemetry-core/src/platform/browser/hex-to-bytes.ts rename packages/{opentelemetry-exporter-collector/src/platform/node/grpc/types/index.ts => opentelemetry-core/src/platform/node/hex-to-bytes.ts} (58%) delete mode 160000 packages/opentelemetry-exporter-collector/src/platform/node/grpc/protos delete mode 100644 packages/opentelemetry-exporter-collector/src/platform/node/grpc/types/opentelemetry.ts create mode 100644 packages/opentelemetry-exporter-collector/src/platform/node/protos/.gitattributes create mode 100644 packages/opentelemetry-exporter-collector/src/platform/node/protos/.gitignore create mode 100644 packages/opentelemetry-exporter-collector/src/platform/node/protos/.travis.yml create mode 100644 packages/opentelemetry-exporter-collector/src/platform/node/protos/CHANGELOG.md create mode 100644 packages/opentelemetry-exporter-collector/src/platform/node/protos/CODEOWNERS create mode 100644 packages/opentelemetry-exporter-collector/src/platform/node/protos/CONTRIBUTING.md create mode 100644 packages/opentelemetry-exporter-collector/src/platform/node/protos/LICENSE create mode 100644 packages/opentelemetry-exporter-collector/src/platform/node/protos/README.md create mode 100644 packages/opentelemetry-exporter-collector/src/platform/node/protos/RELEASING.md create mode 100644 packages/opentelemetry-exporter-collector/src/platform/node/protos/gen/go/collector/metrics/v1/metrics_service.pb.go create mode 100644 packages/opentelemetry-exporter-collector/src/platform/node/protos/gen/go/collector/metrics/v1/metrics_service.pb.gw.go create mode 100644 packages/opentelemetry-exporter-collector/src/platform/node/protos/gen/go/collector/trace/v1/trace_config.pb.go create mode 100644 packages/opentelemetry-exporter-collector/src/platform/node/protos/gen/go/collector/trace/v1/trace_service.pb.go create mode 100644 packages/opentelemetry-exporter-collector/src/platform/node/protos/gen/go/collector/trace/v1/trace_service.pb.gw.go create mode 100644 packages/opentelemetry-exporter-collector/src/platform/node/protos/gen/go/common/v1/common.pb.go create mode 100644 packages/opentelemetry-exporter-collector/src/platform/node/protos/gen/go/metrics/v1/metrics.pb.go create mode 100644 packages/opentelemetry-exporter-collector/src/platform/node/protos/gen/go/resource/v1/resource.pb.go create mode 100644 packages/opentelemetry-exporter-collector/src/platform/node/protos/gen/go/trace/v1/trace.pb.go create mode 100755 packages/opentelemetry-exporter-collector/src/platform/node/protos/install-proto-osx.sh create mode 100755 packages/opentelemetry-exporter-collector/src/platform/node/protos/install-proto.sh create mode 100755 packages/opentelemetry-exporter-collector/src/platform/node/protos/makefile create mode 100644 packages/opentelemetry-exporter-collector/src/platform/node/protos/opentelemetry/proto/collector/README.md create mode 100644 packages/opentelemetry-exporter-collector/src/platform/node/protos/opentelemetry/proto/collector/metrics/v1/metrics_service.proto create mode 100644 packages/opentelemetry-exporter-collector/src/platform/node/protos/opentelemetry/proto/collector/metrics/v1/metrics_service_http.yaml create mode 100644 packages/opentelemetry-exporter-collector/src/platform/node/protos/opentelemetry/proto/collector/trace/v1/trace_service.proto create mode 100644 packages/opentelemetry-exporter-collector/src/platform/node/protos/opentelemetry/proto/collector/trace/v1/trace_service_http.yaml create mode 100644 packages/opentelemetry-exporter-collector/src/platform/node/protos/opentelemetry/proto/common/v1/common.proto create mode 100644 packages/opentelemetry-exporter-collector/src/platform/node/protos/opentelemetry/proto/metrics/v1/metrics.proto create mode 100644 packages/opentelemetry-exporter-collector/src/platform/node/protos/opentelemetry/proto/resource/v1/resource.proto create mode 100644 packages/opentelemetry-exporter-collector/src/platform/node/protos/opentelemetry/proto/trace/v1/trace.proto create mode 100644 packages/opentelemetry-exporter-collector/src/platform/node/protos/opentelemetry/proto/trace/v1/trace_config.proto create mode 100755 packages/opentelemetry-exporter-collector/src/platform/node/protos/verify-go.sh rename packages/opentelemetry-exporter-collector/src/platform/node/{transform.ts => transform.ts.old} (100%) rename packages/opentelemetry-exporter-collector/src/platform/node/{grpc/types => }/types.ts (88%) diff --git a/.gitmodules b/.gitmodules index 29bb6e2c4d..50b83a59cd 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,3 @@ -[submodule "packages/opentelemetry-exporter-collector/src/platform/node/grpc/protos"] - path = packages/opentelemetry-exporter-collector/src/platform/node/grpc/protos +[submodule "packages/opentelemetry-exporter-collector/src/platform/node/protos"] + path = packages/opentelemetry-exporter-collector/src/platform/node/protos url = git@github.com:open-telemetry/opentelemetry-proto.git diff --git a/examples/basic-tracer-node/docker/ot/collector-config.yaml b/examples/basic-tracer-node/docker/ot/collector-config.yaml index b4bc9cb9fc..f3df32db08 100644 --- a/examples/basic-tracer-node/docker/ot/collector-config.yaml +++ b/examples/basic-tracer-node/docker/ot/collector-config.yaml @@ -1,5 +1,5 @@ receivers: - opencensus: + opentelemetry: endpoint: 0.0.0.0:55678 exporters: @@ -13,6 +13,6 @@ processors: service: pipelines: traces: - receivers: [opencensus] + receivers: [opentelemetry] exporters: [zipkin] processors: [batch, queued_retry] diff --git a/packages/opentelemetry-core/src/platform/browser/hex-to-bytes.ts b/packages/opentelemetry-core/src/platform/browser/hex-to-bytes.ts new file mode 100644 index 0000000000..3d2afaba43 --- /dev/null +++ b/packages/opentelemetry-core/src/platform/browser/hex-to-bytes.ts @@ -0,0 +1,30 @@ +/*! + * Copyright 2019, 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. + */ + +/** + * converts id string into Uint8Array + * @param hexStr - id of span + */ +export function hexToBytes(hexStr: string): any { + const hexStrLen = hexStr.length; + const arr = []; + for (let i = 0; i < hexStrLen; i += 2) { + const hexPair = hexStr.substring(i, i + 2); + const hexVal = parseInt(hexPair, 16); + arr.push(hexVal); + } + return new Uint8Array(arr); +} diff --git a/packages/opentelemetry-core/src/platform/browser/index.ts b/packages/opentelemetry-core/src/platform/browser/index.ts index 4668bb35aa..1c67bf624f 100644 --- a/packages/opentelemetry-core/src/platform/browser/index.ts +++ b/packages/opentelemetry-core/src/platform/browser/index.ts @@ -18,3 +18,4 @@ export * from './id'; export * from './performance'; export * from './timer-util'; export * from './hex-to-base64'; +export * from './hex-to-bytes'; diff --git a/packages/opentelemetry-exporter-collector/src/platform/node/grpc/types/index.ts b/packages/opentelemetry-core/src/platform/node/hex-to-bytes.ts similarity index 58% rename from packages/opentelemetry-exporter-collector/src/platform/node/grpc/types/index.ts rename to packages/opentelemetry-core/src/platform/node/hex-to-bytes.ts index bb1e4e32c9..9a2111525b 100644 --- a/packages/opentelemetry-exporter-collector/src/platform/node/grpc/types/index.ts +++ b/packages/opentelemetry-core/src/platform/node/hex-to-bytes.ts @@ -14,5 +14,18 @@ * limitations under the License. */ -export * from './opentelemetry'; -export * from './types'; +/** + * converts id string into bytes + * @param hexStr - id of span + */ +export function hexToBytes(hexStr: string): Uint8Array { + const hexStrLen = hexStr.length; + let hexAsciiCharsStr = ''; + for (let i = 0; i < hexStrLen; i += 2) { + const hexPair = hexStr.substring(i, i + 2); + const hexVal = parseInt(hexPair, 16); + hexAsciiCharsStr += String.fromCharCode(hexVal); + } + + return Buffer.from(hexAsciiCharsStr, 'ascii'); +} diff --git a/packages/opentelemetry-core/src/platform/node/index.ts b/packages/opentelemetry-core/src/platform/node/index.ts index 4668bb35aa..1c67bf624f 100644 --- a/packages/opentelemetry-core/src/platform/node/index.ts +++ b/packages/opentelemetry-core/src/platform/node/index.ts @@ -18,3 +18,4 @@ export * from './id'; export * from './performance'; export * from './timer-util'; export * from './hex-to-base64'; +export * from './hex-to-bytes'; diff --git a/packages/opentelemetry-exporter-collector/README.md b/packages/opentelemetry-exporter-collector/README.md index 275674470c..6d27c508c1 100644 --- a/packages/opentelemetry-exporter-collector/README.md +++ b/packages/opentelemetry-exporter-collector/README.md @@ -37,6 +37,7 @@ const { BasicTracerProvider, SimpleSpanProcessor } = require('@opentelemetry/tra const { CollectorExporter } = require('@opentelemetry/exporter-collector'); const collectorOptions = { + serviceName: 'basic-service', url: '' // url is optional and can be omitted - default is http://localhost:55678/v1/trace }; diff --git a/packages/opentelemetry-exporter-collector/package.json b/packages/opentelemetry-exporter-collector/package.json index f7b32a8bec..e5598c4cc3 100644 --- a/packages/opentelemetry-exporter-collector/package.json +++ b/packages/opentelemetry-exporter-collector/package.json @@ -18,7 +18,7 @@ "compile": "npm run version:update && tsc -p .", "postcompile": "npm run protos:copy", "prepare": "npm run compile", - "protos:copy": "cpx src/platform/node/grpc/protos/**/*.* build/src/platform/node/grpc/protos", + "protos:copy": "cpx src/platform/node/protos/opentelemetry/**/*.* build/src/platform/node/protos/opentelemetry", "tdd": "npm run test -- --watch-extensions ts --watch", "tdd:browser": "karma start", "test": "nyc ts-mocha -p tsconfig.json 'test/**/*.test.ts' --exclude 'test/browser/**/*.ts'", diff --git a/packages/opentelemetry-exporter-collector/src/CollectorExporter.ts b/packages/opentelemetry-exporter-collector/src/CollectorExporter.ts index 72e802cf0f..370c50d742 100644 --- a/packages/opentelemetry-exporter-collector/src/CollectorExporter.ts +++ b/packages/opentelemetry-exporter-collector/src/CollectorExporter.ts @@ -19,6 +19,7 @@ import { NoopLogger } from '@opentelemetry/core'; import { ReadableSpan, SpanExporter } from '@opentelemetry/tracing'; import { Attributes, Logger } from '@opentelemetry/api'; import { onInit, onShutdown, sendSpans } from './platform/index'; +import { CollectorExporterError } from './types'; /** * Collector Exporter Config @@ -83,8 +84,11 @@ export class CollectorExporter implements SpanExporter { .then(() => { resultCallback(ExportResult.SUCCESS); }) - .catch((status: number = 0) => { - if (status < 500) { + .catch((error: CollectorExporterError) => { + if (error.message) { + this.logger.error(error.message); + } + if (error.code && error.code < 500) { resultCallback(ExportResult.FAILED_NOT_RETRYABLE); } else { resultCallback(ExportResult.FAILED_RETRYABLE); diff --git a/packages/opentelemetry-exporter-collector/src/platform/browser/sendSpans.ts b/packages/opentelemetry-exporter-collector/src/platform/browser/sendSpans.ts index be7e17537d..8cc3110652 100644 --- a/packages/opentelemetry-exporter-collector/src/platform/browser/sendSpans.ts +++ b/packages/opentelemetry-exporter-collector/src/platform/browser/sendSpans.ts @@ -14,14 +14,16 @@ * limitations under the License. */ -import * as core from '@opentelemetry/core'; import { Logger } from '@opentelemetry/api'; import { Resource } from '@opentelemetry/resources'; import { ReadableSpan } from '@opentelemetry/tracing'; import { CollectorExporter } from '../../CollectorExporter'; -import { toCollectorResource, toCollectorSpan } from '../../transform'; +import { + toCollectorExportTraceServiceRequest, + toCollectorResource, + toCollectorSpan, +} from '../../transform'; import * as collectorTypes from '../../types'; -import { VERSION } from '../../version'; /** * function that is called once when {@link ExporterCollector} is initialised @@ -50,35 +52,19 @@ export function onShutdown(collectorExporter: CollectorExporter) { export function sendSpans( spans: ReadableSpan[], onSuccess: () => void, - onError: (status?: number) => void, + onError: (error: collectorTypes.CollectorExporterError) => void, collectorExporter: CollectorExporter ) { - const resource = toCollectorResource( - spans.length > 0 ? spans[0].resource : Resource.empty() - ); - const spansToBeSent: collectorTypes.Span[] = spans.map(span => - toCollectorSpan(span) + const spansToBeSent: collectorTypes.opentelemetryProto.trace.v1.Span[] = spans.map( + span => toCollectorSpan(span) ); + const resource: Resource | undefined = + spans.length > 0 ? spans[0].resource : Resource.empty(); - const exportTraceServiceRequest: collectorTypes.ExportTraceServiceRequest = { - node: { - identifier: { - hostName: collectorExporter.hostName || window.location.host, - startTimestamp: core.hrTimeToTimeStamp(core.hrTime()), - }, - libraryInfo: { - language: collectorTypes.LibraryInfoLanguage.WEB_JS, - coreLibraryVersion: core.VERSION, - exporterVersion: VERSION, - }, - serviceInfo: { - name: collectorExporter.serviceName, - }, - attributes: collectorExporter.attributes, - }, - resource, - spans: spansToBeSent, - }; + const exportTraceServiceRequest = toCollectorExportTraceServiceRequest( + spansToBeSent, + toCollectorResource(resource) + ); const body = JSON.stringify(exportTraceServiceRequest); @@ -112,7 +98,7 @@ export function sendSpans( function sendSpansWithBeacon( body: string, onSuccess: () => void, - onError: (status?: number) => void, + onError: (error: collectorTypes.CollectorExporterError) => void, logger: Logger, collectorUrl: string ) { @@ -121,7 +107,7 @@ function sendSpansWithBeacon( onSuccess(); } else { logger.error('sendBeacon - cannot send', body); - onError(); + onError({}); } } @@ -135,15 +121,16 @@ function sendSpansWithBeacon( * @param collectorUrl */ function sendSpansWithXhr( - body: string, + body: any, onSuccess: () => void, - onError: (status?: number) => void, + onError: (error: collectorTypes.CollectorExporterError) => void, logger: Logger, collectorUrl: string ) { const xhr = new XMLHttpRequest(); xhr.open('POST', collectorUrl); xhr.setRequestHeader(collectorTypes.OT_REQUEST_HEADER, '1'); + // xhr.setRequestHeader('Content-Length', String(body.length)); xhr.send(body); xhr.onreadystatechange = () => { @@ -153,7 +140,10 @@ function sendSpansWithXhr( onSuccess(); } else { logger.error('xhr error', xhr.status, body); - onError(xhr.status); + onError({ + code: xhr.status, + message: xhr.responseText, + }); } } }; diff --git a/packages/opentelemetry-exporter-collector/src/platform/node/grpc/protos b/packages/opentelemetry-exporter-collector/src/platform/node/grpc/protos deleted file mode 160000 index 6a4eb2fa6f..0000000000 --- a/packages/opentelemetry-exporter-collector/src/platform/node/grpc/protos +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 6a4eb2fa6f25569910f7b17216e3a2087496bbce diff --git a/packages/opentelemetry-exporter-collector/src/platform/node/grpc/types/opentelemetry.ts b/packages/opentelemetry-exporter-collector/src/platform/node/grpc/types/opentelemetry.ts deleted file mode 100644 index 4f98afa91e..0000000000 --- a/packages/opentelemetry-exporter-collector/src/platform/node/grpc/types/opentelemetry.ts +++ /dev/null @@ -1,164 +0,0 @@ -/*! - * Copyright 2020, 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 api from '@opentelemetry/api'; - -export namespace opentelemetry.proto { - export namespace collector { - export namespace trace.v1 { - export interface TraceService { - service: opentelemetry.proto.collector.trace.v1.TraceService; - } - - export interface ExportTraceServiceRequest { - resourceSpans: opentelemetry.proto.trace.v1.ResourceSpans[]; - } - - export interface ExportTraceServiceResponse {} - - export interface ExportTraceServiceError { - code: number; - details: string; - metadata: { [key: string]: unknown }; - message: string; - stack: string; - } - } - } - - export namespace resource.v1 { - export interface Resource { - attributes: opentelemetry.proto.common.v1.AttributeKeyValue[]; - droppedAttributesCount: number; - } - } - - export namespace trace.v1 { - export namespace ConstantSampler { - export enum ConstantDecision { - ALWAYS_OFF = 0, - ALWAYS_ON = 1, - ALWAYS_PARENT = 2, - } - } - export namespace Span { - export interface Event { - timeUnixNano: number; - name: string; - attributes?: opentelemetry.proto.common.v1.AttributeKeyValue[]; - droppedAttributesCount: number; - } - - export interface Link { - traceId: Uint8Array; - spanId: Uint8Array; - traceState?: TraceState; - attributes?: opentelemetry.proto.common.v1.AttributeKeyValue[]; - droppedAttributesCount: number; - } - - export enum SpanKind { - SPAN_KIND_UNSPECIFIED, - INTERNAL, - SERVER, - CLIENT, - PRODUCER, - CONSUMER, - } - export type TraceState = string | undefined; - } - - export interface ConstantSampler { - decision?: opentelemetry.proto.trace.v1.ConstantSampler.ConstantDecision; - } - - export interface InstrumentationLibrarySpans { - instrumentationLibrary: opentelemetry.proto.common.v1.InstrumentationLibrary | null; - spans: opentelemetry.proto.trace.v1.Span[]; - } - - export interface ProbabilitySampler { - samplingProbability?: number | null; - } - - export interface RateLimitingSampler { - qps?: number | null; - } - - export interface ResourceSpans { - resource?: opentelemetry.proto.resource.v1.Resource; - instrumentationLibrarySpans: opentelemetry.proto.trace.v1.InstrumentationLibrarySpans[]; - } - - export interface Span { - traceId: Uint8Array; - spanId: Uint8Array; - traceState: opentelemetry.proto.trace.v1.Span.TraceState; - parentSpanId?: Uint8Array; - name?: opentelemetry.proto.trace.v1.TruncatableString; - kind?: opentelemetry.proto.trace.v1.Span.SpanKind; - startTimeUnixNano?: number; - endTimeUnixNano?: number; - attributes?: opentelemetry.proto.common.v1.AttributeKeyValue[]; - droppedAttributesCount: number; - events?: opentelemetry.proto.trace.v1.Span.Event[]; - droppedEventsCount: number; - links?: opentelemetry.proto.trace.v1.Span.Link[]; - droppedLinksCount: number; - status?: Status; - } - - export interface Status extends api.Status {} - - export interface TraceConfig { - constantSampler?: ConstantSampler | null; - probabilitySampler?: ProbabilitySampler | null; - rateLimitingSampler?: RateLimitingSampler | null; - } - - export interface TruncatableString { - value?: string | null; - truncatedByteCount?: number | null; - } - } - export namespace common.v1 { - export interface AttributeKeyValue { - key: string; - type: opentelemetry.proto.common.v1.ValueType; - stringValue?: string; - intValue?: number; - doubleValue?: number; - boolValue?: boolean; - } - - export interface InstrumentationLibrary { - name: string; - version: string; - } - - export interface StringKeyValue { - key: string; - value: string; - } - - export enum ValueType { - STRING, - INT, - DOUBLE, - BOOL, - } - } -} diff --git a/packages/opentelemetry-exporter-collector/src/platform/node/protos/.gitattributes b/packages/opentelemetry-exporter-collector/src/platform/node/protos/.gitattributes new file mode 100644 index 0000000000..6313b56c57 --- /dev/null +++ b/packages/opentelemetry-exporter-collector/src/platform/node/protos/.gitattributes @@ -0,0 +1 @@ +* text=auto eol=lf diff --git a/packages/opentelemetry-exporter-collector/src/platform/node/protos/.gitignore b/packages/opentelemetry-exporter-collector/src/platform/node/protos/.gitignore new file mode 100644 index 0000000000..21e871b49f --- /dev/null +++ b/packages/opentelemetry-exporter-collector/src/platform/node/protos/.gitignore @@ -0,0 +1,19 @@ +# IntelliJ IDEA +.idea +*.iml + +# VS Code +.vscode +.classpath +.project +.settings/ + +# OS X +.DS_Store + +# Emacs +*~ +\#*\# + +# Vim +.swp diff --git a/packages/opentelemetry-exporter-collector/src/platform/node/protos/.travis.yml b/packages/opentelemetry-exporter-collector/src/platform/node/protos/.travis.yml new file mode 100644 index 0000000000..aecd86e993 --- /dev/null +++ b/packages/opentelemetry-exporter-collector/src/platform/node/protos/.travis.yml @@ -0,0 +1,10 @@ +sudo: required +dist: xenial +language: go + +install: + - ./install-proto.sh + +script: + - ./verify-go.sh + - make ci diff --git a/packages/opentelemetry-exporter-collector/src/platform/node/protos/CHANGELOG.md b/packages/opentelemetry-exporter-collector/src/platform/node/protos/CHANGELOG.md new file mode 100644 index 0000000000..9240bce2cd --- /dev/null +++ b/packages/opentelemetry-exporter-collector/src/platform/node/protos/CHANGELOG.md @@ -0,0 +1,5 @@ +# Changelog + +## Unreleased + +- Initial protos for trace, metrics, resource and OTLP. diff --git a/packages/opentelemetry-exporter-collector/src/platform/node/protos/CODEOWNERS b/packages/opentelemetry-exporter-collector/src/platform/node/protos/CODEOWNERS new file mode 100644 index 0000000000..64488e355c --- /dev/null +++ b/packages/opentelemetry-exporter-collector/src/platform/node/protos/CODEOWNERS @@ -0,0 +1,15 @@ +##################################################### +# +# List of approvers for OpenTelemetry Proto repository +# +##################################################### +# +# Learn about membership in OpenTelemetry community: +# https://github.com/open-telemetry/community/blob/master/community-membership.md +# +# +# Learn about CODEOWNERS file format: +# https://help.github.com/en/articles/about-code-owners +# + +* @bogdandrutu @carlosalberto @SergeyKanzhelev @yurishkuro @tedsuo @iredelmeier @arminru @c24t @reyang @tigrannajaryan @jmacd diff --git a/packages/opentelemetry-exporter-collector/src/platform/node/protos/CONTRIBUTING.md b/packages/opentelemetry-exporter-collector/src/platform/node/protos/CONTRIBUTING.md new file mode 100644 index 0000000000..2f7197c000 --- /dev/null +++ b/packages/opentelemetry-exporter-collector/src/platform/node/protos/CONTRIBUTING.md @@ -0,0 +1,24 @@ +# Contributing + +Read OpenTelemetry project [contributing +guide](https://github.com/open-telemetry/community/blob/master/CONTRIBUTING.md) +for general information about the project. + +## Prerequisites + +- Protocol Buffers compiler `protoc`. +- Protocol Buffers Go compiler `protoc-gen-go`. + +Install manually or use: + +- `install-proto.sh` (if on Linux). +- `install-proto-osx.sh` (for mac). + +## Making changes to the .proto files + +Non-backward compatible changes to .proto files are permitted until protocol schema is +declared complete. + +After making any changes to .proto files make sure to generate Go implementation by +running `make gen-go`. Generated files must be included in the same commit as the .proto +files. diff --git a/packages/opentelemetry-exporter-collector/src/platform/node/protos/LICENSE b/packages/opentelemetry-exporter-collector/src/platform/node/protos/LICENSE new file mode 100644 index 0000000000..261eeb9e9f --- /dev/null +++ b/packages/opentelemetry-exporter-collector/src/platform/node/protos/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + 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 + + http://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. diff --git a/packages/opentelemetry-exporter-collector/src/platform/node/protos/README.md b/packages/opentelemetry-exporter-collector/src/platform/node/protos/README.md new file mode 100644 index 0000000000..a08404ec6b --- /dev/null +++ b/packages/opentelemetry-exporter-collector/src/platform/node/protos/README.md @@ -0,0 +1,22 @@ +# Language Independent Interface Types For OpenTelemetry + +The proto files can be consumed as GIT submodule or copied over and built directly in the consumer project. + +The compiled files are published to central repositories (Maven, NPM...) from OpenTelemetry client libraries. + +See [contribution guidelines](CONTRIBUTING.md) if you would like to make any changes. + +## Maturity Level + +Component | Maturity | +-------------------------|----------| +collector/metrics/* | Alpha | +collector/trace/* | Beta | +common/* | Beta | +metrics/* | Alpha | +resource/* | Beta | +trace/trace.proto | Beta | +trace/trace_config.proto | Alpha | + +(See [maturity-matrix.yaml](https://github.com/open-telemetry/community/blob/47813530864b9fe5a5146f466a58bd2bb94edc72/maturity-matrix.yaml#L57) +for definition of maturity levels). \ No newline at end of file diff --git a/packages/opentelemetry-exporter-collector/src/platform/node/protos/RELEASING.md b/packages/opentelemetry-exporter-collector/src/platform/node/protos/RELEASING.md new file mode 100644 index 0000000000..68c451b9b0 --- /dev/null +++ b/packages/opentelemetry-exporter-collector/src/platform/node/protos/RELEASING.md @@ -0,0 +1,94 @@ +# How to Create a Release of OpenTelemetry Proto (for Maintainers Only) + +## Tagging the Release + +Our release branches follow the naming convention of `v..x`, while +the tags include the patch version `v..`. For example, the +same branch `v0.3.x` would be used to create all `v0.3` tags (e.g. `v0.3.0`, +`v0.3.1`). + +In this section upstream repository refers to the main opentelemetry-proto +github repository. + +Before any push to the upstream repository you need to create a [personal access +token](https://help.github.com/articles/creating-a-personal-access-token-for-the-command-line/). + +1. Create the release branch and push it to GitHub: + + ```bash + MAJOR=0 MINOR=3 PATCH=0 # Set appropriately for new release + git checkout -b v$MAJOR.$MINOR.x master + git push upstream v$MAJOR.$MINOR.x + ``` + +2. Enable branch protection for the new branch, if you have admin access. + Otherwise, let someone with admin access know that there is a new release + branch. + + - Open the branch protection settings for the new branch, by following + [Github's instructions](https://help.github.com/articles/configuring-protected-branches/). + - Copy the settings from a previous branch, i.e., check + - `Protect this branch` + - `Require pull request reviews before merging` + - `Require status checks to pass before merging` + - `Include administrators` + + Enable the following required status checks: + - `cla/linuxfoundation` + - `ci/circleci: build` + - Uncheck everything else. + - Click "Save changes". + +3. For `vMajor.Minor.x` branch: + + - Create and push a tag: + + ```bash + git checkout v$MAJOR.$MINOR.x + git pull upstream v$MAJOR.$MINOR.x + git tag -a v$MAJOR.$MINOR.$PATCH -m "Version $MAJOR.$MINOR.$PATCH" + git push upstream v$MAJOR.$MINOR.x + ``` + +## Patch Release + +All patch releases should include only bug-fixes, and must avoid +adding/modifying the public APIs. To cherry-pick one commit use the following +instructions: + +- Create and push a tag: + +```bash +COMMIT=1224f0a # Set the right commit hash. +git checkout -b cherrypick v$MAJOR.$MINOR.x +git cherry-pick -x $COMMIT +git commit -a -m "Cherry-pick commit $COMMIT" +``` + +- Go through PR review and merge it to GitHub v$MAJOR.$MINOR.x branch. + +- Tag a new patch release when all commits are merged. + +## Announcement + +Once deployment is done, go to Github [release +page](https://github.com/open-telemetry/opentelemetry-proto/releases), press +`Draft a new release` to write release notes about the new release. + +You can use `git log upstream/v$MAJOR.$((MINOR-1)).x..upstream/v$MAJOR.$MINOR.x --graph --first-parent` +or the Github [compare tool](https://github.com/open-telemetry/opentelemetry-proto/compare/) +to view a summary of all commits since last release as a reference. + +In addition, you can refer to +[CHANGELOG.md](https://github.com/open-telemetry/opentelemetry-proto/blob/master/CHANGELOG.md) +for a list of major changes since last release. + +## Update release versions in documentations and CHANGELOG files + +After releasing is done, you need to update +[README.md](https://github.com/open-telemetry/opentelemetry-proto/blob/master/README.md) and +[CHANGELOG.md](https://github.com/open-telemetry/opentelemetry-proto/blob/master/CHANGELOG.md). + +Create a PR to mark the new release in +[CHANGELOG.md](https://github.com/census-instrumentation/opencensus-java/blob/master/CHANGELOG.md) +on master branch. diff --git a/packages/opentelemetry-exporter-collector/src/platform/node/protos/gen/go/collector/metrics/v1/metrics_service.pb.go b/packages/opentelemetry-exporter-collector/src/platform/node/protos/gen/go/collector/metrics/v1/metrics_service.pb.go new file mode 100644 index 0000000000..39a22f51ac --- /dev/null +++ b/packages/opentelemetry-exporter-collector/src/platform/node/protos/gen/go/collector/metrics/v1/metrics_service.pb.go @@ -0,0 +1,215 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// source: opentelemetry/proto/collector/metrics/v1/metrics_service.proto + +package v1 + +import ( + context "context" + fmt "fmt" + proto "github.com/golang/protobuf/proto" + v1 "github.com/open-telemetry/opentelemetry-proto/gen/go/metrics/v1" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + math "math" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package + +type ExportMetricsServiceRequest struct { + // An array of ResourceMetrics. + // For data coming from a single resource this array will typically contain one + // element. Intermediary nodes (such as OpenTelemetry Collector) that receive + // data from multiple origins typically batch the data before forwarding further and + // in that case this array will contain multiple elements. + ResourceMetrics []*v1.ResourceMetrics `protobuf:"bytes,1,rep,name=resource_metrics,json=resourceMetrics,proto3" json:"resource_metrics,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ExportMetricsServiceRequest) Reset() { *m = ExportMetricsServiceRequest{} } +func (m *ExportMetricsServiceRequest) String() string { return proto.CompactTextString(m) } +func (*ExportMetricsServiceRequest) ProtoMessage() {} +func (*ExportMetricsServiceRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_75fb6015e6e64798, []int{0} +} + +func (m *ExportMetricsServiceRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ExportMetricsServiceRequest.Unmarshal(m, b) +} +func (m *ExportMetricsServiceRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ExportMetricsServiceRequest.Marshal(b, m, deterministic) +} +func (m *ExportMetricsServiceRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_ExportMetricsServiceRequest.Merge(m, src) +} +func (m *ExportMetricsServiceRequest) XXX_Size() int { + return xxx_messageInfo_ExportMetricsServiceRequest.Size(m) +} +func (m *ExportMetricsServiceRequest) XXX_DiscardUnknown() { + xxx_messageInfo_ExportMetricsServiceRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_ExportMetricsServiceRequest proto.InternalMessageInfo + +func (m *ExportMetricsServiceRequest) GetResourceMetrics() []*v1.ResourceMetrics { + if m != nil { + return m.ResourceMetrics + } + return nil +} + +type ExportMetricsServiceResponse struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ExportMetricsServiceResponse) Reset() { *m = ExportMetricsServiceResponse{} } +func (m *ExportMetricsServiceResponse) String() string { return proto.CompactTextString(m) } +func (*ExportMetricsServiceResponse) ProtoMessage() {} +func (*ExportMetricsServiceResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_75fb6015e6e64798, []int{1} +} + +func (m *ExportMetricsServiceResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ExportMetricsServiceResponse.Unmarshal(m, b) +} +func (m *ExportMetricsServiceResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ExportMetricsServiceResponse.Marshal(b, m, deterministic) +} +func (m *ExportMetricsServiceResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_ExportMetricsServiceResponse.Merge(m, src) +} +func (m *ExportMetricsServiceResponse) XXX_Size() int { + return xxx_messageInfo_ExportMetricsServiceResponse.Size(m) +} +func (m *ExportMetricsServiceResponse) XXX_DiscardUnknown() { + xxx_messageInfo_ExportMetricsServiceResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_ExportMetricsServiceResponse proto.InternalMessageInfo + +func init() { + proto.RegisterType((*ExportMetricsServiceRequest)(nil), "opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceRequest") + proto.RegisterType((*ExportMetricsServiceResponse)(nil), "opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceResponse") +} + +func init() { + proto.RegisterFile("opentelemetry/proto/collector/metrics/v1/metrics_service.proto", fileDescriptor_75fb6015e6e64798) +} + +var fileDescriptor_75fb6015e6e64798 = []byte{ + // 264 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xb2, 0xcb, 0x2f, 0x48, 0xcd, + 0x2b, 0x49, 0xcd, 0x49, 0xcd, 0x4d, 0x2d, 0x29, 0xaa, 0xd4, 0x2f, 0x28, 0xca, 0x2f, 0xc9, 0xd7, + 0x4f, 0xce, 0xcf, 0xc9, 0x49, 0x4d, 0x2e, 0xc9, 0x2f, 0xd2, 0x07, 0x89, 0x66, 0x26, 0x17, 0xeb, + 0x97, 0x19, 0xc2, 0x98, 0xf1, 0xc5, 0xa9, 0x45, 0x65, 0x99, 0xc9, 0xa9, 0x7a, 0x60, 0xa5, 0x42, + 0x1a, 0x28, 0xfa, 0x21, 0x82, 0x7a, 0x70, 0xfd, 0x7a, 0x50, 0x4d, 0x7a, 0x65, 0x86, 0x52, 0x3a, + 0xd8, 0x6c, 0xc2, 0x34, 0x1f, 0x62, 0x84, 0x52, 0x25, 0x97, 0xb4, 0x6b, 0x45, 0x41, 0x7e, 0x51, + 0x89, 0x2f, 0x44, 0x38, 0x18, 0x62, 0x6b, 0x50, 0x6a, 0x61, 0x69, 0x6a, 0x71, 0x89, 0x50, 0x14, + 0x97, 0x40, 0x51, 0x6a, 0x71, 0x7e, 0x69, 0x51, 0x72, 0x6a, 0x3c, 0x54, 0xa3, 0x04, 0xa3, 0x02, + 0xb3, 0x06, 0xb7, 0x91, 0xbe, 0x1e, 0x36, 0x17, 0x21, 0xdc, 0xa1, 0x17, 0x04, 0xd5, 0x07, 0x35, + 0x38, 0x88, 0xbf, 0x08, 0x55, 0x40, 0x49, 0x8e, 0x4b, 0x06, 0xbb, 0xd5, 0xc5, 0x05, 0xf9, 0x79, + 0xc5, 0xa9, 0x46, 0x6b, 0x18, 0xb9, 0xf8, 0x50, 0xa5, 0x84, 0x66, 0x32, 0x72, 0xb1, 0x41, 0xf4, + 0x08, 0xb9, 0xea, 0x11, 0x1b, 0x22, 0x7a, 0x78, 0x3c, 0x28, 0xe5, 0x46, 0xa9, 0x31, 0x10, 0xc7, + 0x2a, 0x31, 0x38, 0xf5, 0x33, 0x72, 0x69, 0x67, 0xe6, 0x13, 0x6d, 0x9c, 0x93, 0x30, 0xaa, 0x49, + 0x01, 0x20, 0x95, 0x01, 0x8c, 0x51, 0x9e, 0xe9, 0x99, 0x25, 0x19, 0xa5, 0x49, 0x7a, 0xc9, 0xf9, + 0xb9, 0xfa, 0x20, 0xb3, 0x74, 0x11, 0x51, 0x89, 0x62, 0xb4, 0x2e, 0x24, 0x62, 0xd3, 0x53, 0xf3, + 0xf4, 0xd3, 0xb1, 0xa7, 0xa4, 0x24, 0x36, 0xb0, 0x12, 0x63, 0x40, 0x00, 0x00, 0x00, 0xff, 0xff, + 0xaa, 0xdd, 0xdf, 0x49, 0x7c, 0x02, 0x00, 0x00, +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// MetricsServiceClient is the client API for MetricsService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type MetricsServiceClient interface { + // For performance reasons, it is recommended to keep this RPC + // alive for the entire life of the application. + Export(ctx context.Context, in *ExportMetricsServiceRequest, opts ...grpc.CallOption) (*ExportMetricsServiceResponse, error) +} + +type metricsServiceClient struct { + cc *grpc.ClientConn +} + +func NewMetricsServiceClient(cc *grpc.ClientConn) MetricsServiceClient { + return &metricsServiceClient{cc} +} + +func (c *metricsServiceClient) Export(ctx context.Context, in *ExportMetricsServiceRequest, opts ...grpc.CallOption) (*ExportMetricsServiceResponse, error) { + out := new(ExportMetricsServiceResponse) + err := c.cc.Invoke(ctx, "/opentelemetry.proto.collector.metrics.v1.MetricsService/Export", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// MetricsServiceServer is the server API for MetricsService service. +type MetricsServiceServer interface { + // For performance reasons, it is recommended to keep this RPC + // alive for the entire life of the application. + Export(context.Context, *ExportMetricsServiceRequest) (*ExportMetricsServiceResponse, error) +} + +// UnimplementedMetricsServiceServer can be embedded to have forward compatible implementations. +type UnimplementedMetricsServiceServer struct { +} + +func (*UnimplementedMetricsServiceServer) Export(ctx context.Context, req *ExportMetricsServiceRequest) (*ExportMetricsServiceResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Export not implemented") +} + +func RegisterMetricsServiceServer(s *grpc.Server, srv MetricsServiceServer) { + s.RegisterService(&_MetricsService_serviceDesc, srv) +} + +func _MetricsService_Export_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ExportMetricsServiceRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MetricsServiceServer).Export(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/opentelemetry.proto.collector.metrics.v1.MetricsService/Export", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MetricsServiceServer).Export(ctx, req.(*ExportMetricsServiceRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _MetricsService_serviceDesc = grpc.ServiceDesc{ + ServiceName: "opentelemetry.proto.collector.metrics.v1.MetricsService", + HandlerType: (*MetricsServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Export", + Handler: _MetricsService_Export_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "opentelemetry/proto/collector/metrics/v1/metrics_service.proto", +} diff --git a/packages/opentelemetry-exporter-collector/src/platform/node/protos/gen/go/collector/metrics/v1/metrics_service.pb.gw.go b/packages/opentelemetry-exporter-collector/src/platform/node/protos/gen/go/collector/metrics/v1/metrics_service.pb.gw.go new file mode 100644 index 0000000000..3bd2374a42 --- /dev/null +++ b/packages/opentelemetry-exporter-collector/src/platform/node/protos/gen/go/collector/metrics/v1/metrics_service.pb.gw.go @@ -0,0 +1,115 @@ +// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. +// source: opentelemetry/proto/collector/metrics/v1/metrics_service.proto + +/* +Package v1 is a reverse proxy. + +It translates gRPC into RESTful JSON APIs. +*/ +package v1 + +import ( + "context" + "io" + "net/http" + + "github.com/golang/protobuf/proto" + "github.com/grpc-ecosystem/grpc-gateway/runtime" + "github.com/grpc-ecosystem/grpc-gateway/utilities" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/status" +) + +var _ codes.Code +var _ io.Reader +var _ status.Status +var _ = runtime.String +var _ = utilities.NewDoubleArray + +func request_MetricsService_Export_0(ctx context.Context, marshaler runtime.Marshaler, client MetricsServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq ExportMetricsServiceRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.Export(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +// RegisterMetricsServiceHandlerFromEndpoint is same as RegisterMetricsServiceHandler but +// automatically dials to "endpoint" and closes the connection when "ctx" gets done. +func RegisterMetricsServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { + conn, err := grpc.Dial(endpoint, opts...) + if err != nil { + return err + } + defer func() { + if err != nil { + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + return + } + go func() { + <-ctx.Done() + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + }() + }() + + return RegisterMetricsServiceHandler(ctx, mux, conn) +} + +// RegisterMetricsServiceHandler registers the http handlers for service MetricsService to "mux". +// The handlers forward requests to the grpc endpoint over "conn". +func RegisterMetricsServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { + return RegisterMetricsServiceHandlerClient(ctx, mux, NewMetricsServiceClient(conn)) +} + +// RegisterMetricsServiceHandlerClient registers the http handlers for service MetricsService +// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "MetricsServiceClient". +// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "MetricsServiceClient" +// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in +// "MetricsServiceClient" to call the correct interceptors. +func RegisterMetricsServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client MetricsServiceClient) error { + + mux.Handle("POST", pattern_MetricsService_Export_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_MetricsService_Export_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_MetricsService_Export_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +var ( + pattern_MetricsService_Export_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "metrics"}, "", runtime.AssumeColonVerbOpt(true))) +) + +var ( + forward_MetricsService_Export_0 = runtime.ForwardResponseMessage +) diff --git a/packages/opentelemetry-exporter-collector/src/platform/node/protos/gen/go/collector/trace/v1/trace_config.pb.go b/packages/opentelemetry-exporter-collector/src/platform/node/protos/gen/go/collector/trace/v1/trace_config.pb.go new file mode 100644 index 0000000000..11781ccbe6 --- /dev/null +++ b/packages/opentelemetry-exporter-collector/src/platform/node/protos/gen/go/collector/trace/v1/trace_config.pb.go @@ -0,0 +1,368 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// source: opentelemetry/proto/trace/v1/trace_config.proto + +package v1 + +import ( + fmt "fmt" + proto "github.com/golang/protobuf/proto" + math "math" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package + +// How spans should be sampled: +// - Always off +// - Always on +// - Always follow the parent Span's decision (off if no parent). +type ConstantSampler_ConstantDecision int32 + +const ( + ConstantSampler_ALWAYS_OFF ConstantSampler_ConstantDecision = 0 + ConstantSampler_ALWAYS_ON ConstantSampler_ConstantDecision = 1 + ConstantSampler_ALWAYS_PARENT ConstantSampler_ConstantDecision = 2 +) + +var ConstantSampler_ConstantDecision_name = map[int32]string{ + 0: "ALWAYS_OFF", + 1: "ALWAYS_ON", + 2: "ALWAYS_PARENT", +} + +var ConstantSampler_ConstantDecision_value = map[string]int32{ + "ALWAYS_OFF": 0, + "ALWAYS_ON": 1, + "ALWAYS_PARENT": 2, +} + +func (x ConstantSampler_ConstantDecision) String() string { + return proto.EnumName(ConstantSampler_ConstantDecision_name, int32(x)) +} + +func (ConstantSampler_ConstantDecision) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_5936aa8fa6443e6f, []int{1, 0} +} + +// Global configuration of the trace service. All fields must be specified, or +// the default (zero) values will be used for each type. +type TraceConfig struct { + // The global default sampler used to make decisions on span sampling. + // + // Types that are valid to be assigned to Sampler: + // *TraceConfig_ConstantSampler + // *TraceConfig_ProbabilitySampler + // *TraceConfig_RateLimitingSampler + Sampler isTraceConfig_Sampler `protobuf_oneof:"sampler"` + // The global default max number of attributes per span. + MaxNumberOfAttributes int64 `protobuf:"varint,4,opt,name=max_number_of_attributes,json=maxNumberOfAttributes,proto3" json:"max_number_of_attributes,omitempty"` + // The global default max number of annotation events per span. + MaxNumberOfTimedEvents int64 `protobuf:"varint,5,opt,name=max_number_of_timed_events,json=maxNumberOfTimedEvents,proto3" json:"max_number_of_timed_events,omitempty"` + // The global default max number of attributes per timed event. + MaxNumberOfAttributesPerTimedEvent int64 `protobuf:"varint,6,opt,name=max_number_of_attributes_per_timed_event,json=maxNumberOfAttributesPerTimedEvent,proto3" json:"max_number_of_attributes_per_timed_event,omitempty"` + // The global default max number of link entries per span. + MaxNumberOfLinks int64 `protobuf:"varint,7,opt,name=max_number_of_links,json=maxNumberOfLinks,proto3" json:"max_number_of_links,omitempty"` + // The global default max number of attributes per span. + MaxNumberOfAttributesPerLink int64 `protobuf:"varint,8,opt,name=max_number_of_attributes_per_link,json=maxNumberOfAttributesPerLink,proto3" json:"max_number_of_attributes_per_link,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *TraceConfig) Reset() { *m = TraceConfig{} } +func (m *TraceConfig) String() string { return proto.CompactTextString(m) } +func (*TraceConfig) ProtoMessage() {} +func (*TraceConfig) Descriptor() ([]byte, []int) { + return fileDescriptor_5936aa8fa6443e6f, []int{0} +} + +func (m *TraceConfig) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_TraceConfig.Unmarshal(m, b) +} +func (m *TraceConfig) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_TraceConfig.Marshal(b, m, deterministic) +} +func (m *TraceConfig) XXX_Merge(src proto.Message) { + xxx_messageInfo_TraceConfig.Merge(m, src) +} +func (m *TraceConfig) XXX_Size() int { + return xxx_messageInfo_TraceConfig.Size(m) +} +func (m *TraceConfig) XXX_DiscardUnknown() { + xxx_messageInfo_TraceConfig.DiscardUnknown(m) +} + +var xxx_messageInfo_TraceConfig proto.InternalMessageInfo + +type isTraceConfig_Sampler interface { + isTraceConfig_Sampler() +} + +type TraceConfig_ConstantSampler struct { + ConstantSampler *ConstantSampler `protobuf:"bytes,1,opt,name=constant_sampler,json=constantSampler,proto3,oneof"` +} + +type TraceConfig_ProbabilitySampler struct { + ProbabilitySampler *ProbabilitySampler `protobuf:"bytes,2,opt,name=probability_sampler,json=probabilitySampler,proto3,oneof"` +} + +type TraceConfig_RateLimitingSampler struct { + RateLimitingSampler *RateLimitingSampler `protobuf:"bytes,3,opt,name=rate_limiting_sampler,json=rateLimitingSampler,proto3,oneof"` +} + +func (*TraceConfig_ConstantSampler) isTraceConfig_Sampler() {} + +func (*TraceConfig_ProbabilitySampler) isTraceConfig_Sampler() {} + +func (*TraceConfig_RateLimitingSampler) isTraceConfig_Sampler() {} + +func (m *TraceConfig) GetSampler() isTraceConfig_Sampler { + if m != nil { + return m.Sampler + } + return nil +} + +func (m *TraceConfig) GetConstantSampler() *ConstantSampler { + if x, ok := m.GetSampler().(*TraceConfig_ConstantSampler); ok { + return x.ConstantSampler + } + return nil +} + +func (m *TraceConfig) GetProbabilitySampler() *ProbabilitySampler { + if x, ok := m.GetSampler().(*TraceConfig_ProbabilitySampler); ok { + return x.ProbabilitySampler + } + return nil +} + +func (m *TraceConfig) GetRateLimitingSampler() *RateLimitingSampler { + if x, ok := m.GetSampler().(*TraceConfig_RateLimitingSampler); ok { + return x.RateLimitingSampler + } + return nil +} + +func (m *TraceConfig) GetMaxNumberOfAttributes() int64 { + if m != nil { + return m.MaxNumberOfAttributes + } + return 0 +} + +func (m *TraceConfig) GetMaxNumberOfTimedEvents() int64 { + if m != nil { + return m.MaxNumberOfTimedEvents + } + return 0 +} + +func (m *TraceConfig) GetMaxNumberOfAttributesPerTimedEvent() int64 { + if m != nil { + return m.MaxNumberOfAttributesPerTimedEvent + } + return 0 +} + +func (m *TraceConfig) GetMaxNumberOfLinks() int64 { + if m != nil { + return m.MaxNumberOfLinks + } + return 0 +} + +func (m *TraceConfig) GetMaxNumberOfAttributesPerLink() int64 { + if m != nil { + return m.MaxNumberOfAttributesPerLink + } + return 0 +} + +// XXX_OneofWrappers is for the internal use of the proto package. +func (*TraceConfig) XXX_OneofWrappers() []interface{} { + return []interface{}{ + (*TraceConfig_ConstantSampler)(nil), + (*TraceConfig_ProbabilitySampler)(nil), + (*TraceConfig_RateLimitingSampler)(nil), + } +} + +// Sampler that always makes a constant decision on span sampling. +type ConstantSampler struct { + Decision ConstantSampler_ConstantDecision `protobuf:"varint,1,opt,name=decision,proto3,enum=opentelemetry.proto.trace.v1.ConstantSampler_ConstantDecision" json:"decision,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ConstantSampler) Reset() { *m = ConstantSampler{} } +func (m *ConstantSampler) String() string { return proto.CompactTextString(m) } +func (*ConstantSampler) ProtoMessage() {} +func (*ConstantSampler) Descriptor() ([]byte, []int) { + return fileDescriptor_5936aa8fa6443e6f, []int{1} +} + +func (m *ConstantSampler) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ConstantSampler.Unmarshal(m, b) +} +func (m *ConstantSampler) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ConstantSampler.Marshal(b, m, deterministic) +} +func (m *ConstantSampler) XXX_Merge(src proto.Message) { + xxx_messageInfo_ConstantSampler.Merge(m, src) +} +func (m *ConstantSampler) XXX_Size() int { + return xxx_messageInfo_ConstantSampler.Size(m) +} +func (m *ConstantSampler) XXX_DiscardUnknown() { + xxx_messageInfo_ConstantSampler.DiscardUnknown(m) +} + +var xxx_messageInfo_ConstantSampler proto.InternalMessageInfo + +func (m *ConstantSampler) GetDecision() ConstantSampler_ConstantDecision { + if m != nil { + return m.Decision + } + return ConstantSampler_ALWAYS_OFF +} + +// Sampler that tries to uniformly sample traces with a given probability. +// The probability of sampling a trace is equal to that of the specified probability. +type ProbabilitySampler struct { + // The desired probability of sampling. Must be within [0.0, 1.0]. + SamplingProbability float64 `protobuf:"fixed64,1,opt,name=samplingProbability,proto3" json:"samplingProbability,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ProbabilitySampler) Reset() { *m = ProbabilitySampler{} } +func (m *ProbabilitySampler) String() string { return proto.CompactTextString(m) } +func (*ProbabilitySampler) ProtoMessage() {} +func (*ProbabilitySampler) Descriptor() ([]byte, []int) { + return fileDescriptor_5936aa8fa6443e6f, []int{2} +} + +func (m *ProbabilitySampler) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ProbabilitySampler.Unmarshal(m, b) +} +func (m *ProbabilitySampler) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ProbabilitySampler.Marshal(b, m, deterministic) +} +func (m *ProbabilitySampler) XXX_Merge(src proto.Message) { + xxx_messageInfo_ProbabilitySampler.Merge(m, src) +} +func (m *ProbabilitySampler) XXX_Size() int { + return xxx_messageInfo_ProbabilitySampler.Size(m) +} +func (m *ProbabilitySampler) XXX_DiscardUnknown() { + xxx_messageInfo_ProbabilitySampler.DiscardUnknown(m) +} + +var xxx_messageInfo_ProbabilitySampler proto.InternalMessageInfo + +func (m *ProbabilitySampler) GetSamplingProbability() float64 { + if m != nil { + return m.SamplingProbability + } + return 0 +} + +// Sampler that tries to sample with a rate per time window. +type RateLimitingSampler struct { + // Rate per second. + Qps int64 `protobuf:"varint,1,opt,name=qps,proto3" json:"qps,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *RateLimitingSampler) Reset() { *m = RateLimitingSampler{} } +func (m *RateLimitingSampler) String() string { return proto.CompactTextString(m) } +func (*RateLimitingSampler) ProtoMessage() {} +func (*RateLimitingSampler) Descriptor() ([]byte, []int) { + return fileDescriptor_5936aa8fa6443e6f, []int{3} +} + +func (m *RateLimitingSampler) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_RateLimitingSampler.Unmarshal(m, b) +} +func (m *RateLimitingSampler) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_RateLimitingSampler.Marshal(b, m, deterministic) +} +func (m *RateLimitingSampler) XXX_Merge(src proto.Message) { + xxx_messageInfo_RateLimitingSampler.Merge(m, src) +} +func (m *RateLimitingSampler) XXX_Size() int { + return xxx_messageInfo_RateLimitingSampler.Size(m) +} +func (m *RateLimitingSampler) XXX_DiscardUnknown() { + xxx_messageInfo_RateLimitingSampler.DiscardUnknown(m) +} + +var xxx_messageInfo_RateLimitingSampler proto.InternalMessageInfo + +func (m *RateLimitingSampler) GetQps() int64 { + if m != nil { + return m.Qps + } + return 0 +} + +func init() { + proto.RegisterEnum("opentelemetry.proto.trace.v1.ConstantSampler_ConstantDecision", ConstantSampler_ConstantDecision_name, ConstantSampler_ConstantDecision_value) + proto.RegisterType((*TraceConfig)(nil), "opentelemetry.proto.trace.v1.TraceConfig") + proto.RegisterType((*ConstantSampler)(nil), "opentelemetry.proto.trace.v1.ConstantSampler") + proto.RegisterType((*ProbabilitySampler)(nil), "opentelemetry.proto.trace.v1.ProbabilitySampler") + proto.RegisterType((*RateLimitingSampler)(nil), "opentelemetry.proto.trace.v1.RateLimitingSampler") +} + +func init() { + proto.RegisterFile("opentelemetry/proto/trace/v1/trace_config.proto", fileDescriptor_5936aa8fa6443e6f) +} + +var fileDescriptor_5936aa8fa6443e6f = []byte{ + // 509 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x94, 0x4d, 0x6f, 0x9b, 0x4c, + 0x14, 0x85, 0x43, 0xfc, 0xe6, 0xeb, 0x46, 0x49, 0x78, 0x07, 0xa5, 0x42, 0x55, 0xa4, 0xa6, 0x6c, + 0xea, 0x8d, 0x21, 0x4e, 0x17, 0x95, 0xba, 0xa8, 0x64, 0x27, 0x71, 0xba, 0xb0, 0x1c, 0x44, 0x2c, + 0x55, 0xf5, 0x06, 0xc1, 0x64, 0x4c, 0x47, 0x85, 0x19, 0x3a, 0x8c, 0xad, 0x64, 0xd3, 0x5d, 0x7f, + 0x51, 0xff, 0x60, 0xc5, 0x98, 0xf2, 0x11, 0x3b, 0x48, 0xdd, 0x71, 0xef, 0xe1, 0x3c, 0x67, 0xc6, + 0xbe, 0x5c, 0x70, 0x78, 0x4a, 0x98, 0x24, 0x31, 0x49, 0x88, 0x14, 0x4f, 0x4e, 0x2a, 0xb8, 0xe4, + 0x8e, 0x14, 0x01, 0x26, 0xce, 0xb2, 0xbf, 0x7a, 0xf0, 0x31, 0x67, 0x73, 0x1a, 0xd9, 0x4a, 0x43, + 0x67, 0x0d, 0xc3, 0xaa, 0x69, 0xab, 0xf7, 0xec, 0x65, 0xdf, 0xfa, 0xb5, 0x03, 0x87, 0xd3, 0xbc, + 0xb8, 0x52, 0x1e, 0x34, 0x03, 0x1d, 0x73, 0x96, 0xc9, 0x80, 0x49, 0x3f, 0x0b, 0x92, 0x34, 0x26, + 0xc2, 0xd4, 0xce, 0xb5, 0xee, 0xe1, 0x65, 0xcf, 0x6e, 0x03, 0xd9, 0x57, 0x85, 0xeb, 0x7e, 0x65, + 0xfa, 0xbc, 0xe5, 0x9d, 0xe0, 0x66, 0x0b, 0x61, 0x30, 0x52, 0xc1, 0xc3, 0x20, 0xa4, 0x31, 0x95, + 0x4f, 0x25, 0x7e, 0x5b, 0xe1, 0x2f, 0xda, 0xf1, 0x6e, 0x65, 0xac, 0x12, 0x50, 0xba, 0xd6, 0x45, + 0x11, 0x9c, 0x8a, 0x40, 0x12, 0x3f, 0xa6, 0x09, 0x95, 0x94, 0x45, 0x65, 0x4c, 0x47, 0xc5, 0xf4, + 0xdb, 0x63, 0xbc, 0x40, 0x92, 0x71, 0xe1, 0xac, 0x72, 0x0c, 0xb1, 0xde, 0x46, 0x1f, 0xc0, 0x4c, + 0x82, 0x47, 0x9f, 0x2d, 0x92, 0x90, 0x08, 0x9f, 0xcf, 0xfd, 0x40, 0x4a, 0x41, 0xc3, 0x85, 0x24, + 0x99, 0xf9, 0xdf, 0xb9, 0xd6, 0xed, 0x78, 0xa7, 0x49, 0xf0, 0x38, 0x51, 0xf2, 0xdd, 0x7c, 0x50, + 0x8a, 0xe8, 0x23, 0xbc, 0x6e, 0x1a, 0x25, 0x4d, 0xc8, 0x83, 0x4f, 0x96, 0x84, 0xc9, 0xcc, 0xdc, + 0x51, 0xd6, 0x57, 0x35, 0xeb, 0x34, 0x97, 0x6f, 0x94, 0x8a, 0xa6, 0xd0, 0x7d, 0x29, 0xd4, 0x4f, + 0x89, 0xa8, 0xa3, 0xcc, 0x5d, 0x45, 0xb2, 0x36, 0x1e, 0xc2, 0x25, 0xa2, 0xc2, 0xa2, 0x1e, 0x18, + 0x4d, 0x6a, 0x4c, 0xd9, 0xf7, 0xcc, 0xdc, 0x53, 0x00, 0xbd, 0x06, 0x18, 0xe7, 0x7d, 0x74, 0x0b, + 0x6f, 0x5b, 0x0f, 0x91, 0xbb, 0xcd, 0x7d, 0x65, 0x3e, 0x7b, 0x29, 0x3d, 0x27, 0x0d, 0x0f, 0x60, + 0xaf, 0xf8, 0x77, 0xac, 0xdf, 0x1a, 0x9c, 0x3c, 0x1b, 0x21, 0x34, 0x83, 0xfd, 0x07, 0x82, 0x69, + 0x46, 0x39, 0x53, 0x33, 0x78, 0x7c, 0xf9, 0xe9, 0x9f, 0x66, 0xb0, 0xac, 0xaf, 0x0b, 0x8a, 0x57, + 0xf2, 0xac, 0x6b, 0xd0, 0x9f, 0xab, 0xe8, 0x18, 0x60, 0x30, 0xfe, 0x32, 0xf8, 0x7a, 0xef, 0xdf, + 0x8d, 0x46, 0xfa, 0x16, 0x3a, 0x82, 0x83, 0xbf, 0xf5, 0x44, 0xd7, 0xd0, 0xff, 0x70, 0x54, 0x94, + 0xee, 0xc0, 0xbb, 0x99, 0x4c, 0xf5, 0x6d, 0x6b, 0x04, 0x68, 0x7d, 0x30, 0xd1, 0x05, 0x18, 0xea, + 0x5a, 0x94, 0x45, 0x35, 0x55, 0x5d, 0x41, 0xf3, 0x36, 0x49, 0xd6, 0x3b, 0x30, 0x36, 0x4c, 0x1e, + 0xd2, 0xa1, 0xf3, 0x23, 0xcd, 0x94, 0xb1, 0xe3, 0xe5, 0x8f, 0xc3, 0x9f, 0xf0, 0x86, 0xf2, 0xd6, + 0x1f, 0x61, 0xa8, 0xd7, 0x3e, 0x67, 0x37, 0x97, 0x5c, 0x6d, 0x76, 0x1b, 0x51, 0xf9, 0x6d, 0x11, + 0xda, 0x98, 0x27, 0x6a, 0x7f, 0xf4, 0xaa, 0x05, 0xd2, 0x60, 0xf5, 0x56, 0xeb, 0x24, 0x22, 0xcc, + 0x89, 0xb8, 0x83, 0x79, 0x1c, 0x13, 0x2c, 0xb9, 0x28, 0xf7, 0x4b, 0xb8, 0xab, 0x5e, 0x78, 0xff, + 0x27, 0x00, 0x00, 0xff, 0xff, 0xe4, 0x80, 0x54, 0x8b, 0x86, 0x04, 0x00, 0x00, +} diff --git a/packages/opentelemetry-exporter-collector/src/platform/node/protos/gen/go/collector/trace/v1/trace_service.pb.go b/packages/opentelemetry-exporter-collector/src/platform/node/protos/gen/go/collector/trace/v1/trace_service.pb.go new file mode 100644 index 0000000000..705c8c1575 --- /dev/null +++ b/packages/opentelemetry-exporter-collector/src/platform/node/protos/gen/go/collector/trace/v1/trace_service.pb.go @@ -0,0 +1,215 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// source: opentelemetry/proto/collector/trace/v1/trace_service.proto + +package v1 + +import ( + context "context" + fmt "fmt" + proto "github.com/golang/protobuf/proto" + v1 "github.com/open-telemetry/opentelemetry-proto/gen/go/trace/v1" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + math "math" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package + +type ExportTraceServiceRequest struct { + // An array of ResourceSpans. + // For data coming from a single resource this array will typically contain one + // element. Intermediary nodes (such as OpenTelemetry Collector) that receive + // data from multiple origins typically batch the data before forwarding further and + // in that case this array will contain multiple elements. + ResourceSpans []*v1.ResourceSpans `protobuf:"bytes,1,rep,name=resource_spans,json=resourceSpans,proto3" json:"resource_spans,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ExportTraceServiceRequest) Reset() { *m = ExportTraceServiceRequest{} } +func (m *ExportTraceServiceRequest) String() string { return proto.CompactTextString(m) } +func (*ExportTraceServiceRequest) ProtoMessage() {} +func (*ExportTraceServiceRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_192a962890318cf4, []int{0} +} + +func (m *ExportTraceServiceRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ExportTraceServiceRequest.Unmarshal(m, b) +} +func (m *ExportTraceServiceRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ExportTraceServiceRequest.Marshal(b, m, deterministic) +} +func (m *ExportTraceServiceRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_ExportTraceServiceRequest.Merge(m, src) +} +func (m *ExportTraceServiceRequest) XXX_Size() int { + return xxx_messageInfo_ExportTraceServiceRequest.Size(m) +} +func (m *ExportTraceServiceRequest) XXX_DiscardUnknown() { + xxx_messageInfo_ExportTraceServiceRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_ExportTraceServiceRequest proto.InternalMessageInfo + +func (m *ExportTraceServiceRequest) GetResourceSpans() []*v1.ResourceSpans { + if m != nil { + return m.ResourceSpans + } + return nil +} + +type ExportTraceServiceResponse struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ExportTraceServiceResponse) Reset() { *m = ExportTraceServiceResponse{} } +func (m *ExportTraceServiceResponse) String() string { return proto.CompactTextString(m) } +func (*ExportTraceServiceResponse) ProtoMessage() {} +func (*ExportTraceServiceResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_192a962890318cf4, []int{1} +} + +func (m *ExportTraceServiceResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ExportTraceServiceResponse.Unmarshal(m, b) +} +func (m *ExportTraceServiceResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ExportTraceServiceResponse.Marshal(b, m, deterministic) +} +func (m *ExportTraceServiceResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_ExportTraceServiceResponse.Merge(m, src) +} +func (m *ExportTraceServiceResponse) XXX_Size() int { + return xxx_messageInfo_ExportTraceServiceResponse.Size(m) +} +func (m *ExportTraceServiceResponse) XXX_DiscardUnknown() { + xxx_messageInfo_ExportTraceServiceResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_ExportTraceServiceResponse proto.InternalMessageInfo + +func init() { + proto.RegisterType((*ExportTraceServiceRequest)(nil), "opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest") + proto.RegisterType((*ExportTraceServiceResponse)(nil), "opentelemetry.proto.collector.trace.v1.ExportTraceServiceResponse") +} + +func init() { + proto.RegisterFile("opentelemetry/proto/collector/trace/v1/trace_service.proto", fileDescriptor_192a962890318cf4) +} + +var fileDescriptor_192a962890318cf4 = []byte{ + // 265 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xb2, 0xca, 0x2f, 0x48, 0xcd, + 0x2b, 0x49, 0xcd, 0x49, 0xcd, 0x4d, 0x2d, 0x29, 0xaa, 0xd4, 0x2f, 0x28, 0xca, 0x2f, 0xc9, 0xd7, + 0x4f, 0xce, 0xcf, 0xc9, 0x49, 0x4d, 0x2e, 0xc9, 0x2f, 0xd2, 0x2f, 0x29, 0x4a, 0x4c, 0x4e, 0xd5, + 0x2f, 0x33, 0x84, 0x30, 0xe2, 0x8b, 0x53, 0x8b, 0xca, 0x32, 0x93, 0x53, 0xf5, 0xc0, 0xca, 0x84, + 0xd4, 0x50, 0xf4, 0x42, 0x04, 0xf5, 0xe0, 0x7a, 0xf5, 0xc0, 0x5a, 0xf4, 0xca, 0x0c, 0xa5, 0x34, + 0xb0, 0xd9, 0x81, 0x6a, 0x32, 0x44, 0xb3, 0x52, 0x3e, 0x97, 0xa4, 0x6b, 0x45, 0x41, 0x7e, 0x51, + 0x49, 0x08, 0x48, 0x30, 0x18, 0x62, 0x5b, 0x50, 0x6a, 0x61, 0x69, 0x6a, 0x71, 0x89, 0x50, 0x10, + 0x17, 0x5f, 0x51, 0x6a, 0x71, 0x7e, 0x69, 0x11, 0xc8, 0x21, 0x05, 0x89, 0x79, 0xc5, 0x12, 0x8c, + 0x0a, 0xcc, 0x1a, 0xdc, 0x46, 0xda, 0x7a, 0xd8, 0xdc, 0x01, 0xb3, 0x5d, 0x2f, 0x08, 0xaa, 0x27, + 0x18, 0xa4, 0x25, 0x88, 0xb7, 0x08, 0x99, 0xab, 0x24, 0xc3, 0x25, 0x85, 0xcd, 0xc2, 0xe2, 0x82, + 0xfc, 0xbc, 0xe2, 0x54, 0xa3, 0x45, 0x8c, 0x5c, 0x3c, 0xc8, 0x12, 0x42, 0x13, 0x19, 0xb9, 0xd8, + 0x20, 0xea, 0x85, 0x1c, 0xf5, 0x88, 0xf3, 0xbd, 0x1e, 0x4e, 0x0f, 0x49, 0x39, 0x51, 0x62, 0x04, + 0xc4, 0x89, 0x4a, 0x0c, 0x4e, 0x9d, 0x8c, 0x5c, 0x9a, 0x99, 0xf9, 0x44, 0x1a, 0xe5, 0x24, 0x88, + 0x6c, 0x4a, 0x00, 0x48, 0x55, 0x00, 0x63, 0x94, 0x7b, 0x7a, 0x66, 0x49, 0x46, 0x69, 0x92, 0x5e, + 0x72, 0x7e, 0xae, 0x3e, 0xc8, 0x1c, 0x5d, 0x44, 0x64, 0xa1, 0x18, 0xab, 0x0b, 0x89, 0xba, 0xf4, + 0xd4, 0x3c, 0xfd, 0x74, 0x6c, 0xa9, 0x24, 0x89, 0x0d, 0xac, 0xc0, 0x18, 0x10, 0x00, 0x00, 0xff, + 0xff, 0xc1, 0x6e, 0x1a, 0x15, 0x56, 0x02, 0x00, 0x00, +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// TraceServiceClient is the client API for TraceService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type TraceServiceClient interface { + // For performance reasons, it is recommended to keep this RPC + // alive for the entire life of the application. + Export(ctx context.Context, in *ExportTraceServiceRequest, opts ...grpc.CallOption) (*ExportTraceServiceResponse, error) +} + +type traceServiceClient struct { + cc *grpc.ClientConn +} + +func NewTraceServiceClient(cc *grpc.ClientConn) TraceServiceClient { + return &traceServiceClient{cc} +} + +func (c *traceServiceClient) Export(ctx context.Context, in *ExportTraceServiceRequest, opts ...grpc.CallOption) (*ExportTraceServiceResponse, error) { + out := new(ExportTraceServiceResponse) + err := c.cc.Invoke(ctx, "/opentelemetry.proto.collector.trace.v1.TraceService/Export", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// TraceServiceServer is the server API for TraceService service. +type TraceServiceServer interface { + // For performance reasons, it is recommended to keep this RPC + // alive for the entire life of the application. + Export(context.Context, *ExportTraceServiceRequest) (*ExportTraceServiceResponse, error) +} + +// UnimplementedTraceServiceServer can be embedded to have forward compatible implementations. +type UnimplementedTraceServiceServer struct { +} + +func (*UnimplementedTraceServiceServer) Export(ctx context.Context, req *ExportTraceServiceRequest) (*ExportTraceServiceResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Export not implemented") +} + +func RegisterTraceServiceServer(s *grpc.Server, srv TraceServiceServer) { + s.RegisterService(&_TraceService_serviceDesc, srv) +} + +func _TraceService_Export_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ExportTraceServiceRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(TraceServiceServer).Export(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/opentelemetry.proto.collector.trace.v1.TraceService/Export", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(TraceServiceServer).Export(ctx, req.(*ExportTraceServiceRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _TraceService_serviceDesc = grpc.ServiceDesc{ + ServiceName: "opentelemetry.proto.collector.trace.v1.TraceService", + HandlerType: (*TraceServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Export", + Handler: _TraceService_Export_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "opentelemetry/proto/collector/trace/v1/trace_service.proto", +} diff --git a/packages/opentelemetry-exporter-collector/src/platform/node/protos/gen/go/collector/trace/v1/trace_service.pb.gw.go b/packages/opentelemetry-exporter-collector/src/platform/node/protos/gen/go/collector/trace/v1/trace_service.pb.gw.go new file mode 100644 index 0000000000..df329e393e --- /dev/null +++ b/packages/opentelemetry-exporter-collector/src/platform/node/protos/gen/go/collector/trace/v1/trace_service.pb.gw.go @@ -0,0 +1,115 @@ +// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. +// source: opentelemetry/proto/collector/trace/v1/trace_service.proto + +/* +Package v1 is a reverse proxy. + +It translates gRPC into RESTful JSON APIs. +*/ +package v1 + +import ( + "context" + "io" + "net/http" + + "github.com/golang/protobuf/proto" + "github.com/grpc-ecosystem/grpc-gateway/runtime" + "github.com/grpc-ecosystem/grpc-gateway/utilities" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/status" +) + +var _ codes.Code +var _ io.Reader +var _ status.Status +var _ = runtime.String +var _ = utilities.NewDoubleArray + +func request_TraceService_Export_0(ctx context.Context, marshaler runtime.Marshaler, client TraceServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq ExportTraceServiceRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.Export(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +// RegisterTraceServiceHandlerFromEndpoint is same as RegisterTraceServiceHandler but +// automatically dials to "endpoint" and closes the connection when "ctx" gets done. +func RegisterTraceServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { + conn, err := grpc.Dial(endpoint, opts...) + if err != nil { + return err + } + defer func() { + if err != nil { + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + return + } + go func() { + <-ctx.Done() + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + }() + }() + + return RegisterTraceServiceHandler(ctx, mux, conn) +} + +// RegisterTraceServiceHandler registers the http handlers for service TraceService to "mux". +// The handlers forward requests to the grpc endpoint over "conn". +func RegisterTraceServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { + return RegisterTraceServiceHandlerClient(ctx, mux, NewTraceServiceClient(conn)) +} + +// RegisterTraceServiceHandlerClient registers the http handlers for service TraceService +// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "TraceServiceClient". +// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "TraceServiceClient" +// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in +// "TraceServiceClient" to call the correct interceptors. +func RegisterTraceServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client TraceServiceClient) error { + + mux.Handle("POST", pattern_TraceService_Export_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_TraceService_Export_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_TraceService_Export_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +var ( + pattern_TraceService_Export_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "trace"}, "", runtime.AssumeColonVerbOpt(true))) +) + +var ( + forward_TraceService_Export_0 = runtime.ForwardResponseMessage +) diff --git a/packages/opentelemetry-exporter-collector/src/platform/node/protos/gen/go/common/v1/common.pb.go b/packages/opentelemetry-exporter-collector/src/platform/node/protos/gen/go/common/v1/common.pb.go new file mode 100644 index 0000000000..3930f9134d --- /dev/null +++ b/packages/opentelemetry-exporter-collector/src/platform/node/protos/gen/go/common/v1/common.pb.go @@ -0,0 +1,273 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// source: opentelemetry/proto/common/v1/common.proto + +package v1 + +import ( + fmt "fmt" + proto "github.com/golang/protobuf/proto" + math "math" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package + +// ValueType is the enumeration of possible types that value can have. +type AttributeKeyValue_ValueType int32 + +const ( + AttributeKeyValue_STRING AttributeKeyValue_ValueType = 0 + AttributeKeyValue_INT AttributeKeyValue_ValueType = 1 + AttributeKeyValue_DOUBLE AttributeKeyValue_ValueType = 2 + AttributeKeyValue_BOOL AttributeKeyValue_ValueType = 3 +) + +var AttributeKeyValue_ValueType_name = map[int32]string{ + 0: "STRING", + 1: "INT", + 2: "DOUBLE", + 3: "BOOL", +} + +var AttributeKeyValue_ValueType_value = map[string]int32{ + "STRING": 0, + "INT": 1, + "DOUBLE": 2, + "BOOL": 3, +} + +func (x AttributeKeyValue_ValueType) String() string { + return proto.EnumName(AttributeKeyValue_ValueType_name, int32(x)) +} + +func (AttributeKeyValue_ValueType) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_62ba46dcb97aa817, []int{0, 0} +} + +// AttributeKeyValue is a key-value pair that is used to store Span attributes, Link +// attributes, etc. +type AttributeKeyValue struct { + // key part of the key-value pair. + Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` + // type of the value. + Type AttributeKeyValue_ValueType `protobuf:"varint,2,opt,name=type,proto3,enum=opentelemetry.proto.common.v1.AttributeKeyValue_ValueType" json:"type,omitempty"` + StringValue string `protobuf:"bytes,3,opt,name=string_value,json=stringValue,proto3" json:"string_value,omitempty"` + IntValue int64 `protobuf:"varint,4,opt,name=int_value,json=intValue,proto3" json:"int_value,omitempty"` + DoubleValue float64 `protobuf:"fixed64,5,opt,name=double_value,json=doubleValue,proto3" json:"double_value,omitempty"` + BoolValue bool `protobuf:"varint,6,opt,name=bool_value,json=boolValue,proto3" json:"bool_value,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *AttributeKeyValue) Reset() { *m = AttributeKeyValue{} } +func (m *AttributeKeyValue) String() string { return proto.CompactTextString(m) } +func (*AttributeKeyValue) ProtoMessage() {} +func (*AttributeKeyValue) Descriptor() ([]byte, []int) { + return fileDescriptor_62ba46dcb97aa817, []int{0} +} + +func (m *AttributeKeyValue) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_AttributeKeyValue.Unmarshal(m, b) +} +func (m *AttributeKeyValue) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_AttributeKeyValue.Marshal(b, m, deterministic) +} +func (m *AttributeKeyValue) XXX_Merge(src proto.Message) { + xxx_messageInfo_AttributeKeyValue.Merge(m, src) +} +func (m *AttributeKeyValue) XXX_Size() int { + return xxx_messageInfo_AttributeKeyValue.Size(m) +} +func (m *AttributeKeyValue) XXX_DiscardUnknown() { + xxx_messageInfo_AttributeKeyValue.DiscardUnknown(m) +} + +var xxx_messageInfo_AttributeKeyValue proto.InternalMessageInfo + +func (m *AttributeKeyValue) GetKey() string { + if m != nil { + return m.Key + } + return "" +} + +func (m *AttributeKeyValue) GetType() AttributeKeyValue_ValueType { + if m != nil { + return m.Type + } + return AttributeKeyValue_STRING +} + +func (m *AttributeKeyValue) GetStringValue() string { + if m != nil { + return m.StringValue + } + return "" +} + +func (m *AttributeKeyValue) GetIntValue() int64 { + if m != nil { + return m.IntValue + } + return 0 +} + +func (m *AttributeKeyValue) GetDoubleValue() float64 { + if m != nil { + return m.DoubleValue + } + return 0 +} + +func (m *AttributeKeyValue) GetBoolValue() bool { + if m != nil { + return m.BoolValue + } + return false +} + +// StringKeyValue is a pair of key/value strings. This is the simpler (and faster) version +// of AttributeKeyValue that only supports string values. +type StringKeyValue struct { + Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` + Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *StringKeyValue) Reset() { *m = StringKeyValue{} } +func (m *StringKeyValue) String() string { return proto.CompactTextString(m) } +func (*StringKeyValue) ProtoMessage() {} +func (*StringKeyValue) Descriptor() ([]byte, []int) { + return fileDescriptor_62ba46dcb97aa817, []int{1} +} + +func (m *StringKeyValue) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_StringKeyValue.Unmarshal(m, b) +} +func (m *StringKeyValue) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_StringKeyValue.Marshal(b, m, deterministic) +} +func (m *StringKeyValue) XXX_Merge(src proto.Message) { + xxx_messageInfo_StringKeyValue.Merge(m, src) +} +func (m *StringKeyValue) XXX_Size() int { + return xxx_messageInfo_StringKeyValue.Size(m) +} +func (m *StringKeyValue) XXX_DiscardUnknown() { + xxx_messageInfo_StringKeyValue.DiscardUnknown(m) +} + +var xxx_messageInfo_StringKeyValue proto.InternalMessageInfo + +func (m *StringKeyValue) GetKey() string { + if m != nil { + return m.Key + } + return "" +} + +func (m *StringKeyValue) GetValue() string { + if m != nil { + return m.Value + } + return "" +} + +// InstrumentationLibrary is a message representing the instrumentation library information +// such as the fully qualified name and version. +type InstrumentationLibrary struct { + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Version string `protobuf:"bytes,2,opt,name=version,proto3" json:"version,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *InstrumentationLibrary) Reset() { *m = InstrumentationLibrary{} } +func (m *InstrumentationLibrary) String() string { return proto.CompactTextString(m) } +func (*InstrumentationLibrary) ProtoMessage() {} +func (*InstrumentationLibrary) Descriptor() ([]byte, []int) { + return fileDescriptor_62ba46dcb97aa817, []int{2} +} + +func (m *InstrumentationLibrary) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_InstrumentationLibrary.Unmarshal(m, b) +} +func (m *InstrumentationLibrary) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_InstrumentationLibrary.Marshal(b, m, deterministic) +} +func (m *InstrumentationLibrary) XXX_Merge(src proto.Message) { + xxx_messageInfo_InstrumentationLibrary.Merge(m, src) +} +func (m *InstrumentationLibrary) XXX_Size() int { + return xxx_messageInfo_InstrumentationLibrary.Size(m) +} +func (m *InstrumentationLibrary) XXX_DiscardUnknown() { + xxx_messageInfo_InstrumentationLibrary.DiscardUnknown(m) +} + +var xxx_messageInfo_InstrumentationLibrary proto.InternalMessageInfo + +func (m *InstrumentationLibrary) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +func (m *InstrumentationLibrary) GetVersion() string { + if m != nil { + return m.Version + } + return "" +} + +func init() { + proto.RegisterEnum("opentelemetry.proto.common.v1.AttributeKeyValue_ValueType", AttributeKeyValue_ValueType_name, AttributeKeyValue_ValueType_value) + proto.RegisterType((*AttributeKeyValue)(nil), "opentelemetry.proto.common.v1.AttributeKeyValue") + proto.RegisterType((*StringKeyValue)(nil), "opentelemetry.proto.common.v1.StringKeyValue") + proto.RegisterType((*InstrumentationLibrary)(nil), "opentelemetry.proto.common.v1.InstrumentationLibrary") +} + +func init() { + proto.RegisterFile("opentelemetry/proto/common/v1/common.proto", fileDescriptor_62ba46dcb97aa817) +} + +var fileDescriptor_62ba46dcb97aa817 = []byte{ + // 377 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x92, 0xdb, 0x8b, 0x9b, 0x40, + 0x18, 0xc5, 0x3b, 0x6a, 0x2e, 0x7e, 0x09, 0xc1, 0x0e, 0xa5, 0x08, 0x25, 0x60, 0x7c, 0x92, 0x42, + 0x94, 0xb4, 0x50, 0x4a, 0x1f, 0x0a, 0xb5, 0x37, 0x42, 0x43, 0x12, 0x4c, 0xda, 0x87, 0xbe, 0x14, + 0x6d, 0x07, 0x3b, 0xac, 0xce, 0xb8, 0x93, 0x51, 0xf0, 0xaf, 0xda, 0x7f, 0x71, 0x71, 0xc6, 0xbd, + 0x84, 0x85, 0xbc, 0xc8, 0x99, 0xdf, 0x39, 0x9e, 0xf9, 0xd0, 0x0f, 0x5e, 0xf3, 0x8a, 0x30, 0x49, + 0x0a, 0x52, 0x12, 0x29, 0xda, 0xa8, 0x12, 0x5c, 0xf2, 0xe8, 0x2f, 0x2f, 0x4b, 0xce, 0xa2, 0x66, + 0xd5, 0xab, 0x50, 0x61, 0x3c, 0x3f, 0xcb, 0x6a, 0x18, 0xf6, 0x89, 0x66, 0xe5, 0xdf, 0x18, 0xf0, + 0xfc, 0x93, 0x94, 0x82, 0x66, 0xb5, 0x24, 0x3f, 0x48, 0xfb, 0x2b, 0x2d, 0x6a, 0x82, 0x1d, 0x30, + 0xaf, 0x48, 0xeb, 0x22, 0x0f, 0x05, 0x76, 0xd2, 0x49, 0xbc, 0x05, 0x4b, 0xb6, 0x15, 0x71, 0x0d, + 0x0f, 0x05, 0xb3, 0x37, 0x1f, 0xc2, 0x8b, 0xad, 0xe1, 0x93, 0xc6, 0x50, 0x3d, 0x8f, 0x6d, 0x45, + 0x12, 0xd5, 0x83, 0x17, 0x30, 0x3d, 0x49, 0x41, 0x59, 0xfe, 0xa7, 0xe9, 0x1c, 0xd7, 0x54, 0x57, + 0x4d, 0x34, 0xd3, 0x43, 0xbc, 0x02, 0x9b, 0x32, 0xd9, 0xfb, 0x96, 0x87, 0x02, 0x33, 0x19, 0x53, + 0x26, 0xb5, 0xb9, 0x80, 0xe9, 0x3f, 0x5e, 0x67, 0x05, 0xe9, 0xfd, 0x81, 0x87, 0x02, 0x94, 0x4c, + 0x34, 0xd3, 0x91, 0x39, 0x40, 0xc6, 0x79, 0xd1, 0x07, 0x86, 0x1e, 0x0a, 0xc6, 0x89, 0xdd, 0x11, + 0x65, 0xfb, 0xef, 0xc0, 0xbe, 0x1f, 0x0a, 0x03, 0x0c, 0x0f, 0xc7, 0x64, 0xbd, 0xfd, 0xee, 0x3c, + 0xc3, 0x23, 0x30, 0xd7, 0xdb, 0xa3, 0x83, 0x3a, 0xf8, 0x65, 0xf7, 0x33, 0xde, 0x7c, 0x75, 0x0c, + 0x3c, 0x06, 0x2b, 0xde, 0xed, 0x36, 0x8e, 0xe9, 0xbf, 0x87, 0xd9, 0x41, 0x4d, 0x79, 0xe1, 0x6b, + 0xbd, 0x80, 0x81, 0xbe, 0xd5, 0x50, 0x4c, 0x1f, 0xfc, 0x6f, 0xf0, 0x72, 0xcd, 0x4e, 0x52, 0xd4, + 0x25, 0x61, 0x32, 0x95, 0x94, 0xb3, 0x0d, 0xcd, 0x44, 0x2a, 0x5a, 0x8c, 0xc1, 0x62, 0x69, 0x49, + 0xfa, 0x0a, 0xa5, 0xb1, 0x0b, 0xa3, 0x86, 0x88, 0x13, 0xe5, 0xac, 0x6f, 0xb9, 0x3b, 0xc6, 0xd7, + 0xe0, 0x51, 0x7e, 0xf9, 0x0f, 0xc4, 0x93, 0xcf, 0x4a, 0xee, 0x3b, 0xbc, 0x47, 0xbf, 0x3f, 0xe6, + 0x54, 0xfe, 0xaf, 0xb3, 0x2e, 0x10, 0x75, 0x2f, 0x2e, 0x1f, 0xb6, 0xe7, 0xac, 0x67, 0xa9, 0x77, + 0x29, 0x27, 0x2c, 0xca, 0x1f, 0xad, 0x54, 0x36, 0x54, 0xfc, 0xed, 0x6d, 0x00, 0x00, 0x00, 0xff, + 0xff, 0x84, 0x93, 0x08, 0x5f, 0x7a, 0x02, 0x00, 0x00, +} diff --git a/packages/opentelemetry-exporter-collector/src/platform/node/protos/gen/go/metrics/v1/metrics.pb.go b/packages/opentelemetry-exporter-collector/src/platform/node/protos/gen/go/metrics/v1/metrics.pb.go new file mode 100644 index 0000000000..61fe5b7d35 --- /dev/null +++ b/packages/opentelemetry-exporter-collector/src/platform/node/protos/gen/go/metrics/v1/metrics.pb.go @@ -0,0 +1,1045 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// source: opentelemetry/proto/metrics/v1/metrics.proto + +package v1 + +import ( + fmt "fmt" + proto "github.com/golang/protobuf/proto" + v11 "github.com/open-telemetry/opentelemetry-proto/gen/go/common/v1" + v1 "github.com/open-telemetry/opentelemetry-proto/gen/go/resource/v1" + math "math" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package + +// Type of the metric. It describes how the data is reported. +// +// A gauge is an instantaneous measurement of a value. +// +// A counter/cumulative measurement is a value accumulated over a time +// interval. In a time series, cumulative measurements should have the same +// start time, increasing values, until an event resets the cumulative value +// to zero and sets a new start time for the subsequent points. +type MetricDescriptor_Type int32 + +const ( + // Do not use this default value. + MetricDescriptor_UNSPECIFIED MetricDescriptor_Type = 0 + // Integer gauge. The value can go both up and down over time. + // Corresponding values are stored in Int64DataPoint. + MetricDescriptor_GAUGE_INT64 MetricDescriptor_Type = 1 + // Floating point gauge. The value can go both up and down over time. + // Corresponding values are stored in DoubleDataPoint. + MetricDescriptor_GAUGE_DOUBLE MetricDescriptor_Type = 2 + // Histogram gauge measurement. + // Used in scenarios like a snapshot of time that current items in a queue + // have spent there. + // Corresponding values are stored in HistogramDataPoint. The count and sum of the + // histogram can go both up and down over time. Recorded values are always >= 0. + MetricDescriptor_GAUGE_HISTOGRAM MetricDescriptor_Type = 3 + // Integer counter measurement. The value cannot decrease; if value is reset then + // start_time_unix_nano should also be reset. + // Corresponding values are stored in Int64DataPoint. + MetricDescriptor_COUNTER_INT64 MetricDescriptor_Type = 4 + // Floating point counter measurement. The value cannot decrease, if + // resets then the start_time_unix_nano should also be reset. + // Recorded values are always >= 0. + // Corresponding values are stored in DoubleDataPoint. + MetricDescriptor_COUNTER_DOUBLE MetricDescriptor_Type = 5 + // Histogram cumulative measurement. + // Corresponding values are stored in HistogramDataPoint. The count and sum of the + // histogram cannot decrease; if values are reset then start_time_unix_nano + // should also be reset to the new start timestamp. + MetricDescriptor_CUMULATIVE_HISTOGRAM MetricDescriptor_Type = 6 + // Summary value. Some frameworks implemented Histograms as a summary of observations + // (usually things like request durations and response sizes). While it + // also provides a total count of observations and a sum of all observed + // values, it calculates configurable percentiles over a sliding time + // window. + // Corresponding values are stored in SummaryDataPoint. + MetricDescriptor_SUMMARY MetricDescriptor_Type = 7 +) + +var MetricDescriptor_Type_name = map[int32]string{ + 0: "UNSPECIFIED", + 1: "GAUGE_INT64", + 2: "GAUGE_DOUBLE", + 3: "GAUGE_HISTOGRAM", + 4: "COUNTER_INT64", + 5: "COUNTER_DOUBLE", + 6: "CUMULATIVE_HISTOGRAM", + 7: "SUMMARY", +} + +var MetricDescriptor_Type_value = map[string]int32{ + "UNSPECIFIED": 0, + "GAUGE_INT64": 1, + "GAUGE_DOUBLE": 2, + "GAUGE_HISTOGRAM": 3, + "COUNTER_INT64": 4, + "COUNTER_DOUBLE": 5, + "CUMULATIVE_HISTOGRAM": 6, + "SUMMARY": 7, +} + +func (x MetricDescriptor_Type) String() string { + return proto.EnumName(MetricDescriptor_Type_name, int32(x)) +} + +func (MetricDescriptor_Type) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_3c3112f9fa006917, []int{3, 0} +} + +// A collection of InstrumentationLibraryMetrics from a Resource. +type ResourceMetrics struct { + // The resource for the metrics in this message. + // If this field is not set then no resource info is known. + Resource *v1.Resource `protobuf:"bytes,1,opt,name=resource,proto3" json:"resource,omitempty"` + // A list of metrics that originate from a resource. + InstrumentationLibraryMetrics []*InstrumentationLibraryMetrics `protobuf:"bytes,2,rep,name=instrumentation_library_metrics,json=instrumentationLibraryMetrics,proto3" json:"instrumentation_library_metrics,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ResourceMetrics) Reset() { *m = ResourceMetrics{} } +func (m *ResourceMetrics) String() string { return proto.CompactTextString(m) } +func (*ResourceMetrics) ProtoMessage() {} +func (*ResourceMetrics) Descriptor() ([]byte, []int) { + return fileDescriptor_3c3112f9fa006917, []int{0} +} + +func (m *ResourceMetrics) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ResourceMetrics.Unmarshal(m, b) +} +func (m *ResourceMetrics) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ResourceMetrics.Marshal(b, m, deterministic) +} +func (m *ResourceMetrics) XXX_Merge(src proto.Message) { + xxx_messageInfo_ResourceMetrics.Merge(m, src) +} +func (m *ResourceMetrics) XXX_Size() int { + return xxx_messageInfo_ResourceMetrics.Size(m) +} +func (m *ResourceMetrics) XXX_DiscardUnknown() { + xxx_messageInfo_ResourceMetrics.DiscardUnknown(m) +} + +var xxx_messageInfo_ResourceMetrics proto.InternalMessageInfo + +func (m *ResourceMetrics) GetResource() *v1.Resource { + if m != nil { + return m.Resource + } + return nil +} + +func (m *ResourceMetrics) GetInstrumentationLibraryMetrics() []*InstrumentationLibraryMetrics { + if m != nil { + return m.InstrumentationLibraryMetrics + } + return nil +} + +// A collection of Metrics produced by an InstrumentationLibrary. +type InstrumentationLibraryMetrics struct { + // The instrumentation library information for the metrics in this message. + // If this field is not set then no library info is known. + InstrumentationLibrary *v11.InstrumentationLibrary `protobuf:"bytes,1,opt,name=instrumentation_library,json=instrumentationLibrary,proto3" json:"instrumentation_library,omitempty"` + // A list of metrics that originate from an instrumentation library. + Metrics []*Metric `protobuf:"bytes,2,rep,name=metrics,proto3" json:"metrics,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *InstrumentationLibraryMetrics) Reset() { *m = InstrumentationLibraryMetrics{} } +func (m *InstrumentationLibraryMetrics) String() string { return proto.CompactTextString(m) } +func (*InstrumentationLibraryMetrics) ProtoMessage() {} +func (*InstrumentationLibraryMetrics) Descriptor() ([]byte, []int) { + return fileDescriptor_3c3112f9fa006917, []int{1} +} + +func (m *InstrumentationLibraryMetrics) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_InstrumentationLibraryMetrics.Unmarshal(m, b) +} +func (m *InstrumentationLibraryMetrics) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_InstrumentationLibraryMetrics.Marshal(b, m, deterministic) +} +func (m *InstrumentationLibraryMetrics) XXX_Merge(src proto.Message) { + xxx_messageInfo_InstrumentationLibraryMetrics.Merge(m, src) +} +func (m *InstrumentationLibraryMetrics) XXX_Size() int { + return xxx_messageInfo_InstrumentationLibraryMetrics.Size(m) +} +func (m *InstrumentationLibraryMetrics) XXX_DiscardUnknown() { + xxx_messageInfo_InstrumentationLibraryMetrics.DiscardUnknown(m) +} + +var xxx_messageInfo_InstrumentationLibraryMetrics proto.InternalMessageInfo + +func (m *InstrumentationLibraryMetrics) GetInstrumentationLibrary() *v11.InstrumentationLibrary { + if m != nil { + return m.InstrumentationLibrary + } + return nil +} + +func (m *InstrumentationLibraryMetrics) GetMetrics() []*Metric { + if m != nil { + return m.Metrics + } + return nil +} + +// Defines a Metric which has one or more timeseries. +// +// The data model and relation between entities is shown in the diagram below. +// +// - Metric is composed of a MetricDescriptor and a list of data points. +// - MetricDescriptor contains a list of label keys (shown horizontally). +// - Data is a list of DataPoints (shown vertically). +// - DataPoint contains a list of label values and a value. +// +// Metric +// +----------+ +------------------------+ +// |descriptor|-------->| MetricDescriptor | +// | | |+-----+-----+ +-----+ | +// | | ||label|label|...|label| | +// | data|--+ ||key1 |key2 | |keyN | | +// +----------+ | |+-----+-----+ +-----+ | +// | +------------------------+ +// | +// | +---------------------------+ +// | |DataPoint 1 | +// v |+------+------+ +------+ | +// +-----+ ||label |label |...|label | | +// | 1 |-->||value1|value2|...|valueN| | +// +-----+ |+------+------+ +------+ | +// | . | |+-----+ | +// | . | ||value| | +// | . | |+-----+ | +// | . | +---------------------------+ +// | . | . +// | . | . +// | . | . +// | . | +---------------------------+ +// | . | |DataPoint M | +// +-----+ |+------+------+ +------+ | +// | M |-->||label |label |...|label | | +// +-----+ ||value1|value2|...|valueN| | +// |+------+------+ +------+ | +// |+-----+ | +// ||value| | +// |+-----+ | +// +---------------------------+ +// +//----------------------------------------------------------------------- +// DataPoint is a value of specific type corresponding to a given moment in +// time. Each DataPoint is timestamped. +// +// DataPoint is strongly typed: each DataPoint type has a specific Protobuf message +// depending on the value type of the metric and thus there are currently 4 DataPoint +// messages, which correspond to the types of metric values. +type Metric struct { + // metric_descriptor describes the Metric. + MetricDescriptor *MetricDescriptor `protobuf:"bytes,1,opt,name=metric_descriptor,json=metricDescriptor,proto3" json:"metric_descriptor,omitempty"` + // Data is a list of one or more DataPoints for a single metric. Only one of the + // following fields is used for the data, depending on the type of the metric defined + // by MetricDescriptor.type field. + Int64DataPoints []*Int64DataPoint `protobuf:"bytes,2,rep,name=int64_data_points,json=int64DataPoints,proto3" json:"int64_data_points,omitempty"` + DoubleDataPoints []*DoubleDataPoint `protobuf:"bytes,3,rep,name=double_data_points,json=doubleDataPoints,proto3" json:"double_data_points,omitempty"` + HistogramDataPoints []*HistogramDataPoint `protobuf:"bytes,4,rep,name=histogram_data_points,json=histogramDataPoints,proto3" json:"histogram_data_points,omitempty"` + SummaryDataPoints []*SummaryDataPoint `protobuf:"bytes,5,rep,name=summary_data_points,json=summaryDataPoints,proto3" json:"summary_data_points,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Metric) Reset() { *m = Metric{} } +func (m *Metric) String() string { return proto.CompactTextString(m) } +func (*Metric) ProtoMessage() {} +func (*Metric) Descriptor() ([]byte, []int) { + return fileDescriptor_3c3112f9fa006917, []int{2} +} + +func (m *Metric) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Metric.Unmarshal(m, b) +} +func (m *Metric) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Metric.Marshal(b, m, deterministic) +} +func (m *Metric) XXX_Merge(src proto.Message) { + xxx_messageInfo_Metric.Merge(m, src) +} +func (m *Metric) XXX_Size() int { + return xxx_messageInfo_Metric.Size(m) +} +func (m *Metric) XXX_DiscardUnknown() { + xxx_messageInfo_Metric.DiscardUnknown(m) +} + +var xxx_messageInfo_Metric proto.InternalMessageInfo + +func (m *Metric) GetMetricDescriptor() *MetricDescriptor { + if m != nil { + return m.MetricDescriptor + } + return nil +} + +func (m *Metric) GetInt64DataPoints() []*Int64DataPoint { + if m != nil { + return m.Int64DataPoints + } + return nil +} + +func (m *Metric) GetDoubleDataPoints() []*DoubleDataPoint { + if m != nil { + return m.DoubleDataPoints + } + return nil +} + +func (m *Metric) GetHistogramDataPoints() []*HistogramDataPoint { + if m != nil { + return m.HistogramDataPoints + } + return nil +} + +func (m *Metric) GetSummaryDataPoints() []*SummaryDataPoint { + if m != nil { + return m.SummaryDataPoints + } + return nil +} + +// Defines a metric type and its schema. +type MetricDescriptor struct { + // name of the metric, including its DNS name prefix. It must be unique. + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // description of the metric, which can be used in documentation. + Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` + // unit in which the metric value is reported. Follows the format + // described by http://unitsofmeasure.org/ucum.html. + Unit string `protobuf:"bytes,3,opt,name=unit,proto3" json:"unit,omitempty"` + Type MetricDescriptor_Type `protobuf:"varint,4,opt,name=type,proto3,enum=opentelemetry.proto.metrics.v1.MetricDescriptor_Type" json:"type,omitempty"` + // The set of labels associated with the metric descriptor. Labels in this list apply to + // all data points. + Labels []*v11.StringKeyValue `protobuf:"bytes,5,rep,name=labels,proto3" json:"labels,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *MetricDescriptor) Reset() { *m = MetricDescriptor{} } +func (m *MetricDescriptor) String() string { return proto.CompactTextString(m) } +func (*MetricDescriptor) ProtoMessage() {} +func (*MetricDescriptor) Descriptor() ([]byte, []int) { + return fileDescriptor_3c3112f9fa006917, []int{3} +} + +func (m *MetricDescriptor) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_MetricDescriptor.Unmarshal(m, b) +} +func (m *MetricDescriptor) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_MetricDescriptor.Marshal(b, m, deterministic) +} +func (m *MetricDescriptor) XXX_Merge(src proto.Message) { + xxx_messageInfo_MetricDescriptor.Merge(m, src) +} +func (m *MetricDescriptor) XXX_Size() int { + return xxx_messageInfo_MetricDescriptor.Size(m) +} +func (m *MetricDescriptor) XXX_DiscardUnknown() { + xxx_messageInfo_MetricDescriptor.DiscardUnknown(m) +} + +var xxx_messageInfo_MetricDescriptor proto.InternalMessageInfo + +func (m *MetricDescriptor) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +func (m *MetricDescriptor) GetDescription() string { + if m != nil { + return m.Description + } + return "" +} + +func (m *MetricDescriptor) GetUnit() string { + if m != nil { + return m.Unit + } + return "" +} + +func (m *MetricDescriptor) GetType() MetricDescriptor_Type { + if m != nil { + return m.Type + } + return MetricDescriptor_UNSPECIFIED +} + +func (m *MetricDescriptor) GetLabels() []*v11.StringKeyValue { + if m != nil { + return m.Labels + } + return nil +} + +// Int64DataPoint is a single data point in a timeseries that describes the time-varying +// values of a int64 metric. +type Int64DataPoint struct { + // The set of labels that uniquely identify this timeseries. + Labels []*v11.StringKeyValue `protobuf:"bytes,1,rep,name=labels,proto3" json:"labels,omitempty"` + // start_time_unix_nano is the time when the cumulative value was reset to zero. + // This is used for Counter type only. For Gauge the value is not specified and + // defaults to 0. + // + // The cumulative value is over the time interval (start_time_unix_nano, time_unix_nano]. + // Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January 1970. + // + // Value of 0 indicates that the timestamp is unspecified. In that case the timestamp + // may be decided by the backend. + StartTimeUnixNano uint64 `protobuf:"fixed64,2,opt,name=start_time_unix_nano,json=startTimeUnixNano,proto3" json:"start_time_unix_nano,omitempty"` + // time_unix_nano is the moment when this value was recorded. + // Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January 1970. + TimeUnixNano uint64 `protobuf:"fixed64,3,opt,name=time_unix_nano,json=timeUnixNano,proto3" json:"time_unix_nano,omitempty"` + // value itself. + Value int64 `protobuf:"varint,4,opt,name=value,proto3" json:"value,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Int64DataPoint) Reset() { *m = Int64DataPoint{} } +func (m *Int64DataPoint) String() string { return proto.CompactTextString(m) } +func (*Int64DataPoint) ProtoMessage() {} +func (*Int64DataPoint) Descriptor() ([]byte, []int) { + return fileDescriptor_3c3112f9fa006917, []int{4} +} + +func (m *Int64DataPoint) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Int64DataPoint.Unmarshal(m, b) +} +func (m *Int64DataPoint) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Int64DataPoint.Marshal(b, m, deterministic) +} +func (m *Int64DataPoint) XXX_Merge(src proto.Message) { + xxx_messageInfo_Int64DataPoint.Merge(m, src) +} +func (m *Int64DataPoint) XXX_Size() int { + return xxx_messageInfo_Int64DataPoint.Size(m) +} +func (m *Int64DataPoint) XXX_DiscardUnknown() { + xxx_messageInfo_Int64DataPoint.DiscardUnknown(m) +} + +var xxx_messageInfo_Int64DataPoint proto.InternalMessageInfo + +func (m *Int64DataPoint) GetLabels() []*v11.StringKeyValue { + if m != nil { + return m.Labels + } + return nil +} + +func (m *Int64DataPoint) GetStartTimeUnixNano() uint64 { + if m != nil { + return m.StartTimeUnixNano + } + return 0 +} + +func (m *Int64DataPoint) GetTimeUnixNano() uint64 { + if m != nil { + return m.TimeUnixNano + } + return 0 +} + +func (m *Int64DataPoint) GetValue() int64 { + if m != nil { + return m.Value + } + return 0 +} + +// DoubleDataPoint is a single data point in a timeseries that describes the time-varying +// value of a double metric. +type DoubleDataPoint struct { + // The set of labels that uniquely identify this timeseries. + Labels []*v11.StringKeyValue `protobuf:"bytes,1,rep,name=labels,proto3" json:"labels,omitempty"` + // start_time_unix_nano is the time when the cumulative value was reset to zero. + // This is used for Counter type only. For Gauge the value is not specified and + // defaults to 0. + // + // The cumulative value is over the time interval (start_time_unix_nano, time_unix_nano]. + // Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January 1970. + // + // Value of 0 indicates that the timestamp is unspecified. In that case the timestamp + // may be decided by the backend. + StartTimeUnixNano uint64 `protobuf:"fixed64,2,opt,name=start_time_unix_nano,json=startTimeUnixNano,proto3" json:"start_time_unix_nano,omitempty"` + // time_unix_nano is the moment when this value was recorded. + // Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January 1970. + TimeUnixNano uint64 `protobuf:"fixed64,3,opt,name=time_unix_nano,json=timeUnixNano,proto3" json:"time_unix_nano,omitempty"` + // value itself. + Value float64 `protobuf:"fixed64,4,opt,name=value,proto3" json:"value,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *DoubleDataPoint) Reset() { *m = DoubleDataPoint{} } +func (m *DoubleDataPoint) String() string { return proto.CompactTextString(m) } +func (*DoubleDataPoint) ProtoMessage() {} +func (*DoubleDataPoint) Descriptor() ([]byte, []int) { + return fileDescriptor_3c3112f9fa006917, []int{5} +} + +func (m *DoubleDataPoint) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_DoubleDataPoint.Unmarshal(m, b) +} +func (m *DoubleDataPoint) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_DoubleDataPoint.Marshal(b, m, deterministic) +} +func (m *DoubleDataPoint) XXX_Merge(src proto.Message) { + xxx_messageInfo_DoubleDataPoint.Merge(m, src) +} +func (m *DoubleDataPoint) XXX_Size() int { + return xxx_messageInfo_DoubleDataPoint.Size(m) +} +func (m *DoubleDataPoint) XXX_DiscardUnknown() { + xxx_messageInfo_DoubleDataPoint.DiscardUnknown(m) +} + +var xxx_messageInfo_DoubleDataPoint proto.InternalMessageInfo + +func (m *DoubleDataPoint) GetLabels() []*v11.StringKeyValue { + if m != nil { + return m.Labels + } + return nil +} + +func (m *DoubleDataPoint) GetStartTimeUnixNano() uint64 { + if m != nil { + return m.StartTimeUnixNano + } + return 0 +} + +func (m *DoubleDataPoint) GetTimeUnixNano() uint64 { + if m != nil { + return m.TimeUnixNano + } + return 0 +} + +func (m *DoubleDataPoint) GetValue() float64 { + if m != nil { + return m.Value + } + return 0 +} + +// HistogramDataPoint is a single data point in a timeseries that describes the time-varying +// values of a Histogram. A Histogram contains summary statistics for a population of values, +// it may optionally contain the distribution of those values across a set of buckets. +type HistogramDataPoint struct { + // The set of labels that uniquely identify this timeseries. + Labels []*v11.StringKeyValue `protobuf:"bytes,1,rep,name=labels,proto3" json:"labels,omitempty"` + // start_time_unix_nano is the time when the cumulative value was reset to zero. + // + // The cumulative value is over the time interval (start_time_unix_nano, time_unix_nano]. + // Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January 1970. + // + // Value of 0 indicates that the timestamp is unspecified. In that case the timestamp + // may be decided by the backend. + // Note: this field is always unspecified and ignored if MetricDescriptor.type==GAUGE_HISTOGRAM. + StartTimeUnixNano uint64 `protobuf:"fixed64,2,opt,name=start_time_unix_nano,json=startTimeUnixNano,proto3" json:"start_time_unix_nano,omitempty"` + // time_unix_nano is the moment when this value was recorded. + // Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January 1970. + TimeUnixNano uint64 `protobuf:"fixed64,3,opt,name=time_unix_nano,json=timeUnixNano,proto3" json:"time_unix_nano,omitempty"` + // count is the number of values in the population. Must be non-negative. This value + // must be equal to the sum of the "count" fields in buckets if a histogram is provided. + Count uint64 `protobuf:"varint,4,opt,name=count,proto3" json:"count,omitempty"` + // sum of the values in the population. If count is zero then this field + // must be zero. This value must be equal to the sum of the "sum" fields in buckets if + // a histogram is provided. + Sum float64 `protobuf:"fixed64,5,opt,name=sum,proto3" json:"sum,omitempty"` + // buckets is an optional field contains the values of histogram for each bucket. + // + // The sum of the values in the buckets "count" field must equal the value in the count field. + // + // The number of elements in buckets array must be by one greater than the + // number of elements in bucket_bounds array. + // + // Note: if HistogramDataPoint.bucket_options defines bucket bounds then this field + // must also be present and number of elements in this field must be equal to the + // number of buckets defined by bucket_options. + Buckets []*HistogramDataPoint_Bucket `protobuf:"bytes,6,rep,name=buckets,proto3" json:"buckets,omitempty"` + // explicit_bounds specifies buckets with explicitly defined bounds for values. + // The bucket boundaries are described by "bounds" field. + // + // This defines size(bounds) + 1 (= N) buckets. The boundaries for bucket + // at index i are: + // + // [0, bounds[i]) for i == 0 + // [bounds[i-1], bounds[i]) for 0 < i < N-1 + // [bounds[i], +infinity) for i == N-1 + // The values in bounds array must be strictly increasing and > 0. + // + // Note: only [a, b) intervals are currently supported for each bucket. If we decides + // to also support (a, b] intervals we should add support for these by defining a boolean + // value which decides what type of intervals to use. + ExplicitBounds []float64 `protobuf:"fixed64,7,rep,packed,name=explicit_bounds,json=explicitBounds,proto3" json:"explicit_bounds,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *HistogramDataPoint) Reset() { *m = HistogramDataPoint{} } +func (m *HistogramDataPoint) String() string { return proto.CompactTextString(m) } +func (*HistogramDataPoint) ProtoMessage() {} +func (*HistogramDataPoint) Descriptor() ([]byte, []int) { + return fileDescriptor_3c3112f9fa006917, []int{6} +} + +func (m *HistogramDataPoint) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_HistogramDataPoint.Unmarshal(m, b) +} +func (m *HistogramDataPoint) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_HistogramDataPoint.Marshal(b, m, deterministic) +} +func (m *HistogramDataPoint) XXX_Merge(src proto.Message) { + xxx_messageInfo_HistogramDataPoint.Merge(m, src) +} +func (m *HistogramDataPoint) XXX_Size() int { + return xxx_messageInfo_HistogramDataPoint.Size(m) +} +func (m *HistogramDataPoint) XXX_DiscardUnknown() { + xxx_messageInfo_HistogramDataPoint.DiscardUnknown(m) +} + +var xxx_messageInfo_HistogramDataPoint proto.InternalMessageInfo + +func (m *HistogramDataPoint) GetLabels() []*v11.StringKeyValue { + if m != nil { + return m.Labels + } + return nil +} + +func (m *HistogramDataPoint) GetStartTimeUnixNano() uint64 { + if m != nil { + return m.StartTimeUnixNano + } + return 0 +} + +func (m *HistogramDataPoint) GetTimeUnixNano() uint64 { + if m != nil { + return m.TimeUnixNano + } + return 0 +} + +func (m *HistogramDataPoint) GetCount() uint64 { + if m != nil { + return m.Count + } + return 0 +} + +func (m *HistogramDataPoint) GetSum() float64 { + if m != nil { + return m.Sum + } + return 0 +} + +func (m *HistogramDataPoint) GetBuckets() []*HistogramDataPoint_Bucket { + if m != nil { + return m.Buckets + } + return nil +} + +func (m *HistogramDataPoint) GetExplicitBounds() []float64 { + if m != nil { + return m.ExplicitBounds + } + return nil +} + +// Bucket contains values for a bucket. +type HistogramDataPoint_Bucket struct { + // The number of values in each bucket of the histogram, as described by + // bucket_options. + Count uint64 `protobuf:"varint,1,opt,name=count,proto3" json:"count,omitempty"` + // exemplar is an optional representative value of the bucket. + Exemplar *HistogramDataPoint_Bucket_Exemplar `protobuf:"bytes,2,opt,name=exemplar,proto3" json:"exemplar,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *HistogramDataPoint_Bucket) Reset() { *m = HistogramDataPoint_Bucket{} } +func (m *HistogramDataPoint_Bucket) String() string { return proto.CompactTextString(m) } +func (*HistogramDataPoint_Bucket) ProtoMessage() {} +func (*HistogramDataPoint_Bucket) Descriptor() ([]byte, []int) { + return fileDescriptor_3c3112f9fa006917, []int{6, 0} +} + +func (m *HistogramDataPoint_Bucket) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_HistogramDataPoint_Bucket.Unmarshal(m, b) +} +func (m *HistogramDataPoint_Bucket) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_HistogramDataPoint_Bucket.Marshal(b, m, deterministic) +} +func (m *HistogramDataPoint_Bucket) XXX_Merge(src proto.Message) { + xxx_messageInfo_HistogramDataPoint_Bucket.Merge(m, src) +} +func (m *HistogramDataPoint_Bucket) XXX_Size() int { + return xxx_messageInfo_HistogramDataPoint_Bucket.Size(m) +} +func (m *HistogramDataPoint_Bucket) XXX_DiscardUnknown() { + xxx_messageInfo_HistogramDataPoint_Bucket.DiscardUnknown(m) +} + +var xxx_messageInfo_HistogramDataPoint_Bucket proto.InternalMessageInfo + +func (m *HistogramDataPoint_Bucket) GetCount() uint64 { + if m != nil { + return m.Count + } + return 0 +} + +func (m *HistogramDataPoint_Bucket) GetExemplar() *HistogramDataPoint_Bucket_Exemplar { + if m != nil { + return m.Exemplar + } + return nil +} + +// Exemplars are example points that may be used to annotate aggregated +// Histogram values. They are metadata that gives information about a +// particular value added to a Histogram bucket. +type HistogramDataPoint_Bucket_Exemplar struct { + // Value of the exemplar point. It determines which bucket the exemplar belongs to. + // If bucket_options define bounds for this bucket then this value must be within + // the defined bounds. + Value float64 `protobuf:"fixed64,1,opt,name=value,proto3" json:"value,omitempty"` + // time_unix_nano is the moment when this exemplar was recorded. + // Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January 1970. + TimeUnixNano uint64 `protobuf:"fixed64,2,opt,name=time_unix_nano,json=timeUnixNano,proto3" json:"time_unix_nano,omitempty"` + // exemplar_attachments are contextual information about the example value. + // Keys in this list must be unique. + Attachments []*v11.StringKeyValue `protobuf:"bytes,3,rep,name=attachments,proto3" json:"attachments,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *HistogramDataPoint_Bucket_Exemplar) Reset() { *m = HistogramDataPoint_Bucket_Exemplar{} } +func (m *HistogramDataPoint_Bucket_Exemplar) String() string { return proto.CompactTextString(m) } +func (*HistogramDataPoint_Bucket_Exemplar) ProtoMessage() {} +func (*HistogramDataPoint_Bucket_Exemplar) Descriptor() ([]byte, []int) { + return fileDescriptor_3c3112f9fa006917, []int{6, 0, 0} +} + +func (m *HistogramDataPoint_Bucket_Exemplar) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_HistogramDataPoint_Bucket_Exemplar.Unmarshal(m, b) +} +func (m *HistogramDataPoint_Bucket_Exemplar) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_HistogramDataPoint_Bucket_Exemplar.Marshal(b, m, deterministic) +} +func (m *HistogramDataPoint_Bucket_Exemplar) XXX_Merge(src proto.Message) { + xxx_messageInfo_HistogramDataPoint_Bucket_Exemplar.Merge(m, src) +} +func (m *HistogramDataPoint_Bucket_Exemplar) XXX_Size() int { + return xxx_messageInfo_HistogramDataPoint_Bucket_Exemplar.Size(m) +} +func (m *HistogramDataPoint_Bucket_Exemplar) XXX_DiscardUnknown() { + xxx_messageInfo_HistogramDataPoint_Bucket_Exemplar.DiscardUnknown(m) +} + +var xxx_messageInfo_HistogramDataPoint_Bucket_Exemplar proto.InternalMessageInfo + +func (m *HistogramDataPoint_Bucket_Exemplar) GetValue() float64 { + if m != nil { + return m.Value + } + return 0 +} + +func (m *HistogramDataPoint_Bucket_Exemplar) GetTimeUnixNano() uint64 { + if m != nil { + return m.TimeUnixNano + } + return 0 +} + +func (m *HistogramDataPoint_Bucket_Exemplar) GetAttachments() []*v11.StringKeyValue { + if m != nil { + return m.Attachments + } + return nil +} + +// SummaryDataPoint is a single data point in a timeseries that describes the time-varying +// values of a Summary metric. +type SummaryDataPoint struct { + // The set of labels that uniquely identify this timeseries. + Labels []*v11.StringKeyValue `protobuf:"bytes,1,rep,name=labels,proto3" json:"labels,omitempty"` + // start_time_unix_nano is the time when the cumulative value was reset to zero. + // + // The cumulative value is over the time interval (start_time_unix_nano, time_unix_nano]. + // Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January 1970. + // + // Value of 0 indicates that the timestamp is unspecified. In that case the timestamp + // may be decided by the backend. + StartTimeUnixNano uint64 `protobuf:"fixed64,2,opt,name=start_time_unix_nano,json=startTimeUnixNano,proto3" json:"start_time_unix_nano,omitempty"` + // time_unix_nano is the moment when this value was recorded. + // Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January 1970. + TimeUnixNano uint64 `protobuf:"fixed64,3,opt,name=time_unix_nano,json=timeUnixNano,proto3" json:"time_unix_nano,omitempty"` + // The total number of recorded values since start_time. Optional since + // some systems don't expose this. + Count uint64 `protobuf:"varint,4,opt,name=count,proto3" json:"count,omitempty"` + // The total sum of recorded values since start_time. Optional since some + // systems don't expose this. If count is zero then this field must be zero. + Sum float64 `protobuf:"fixed64,5,opt,name=sum,proto3" json:"sum,omitempty"` + // A list of values at different percentiles of the distribution calculated + // from the current snapshot. The percentiles must be strictly increasing. + PercentileValues []*SummaryDataPoint_ValueAtPercentile `protobuf:"bytes,6,rep,name=percentile_values,json=percentileValues,proto3" json:"percentile_values,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *SummaryDataPoint) Reset() { *m = SummaryDataPoint{} } +func (m *SummaryDataPoint) String() string { return proto.CompactTextString(m) } +func (*SummaryDataPoint) ProtoMessage() {} +func (*SummaryDataPoint) Descriptor() ([]byte, []int) { + return fileDescriptor_3c3112f9fa006917, []int{7} +} + +func (m *SummaryDataPoint) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_SummaryDataPoint.Unmarshal(m, b) +} +func (m *SummaryDataPoint) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_SummaryDataPoint.Marshal(b, m, deterministic) +} +func (m *SummaryDataPoint) XXX_Merge(src proto.Message) { + xxx_messageInfo_SummaryDataPoint.Merge(m, src) +} +func (m *SummaryDataPoint) XXX_Size() int { + return xxx_messageInfo_SummaryDataPoint.Size(m) +} +func (m *SummaryDataPoint) XXX_DiscardUnknown() { + xxx_messageInfo_SummaryDataPoint.DiscardUnknown(m) +} + +var xxx_messageInfo_SummaryDataPoint proto.InternalMessageInfo + +func (m *SummaryDataPoint) GetLabels() []*v11.StringKeyValue { + if m != nil { + return m.Labels + } + return nil +} + +func (m *SummaryDataPoint) GetStartTimeUnixNano() uint64 { + if m != nil { + return m.StartTimeUnixNano + } + return 0 +} + +func (m *SummaryDataPoint) GetTimeUnixNano() uint64 { + if m != nil { + return m.TimeUnixNano + } + return 0 +} + +func (m *SummaryDataPoint) GetCount() uint64 { + if m != nil { + return m.Count + } + return 0 +} + +func (m *SummaryDataPoint) GetSum() float64 { + if m != nil { + return m.Sum + } + return 0 +} + +func (m *SummaryDataPoint) GetPercentileValues() []*SummaryDataPoint_ValueAtPercentile { + if m != nil { + return m.PercentileValues + } + return nil +} + +// Represents the value at a given percentile of a distribution. +// +// To record Min and Max values following conventions are used: +// - The 100th percentile is equivalent to the maximum value observed. +// - The 0th percentile is equivalent to the minimum value observed. +// +// See the following issue for more context: +// https://github.com/open-telemetry/opentelemetry-proto/issues/125 +type SummaryDataPoint_ValueAtPercentile struct { + // The percentile of a distribution. Must be in the interval + // [0.0, 100.0]. + Percentile float64 `protobuf:"fixed64,1,opt,name=percentile,proto3" json:"percentile,omitempty"` + // The value at the given percentile of a distribution. + Value float64 `protobuf:"fixed64,2,opt,name=value,proto3" json:"value,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *SummaryDataPoint_ValueAtPercentile) Reset() { *m = SummaryDataPoint_ValueAtPercentile{} } +func (m *SummaryDataPoint_ValueAtPercentile) String() string { return proto.CompactTextString(m) } +func (*SummaryDataPoint_ValueAtPercentile) ProtoMessage() {} +func (*SummaryDataPoint_ValueAtPercentile) Descriptor() ([]byte, []int) { + return fileDescriptor_3c3112f9fa006917, []int{7, 0} +} + +func (m *SummaryDataPoint_ValueAtPercentile) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_SummaryDataPoint_ValueAtPercentile.Unmarshal(m, b) +} +func (m *SummaryDataPoint_ValueAtPercentile) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_SummaryDataPoint_ValueAtPercentile.Marshal(b, m, deterministic) +} +func (m *SummaryDataPoint_ValueAtPercentile) XXX_Merge(src proto.Message) { + xxx_messageInfo_SummaryDataPoint_ValueAtPercentile.Merge(m, src) +} +func (m *SummaryDataPoint_ValueAtPercentile) XXX_Size() int { + return xxx_messageInfo_SummaryDataPoint_ValueAtPercentile.Size(m) +} +func (m *SummaryDataPoint_ValueAtPercentile) XXX_DiscardUnknown() { + xxx_messageInfo_SummaryDataPoint_ValueAtPercentile.DiscardUnknown(m) +} + +var xxx_messageInfo_SummaryDataPoint_ValueAtPercentile proto.InternalMessageInfo + +func (m *SummaryDataPoint_ValueAtPercentile) GetPercentile() float64 { + if m != nil { + return m.Percentile + } + return 0 +} + +func (m *SummaryDataPoint_ValueAtPercentile) GetValue() float64 { + if m != nil { + return m.Value + } + return 0 +} + +func init() { + proto.RegisterEnum("opentelemetry.proto.metrics.v1.MetricDescriptor_Type", MetricDescriptor_Type_name, MetricDescriptor_Type_value) + proto.RegisterType((*ResourceMetrics)(nil), "opentelemetry.proto.metrics.v1.ResourceMetrics") + proto.RegisterType((*InstrumentationLibraryMetrics)(nil), "opentelemetry.proto.metrics.v1.InstrumentationLibraryMetrics") + proto.RegisterType((*Metric)(nil), "opentelemetry.proto.metrics.v1.Metric") + proto.RegisterType((*MetricDescriptor)(nil), "opentelemetry.proto.metrics.v1.MetricDescriptor") + proto.RegisterType((*Int64DataPoint)(nil), "opentelemetry.proto.metrics.v1.Int64DataPoint") + proto.RegisterType((*DoubleDataPoint)(nil), "opentelemetry.proto.metrics.v1.DoubleDataPoint") + proto.RegisterType((*HistogramDataPoint)(nil), "opentelemetry.proto.metrics.v1.HistogramDataPoint") + proto.RegisterType((*HistogramDataPoint_Bucket)(nil), "opentelemetry.proto.metrics.v1.HistogramDataPoint.Bucket") + proto.RegisterType((*HistogramDataPoint_Bucket_Exemplar)(nil), "opentelemetry.proto.metrics.v1.HistogramDataPoint.Bucket.Exemplar") + proto.RegisterType((*SummaryDataPoint)(nil), "opentelemetry.proto.metrics.v1.SummaryDataPoint") + proto.RegisterType((*SummaryDataPoint_ValueAtPercentile)(nil), "opentelemetry.proto.metrics.v1.SummaryDataPoint.ValueAtPercentile") +} + +func init() { + proto.RegisterFile("opentelemetry/proto/metrics/v1/metrics.proto", fileDescriptor_3c3112f9fa006917) +} + +var fileDescriptor_3c3112f9fa006917 = []byte{ + // 952 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xdc, 0x56, 0xdf, 0x6e, 0x2a, 0x45, + 0x18, 0x77, 0x59, 0x0a, 0xf5, 0xa3, 0xc2, 0x32, 0xad, 0x4a, 0x48, 0xce, 0x11, 0x89, 0xd1, 0x6a, + 0xec, 0x62, 0x6b, 0x6d, 0xe2, 0x85, 0x51, 0x28, 0xd8, 0x43, 0x2c, 0x2d, 0x19, 0xe0, 0x24, 0x9e, + 0xe4, 0xb8, 0x2e, 0x30, 0xd2, 0x89, 0xec, 0x0c, 0xd9, 0x9d, 0x6d, 0xca, 0x03, 0x78, 0xeb, 0x95, + 0x89, 0xde, 0xf8, 0x36, 0xfa, 0x00, 0xbe, 0x81, 0x0f, 0xe0, 0x9d, 0x2f, 0x60, 0x76, 0x66, 0x17, + 0x76, 0x29, 0x2d, 0x56, 0x6f, 0xf4, 0xdc, 0xcd, 0xfe, 0xbe, 0xef, 0xf7, 0xfb, 0xfe, 0xee, 0xee, + 0xc0, 0xfb, 0x7c, 0x46, 0x98, 0x20, 0x53, 0xe2, 0x10, 0xe1, 0xce, 0x6b, 0x33, 0x97, 0x0b, 0x5e, + 0x0b, 0xce, 0x74, 0xe4, 0xd5, 0xae, 0x0f, 0xa3, 0xa3, 0x29, 0x0d, 0xe8, 0x71, 0xc2, 0x5b, 0x81, + 0x66, 0xe4, 0x72, 0x7d, 0x58, 0x7e, 0x6f, 0x9d, 0xda, 0x88, 0x3b, 0x0e, 0x67, 0x81, 0x98, 0x3a, + 0x29, 0x5a, 0xd9, 0x5c, 0xe7, 0xeb, 0x12, 0x8f, 0xfb, 0xee, 0x88, 0x04, 0xde, 0xd1, 0x59, 0xf9, + 0x57, 0x7f, 0xd7, 0xa0, 0x80, 0x43, 0xa8, 0xa3, 0x42, 0xa2, 0x16, 0x6c, 0x47, 0x5e, 0x25, 0xad, + 0xa2, 0xed, 0xe7, 0x8e, 0xde, 0x35, 0xd7, 0xa5, 0xb8, 0x90, 0xba, 0x3e, 0x34, 0x23, 0x0d, 0xbc, + 0xa0, 0xa2, 0xef, 0x34, 0x78, 0x83, 0x32, 0x4f, 0xb8, 0xbe, 0x43, 0x98, 0xb0, 0x05, 0xe5, 0xcc, + 0x9a, 0xd2, 0xa1, 0x6b, 0xbb, 0x73, 0x2b, 0xac, 0xae, 0x94, 0xaa, 0xe8, 0xfb, 0xb9, 0xa3, 0x4f, + 0xcc, 0xfb, 0x3b, 0x60, 0xb6, 0x93, 0x32, 0xe7, 0x4a, 0x25, 0xcc, 0x17, 0x3f, 0xa2, 0xf7, 0x99, + 0xab, 0xbf, 0x69, 0xf0, 0xe8, 0x5e, 0x01, 0xc4, 0xe0, 0xf5, 0x3b, 0x12, 0x0d, 0xeb, 0xff, 0x68, + 0x6d, 0x82, 0x61, 0xe3, 0xef, 0xcc, 0x0f, 0xbf, 0xb6, 0x3e, 0x31, 0xf4, 0x19, 0x64, 0x93, 0x0d, + 0x78, 0x7b, 0x53, 0x03, 0x54, 0xa6, 0x38, 0xa2, 0x55, 0xff, 0xd0, 0x21, 0xa3, 0x30, 0xf4, 0x1c, + 0x8a, 0x0a, 0xb5, 0xc6, 0xc4, 0x1b, 0xb9, 0x74, 0x26, 0xb8, 0x1b, 0xa6, 0xfd, 0xc1, 0xdf, 0x93, + 0x6d, 0x2e, 0x78, 0xd8, 0x70, 0x56, 0x10, 0xf4, 0x0c, 0x8a, 0x94, 0x89, 0x93, 0x63, 0x6b, 0x6c, + 0x0b, 0xdb, 0x9a, 0x71, 0xca, 0x44, 0x94, 0xb5, 0xb9, 0x79, 0x6c, 0xe2, 0xe4, 0xb8, 0x69, 0x0b, + 0xbb, 0x1b, 0xd0, 0x70, 0x81, 0x26, 0x9e, 0x3d, 0xf4, 0x1c, 0xd0, 0x98, 0xfb, 0xc3, 0x29, 0x49, + 0x88, 0xeb, 0x52, 0xbc, 0xb6, 0x49, 0xbc, 0x29, 0x99, 0x4b, 0x75, 0x63, 0x9c, 0x04, 0x3c, 0xf4, + 0x0d, 0xbc, 0x7a, 0x45, 0x3d, 0xc1, 0x27, 0xae, 0xed, 0x24, 0x22, 0xa4, 0x65, 0x84, 0xa3, 0x4d, + 0x11, 0x9e, 0x44, 0xe4, 0x65, 0x90, 0xdd, 0xab, 0x5b, 0x98, 0x87, 0xbe, 0x86, 0x5d, 0xcf, 0x77, + 0x9c, 0x60, 0xaf, 0xe3, 0x51, 0xb6, 0x64, 0x94, 0x8d, 0x33, 0xe8, 0x29, 0xea, 0x32, 0x46, 0xd1, + 0x5b, 0x41, 0xbc, 0xea, 0xf7, 0x3a, 0x18, 0xab, 0xb3, 0x42, 0x08, 0xd2, 0xcc, 0x76, 0xd4, 0x2b, + 0xfa, 0x32, 0x96, 0x67, 0x54, 0x81, 0x5c, 0xb4, 0x05, 0x94, 0xb3, 0x52, 0x4a, 0x9a, 0xe2, 0x50, + 0xc0, 0xf2, 0x19, 0x15, 0x25, 0x5d, 0xb1, 0x82, 0x33, 0x6a, 0x43, 0x5a, 0xcc, 0x67, 0xa4, 0x94, + 0xae, 0x68, 0xfb, 0xf9, 0x3b, 0x96, 0xfd, 0x9e, 0xad, 0x31, 0xfb, 0xf3, 0x19, 0xc1, 0x52, 0x02, + 0xb5, 0x20, 0x33, 0xb5, 0x87, 0x64, 0x1a, 0x95, 0x7f, 0xb0, 0xe1, 0xcd, 0xe9, 0x09, 0x97, 0xb2, + 0xc9, 0x17, 0x64, 0xfe, 0xd4, 0x9e, 0xfa, 0x04, 0x87, 0xe4, 0xea, 0xcf, 0x1a, 0xa4, 0x03, 0x55, + 0x54, 0x80, 0xdc, 0xe0, 0xa2, 0xd7, 0x6d, 0x9d, 0xb6, 0x3f, 0x6f, 0xb7, 0x9a, 0xc6, 0x4b, 0x01, + 0x70, 0x56, 0x1f, 0x9c, 0xb5, 0xac, 0xf6, 0x45, 0xff, 0xe4, 0xd8, 0xd0, 0x90, 0x01, 0x3b, 0x0a, + 0x68, 0x5e, 0x0e, 0x1a, 0xe7, 0x2d, 0x23, 0x85, 0x76, 0xa1, 0xa0, 0x90, 0x27, 0xed, 0x5e, 0xff, + 0xf2, 0x0c, 0xd7, 0x3b, 0x86, 0x8e, 0x8a, 0xf0, 0xca, 0xe9, 0xe5, 0xe0, 0xa2, 0xdf, 0xc2, 0x21, + 0x33, 0x8d, 0x10, 0xe4, 0x23, 0x28, 0xe4, 0x6e, 0xa1, 0x12, 0xec, 0x9d, 0x0e, 0x3a, 0x83, 0xf3, + 0x7a, 0xbf, 0xfd, 0x34, 0x2e, 0x90, 0x41, 0x39, 0xc8, 0xf6, 0x06, 0x9d, 0x4e, 0x1d, 0x7f, 0x69, + 0x64, 0xab, 0xbf, 0x68, 0x90, 0x4f, 0x6e, 0x77, 0xac, 0x72, 0xed, 0x5f, 0x54, 0x8e, 0x6a, 0xb0, + 0xe7, 0x09, 0xdb, 0x15, 0x96, 0xa0, 0x0e, 0xb1, 0x7c, 0x46, 0x6f, 0x2c, 0x66, 0x33, 0x2e, 0x47, + 0x99, 0xc1, 0x45, 0x69, 0xeb, 0x53, 0x87, 0x0c, 0x18, 0xbd, 0xb9, 0xb0, 0x19, 0x47, 0x6f, 0x41, + 0x7e, 0xc5, 0x55, 0x97, 0xae, 0x3b, 0x22, 0xee, 0xb5, 0x07, 0x5b, 0xd7, 0x41, 0x1c, 0x39, 0x63, + 0x1d, 0xab, 0x87, 0xea, 0xaf, 0x1a, 0x14, 0x56, 0xde, 0xa3, 0xff, 0x53, 0x1d, 0x5a, 0x54, 0xc7, + 0x9f, 0x69, 0x40, 0xb7, 0xdf, 0xd6, 0xff, 0x7e, 0x29, 0x23, 0xee, 0x33, 0x21, 0x4b, 0x49, 0x63, + 0xf5, 0x80, 0x0c, 0xd0, 0x3d, 0xdf, 0x29, 0x6d, 0xc9, 0xf2, 0x82, 0x23, 0xea, 0x41, 0x76, 0xe8, + 0x8f, 0xbe, 0x25, 0xc2, 0x2b, 0x65, 0x64, 0x19, 0x1f, 0x3f, 0xfc, 0xc3, 0x65, 0x36, 0xa4, 0x02, + 0x8e, 0x94, 0xd0, 0x3b, 0x50, 0x20, 0x37, 0xb3, 0x29, 0x1d, 0x51, 0x61, 0x0d, 0xb9, 0xcf, 0xc6, + 0x5e, 0x29, 0x5b, 0xd1, 0xf7, 0x35, 0x9c, 0x8f, 0xe0, 0x86, 0x44, 0xcb, 0x3f, 0xa5, 0x20, 0xa3, + 0xc8, 0xcb, 0x84, 0xb5, 0x78, 0xc2, 0x5f, 0xc1, 0x36, 0xb9, 0x21, 0xce, 0x6c, 0x6a, 0xbb, 0xb2, + 0x23, 0xb9, 0xa3, 0xc6, 0x3f, 0xce, 0xcf, 0x6c, 0x85, 0x4a, 0x78, 0xa1, 0x59, 0xfe, 0x51, 0x83, + 0xed, 0x08, 0x5e, 0x8e, 0x5f, 0x8b, 0x8d, 0x7f, 0x4d, 0xbf, 0x53, 0x6b, 0xfa, 0x7d, 0x09, 0x39, + 0x5b, 0x08, 0x7b, 0x74, 0x15, 0xfc, 0x8f, 0xa3, 0xdf, 0xcc, 0x03, 0x57, 0x22, 0xae, 0x50, 0xfd, + 0x41, 0x07, 0x63, 0xf5, 0xeb, 0xfd, 0x82, 0xec, 0x1c, 0x87, 0xe2, 0x8c, 0xb8, 0x23, 0xc2, 0x04, + 0x9d, 0x12, 0x4b, 0x76, 0x39, 0xda, 0xbe, 0xc6, 0x43, 0x7f, 0x68, 0xa6, 0xac, 0xac, 0x2e, 0xba, + 0x0b, 0x41, 0x6c, 0x2c, 0xc5, 0xa5, 0xd1, 0x2b, 0xb7, 0xa1, 0x78, 0xcb, 0x0d, 0x3d, 0x06, 0x58, + 0x3a, 0x86, 0x23, 0x8f, 0x21, 0xcb, 0x6d, 0x48, 0xc5, 0xb6, 0xa1, 0x21, 0xe0, 0x4d, 0xca, 0x37, + 0x24, 0xd9, 0xd8, 0x09, 0xef, 0x7e, 0xdd, 0xc0, 0xd0, 0xd5, 0x9e, 0x7d, 0x3a, 0xa1, 0xe2, 0xca, + 0x1f, 0x06, 0x83, 0xa9, 0x05, 0xd4, 0x83, 0xe5, 0x1d, 0x3a, 0xa1, 0x74, 0xa0, 0x6e, 0xd4, 0x13, + 0xc2, 0x6a, 0x93, 0xf8, 0x95, 0x7e, 0x98, 0x91, 0x86, 0x0f, 0xff, 0x0a, 0x00, 0x00, 0xff, 0xff, + 0x28, 0xab, 0x2b, 0x39, 0xfb, 0x0b, 0x00, 0x00, +} diff --git a/packages/opentelemetry-exporter-collector/src/platform/node/protos/gen/go/resource/v1/resource.pb.go b/packages/opentelemetry-exporter-collector/src/platform/node/protos/gen/go/resource/v1/resource.pb.go new file mode 100644 index 0000000000..cfc41c45ef --- /dev/null +++ b/packages/opentelemetry-exporter-collector/src/platform/node/protos/gen/go/resource/v1/resource.pb.go @@ -0,0 +1,100 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// source: opentelemetry/proto/resource/v1/resource.proto + +package v1 + +import ( + fmt "fmt" + proto "github.com/golang/protobuf/proto" + v1 "github.com/open-telemetry/opentelemetry-proto/gen/go/common/v1" + math "math" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package + +// Resource information. +type Resource struct { + // Set of labels that describe the resource. + Attributes []*v1.AttributeKeyValue `protobuf:"bytes,1,rep,name=attributes,proto3" json:"attributes,omitempty"` + // dropped_attributes_count is the number of dropped attributes. If the value is 0, then + // no attributes were dropped. + DroppedAttributesCount uint32 `protobuf:"varint,2,opt,name=dropped_attributes_count,json=droppedAttributesCount,proto3" json:"dropped_attributes_count,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Resource) Reset() { *m = Resource{} } +func (m *Resource) String() string { return proto.CompactTextString(m) } +func (*Resource) ProtoMessage() {} +func (*Resource) Descriptor() ([]byte, []int) { + return fileDescriptor_446f73eacf88f3f5, []int{0} +} + +func (m *Resource) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Resource.Unmarshal(m, b) +} +func (m *Resource) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Resource.Marshal(b, m, deterministic) +} +func (m *Resource) XXX_Merge(src proto.Message) { + xxx_messageInfo_Resource.Merge(m, src) +} +func (m *Resource) XXX_Size() int { + return xxx_messageInfo_Resource.Size(m) +} +func (m *Resource) XXX_DiscardUnknown() { + xxx_messageInfo_Resource.DiscardUnknown(m) +} + +var xxx_messageInfo_Resource proto.InternalMessageInfo + +func (m *Resource) GetAttributes() []*v1.AttributeKeyValue { + if m != nil { + return m.Attributes + } + return nil +} + +func (m *Resource) GetDroppedAttributesCount() uint32 { + if m != nil { + return m.DroppedAttributesCount + } + return 0 +} + +func init() { + proto.RegisterType((*Resource)(nil), "opentelemetry.proto.resource.v1.Resource") +} + +func init() { + proto.RegisterFile("opentelemetry/proto/resource/v1/resource.proto", fileDescriptor_446f73eacf88f3f5) +} + +var fileDescriptor_446f73eacf88f3f5 = []byte{ + // 231 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xd2, 0xcb, 0x2f, 0x48, 0xcd, + 0x2b, 0x49, 0xcd, 0x49, 0xcd, 0x4d, 0x2d, 0x29, 0xaa, 0xd4, 0x2f, 0x28, 0xca, 0x2f, 0xc9, 0xd7, + 0x2f, 0x4a, 0x2d, 0xce, 0x2f, 0x2d, 0x4a, 0x4e, 0xd5, 0x2f, 0x33, 0x84, 0xb3, 0xf5, 0xc0, 0x52, + 0x42, 0xf2, 0x28, 0xea, 0x21, 0x82, 0x7a, 0x70, 0x35, 0x65, 0x86, 0x52, 0x5a, 0xd8, 0x0c, 0x4c, + 0xce, 0xcf, 0xcd, 0xcd, 0xcf, 0x03, 0x19, 0x07, 0x61, 0x41, 0xf4, 0x29, 0x4d, 0x63, 0xe4, 0xe2, + 0x08, 0x82, 0xea, 0x15, 0x0a, 0xe0, 0xe2, 0x4a, 0x2c, 0x29, 0x29, 0xca, 0x4c, 0x2a, 0x2d, 0x49, + 0x2d, 0x96, 0x60, 0x54, 0x60, 0xd6, 0xe0, 0x36, 0x32, 0xd0, 0xc3, 0x66, 0x1d, 0xd4, 0x8c, 0x32, + 0x43, 0x3d, 0x47, 0x98, 0x06, 0xef, 0xd4, 0xca, 0xb0, 0xc4, 0x9c, 0xd2, 0xd4, 0x20, 0x24, 0x33, + 0x84, 0x2c, 0xb8, 0x24, 0x52, 0x8a, 0xf2, 0x0b, 0x0a, 0x52, 0x53, 0xe2, 0x11, 0xa2, 0xf1, 0xc9, + 0xf9, 0xa5, 0x79, 0x25, 0x12, 0x4c, 0x0a, 0x8c, 0x1a, 0xbc, 0x41, 0x62, 0x50, 0x79, 0xb8, 0x39, + 0xc5, 0xce, 0x20, 0x59, 0xa7, 0x72, 0x2e, 0xa5, 0xcc, 0x7c, 0x3d, 0x02, 0x5e, 0x75, 0xe2, 0x85, + 0xb9, 0x3d, 0x00, 0x24, 0x15, 0xc0, 0x18, 0xe5, 0x90, 0x9e, 0x59, 0x92, 0x51, 0x9a, 0x04, 0x72, + 0xa0, 0x3e, 0x48, 0xb3, 0x2e, 0x22, 0x1c, 0x50, 0xcc, 0xd2, 0x85, 0x84, 0x4a, 0x7a, 0x6a, 0x9e, + 0x7e, 0x3a, 0x4a, 0x68, 0x27, 0xb1, 0x81, 0x65, 0x8c, 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0xc9, + 0xc6, 0x84, 0x9f, 0x97, 0x01, 0x00, 0x00, +} diff --git a/packages/opentelemetry-exporter-collector/src/platform/node/protos/gen/go/trace/v1/trace.pb.go b/packages/opentelemetry-exporter-collector/src/platform/node/protos/gen/go/trace/v1/trace.pb.go new file mode 100644 index 0000000000..7bda6aadb9 --- /dev/null +++ b/packages/opentelemetry-exporter-collector/src/platform/node/protos/gen/go/trace/v1/trace.pb.go @@ -0,0 +1,767 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// source: opentelemetry/proto/trace/v1/trace.proto + +package v1 + +import ( + fmt "fmt" + proto "github.com/golang/protobuf/proto" + v11 "github.com/open-telemetry/opentelemetry-proto/gen/go/common/v1" + v1 "github.com/open-telemetry/opentelemetry-proto/gen/go/resource/v1" + math "math" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package + +// SpanKind is the type of span. Can be used to specify additional relationships between spans +// in addition to a parent/child relationship. +type Span_SpanKind int32 + +const ( + // Unspecified. Do NOT use as default. + // Implementations MAY assume SpanKind to be INTERNAL when receiving UNSPECIFIED. + Span_SPAN_KIND_UNSPECIFIED Span_SpanKind = 0 + // Indicates that the span represents an internal operation within an application, + // as opposed to an operations happening at the boundaries. Default value. + Span_INTERNAL Span_SpanKind = 1 + // Indicates that the span covers server-side handling of an RPC or other + // remote network request. + Span_SERVER Span_SpanKind = 2 + // Indicates that the span describes a request to some remote service. + Span_CLIENT Span_SpanKind = 3 + // Indicates that the span describes a producer sending a message to a broker. + // Unlike CLIENT and SERVER, there is often no direct critical path latency relationship + // between producer and consumer spans. A PRODUCER span ends when the message was accepted + // by the broker while the logical processing of the message might span a much longer time. + Span_PRODUCER Span_SpanKind = 4 + // Indicates that the span describes consumer receiving a message from a broker. + // Like the PRODUCER kind, there is often no direct critical path latency relationship + // between producer and consumer spans. + Span_CONSUMER Span_SpanKind = 5 +) + +var Span_SpanKind_name = map[int32]string{ + 0: "SPAN_KIND_UNSPECIFIED", + 1: "INTERNAL", + 2: "SERVER", + 3: "CLIENT", + 4: "PRODUCER", + 5: "CONSUMER", +} + +var Span_SpanKind_value = map[string]int32{ + "SPAN_KIND_UNSPECIFIED": 0, + "INTERNAL": 1, + "SERVER": 2, + "CLIENT": 3, + "PRODUCER": 4, + "CONSUMER": 5, +} + +func (x Span_SpanKind) String() string { + return proto.EnumName(Span_SpanKind_name, int32(x)) +} + +func (Span_SpanKind) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_5c407ac9c675a601, []int{2, 0} +} + +// StatusCode mirrors the codes defined at +// https://github.com/open-telemetry/opentelemetry-specification/blob/master/specification/api-tracing.md#statuscanonicalcode +type Status_StatusCode int32 + +const ( + Status_Ok Status_StatusCode = 0 + Status_Cancelled Status_StatusCode = 1 + Status_UnknownError Status_StatusCode = 2 + Status_InvalidArgument Status_StatusCode = 3 + Status_DeadlineExceeded Status_StatusCode = 4 + Status_NotFound Status_StatusCode = 5 + Status_AlreadyExists Status_StatusCode = 6 + Status_PermissionDenied Status_StatusCode = 7 + Status_ResourceExhausted Status_StatusCode = 8 + Status_FailedPrecondition Status_StatusCode = 9 + Status_Aborted Status_StatusCode = 10 + Status_OutOfRange Status_StatusCode = 11 + Status_Unimplemented Status_StatusCode = 12 + Status_InternalError Status_StatusCode = 13 + Status_Unavailable Status_StatusCode = 14 + Status_DataLoss Status_StatusCode = 15 + Status_Unauthenticated Status_StatusCode = 16 +) + +var Status_StatusCode_name = map[int32]string{ + 0: "Ok", + 1: "Cancelled", + 2: "UnknownError", + 3: "InvalidArgument", + 4: "DeadlineExceeded", + 5: "NotFound", + 6: "AlreadyExists", + 7: "PermissionDenied", + 8: "ResourceExhausted", + 9: "FailedPrecondition", + 10: "Aborted", + 11: "OutOfRange", + 12: "Unimplemented", + 13: "InternalError", + 14: "Unavailable", + 15: "DataLoss", + 16: "Unauthenticated", +} + +var Status_StatusCode_value = map[string]int32{ + "Ok": 0, + "Cancelled": 1, + "UnknownError": 2, + "InvalidArgument": 3, + "DeadlineExceeded": 4, + "NotFound": 5, + "AlreadyExists": 6, + "PermissionDenied": 7, + "ResourceExhausted": 8, + "FailedPrecondition": 9, + "Aborted": 10, + "OutOfRange": 11, + "Unimplemented": 12, + "InternalError": 13, + "Unavailable": 14, + "DataLoss": 15, + "Unauthenticated": 16, +} + +func (x Status_StatusCode) String() string { + return proto.EnumName(Status_StatusCode_name, int32(x)) +} + +func (Status_StatusCode) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_5c407ac9c675a601, []int{3, 0} +} + +// A collection of InstrumentationLibrarySpans from a Resource. +type ResourceSpans struct { + // The resource for the spans in this message. + // If this field is not set then no resource info is known. + Resource *v1.Resource `protobuf:"bytes,1,opt,name=resource,proto3" json:"resource,omitempty"` + // A list of InstrumentationLibrarySpans that originate from a resource. + InstrumentationLibrarySpans []*InstrumentationLibrarySpans `protobuf:"bytes,2,rep,name=instrumentation_library_spans,json=instrumentationLibrarySpans,proto3" json:"instrumentation_library_spans,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ResourceSpans) Reset() { *m = ResourceSpans{} } +func (m *ResourceSpans) String() string { return proto.CompactTextString(m) } +func (*ResourceSpans) ProtoMessage() {} +func (*ResourceSpans) Descriptor() ([]byte, []int) { + return fileDescriptor_5c407ac9c675a601, []int{0} +} + +func (m *ResourceSpans) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ResourceSpans.Unmarshal(m, b) +} +func (m *ResourceSpans) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ResourceSpans.Marshal(b, m, deterministic) +} +func (m *ResourceSpans) XXX_Merge(src proto.Message) { + xxx_messageInfo_ResourceSpans.Merge(m, src) +} +func (m *ResourceSpans) XXX_Size() int { + return xxx_messageInfo_ResourceSpans.Size(m) +} +func (m *ResourceSpans) XXX_DiscardUnknown() { + xxx_messageInfo_ResourceSpans.DiscardUnknown(m) +} + +var xxx_messageInfo_ResourceSpans proto.InternalMessageInfo + +func (m *ResourceSpans) GetResource() *v1.Resource { + if m != nil { + return m.Resource + } + return nil +} + +func (m *ResourceSpans) GetInstrumentationLibrarySpans() []*InstrumentationLibrarySpans { + if m != nil { + return m.InstrumentationLibrarySpans + } + return nil +} + +// A collection of Spans produced by an InstrumentationLibrary. +type InstrumentationLibrarySpans struct { + // The instrumentation library information for the spans in this message. + // If this field is not set then no library info is known. + InstrumentationLibrary *v11.InstrumentationLibrary `protobuf:"bytes,1,opt,name=instrumentation_library,json=instrumentationLibrary,proto3" json:"instrumentation_library,omitempty"` + // A list of Spans that originate from an instrumentation library. + Spans []*Span `protobuf:"bytes,2,rep,name=spans,proto3" json:"spans,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *InstrumentationLibrarySpans) Reset() { *m = InstrumentationLibrarySpans{} } +func (m *InstrumentationLibrarySpans) String() string { return proto.CompactTextString(m) } +func (*InstrumentationLibrarySpans) ProtoMessage() {} +func (*InstrumentationLibrarySpans) Descriptor() ([]byte, []int) { + return fileDescriptor_5c407ac9c675a601, []int{1} +} + +func (m *InstrumentationLibrarySpans) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_InstrumentationLibrarySpans.Unmarshal(m, b) +} +func (m *InstrumentationLibrarySpans) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_InstrumentationLibrarySpans.Marshal(b, m, deterministic) +} +func (m *InstrumentationLibrarySpans) XXX_Merge(src proto.Message) { + xxx_messageInfo_InstrumentationLibrarySpans.Merge(m, src) +} +func (m *InstrumentationLibrarySpans) XXX_Size() int { + return xxx_messageInfo_InstrumentationLibrarySpans.Size(m) +} +func (m *InstrumentationLibrarySpans) XXX_DiscardUnknown() { + xxx_messageInfo_InstrumentationLibrarySpans.DiscardUnknown(m) +} + +var xxx_messageInfo_InstrumentationLibrarySpans proto.InternalMessageInfo + +func (m *InstrumentationLibrarySpans) GetInstrumentationLibrary() *v11.InstrumentationLibrary { + if m != nil { + return m.InstrumentationLibrary + } + return nil +} + +func (m *InstrumentationLibrarySpans) GetSpans() []*Span { + if m != nil { + return m.Spans + } + return nil +} + +// Span represents a single operation within a trace. Spans can be +// nested to form a trace tree. Spans may also be linked to other spans +// from the same or different trace and form graphs. Often, a trace +// contains a root span that describes the end-to-end latency, and one +// or more subspans for its sub-operations. A trace can also contain +// multiple root spans, or none at all. Spans do not need to be +// contiguous - there may be gaps or overlaps between spans in a trace. +// +// The next available field id is 17. +type Span struct { + // A unique identifier for a trace. All spans from the same trace share + // the same `trace_id`. The ID is a 16-byte array. An ID with all zeroes + // is considered invalid. + // + // This field is semantically required. Receiver should generate new + // random trace_id if empty or invalid trace_id was received. + // + // This field is required. + TraceId []byte `protobuf:"bytes,1,opt,name=trace_id,json=traceId,proto3" json:"trace_id,omitempty"` + // A unique identifier for a span within a trace, assigned when the span + // is created. The ID is an 8-byte array. An ID with all zeroes is considered + // invalid. + // + // This field is semantically required. Receiver should generate new + // random span_id if empty or invalid span_id was received. + // + // This field is required. + SpanId []byte `protobuf:"bytes,2,opt,name=span_id,json=spanId,proto3" json:"span_id,omitempty"` + // trace_state conveys information about request position in multiple distributed tracing graphs. + // It is a trace_state in w3c-trace-context format: https://www.w3.org/TR/trace-context/#tracestate-header + // See also https://github.com/w3c/distributed-tracing for more details about this field. + TraceState string `protobuf:"bytes,3,opt,name=trace_state,json=traceState,proto3" json:"trace_state,omitempty"` + // The `span_id` of this span's parent span. If this is a root span, then this + // field must be empty. The ID is an 8-byte array. + ParentSpanId []byte `protobuf:"bytes,4,opt,name=parent_span_id,json=parentSpanId,proto3" json:"parent_span_id,omitempty"` + // A description of the span's operation. + // + // For example, the name can be a qualified method name or a file name + // and a line number where the operation is called. A best practice is to use + // the same display name at the same call point in an application. + // This makes it easier to correlate spans in different traces. + // + // This field is semantically required to be set to non-empty string. + // When null or empty string received - receiver may use string "name" + // as a replacement. There might be smarted algorithms implemented by + // receiver to fix the empty span name. + // + // This field is required. + Name string `protobuf:"bytes,5,opt,name=name,proto3" json:"name,omitempty"` + // Distinguishes between spans generated in a particular context. For example, + // two spans with the same name may be distinguished using `CLIENT` (caller) + // and `SERVER` (callee) to identify queueing latency associated with the span. + Kind Span_SpanKind `protobuf:"varint,6,opt,name=kind,proto3,enum=opentelemetry.proto.trace.v1.Span_SpanKind" json:"kind,omitempty"` + // start_time_unix_nano is the start time of the span. On the client side, this is the time + // kept by the local machine where the span execution starts. On the server side, this + // is the time when the server's application handler starts running. + // Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January 1970. + // + // This field is semantically required and it is expected that end_time >= start_time. + StartTimeUnixNano uint64 `protobuf:"fixed64,7,opt,name=start_time_unix_nano,json=startTimeUnixNano,proto3" json:"start_time_unix_nano,omitempty"` + // end_time_unix_nano is the end time of the span. On the client side, this is the time + // kept by the local machine where the span execution ends. On the server side, this + // is the time when the server application handler stops running. + // Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January 1970. + // + // This field is semantically required and it is expected that end_time >= start_time. + EndTimeUnixNano uint64 `protobuf:"fixed64,8,opt,name=end_time_unix_nano,json=endTimeUnixNano,proto3" json:"end_time_unix_nano,omitempty"` + // attributes is a collection of key/value pairs. The value can be a string, + // an integer, a double or the Boolean values `true` or `false`. Note, global attributes + // like server name can be set using the resource API. Examples of attributes: + // + // "/http/user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36" + // "/http/server_latency": 300 + // "abc.com/myattribute": true + // "abc.com/score": 10.239 + Attributes []*v11.AttributeKeyValue `protobuf:"bytes,9,rep,name=attributes,proto3" json:"attributes,omitempty"` + // dropped_attributes_count is the number of attributes that were discarded. Attributes + // can be discarded because their keys are too long or because there are too many + // attributes. If this value is 0, then no attributes were dropped. + DroppedAttributesCount uint32 `protobuf:"varint,10,opt,name=dropped_attributes_count,json=droppedAttributesCount,proto3" json:"dropped_attributes_count,omitempty"` + // events is a collection of Event items. + Events []*Span_Event `protobuf:"bytes,11,rep,name=events,proto3" json:"events,omitempty"` + // dropped_events_count is the number of dropped events. If the value is 0, then no + // events were dropped. + DroppedEventsCount uint32 `protobuf:"varint,12,opt,name=dropped_events_count,json=droppedEventsCount,proto3" json:"dropped_events_count,omitempty"` + // links is a collection of Links, which are references from this span to a span + // in the same or different trace. + Links []*Span_Link `protobuf:"bytes,13,rep,name=links,proto3" json:"links,omitempty"` + // dropped_links_count is the number of dropped links after the maximum size was + // enforced. If this value is 0, then no links were dropped. + DroppedLinksCount uint32 `protobuf:"varint,14,opt,name=dropped_links_count,json=droppedLinksCount,proto3" json:"dropped_links_count,omitempty"` + // An optional final status for this span. Semantically when Status + // wasn't set it is means span ended without errors and assume + // Status.Ok (code = 0). + Status *Status `protobuf:"bytes,15,opt,name=status,proto3" json:"status,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Span) Reset() { *m = Span{} } +func (m *Span) String() string { return proto.CompactTextString(m) } +func (*Span) ProtoMessage() {} +func (*Span) Descriptor() ([]byte, []int) { + return fileDescriptor_5c407ac9c675a601, []int{2} +} + +func (m *Span) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Span.Unmarshal(m, b) +} +func (m *Span) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Span.Marshal(b, m, deterministic) +} +func (m *Span) XXX_Merge(src proto.Message) { + xxx_messageInfo_Span.Merge(m, src) +} +func (m *Span) XXX_Size() int { + return xxx_messageInfo_Span.Size(m) +} +func (m *Span) XXX_DiscardUnknown() { + xxx_messageInfo_Span.DiscardUnknown(m) +} + +var xxx_messageInfo_Span proto.InternalMessageInfo + +func (m *Span) GetTraceId() []byte { + if m != nil { + return m.TraceId + } + return nil +} + +func (m *Span) GetSpanId() []byte { + if m != nil { + return m.SpanId + } + return nil +} + +func (m *Span) GetTraceState() string { + if m != nil { + return m.TraceState + } + return "" +} + +func (m *Span) GetParentSpanId() []byte { + if m != nil { + return m.ParentSpanId + } + return nil +} + +func (m *Span) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +func (m *Span) GetKind() Span_SpanKind { + if m != nil { + return m.Kind + } + return Span_SPAN_KIND_UNSPECIFIED +} + +func (m *Span) GetStartTimeUnixNano() uint64 { + if m != nil { + return m.StartTimeUnixNano + } + return 0 +} + +func (m *Span) GetEndTimeUnixNano() uint64 { + if m != nil { + return m.EndTimeUnixNano + } + return 0 +} + +func (m *Span) GetAttributes() []*v11.AttributeKeyValue { + if m != nil { + return m.Attributes + } + return nil +} + +func (m *Span) GetDroppedAttributesCount() uint32 { + if m != nil { + return m.DroppedAttributesCount + } + return 0 +} + +func (m *Span) GetEvents() []*Span_Event { + if m != nil { + return m.Events + } + return nil +} + +func (m *Span) GetDroppedEventsCount() uint32 { + if m != nil { + return m.DroppedEventsCount + } + return 0 +} + +func (m *Span) GetLinks() []*Span_Link { + if m != nil { + return m.Links + } + return nil +} + +func (m *Span) GetDroppedLinksCount() uint32 { + if m != nil { + return m.DroppedLinksCount + } + return 0 +} + +func (m *Span) GetStatus() *Status { + if m != nil { + return m.Status + } + return nil +} + +// Event is a time-stamped annotation of the span, consisting of user-supplied +// text description and key-value pairs. +type Span_Event struct { + // time_unix_nano is the time the event occurred. + TimeUnixNano uint64 `protobuf:"fixed64,1,opt,name=time_unix_nano,json=timeUnixNano,proto3" json:"time_unix_nano,omitempty"` + // name of the event. + // This field is semantically required to be set to non-empty string. + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + // attributes is a collection of attribute key/value pairs on the event. + Attributes []*v11.AttributeKeyValue `protobuf:"bytes,3,rep,name=attributes,proto3" json:"attributes,omitempty"` + // dropped_attributes_count is the number of dropped attributes. If the value is 0, + // then no attributes were dropped. + DroppedAttributesCount uint32 `protobuf:"varint,4,opt,name=dropped_attributes_count,json=droppedAttributesCount,proto3" json:"dropped_attributes_count,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Span_Event) Reset() { *m = Span_Event{} } +func (m *Span_Event) String() string { return proto.CompactTextString(m) } +func (*Span_Event) ProtoMessage() {} +func (*Span_Event) Descriptor() ([]byte, []int) { + return fileDescriptor_5c407ac9c675a601, []int{2, 0} +} + +func (m *Span_Event) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Span_Event.Unmarshal(m, b) +} +func (m *Span_Event) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Span_Event.Marshal(b, m, deterministic) +} +func (m *Span_Event) XXX_Merge(src proto.Message) { + xxx_messageInfo_Span_Event.Merge(m, src) +} +func (m *Span_Event) XXX_Size() int { + return xxx_messageInfo_Span_Event.Size(m) +} +func (m *Span_Event) XXX_DiscardUnknown() { + xxx_messageInfo_Span_Event.DiscardUnknown(m) +} + +var xxx_messageInfo_Span_Event proto.InternalMessageInfo + +func (m *Span_Event) GetTimeUnixNano() uint64 { + if m != nil { + return m.TimeUnixNano + } + return 0 +} + +func (m *Span_Event) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +func (m *Span_Event) GetAttributes() []*v11.AttributeKeyValue { + if m != nil { + return m.Attributes + } + return nil +} + +func (m *Span_Event) GetDroppedAttributesCount() uint32 { + if m != nil { + return m.DroppedAttributesCount + } + return 0 +} + +// A pointer from the current span to another span in the same trace or in a +// different trace. For example, this can be used in batching operations, +// where a single batch handler processes multiple requests from different +// traces or when the handler receives a request from a different project. +type Span_Link struct { + // A unique identifier of a trace that this linked span is part of. The ID is a + // 16-byte array. + TraceId []byte `protobuf:"bytes,1,opt,name=trace_id,json=traceId,proto3" json:"trace_id,omitempty"` + // A unique identifier for the linked span. The ID is an 8-byte array. + SpanId []byte `protobuf:"bytes,2,opt,name=span_id,json=spanId,proto3" json:"span_id,omitempty"` + // The trace_state associated with the link. + TraceState string `protobuf:"bytes,3,opt,name=trace_state,json=traceState,proto3" json:"trace_state,omitempty"` + // attributes is a collection of attribute key/value pairs on the link. + Attributes []*v11.AttributeKeyValue `protobuf:"bytes,4,rep,name=attributes,proto3" json:"attributes,omitempty"` + // dropped_attributes_count is the number of dropped attributes. If the value is 0, + // then no attributes were dropped. + DroppedAttributesCount uint32 `protobuf:"varint,5,opt,name=dropped_attributes_count,json=droppedAttributesCount,proto3" json:"dropped_attributes_count,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Span_Link) Reset() { *m = Span_Link{} } +func (m *Span_Link) String() string { return proto.CompactTextString(m) } +func (*Span_Link) ProtoMessage() {} +func (*Span_Link) Descriptor() ([]byte, []int) { + return fileDescriptor_5c407ac9c675a601, []int{2, 1} +} + +func (m *Span_Link) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Span_Link.Unmarshal(m, b) +} +func (m *Span_Link) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Span_Link.Marshal(b, m, deterministic) +} +func (m *Span_Link) XXX_Merge(src proto.Message) { + xxx_messageInfo_Span_Link.Merge(m, src) +} +func (m *Span_Link) XXX_Size() int { + return xxx_messageInfo_Span_Link.Size(m) +} +func (m *Span_Link) XXX_DiscardUnknown() { + xxx_messageInfo_Span_Link.DiscardUnknown(m) +} + +var xxx_messageInfo_Span_Link proto.InternalMessageInfo + +func (m *Span_Link) GetTraceId() []byte { + if m != nil { + return m.TraceId + } + return nil +} + +func (m *Span_Link) GetSpanId() []byte { + if m != nil { + return m.SpanId + } + return nil +} + +func (m *Span_Link) GetTraceState() string { + if m != nil { + return m.TraceState + } + return "" +} + +func (m *Span_Link) GetAttributes() []*v11.AttributeKeyValue { + if m != nil { + return m.Attributes + } + return nil +} + +func (m *Span_Link) GetDroppedAttributesCount() uint32 { + if m != nil { + return m.DroppedAttributesCount + } + return 0 +} + +// The Status type defines a logical error model that is suitable for different +// programming environments, including REST APIs and RPC APIs. +type Status struct { + // The status code. This is optional field. It is safe to assume 0 (OK) + // when not set. + Code Status_StatusCode `protobuf:"varint,1,opt,name=code,proto3,enum=opentelemetry.proto.trace.v1.Status_StatusCode" json:"code,omitempty"` + // A developer-facing human readable error message. + Message string `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Status) Reset() { *m = Status{} } +func (m *Status) String() string { return proto.CompactTextString(m) } +func (*Status) ProtoMessage() {} +func (*Status) Descriptor() ([]byte, []int) { + return fileDescriptor_5c407ac9c675a601, []int{3} +} + +func (m *Status) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Status.Unmarshal(m, b) +} +func (m *Status) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Status.Marshal(b, m, deterministic) +} +func (m *Status) XXX_Merge(src proto.Message) { + xxx_messageInfo_Status.Merge(m, src) +} +func (m *Status) XXX_Size() int { + return xxx_messageInfo_Status.Size(m) +} +func (m *Status) XXX_DiscardUnknown() { + xxx_messageInfo_Status.DiscardUnknown(m) +} + +var xxx_messageInfo_Status proto.InternalMessageInfo + +func (m *Status) GetCode() Status_StatusCode { + if m != nil { + return m.Code + } + return Status_Ok +} + +func (m *Status) GetMessage() string { + if m != nil { + return m.Message + } + return "" +} + +func init() { + proto.RegisterEnum("opentelemetry.proto.trace.v1.Span_SpanKind", Span_SpanKind_name, Span_SpanKind_value) + proto.RegisterEnum("opentelemetry.proto.trace.v1.Status_StatusCode", Status_StatusCode_name, Status_StatusCode_value) + proto.RegisterType((*ResourceSpans)(nil), "opentelemetry.proto.trace.v1.ResourceSpans") + proto.RegisterType((*InstrumentationLibrarySpans)(nil), "opentelemetry.proto.trace.v1.InstrumentationLibrarySpans") + proto.RegisterType((*Span)(nil), "opentelemetry.proto.trace.v1.Span") + proto.RegisterType((*Span_Event)(nil), "opentelemetry.proto.trace.v1.Span.Event") + proto.RegisterType((*Span_Link)(nil), "opentelemetry.proto.trace.v1.Span.Link") + proto.RegisterType((*Status)(nil), "opentelemetry.proto.trace.v1.Status") +} + +func init() { + proto.RegisterFile("opentelemetry/proto/trace/v1/trace.proto", fileDescriptor_5c407ac9c675a601) +} + +var fileDescriptor_5c407ac9c675a601 = []byte{ + // 1008 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x56, 0xcd, 0x6e, 0x1b, 0x37, + 0x10, 0xce, 0xea, 0xdf, 0xa3, 0x1f, 0xaf, 0x19, 0xc7, 0xd9, 0x38, 0x2d, 0x22, 0x08, 0x01, 0xaa, + 0x36, 0x88, 0x14, 0xbb, 0x28, 0x90, 0x02, 0x0d, 0x5a, 0x45, 0x5a, 0x03, 0x82, 0x5d, 0x59, 0xa0, + 0xac, 0x1c, 0x7a, 0x59, 0x50, 0x22, 0x2b, 0x13, 0x5e, 0x91, 0xc2, 0x2e, 0x57, 0xb5, 0x0f, 0xbd, + 0xf5, 0x5d, 0xfa, 0x14, 0x3d, 0xf7, 0xd4, 0x63, 0x9f, 0xa1, 0xaf, 0x51, 0x90, 0xbb, 0x6b, 0x5b, + 0x81, 0x2c, 0xfb, 0xe2, 0x8b, 0x44, 0xce, 0x7c, 0xdf, 0x7c, 0x33, 0x9c, 0x59, 0x90, 0xd0, 0x94, + 0x0b, 0x26, 0x14, 0xf3, 0xd9, 0x9c, 0xa9, 0xe0, 0xaa, 0xbd, 0x08, 0xa4, 0x92, 0x6d, 0x15, 0x90, + 0x29, 0x6b, 0x2f, 0x0f, 0xe2, 0x45, 0xcb, 0x18, 0xd1, 0x17, 0x2b, 0xc8, 0xd8, 0xd8, 0x8a, 0x01, + 0xcb, 0x83, 0xfd, 0x6f, 0xd6, 0xc5, 0x99, 0xca, 0xf9, 0x5c, 0x0a, 0x1d, 0x28, 0x5e, 0xc5, 0xa4, + 0xfd, 0xd6, 0x3a, 0x6c, 0xc0, 0x42, 0x19, 0x05, 0xb1, 0x6c, 0xba, 0x8e, 0xf1, 0x8d, 0x7f, 0x2d, + 0xa8, 0xe2, 0xc4, 0x34, 0x5a, 0x10, 0x11, 0x22, 0x17, 0x4a, 0x29, 0xc6, 0xb1, 0xea, 0x56, 0xb3, + 0x7c, 0xf8, 0x75, 0x6b, 0x5d, 0x7a, 0xd7, 0x81, 0x96, 0x07, 0xad, 0x34, 0x02, 0xbe, 0xa6, 0xa2, + 0xdf, 0xe1, 0x4b, 0x2e, 0x42, 0x15, 0x44, 0x73, 0x26, 0x14, 0x51, 0x5c, 0x0a, 0xcf, 0xe7, 0x93, + 0x80, 0x04, 0x57, 0x5e, 0xa8, 0x75, 0x9c, 0x4c, 0x3d, 0xdb, 0x2c, 0x1f, 0x7e, 0xdf, 0xda, 0x54, + 0x7a, 0xab, 0xbf, 0x1a, 0xe2, 0x24, 0x8e, 0x60, 0x12, 0xc5, 0x2f, 0xf9, 0xdd, 0xce, 0xc6, 0xdf, + 0x16, 0xbc, 0xdc, 0x40, 0x46, 0x02, 0x9e, 0xdf, 0x91, 0x5e, 0x52, 0xf4, 0x77, 0x6b, 0x13, 0x4b, + 0xce, 0xfa, 0xce, 0xcc, 0xf0, 0xde, 0xfa, 0xa4, 0xd0, 0x7b, 0xc8, 0xdf, 0x2e, 0xbb, 0xb1, 0xb9, + 0x6c, 0x9d, 0x23, 0x8e, 0x09, 0x8d, 0x3f, 0x00, 0x72, 0x7a, 0x8f, 0x5e, 0x40, 0xc9, 0x00, 0x3c, + 0x4e, 0x4d, 0x8e, 0x15, 0x5c, 0x34, 0xfb, 0x3e, 0x45, 0xcf, 0xa1, 0xa8, 0xc1, 0xda, 0x93, 0x31, + 0x9e, 0x82, 0xde, 0xf6, 0x29, 0x7a, 0x05, 0xe5, 0x98, 0x13, 0x2a, 0xa2, 0x98, 0x93, 0xad, 0x5b, + 0xcd, 0x2d, 0x0c, 0xc6, 0x34, 0xd2, 0x16, 0xf4, 0x1a, 0x6a, 0x0b, 0x12, 0x30, 0xa1, 0xbc, 0x34, + 0x40, 0xce, 0x04, 0xa8, 0xc4, 0xd6, 0x51, 0x1c, 0x06, 0x41, 0x4e, 0x90, 0x39, 0x73, 0xf2, 0x86, + 0x6f, 0xd6, 0xe8, 0x47, 0xc8, 0x5d, 0x70, 0x41, 0x9d, 0x42, 0xdd, 0x6a, 0xd6, 0x0e, 0xdf, 0xdc, + 0x5f, 0x90, 0xf9, 0x39, 0xe6, 0x82, 0x62, 0x43, 0x44, 0x6d, 0xd8, 0x0d, 0x15, 0x09, 0x94, 0xa7, + 0xf8, 0x9c, 0x79, 0x91, 0xe0, 0x97, 0x9e, 0x20, 0x42, 0x3a, 0xc5, 0xba, 0xd5, 0x2c, 0xe0, 0x1d, + 0xe3, 0x3b, 0xe3, 0x73, 0x36, 0x16, 0xfc, 0x72, 0x40, 0x84, 0x44, 0x6f, 0x00, 0x31, 0x41, 0x3f, + 0x87, 0x97, 0x0c, 0x7c, 0x9b, 0x09, 0xba, 0x02, 0x1e, 0x02, 0x10, 0xa5, 0x02, 0x3e, 0x89, 0x14, + 0x0b, 0x9d, 0x2d, 0x73, 0xea, 0xef, 0xee, 0xe9, 0x69, 0x27, 0x25, 0x1c, 0xb3, 0xab, 0x4f, 0xc4, + 0x8f, 0x18, 0xbe, 0x15, 0x03, 0xbd, 0x07, 0x87, 0x06, 0x72, 0xb1, 0x60, 0xd4, 0xbb, 0xb1, 0x7a, + 0x53, 0x19, 0x09, 0xe5, 0x40, 0xdd, 0x6a, 0x56, 0xf1, 0x5e, 0xe2, 0xbf, 0x8e, 0x13, 0x76, 0xb5, + 0x17, 0xfd, 0x04, 0x05, 0xb6, 0x64, 0x42, 0x85, 0x4e, 0xd9, 0xe4, 0xd1, 0x7c, 0xc0, 0x61, 0xb9, + 0x9a, 0x80, 0x13, 0x1e, 0x7a, 0x07, 0xbb, 0xa9, 0x76, 0x6c, 0x49, 0x74, 0x2b, 0x46, 0x17, 0x25, + 0x3e, 0xc3, 0x49, 0x34, 0x3f, 0x40, 0xde, 0xe7, 0xe2, 0x22, 0x74, 0xaa, 0x46, 0xf2, 0xab, 0x07, + 0x48, 0x9e, 0x70, 0x71, 0x81, 0x63, 0x16, 0x6a, 0xc1, 0xd3, 0x54, 0xd0, 0x18, 0x12, 0xbd, 0x9a, + 0xd1, 0xdb, 0x49, 0x5c, 0x9a, 0x90, 0xc8, 0xfd, 0x00, 0x05, 0x3d, 0x62, 0x51, 0xe8, 0x6c, 0x9b, + 0xcf, 0xe7, 0xf5, 0x3d, 0x7a, 0x06, 0x8b, 0x13, 0xce, 0xfe, 0x3f, 0x16, 0xe4, 0x4d, 0xf2, 0x7a, + 0x1e, 0x3f, 0xeb, 0xaf, 0x65, 0xfa, 0x5b, 0x51, 0xb7, 0x9b, 0x9b, 0xce, 0x63, 0xe6, 0xd6, 0x3c, + 0xae, 0x36, 0x3c, 0xfb, 0xc8, 0x0d, 0xcf, 0x6d, 0x6a, 0xf8, 0xfe, 0x7f, 0x16, 0xe4, 0xf4, 0xe1, + 0x3c, 0xce, 0x37, 0xbb, 0x5a, 0x69, 0xee, 0x91, 0x2b, 0xcd, 0x6f, 0xaa, 0xb4, 0x31, 0x83, 0x52, + 0xfa, 0x59, 0xa3, 0x17, 0xf0, 0x6c, 0x34, 0xec, 0x0c, 0xbc, 0xe3, 0xfe, 0xa0, 0xe7, 0x8d, 0x07, + 0xa3, 0xa1, 0xdb, 0xed, 0x1f, 0xf5, 0xdd, 0x9e, 0xfd, 0x04, 0x55, 0xa0, 0xd4, 0x1f, 0x9c, 0xb9, + 0x78, 0xd0, 0x39, 0xb1, 0x2d, 0x04, 0x50, 0x18, 0xb9, 0xf8, 0x93, 0x8b, 0xed, 0x8c, 0x5e, 0x77, + 0x4f, 0xfa, 0xee, 0xe0, 0xcc, 0xce, 0x6a, 0xd4, 0x10, 0x9f, 0xf6, 0xc6, 0x5d, 0x17, 0xdb, 0x39, + 0xbd, 0xeb, 0x9e, 0x0e, 0x46, 0xe3, 0x9f, 0x5d, 0x6c, 0xe7, 0x1b, 0x7f, 0x66, 0xa1, 0x10, 0x4f, + 0x0d, 0xea, 0x42, 0x6e, 0x2a, 0x69, 0x7c, 0x3b, 0xd5, 0x0e, 0xdb, 0x0f, 0x99, 0xb4, 0xe4, 0xaf, + 0x2b, 0x29, 0xc3, 0x86, 0x8c, 0x1c, 0x28, 0xce, 0x59, 0x18, 0x92, 0x59, 0x3a, 0x45, 0xe9, 0xb6, + 0xf1, 0x57, 0x06, 0xe0, 0x06, 0x8e, 0x0a, 0x90, 0x39, 0xbd, 0xb0, 0x9f, 0xa0, 0x2a, 0x6c, 0x75, + 0x89, 0x98, 0x32, 0xdf, 0x67, 0xd4, 0xb6, 0x90, 0x0d, 0x95, 0xb1, 0xb8, 0x10, 0xf2, 0x37, 0xe1, + 0x06, 0x81, 0x0c, 0xec, 0x0c, 0x7a, 0x0a, 0xdb, 0x7d, 0xb1, 0x24, 0x3e, 0xa7, 0x9d, 0x60, 0x66, + 0x6e, 0x00, 0x3b, 0x8b, 0x76, 0xc1, 0xee, 0x31, 0x42, 0x7d, 0x2e, 0x98, 0x7b, 0x39, 0x65, 0x8c, + 0x32, 0x1a, 0x97, 0x36, 0x90, 0xea, 0x48, 0x46, 0x82, 0xda, 0x79, 0xb4, 0x03, 0xd5, 0x8e, 0x1f, + 0x30, 0x42, 0xaf, 0xdc, 0x4b, 0x1e, 0xaa, 0xd0, 0x2e, 0x68, 0xda, 0x90, 0x05, 0x73, 0x1e, 0x86, + 0x5c, 0x8a, 0x1e, 0x13, 0x9c, 0x51, 0xbb, 0x88, 0x9e, 0xc1, 0x4e, 0x7a, 0xd3, 0xba, 0x97, 0xe7, + 0x24, 0x0a, 0x15, 0xa3, 0x76, 0x09, 0xed, 0x01, 0x3a, 0x22, 0xdc, 0x67, 0x74, 0x18, 0xb0, 0xa9, + 0x14, 0x94, 0xeb, 0x8b, 0xc7, 0xde, 0x42, 0x65, 0x28, 0x76, 0x26, 0x32, 0xd0, 0x20, 0x40, 0x35, + 0x80, 0xd3, 0x48, 0x9d, 0xfe, 0x8a, 0x89, 0x98, 0x31, 0xbb, 0xac, 0x45, 0xc7, 0x82, 0xcf, 0x17, + 0xfa, 0xd8, 0x84, 0x86, 0x54, 0xb4, 0xa9, 0x2f, 0x14, 0x0b, 0x04, 0xf1, 0xe3, 0x9a, 0xaa, 0x68, + 0x1b, 0xca, 0x63, 0x41, 0x96, 0x84, 0xfb, 0x64, 0xe2, 0x33, 0xbb, 0xa6, 0x33, 0xef, 0x11, 0x45, + 0x4e, 0x64, 0x18, 0xda, 0xdb, 0xba, 0xe4, 0xb1, 0x20, 0x91, 0x3a, 0x67, 0x42, 0xf1, 0x29, 0xd1, + 0x61, 0xec, 0x8f, 0x02, 0x5e, 0x71, 0xb9, 0xb1, 0x29, 0x1f, 0xe1, 0x4c, 0xaf, 0x86, 0xda, 0x38, + 0xb4, 0x7e, 0xf9, 0x30, 0xe3, 0xea, 0x3c, 0x9a, 0xe8, 0x69, 0x6d, 0x6b, 0xda, 0xdb, 0x9b, 0xf7, + 0xcb, 0x4a, 0x94, 0xb7, 0xf1, 0x6b, 0x66, 0xc6, 0x44, 0x7b, 0x76, 0xf3, 0x90, 0x9a, 0x14, 0x8c, + 0xf9, 0xdb, 0xff, 0x03, 0x00, 0x00, 0xff, 0xff, 0x17, 0xf4, 0x60, 0x4c, 0x6f, 0x09, 0x00, 0x00, +} diff --git a/packages/opentelemetry-exporter-collector/src/platform/node/protos/install-proto-osx.sh b/packages/opentelemetry-exporter-collector/src/platform/node/protos/install-proto-osx.sh new file mode 100755 index 0000000000..c1e86e48b3 --- /dev/null +++ b/packages/opentelemetry-exporter-collector/src/platform/node/protos/install-proto-osx.sh @@ -0,0 +1,23 @@ +#!/usr/bin/env bash + +set -e + +DIR="${DIR:-/tmp}" +cd ${DIR} + +wget https://github.com/grpc-ecosystem/grpc-gateway/releases/download/v1.9.6/protoc-gen-swagger-v1.9.6-darwin-x86_64 \ + && chmod +x protoc-gen-swagger-v1.9.6-darwin-x86_64 \ + && sudo ln -s -f ${DIR}/protoc-gen-swagger-v1.9.6-darwin-x86_64 /usr/local/bin/protoc-gen-swagger + +wget https://github.com/grpc-ecosystem/grpc-gateway/releases/download/v1.9.6/protoc-gen-grpc-gateway-v1.9.6-darwin-x86_64 \ + && chmod +x protoc-gen-grpc-gateway-v1.9.6-darwin-x86_64 \ + && sudo ln -s -f ${DIR}/protoc-gen-grpc-gateway-v1.9.6-darwin-x86_64 /usr/local/bin/protoc-gen-grpc-gateway + +wget https://github.com/protocolbuffers/protobuf/releases/download/v3.9.1/protoc-3.9.1-osx-x86_64.zip \ + && unzip protoc-3.9.1-osx-x86_64.zip \ + && sudo ln -s -f ${DIR}/bin/protoc /usr/local/bin/protoc + +GIT_TAG="v1.3.2" +go get -d -u github.com/golang/protobuf/protoc-gen-go +git -C "$(go env GOPATH)"/src/github.com/golang/protobuf checkout $GIT_TAG +go install github.com/golang/protobuf/protoc-gen-go diff --git a/packages/opentelemetry-exporter-collector/src/platform/node/protos/install-proto.sh b/packages/opentelemetry-exporter-collector/src/platform/node/protos/install-proto.sh new file mode 100755 index 0000000000..f33c0a1d8e --- /dev/null +++ b/packages/opentelemetry-exporter-collector/src/platform/node/protos/install-proto.sh @@ -0,0 +1,23 @@ +#!/usr/bin/env bash + +set -e + +DIR="${DIR:-/tmp}" +cd ${DIR} + +wget https://github.com/grpc-ecosystem/grpc-gateway/releases/download/v1.9.6/protoc-gen-swagger-v1.9.6-linux-x86_64 \ + && chmod +x protoc-gen-swagger-v1.9.6-linux-x86_64 \ + && sudo ln -s ${DIR}/protoc-gen-swagger-v1.9.6-linux-x86_64 /usr/bin/protoc-gen-swagger + +wget https://github.com/grpc-ecosystem/grpc-gateway/releases/download/v1.9.6/protoc-gen-grpc-gateway-v1.9.6-linux-x86_64 \ + && chmod +x protoc-gen-grpc-gateway-v1.9.6-linux-x86_64 \ + && sudo ln -s -f ${DIR}/protoc-gen-grpc-gateway-v1.9.6-linux-x86_64 /usr/local/bin/protoc-gen-grpc-gateway + +wget https://github.com/protocolbuffers/protobuf/releases/download/v3.9.1/protoc-3.9.1-linux-x86_64.zip \ + && unzip protoc-3.9.1-linux-x86_64.zip \ + && sudo ln -s ${DIR}/bin/protoc /usr/bin/protoc + +GIT_TAG="v1.3.2" +go get -d -u github.com/golang/protobuf/protoc-gen-go +git -C "$(go env GOPATH)"/src/github.com/golang/protobuf checkout $GIT_TAG +go install github.com/golang/protobuf/protoc-gen-go diff --git a/packages/opentelemetry-exporter-collector/src/platform/node/protos/makefile b/packages/opentelemetry-exporter-collector/src/platform/node/protos/makefile new file mode 100755 index 0000000000..6635b904a4 --- /dev/null +++ b/packages/opentelemetry-exporter-collector/src/platform/node/protos/makefile @@ -0,0 +1,46 @@ +GOPATH_DIR := $(GOPATH)/src/github.com/open-telemetry/opentelemetry-proto +GENDIR := gen +OPENAPI_OUTDIR := "./$(GENDIR)/openapi" +GOPATH_GENDIR := $(GOPATH_DIR)/$(GENDIR) + +# Find all .proto files. +PROTO_FILES := $(wildcard opentelemetry/proto/*/v1/*.proto opentelemetry/proto/collector/*/v1/*.proto) + +# Function to execute a command. Note the empty line before endef to make sure each command +# gets executed separately instead of concatenated with previous one. +# Accepts command to execute as first parameter. +define exec-command +$(1) + +endef + +# CI build +.PHONY: ci +ci: gen-go gen-java gen-swagger + +# Generate ProtoBuf implementation for Go. +.PHONY: gen-go +gen-go: + rm -rf ./$(GENDIR)/go + $(foreach file,$(PROTO_FILES),$(call exec-command,protoc --go_out=plugins=grpc:$(GOPATH)/src $(file))) + protoc --grpc-gateway_out=logtostderr=true,grpc_api_configuration=opentelemetry/proto/collector/trace/v1/trace_service_http.yaml:$(GOPATH)/src opentelemetry/proto/collector/trace/v1/trace_service.proto + protoc --grpc-gateway_out=logtostderr=true,grpc_api_configuration=opentelemetry/proto/collector/metrics/v1/metrics_service_http.yaml:$(GOPATH)/src opentelemetry/proto/collector/metrics/v1/metrics_service.proto +# Only need to copy generated files if repo was checked out +# into a directory different from the standard GOPATH based one. +ifneq ($(PWD), $(GOPATH_DIR)) + cp -R $(GOPATH_GENDIR)/go ./$(GENDIR)/ +endif + +# Generate ProtoBuf implementation for Java. +.PHONY: gen-java +gen-java: + rm -rf ./$(GENDIR)/java + mkdir -p ./$(GENDIR)/java + $(foreach file,$(PROTO_FILES),$(call exec-command, protoc --java_out=./$(GENDIR)/java $(file))) + +# Generate Swagger +.PHONY: gen-swagger +gen-swagger: + mkdir -p $(OPENAPI_OUTDIR) + protoc --plugin=protoc-gen-swagger=/usr/bin/protoc-gen-swagger --swagger_out=logtostderr=true,grpc_api_configuration=opentelemetry/proto/collector/trace/v1/trace_service_http.yaml:$(OPENAPI_OUTDIR) opentelemetry/proto/collector/trace/v1/trace_service.proto + protoc --plugin=protoc-gen-swagger=/usr/bin/protoc-gen-swagger --swagger_out=logtostderr=true,grpc_api_configuration=opentelemetry/proto/collector/metrics/v1/metrics_service_http.yaml:$(OPENAPI_OUTDIR) opentelemetry/proto/collector/metrics/v1/metrics_service.proto diff --git a/packages/opentelemetry-exporter-collector/src/platform/node/protos/opentelemetry/proto/collector/README.md b/packages/opentelemetry-exporter-collector/src/platform/node/protos/opentelemetry/proto/collector/README.md new file mode 100644 index 0000000000..4a73a31ed8 --- /dev/null +++ b/packages/opentelemetry-exporter-collector/src/platform/node/protos/opentelemetry/proto/collector/README.md @@ -0,0 +1,9 @@ +# OpenTelemetry Collector Proto + +This package describes the OpenTelemetry collector protocol. + +## Packages + +1. `common` package contains the common messages shared between different services. +2. `trace` package contains the Trace Service protos. +3. `metrics` package contains the Metrics Service protos. diff --git a/packages/opentelemetry-exporter-collector/src/platform/node/protos/opentelemetry/proto/collector/metrics/v1/metrics_service.proto b/packages/opentelemetry-exporter-collector/src/platform/node/protos/opentelemetry/proto/collector/metrics/v1/metrics_service.proto new file mode 100644 index 0000000000..5a3cbee4c9 --- /dev/null +++ b/packages/opentelemetry-exporter-collector/src/platform/node/protos/opentelemetry/proto/collector/metrics/v1/metrics_service.proto @@ -0,0 +1,45 @@ +// Copyright 2019, 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 +// +// http://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. + +syntax = "proto3"; + +package opentelemetry.proto.collector.metrics.v1; + +import "opentelemetry/proto/metrics/v1/metrics.proto"; + +option java_multiple_files = true; +option java_package = "io.opentelemetry.proto.collector.metrics.v1"; +option java_outer_classname = "MetricsServiceProto"; +option go_package = "github.com/open-telemetry/opentelemetry-proto/gen/go/collector/metrics/v1"; + +// Service that can be used to push metrics between one Application +// instrumented with OpenTelemetry and a collector, or between a collector and a +// central collector. +service MetricsService { + // For performance reasons, it is recommended to keep this RPC + // alive for the entire life of the application. + rpc Export(ExportMetricsServiceRequest) returns (ExportMetricsServiceResponse) {} +} + +message ExportMetricsServiceRequest { + // An array of ResourceMetrics. + // For data coming from a single resource this array will typically contain one + // element. Intermediary nodes (such as OpenTelemetry Collector) that receive + // data from multiple origins typically batch the data before forwarding further and + // in that case this array will contain multiple elements. + repeated opentelemetry.proto.metrics.v1.ResourceMetrics resource_metrics = 1; +} + +message ExportMetricsServiceResponse { +} diff --git a/packages/opentelemetry-exporter-collector/src/platform/node/protos/opentelemetry/proto/collector/metrics/v1/metrics_service_http.yaml b/packages/opentelemetry-exporter-collector/src/platform/node/protos/opentelemetry/proto/collector/metrics/v1/metrics_service_http.yaml new file mode 100644 index 0000000000..a545650260 --- /dev/null +++ b/packages/opentelemetry-exporter-collector/src/platform/node/protos/opentelemetry/proto/collector/metrics/v1/metrics_service_http.yaml @@ -0,0 +1,9 @@ +# This is an API configuration to generate an HTTP/JSON -> gRPC gateway for the +# OpenTelemetry service using github.com/grpc-ecosystem/grpc-gateway. +type: google.api.Service +config_version: 3 +http: + rules: + - selector: opentelemetry.proto.collector.metrics.v1.MetricsService.Export + post: /v1/metrics + body: "*" \ No newline at end of file diff --git a/packages/opentelemetry-exporter-collector/src/platform/node/protos/opentelemetry/proto/collector/trace/v1/trace_service.proto b/packages/opentelemetry-exporter-collector/src/platform/node/protos/opentelemetry/proto/collector/trace/v1/trace_service.proto new file mode 100644 index 0000000000..16784c666a --- /dev/null +++ b/packages/opentelemetry-exporter-collector/src/platform/node/protos/opentelemetry/proto/collector/trace/v1/trace_service.proto @@ -0,0 +1,48 @@ +// Copyright 2019, 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 +// +// http://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. + +syntax = "proto3"; + +// NOTE: This proto is experimental and is subject to change at this point. +// Please do not use it at the moment. + +package opentelemetry.proto.collector.trace.v1; + +import "opentelemetry/proto/trace/v1/trace.proto"; + +option java_multiple_files = true; +option java_package = "io.opentelemetry.proto.collector.trace.v1"; +option java_outer_classname = "TraceServiceProto"; +option go_package = "github.com/open-telemetry/opentelemetry-proto/gen/go/collector/trace/v1"; + +// Service that can be used to push spans between one Application instrumented with +// OpenTelemetry and an collector, or between an collector and a central collector (in this +// case spans are sent/received to/from multiple Applications). +service TraceService { + // For performance reasons, it is recommended to keep this RPC + // alive for the entire life of the application. + rpc Export(ExportTraceServiceRequest) returns (ExportTraceServiceResponse) {} +} + +message ExportTraceServiceRequest { + // An array of ResourceSpans. + // For data coming from a single resource this array will typically contain one + // element. Intermediary nodes (such as OpenTelemetry Collector) that receive + // data from multiple origins typically batch the data before forwarding further and + // in that case this array will contain multiple elements. + repeated opentelemetry.proto.trace.v1.ResourceSpans resource_spans = 1; +} + +message ExportTraceServiceResponse { +} diff --git a/packages/opentelemetry-exporter-collector/src/platform/node/protos/opentelemetry/proto/collector/trace/v1/trace_service_http.yaml b/packages/opentelemetry-exporter-collector/src/platform/node/protos/opentelemetry/proto/collector/trace/v1/trace_service_http.yaml new file mode 100644 index 0000000000..287473597c --- /dev/null +++ b/packages/opentelemetry-exporter-collector/src/platform/node/protos/opentelemetry/proto/collector/trace/v1/trace_service_http.yaml @@ -0,0 +1,9 @@ +# This is an API configuration to generate an HTTP/JSON -> gRPC gateway for the +# OpenTelemetry service using github.com/grpc-ecosystem/grpc-gateway. +type: google.api.Service +config_version: 3 +http: + rules: + - selector: opentelemetry.proto.collector.trace.v1.TraceService.Export + post: /v1/trace + body: "*" \ No newline at end of file diff --git a/packages/opentelemetry-exporter-collector/src/platform/node/protos/opentelemetry/proto/common/v1/common.proto b/packages/opentelemetry-exporter-collector/src/platform/node/protos/opentelemetry/proto/common/v1/common.proto new file mode 100644 index 0000000000..45fbcdb755 --- /dev/null +++ b/packages/opentelemetry-exporter-collector/src/platform/node/protos/opentelemetry/proto/common/v1/common.proto @@ -0,0 +1,62 @@ +// Copyright 2019, 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 +// +// http://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. + +syntax = "proto3"; + +package opentelemetry.proto.common.v1; + +option java_multiple_files = true; +option java_package = "io.opentelemetry.proto.common.v1"; +option java_outer_classname = "CommonProto"; +option go_package = "github.com/open-telemetry/opentelemetry-proto/gen/go/common/v1"; + +// AttributeKeyValue is a key-value pair that is used to store Span attributes, Link +// attributes, etc. +message AttributeKeyValue { + // ValueType is the enumeration of possible types that value can have. + enum ValueType { + STRING = 0; + INT = 1; + DOUBLE = 2; + BOOL = 3; + }; + + // key part of the key-value pair. + string key = 1; + + // type of the value. + ValueType type = 2; + + // Only one of the following fields is supposed to contain data (determined by `type` field). + // This is deliberately not using Protobuf `oneof` for performance reasons (verified by benchmarks). + + string string_value = 3; + int64 int_value = 4; + double double_value = 5; + bool bool_value = 6; +} + +// StringKeyValue is a pair of key/value strings. This is the simpler (and faster) version +// of AttributeKeyValue that only supports string values. +message StringKeyValue { + string key = 1; + string value = 2; +} + +// InstrumentationLibrary is a message representing the instrumentation library information +// such as the fully qualified name and version. +message InstrumentationLibrary { + string name = 1; + string version = 2; +} diff --git a/packages/opentelemetry-exporter-collector/src/platform/node/protos/opentelemetry/proto/metrics/v1/metrics.proto b/packages/opentelemetry-exporter-collector/src/platform/node/protos/opentelemetry/proto/metrics/v1/metrics.proto new file mode 100644 index 0000000000..ebfb242712 --- /dev/null +++ b/packages/opentelemetry-exporter-collector/src/platform/node/protos/opentelemetry/proto/metrics/v1/metrics.proto @@ -0,0 +1,372 @@ +// Copyright 2019, 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 +// +// http://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. + +syntax = "proto3"; + +package opentelemetry.proto.metrics.v1; + +import "opentelemetry/proto/common/v1/common.proto"; +import "opentelemetry/proto/resource/v1/resource.proto"; + +option java_multiple_files = true; +option java_package = "io.opentelemetry.proto.metrics.v1"; +option java_outer_classname = "MetricsProto"; +option go_package = "github.com/open-telemetry/opentelemetry-proto/gen/go/metrics/v1"; + +// A collection of InstrumentationLibraryMetrics from a Resource. +message ResourceMetrics { + // The resource for the metrics in this message. + // If this field is not set then no resource info is known. + opentelemetry.proto.resource.v1.Resource resource = 1; + + // A list of metrics that originate from a resource. + repeated InstrumentationLibraryMetrics instrumentation_library_metrics = 2; +} + +// A collection of Metrics produced by an InstrumentationLibrary. +message InstrumentationLibraryMetrics { + // The instrumentation library information for the metrics in this message. + // If this field is not set then no library info is known. + opentelemetry.proto.common.v1.InstrumentationLibrary instrumentation_library = 1; + + // A list of metrics that originate from an instrumentation library. + repeated Metric metrics = 2; +} + +// Defines a Metric which has one or more timeseries. +// +// The data model and relation between entities is shown in the diagram below. +// +// - Metric is composed of a MetricDescriptor and a list of data points. +// - MetricDescriptor contains a list of label keys (shown horizontally). +// - Data is a list of DataPoints (shown vertically). +// - DataPoint contains a list of label values and a value. +// +// Metric +// +----------+ +------------------------+ +// |descriptor|-------->| MetricDescriptor | +// | | |+-----+-----+ +-----+ | +// | | ||label|label|...|label| | +// | data|--+ ||key1 |key2 | |keyN | | +// +----------+ | |+-----+-----+ +-----+ | +// | +------------------------+ +// | +// | +---------------------------+ +// | |DataPoint 1 | +// v |+------+------+ +------+ | +// +-----+ ||label |label |...|label | | +// | 1 |-->||value1|value2|...|valueN| | +// +-----+ |+------+------+ +------+ | +// | . | |+-----+ | +// | . | ||value| | +// | . | |+-----+ | +// | . | +---------------------------+ +// | . | . +// | . | . +// | . | . +// | . | +---------------------------+ +// | . | |DataPoint M | +// +-----+ |+------+------+ +------+ | +// | M |-->||label |label |...|label | | +// +-----+ ||value1|value2|...|valueN| | +// |+------+------+ +------+ | +// |+-----+ | +// ||value| | +// |+-----+ | +// +---------------------------+ +// +//----------------------------------------------------------------------- +// DataPoint is a value of specific type corresponding to a given moment in +// time. Each DataPoint is timestamped. +// +// DataPoint is strongly typed: each DataPoint type has a specific Protobuf message +// depending on the value type of the metric and thus there are currently 4 DataPoint +// messages, which correspond to the types of metric values. +message Metric { + // metric_descriptor describes the Metric. + MetricDescriptor metric_descriptor = 1; + + // Data is a list of one or more DataPoints for a single metric. Only one of the + // following fields is used for the data, depending on the type of the metric defined + // by MetricDescriptor.type field. + repeated Int64DataPoint int64_data_points = 2; + repeated DoubleDataPoint double_data_points = 3; + repeated HistogramDataPoint histogram_data_points = 4; + repeated SummaryDataPoint summary_data_points = 5; +} + +// Defines a metric type and its schema. +message MetricDescriptor { + // name of the metric, including its DNS name prefix. It must be unique. + string name = 1; + + // description of the metric, which can be used in documentation. + string description = 2; + + // unit in which the metric value is reported. Follows the format + // described by http://unitsofmeasure.org/ucum.html. + string unit = 3; + + // Type of the metric. It describes how the data is reported. + // + // A gauge is an instantaneous measurement of a value. + // + // A counter/cumulative measurement is a value accumulated over a time + // interval. In a time series, cumulative measurements should have the same + // start time, increasing values, until an event resets the cumulative value + // to zero and sets a new start time for the subsequent points. + enum Type { + // Do not use this default value. + UNSPECIFIED = 0; + + // Integer gauge. The value can go both up and down over time. + // Corresponding values are stored in Int64DataPoint. + GAUGE_INT64 = 1; + + // Floating point gauge. The value can go both up and down over time. + // Corresponding values are stored in DoubleDataPoint. + GAUGE_DOUBLE = 2; + + // Histogram gauge measurement. + // Used in scenarios like a snapshot of time that current items in a queue + // have spent there. + // Corresponding values are stored in HistogramDataPoint. The count and sum of the + // histogram can go both up and down over time. Recorded values are always >= 0. + GAUGE_HISTOGRAM = 3; + + // Integer counter measurement. The value cannot decrease; if value is reset then + // start_time_unix_nano should also be reset. + // Corresponding values are stored in Int64DataPoint. + COUNTER_INT64 = 4; + + // Floating point counter measurement. The value cannot decrease, if + // resets then the start_time_unix_nano should also be reset. + // Recorded values are always >= 0. + // Corresponding values are stored in DoubleDataPoint. + COUNTER_DOUBLE = 5; + + // Histogram cumulative measurement. + // Corresponding values are stored in HistogramDataPoint. The count and sum of the + // histogram cannot decrease; if values are reset then start_time_unix_nano + // should also be reset to the new start timestamp. + CUMULATIVE_HISTOGRAM = 6; + + // Summary value. Some frameworks implemented Histograms as a summary of observations + // (usually things like request durations and response sizes). While it + // also provides a total count of observations and a sum of all observed + // values, it calculates configurable percentiles over a sliding time + // window. + // Corresponding values are stored in SummaryDataPoint. + SUMMARY = 7; + } + Type type = 4; + + // The set of labels associated with the metric descriptor. Labels in this list apply to + // all data points. + repeated opentelemetry.proto.common.v1.StringKeyValue labels = 5; +} + +// Int64DataPoint is a single data point in a timeseries that describes the time-varying +// values of a int64 metric. +message Int64DataPoint { + // The set of labels that uniquely identify this timeseries. + repeated opentelemetry.proto.common.v1.StringKeyValue labels = 1; + + // start_time_unix_nano is the time when the cumulative value was reset to zero. + // This is used for Counter type only. For Gauge the value is not specified and + // defaults to 0. + // + // The cumulative value is over the time interval (start_time_unix_nano, time_unix_nano]. + // Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January 1970. + // + // Value of 0 indicates that the timestamp is unspecified. In that case the timestamp + // may be decided by the backend. + fixed64 start_time_unix_nano = 2; + + // time_unix_nano is the moment when this value was recorded. + // Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January 1970. + fixed64 time_unix_nano = 3; + + // value itself. + int64 value = 4; +} + +// DoubleDataPoint is a single data point in a timeseries that describes the time-varying +// value of a double metric. +message DoubleDataPoint { + // The set of labels that uniquely identify this timeseries. + repeated opentelemetry.proto.common.v1.StringKeyValue labels = 1; + + // start_time_unix_nano is the time when the cumulative value was reset to zero. + // This is used for Counter type only. For Gauge the value is not specified and + // defaults to 0. + // + // The cumulative value is over the time interval (start_time_unix_nano, time_unix_nano]. + // Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January 1970. + // + // Value of 0 indicates that the timestamp is unspecified. In that case the timestamp + // may be decided by the backend. + fixed64 start_time_unix_nano = 2; + + // time_unix_nano is the moment when this value was recorded. + // Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January 1970. + fixed64 time_unix_nano = 3; + + // value itself. + double value = 4; +} + +// HistogramDataPoint is a single data point in a timeseries that describes the time-varying +// values of a Histogram. A Histogram contains summary statistics for a population of values, +// it may optionally contain the distribution of those values across a set of buckets. +message HistogramDataPoint { + // The set of labels that uniquely identify this timeseries. + repeated opentelemetry.proto.common.v1.StringKeyValue labels = 1; + + // start_time_unix_nano is the time when the cumulative value was reset to zero. + // + // The cumulative value is over the time interval (start_time_unix_nano, time_unix_nano]. + // Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January 1970. + // + // Value of 0 indicates that the timestamp is unspecified. In that case the timestamp + // may be decided by the backend. + // Note: this field is always unspecified and ignored if MetricDescriptor.type==GAUGE_HISTOGRAM. + fixed64 start_time_unix_nano = 2; + + // time_unix_nano is the moment when this value was recorded. + // Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January 1970. + fixed64 time_unix_nano = 3; + + // count is the number of values in the population. Must be non-negative. This value + // must be equal to the sum of the "count" fields in buckets if a histogram is provided. + uint64 count = 4; + + // sum of the values in the population. If count is zero then this field + // must be zero. This value must be equal to the sum of the "sum" fields in buckets if + // a histogram is provided. + double sum = 5; + + // Bucket contains values for a bucket. + message Bucket { + // The number of values in each bucket of the histogram, as described by + // bucket_options. + uint64 count = 1; + + // Exemplars are example points that may be used to annotate aggregated + // Histogram values. They are metadata that gives information about a + // particular value added to a Histogram bucket. + message Exemplar { + // Value of the exemplar point. It determines which bucket the exemplar belongs to. + // If bucket_options define bounds for this bucket then this value must be within + // the defined bounds. + double value = 1; + + // time_unix_nano is the moment when this exemplar was recorded. + // Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January 1970. + fixed64 time_unix_nano = 2; + + // exemplar_attachments are contextual information about the example value. + // Keys in this list must be unique. + repeated opentelemetry.proto.common.v1.StringKeyValue attachments = 3; + } + + // exemplar is an optional representative value of the bucket. + Exemplar exemplar = 2; + } + + // buckets is an optional field contains the values of histogram for each bucket. + // + // The sum of the values in the buckets "count" field must equal the value in the count field. + // + // The number of elements in buckets array must be by one greater than the + // number of elements in bucket_bounds array. + // + // Note: if HistogramDataPoint.bucket_options defines bucket bounds then this field + // must also be present and number of elements in this field must be equal to the + // number of buckets defined by bucket_options. + repeated Bucket buckets = 6; + + // A histogram may optionally contain the distribution of the values in the population. + // In that case one of the option fields below and "buckets" field both must be defined. + // Otherwise all option fields and "buckets" field must be omitted in which case the + // distribution of values in the histogram is unknown and only the total count and sum are known. + + // explicit_bounds is the only supported bucket option currently. + // TODO: Add more bucket options. + + // explicit_bounds specifies buckets with explicitly defined bounds for values. + // The bucket boundaries are described by "bounds" field. + // + // This defines size(bounds) + 1 (= N) buckets. The boundaries for bucket + // at index i are: + // + // [0, bounds[i]) for i == 0 + // [bounds[i-1], bounds[i]) for 0 < i < N-1 + // [bounds[i], +infinity) for i == N-1 + // The values in bounds array must be strictly increasing and > 0. + // + // Note: only [a, b) intervals are currently supported for each bucket. If we decides + // to also support (a, b] intervals we should add support for these by defining a boolean + // value which decides what type of intervals to use. + repeated double explicit_bounds = 7; +} + +// SummaryDataPoint is a single data point in a timeseries that describes the time-varying +// values of a Summary metric. +message SummaryDataPoint { + // The set of labels that uniquely identify this timeseries. + repeated opentelemetry.proto.common.v1.StringKeyValue labels = 1; + + // start_time_unix_nano is the time when the cumulative value was reset to zero. + // + // The cumulative value is over the time interval (start_time_unix_nano, time_unix_nano]. + // Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January 1970. + // + // Value of 0 indicates that the timestamp is unspecified. In that case the timestamp + // may be decided by the backend. + fixed64 start_time_unix_nano = 2; + + // time_unix_nano is the moment when this value was recorded. + // Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January 1970. + fixed64 time_unix_nano = 3; + + // The total number of recorded values since start_time. Optional since + // some systems don't expose this. + uint64 count = 4; + + // The total sum of recorded values since start_time. Optional since some + // systems don't expose this. If count is zero then this field must be zero. + double sum = 5; + + // Represents the value at a given percentile of a distribution. + // + // To record Min and Max values following conventions are used: + // - The 100th percentile is equivalent to the maximum value observed. + // - The 0th percentile is equivalent to the minimum value observed. + // + // See the following issue for more context: + // https://github.com/open-telemetry/opentelemetry-proto/issues/125 + message ValueAtPercentile { + // The percentile of a distribution. Must be in the interval + // [0.0, 100.0]. + double percentile = 1; + + // The value at the given percentile of a distribution. + double value = 2; + } + + // A list of values at different percentiles of the distribution calculated + // from the current snapshot. The percentiles must be strictly increasing. + repeated ValueAtPercentile percentile_values = 6; +} diff --git a/packages/opentelemetry-exporter-collector/src/platform/node/protos/opentelemetry/proto/resource/v1/resource.proto b/packages/opentelemetry-exporter-collector/src/platform/node/protos/opentelemetry/proto/resource/v1/resource.proto new file mode 100644 index 0000000000..a9e1711af4 --- /dev/null +++ b/packages/opentelemetry-exporter-collector/src/platform/node/protos/opentelemetry/proto/resource/v1/resource.proto @@ -0,0 +1,34 @@ +// Copyright 2019, 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 +// +// http://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. + +syntax = "proto3"; + +package opentelemetry.proto.resource.v1; + +import "opentelemetry/proto/common/v1/common.proto"; + +option java_multiple_files = true; +option java_package = "io.opentelemetry.proto.resource.v1"; +option java_outer_classname = "ResourceProto"; +option go_package = "github.com/open-telemetry/opentelemetry-proto/gen/go/resource/v1"; + +// Resource information. +message Resource { + // Set of labels that describe the resource. + repeated opentelemetry.proto.common.v1.AttributeKeyValue attributes = 1; + + // dropped_attributes_count is the number of dropped attributes. If the value is 0, then + // no attributes were dropped. + uint32 dropped_attributes_count = 2; +} diff --git a/packages/opentelemetry-exporter-collector/src/platform/node/protos/opentelemetry/proto/trace/v1/trace.proto b/packages/opentelemetry-exporter-collector/src/platform/node/protos/opentelemetry/proto/trace/v1/trace.proto new file mode 100644 index 0000000000..33a6aea076 --- /dev/null +++ b/packages/opentelemetry-exporter-collector/src/platform/node/protos/opentelemetry/proto/trace/v1/trace.proto @@ -0,0 +1,261 @@ +// Copyright 2019, 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 +// +// http://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. + +syntax = "proto3"; + +package opentelemetry.proto.trace.v1; + +import "opentelemetry/proto/common/v1/common.proto"; +import "opentelemetry/proto/resource/v1/resource.proto"; + +option java_multiple_files = true; +option java_package = "io.opentelemetry.proto.trace.v1"; +option java_outer_classname = "TraceProto"; +option go_package = "github.com/open-telemetry/opentelemetry-proto/gen/go/trace/v1"; + +// A collection of InstrumentationLibrarySpans from a Resource. +message ResourceSpans { + // The resource for the spans in this message. + // If this field is not set then no resource info is known. + opentelemetry.proto.resource.v1.Resource resource = 1; + + // A list of InstrumentationLibrarySpans that originate from a resource. + repeated InstrumentationLibrarySpans instrumentation_library_spans = 2; +} + +// A collection of Spans produced by an InstrumentationLibrary. +message InstrumentationLibrarySpans { + // The instrumentation library information for the spans in this message. + // If this field is not set then no library info is known. + opentelemetry.proto.common.v1.InstrumentationLibrary instrumentation_library = 1; + + // A list of Spans that originate from an instrumentation library. + repeated Span spans = 2; +} + +// Span represents a single operation within a trace. Spans can be +// nested to form a trace tree. Spans may also be linked to other spans +// from the same or different trace and form graphs. Often, a trace +// contains a root span that describes the end-to-end latency, and one +// or more subspans for its sub-operations. A trace can also contain +// multiple root spans, or none at all. Spans do not need to be +// contiguous - there may be gaps or overlaps between spans in a trace. +// +// The next available field id is 17. +message Span { + // A unique identifier for a trace. All spans from the same trace share + // the same `trace_id`. The ID is a 16-byte array. An ID with all zeroes + // is considered invalid. + // + // This field is semantically required. Receiver should generate new + // random trace_id if empty or invalid trace_id was received. + // + // This field is required. + bytes trace_id = 1; + + // A unique identifier for a span within a trace, assigned when the span + // is created. The ID is an 8-byte array. An ID with all zeroes is considered + // invalid. + // + // This field is semantically required. Receiver should generate new + // random span_id if empty or invalid span_id was received. + // + // This field is required. + bytes span_id = 2; + + // trace_state conveys information about request position in multiple distributed tracing graphs. + // It is a trace_state in w3c-trace-context format: https://www.w3.org/TR/trace-context/#tracestate-header + // See also https://github.com/w3c/distributed-tracing for more details about this field. + string trace_state = 3; + + // The `span_id` of this span's parent span. If this is a root span, then this + // field must be empty. The ID is an 8-byte array. + bytes parent_span_id = 4; + + // A description of the span's operation. + // + // For example, the name can be a qualified method name or a file name + // and a line number where the operation is called. A best practice is to use + // the same display name at the same call point in an application. + // This makes it easier to correlate spans in different traces. + // + // This field is semantically required to be set to non-empty string. + // When null or empty string received - receiver may use string "name" + // as a replacement. There might be smarted algorithms implemented by + // receiver to fix the empty span name. + // + // This field is required. + string name = 5; + + // SpanKind is the type of span. Can be used to specify additional relationships between spans + // in addition to a parent/child relationship. + enum SpanKind { + // Unspecified. Do NOT use as default. + // Implementations MAY assume SpanKind to be INTERNAL when receiving UNSPECIFIED. + SPAN_KIND_UNSPECIFIED = 0; + + // Indicates that the span represents an internal operation within an application, + // as opposed to an operations happening at the boundaries. Default value. + INTERNAL = 1; + + // Indicates that the span covers server-side handling of an RPC or other + // remote network request. + SERVER = 2; + + // Indicates that the span describes a request to some remote service. + CLIENT = 3; + + // Indicates that the span describes a producer sending a message to a broker. + // Unlike CLIENT and SERVER, there is often no direct critical path latency relationship + // between producer and consumer spans. A PRODUCER span ends when the message was accepted + // by the broker while the logical processing of the message might span a much longer time. + PRODUCER = 4; + + // Indicates that the span describes consumer receiving a message from a broker. + // Like the PRODUCER kind, there is often no direct critical path latency relationship + // between producer and consumer spans. + CONSUMER = 5; + } + + // Distinguishes between spans generated in a particular context. For example, + // two spans with the same name may be distinguished using `CLIENT` (caller) + // and `SERVER` (callee) to identify queueing latency associated with the span. + SpanKind kind = 6; + + // start_time_unix_nano is the start time of the span. On the client side, this is the time + // kept by the local machine where the span execution starts. On the server side, this + // is the time when the server's application handler starts running. + // Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January 1970. + // + // This field is semantically required and it is expected that end_time >= start_time. + fixed64 start_time_unix_nano = 7; + + // end_time_unix_nano is the end time of the span. On the client side, this is the time + // kept by the local machine where the span execution ends. On the server side, this + // is the time when the server application handler stops running. + // Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January 1970. + // + // This field is semantically required and it is expected that end_time >= start_time. + fixed64 end_time_unix_nano = 8; + + // attributes is a collection of key/value pairs. The value can be a string, + // an integer, a double or the Boolean values `true` or `false`. Note, global attributes + // like server name can be set using the resource API. Examples of attributes: + // + // "/http/user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36" + // "/http/server_latency": 300 + // "abc.com/myattribute": true + // "abc.com/score": 10.239 + repeated opentelemetry.proto.common.v1.AttributeKeyValue attributes = 9; + + // dropped_attributes_count is the number of attributes that were discarded. Attributes + // can be discarded because their keys are too long or because there are too many + // attributes. If this value is 0, then no attributes were dropped. + uint32 dropped_attributes_count = 10; + + // Event is a time-stamped annotation of the span, consisting of user-supplied + // text description and key-value pairs. + message Event { + // time_unix_nano is the time the event occurred. + fixed64 time_unix_nano = 1; + + // name of the event. + // This field is semantically required to be set to non-empty string. + string name = 2; + + // attributes is a collection of attribute key/value pairs on the event. + repeated opentelemetry.proto.common.v1.AttributeKeyValue attributes = 3; + + // dropped_attributes_count is the number of dropped attributes. If the value is 0, + // then no attributes were dropped. + uint32 dropped_attributes_count = 4; + } + + // events is a collection of Event items. + repeated Event events = 11; + + // dropped_events_count is the number of dropped events. If the value is 0, then no + // events were dropped. + uint32 dropped_events_count = 12; + + // A pointer from the current span to another span in the same trace or in a + // different trace. For example, this can be used in batching operations, + // where a single batch handler processes multiple requests from different + // traces or when the handler receives a request from a different project. + message Link { + // A unique identifier of a trace that this linked span is part of. The ID is a + // 16-byte array. + bytes trace_id = 1; + + // A unique identifier for the linked span. The ID is an 8-byte array. + bytes span_id = 2; + + // The trace_state associated with the link. + string trace_state = 3; + + // attributes is a collection of attribute key/value pairs on the link. + repeated opentelemetry.proto.common.v1.AttributeKeyValue attributes = 4; + + // dropped_attributes_count is the number of dropped attributes. If the value is 0, + // then no attributes were dropped. + uint32 dropped_attributes_count = 5; + } + + // links is a collection of Links, which are references from this span to a span + // in the same or different trace. + repeated Link links = 13; + + // dropped_links_count is the number of dropped links after the maximum size was + // enforced. If this value is 0, then no links were dropped. + uint32 dropped_links_count = 14; + + // An optional final status for this span. Semantically when Status + // wasn't set it is means span ended without errors and assume + // Status.Ok (code = 0). + Status status = 15; +} + +// The Status type defines a logical error model that is suitable for different +// programming environments, including REST APIs and RPC APIs. +message Status { + + // StatusCode mirrors the codes defined at + // https://github.com/open-telemetry/opentelemetry-specification/blob/master/specification/api-tracing.md#statuscanonicalcode + enum StatusCode { + Ok = 0; + Cancelled = 1; + UnknownError = 2; + InvalidArgument = 3; + DeadlineExceeded = 4; + NotFound = 5; + AlreadyExists = 6; + PermissionDenied = 7; + ResourceExhausted = 8; + FailedPrecondition = 9; + Aborted = 10; + OutOfRange = 11; + Unimplemented = 12; + InternalError = 13; + Unavailable = 14; + DataLoss = 15; + Unauthenticated = 16; + }; + + // The status code. This is optional field. It is safe to assume 0 (OK) + // when not set. + StatusCode code = 1; + + // A developer-facing human readable error message. + string message = 2; +} diff --git a/packages/opentelemetry-exporter-collector/src/platform/node/protos/opentelemetry/proto/trace/v1/trace_config.proto b/packages/opentelemetry-exporter-collector/src/platform/node/protos/opentelemetry/proto/trace/v1/trace_config.proto new file mode 100644 index 0000000000..7269da1ee8 --- /dev/null +++ b/packages/opentelemetry-exporter-collector/src/platform/node/protos/opentelemetry/proto/trace/v1/trace_config.proto @@ -0,0 +1,78 @@ +// Copyright 2019, 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 +// +// http://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. + +syntax = "proto3"; + +package opentelemetry.proto.trace.v1; + +option java_multiple_files = true; +option java_package = "io.opentelemetry.proto.trace.v1"; +option java_outer_classname = "TraceConfigProto"; +option go_package = "github.com/open-telemetry/opentelemetry-proto/gen/go/collector/trace/v1"; + +// Global configuration of the trace service. All fields must be specified, or +// the default (zero) values will be used for each type. +message TraceConfig { + + // The global default sampler used to make decisions on span sampling. + oneof sampler { + ConstantSampler constant_sampler = 1; + + ProbabilitySampler probability_sampler = 2; + + RateLimitingSampler rate_limiting_sampler = 3; + } + + // The global default max number of attributes per span. + int64 max_number_of_attributes = 4; + + // The global default max number of annotation events per span. + int64 max_number_of_timed_events= 5; + + // The global default max number of attributes per timed event. + int64 max_number_of_attributes_per_timed_event = 6; + + // The global default max number of link entries per span. + int64 max_number_of_links = 7; + + // The global default max number of attributes per span. + int64 max_number_of_attributes_per_link = 8; +} + +// Sampler that always makes a constant decision on span sampling. +message ConstantSampler { + // How spans should be sampled: + // - Always off + // - Always on + // - Always follow the parent Span's decision (off if no parent). + enum ConstantDecision { + ALWAYS_OFF = 0; + ALWAYS_ON = 1; + ALWAYS_PARENT = 2; + } + ConstantDecision decision = 1; +} + +// Sampler that tries to uniformly sample traces with a given probability. +// The probability of sampling a trace is equal to that of the specified probability. +message ProbabilitySampler { + // The desired probability of sampling. Must be within [0.0, 1.0]. + double samplingProbability = 1; +} + +// Sampler that tries to sample with a rate per time window. +message RateLimitingSampler { + // Rate per second. + int64 qps = 1; +} diff --git a/packages/opentelemetry-exporter-collector/src/platform/node/protos/verify-go.sh b/packages/opentelemetry-exporter-collector/src/platform/node/protos/verify-go.sh new file mode 100755 index 0000000000..e1c86196a5 --- /dev/null +++ b/packages/opentelemetry-exporter-collector/src/platform/node/protos/verify-go.sh @@ -0,0 +1,32 @@ +#!/usr/bin/env bash + +set -e + + +# Calculating checksum of the 'gen' subdirectory. +# This is more portable than git status which doesn't work with detached HEAD in Travis CI. +gen_checksum() +{ + find ./gen -type f -exec md5sum {} \; | sort -k 2 | md5sum +} + +# Print checksum for each file in the 'gen' subdirectory. +# Useful to see which specific files need updating when the directory is out of sync. +print_checksum_details() +{ + find ./gen -type f -exec md5sum {} \; | sort -k 2 +} + +print_checksum_details +CHECKSUM_BEFORE=$(gen_checksum) +echo "checksum before: ${CHECKSUM_BEFORE}" +make gen-go +CHECKSUM_AFTER=$(gen_checksum) +echo "checksum after: ${CHECKSUM_AFTER}" + +if [ "${CHECKSUM_BEFORE}" != "${CHECKSUM_AFTER}" ] +then + print_checksum_details + echo "'gen' directory is out of sync with protos. Please run 'gen-go.sh' and commit changes." + exit 1 +fi \ No newline at end of file diff --git a/packages/opentelemetry-exporter-collector/src/platform/node/sendSpans.ts b/packages/opentelemetry-exporter-collector/src/platform/node/sendSpans.ts index 815d77ebf1..90535cc9f8 100644 --- a/packages/opentelemetry-exporter-collector/src/platform/node/sendSpans.ts +++ b/packages/opentelemetry-exporter-collector/src/platform/node/sendSpans.ts @@ -18,14 +18,16 @@ import * as protoLoader from '@grpc/proto-loader'; import { Resource } from '@opentelemetry/resources'; import { ReadableSpan } from '@opentelemetry/tracing'; import * as grpc from 'grpc'; +import * as path from 'path'; import { CollectorExporter } from '../../CollectorExporter'; +import * as collectorTypes from '../../types'; import { - toCollectorProtoExportTraceServiceRequest, - toCollectorProtoResource, - toCollectorProtoSpan, -} from './transform'; -import { CollectorData, GRPCQueueItem, opentelemetry } from './grpc/types'; + toCollectorExportTraceServiceRequest, + toCollectorResource, + toCollectorSpan, +} from '../../transform'; +import { CollectorData, GRPCQueueItem } from './types'; const traceServiceClients: WeakMap< CollectorExporter, @@ -46,7 +48,7 @@ export function onInit(collectorExporter: CollectorExporter) { const traceServiceProtoPath = 'opentelemetry/proto/collector/trace/v1/trace_service.proto'; - const includeDirs = [__dirname + '/grpc/protos']; + const includeDirs = [path.resolve(__dirname, 'protos')]; protoLoader .load(traceServiceProtoPath, { @@ -108,7 +110,7 @@ export function onShutdown(collectorExporter: CollectorExporter) { export function sendSpans( spans: ReadableSpan[], onSuccess: () => void, - onError: (status?: number) => void, + onError: (error: collectorTypes.CollectorExporterError) => void, collectorExporter: CollectorExporter ) { const exporter = traceServiceClients.get(collectorExporter); @@ -116,22 +118,28 @@ export function sendSpans( return; } if (exporter.traceServiceClient) { - const spansToBeSent: opentelemetry.proto.trace.v1.Span[] = spans.map(span => - toCollectorProtoSpan(span) + const spansToBeSent: collectorTypes.opentelemetryProto.trace.v1.Span[] = spans.map( + span => toCollectorSpan(span) ); const resource: Resource | undefined = - spans.length > 0 ? spans[0].resource : undefined; + spans.length > 0 ? spans[0].resource : Resource.empty(); - const exportTraceServiceRequest = toCollectorProtoExportTraceServiceRequest( + const exportTraceServiceRequest = toCollectorExportTraceServiceRequest( spansToBeSent, - toCollectorProtoResource(resource) + toCollectorResource(resource) ); exporter.traceServiceClient.export( exportTraceServiceRequest, - (err: opentelemetry.proto.collector.trace.v1.ExportTraceServiceError) => { + ( + err: collectorTypes.opentelemetryProto.collector.trace.v1.ExportTraceServiceError + ) => { if (err) { - onError(err.code); + onError({ + code: err.code, + message: err.message, + stack: err.stack, + }); } else { onSuccess(); } diff --git a/packages/opentelemetry-exporter-collector/src/platform/node/transform.ts b/packages/opentelemetry-exporter-collector/src/platform/node/transform.ts.old similarity index 100% rename from packages/opentelemetry-exporter-collector/src/platform/node/transform.ts rename to packages/opentelemetry-exporter-collector/src/platform/node/transform.ts.old diff --git a/packages/opentelemetry-exporter-collector/src/platform/node/grpc/types/types.ts b/packages/opentelemetry-exporter-collector/src/platform/node/types.ts similarity index 88% rename from packages/opentelemetry-exporter-collector/src/platform/node/grpc/types/types.ts rename to packages/opentelemetry-exporter-collector/src/platform/node/types.ts index 58db742e20..8a7786038a 100644 --- a/packages/opentelemetry-exporter-collector/src/platform/node/grpc/types/types.ts +++ b/packages/opentelemetry-exporter-collector/src/platform/node/types.ts @@ -16,6 +16,7 @@ import * as grpc from 'grpc'; import { ReadableSpan } from '@opentelemetry/tracing'; +import { CollectorExporterError } from '../../types'; /** * Queue item to be used to save temporary spans in case the GRPC service @@ -24,7 +25,7 @@ import { ReadableSpan } from '@opentelemetry/tracing'; export interface GRPCQueueItem { spans: ReadableSpan[]; onSuccess: () => void; - onError: (status?: number) => void; + onError: (error: CollectorExporterError) => void; } /** @@ -34,6 +35,9 @@ export interface TraceServiceClient extends grpc.Client { export: (request: any, callback: Function) => {}; } +/** + * Interface to store helper information + */ export interface CollectorData { traceServiceClient?: TraceServiceClient; isShutDown: boolean; diff --git a/packages/opentelemetry-exporter-collector/src/transform.ts b/packages/opentelemetry-exporter-collector/src/transform.ts index a77ccb502d..6a154c16fd 100644 --- a/packages/opentelemetry-exporter-collector/src/transform.ts +++ b/packages/opentelemetry-exporter-collector/src/transform.ts @@ -1,5 +1,5 @@ /*! - * Copyright 2019, OpenTelemetry Authors + * Copyright 2020, OpenTelemetry Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,9 +16,12 @@ import { Attributes, Link, TimedEvent, TraceState } from '@opentelemetry/api'; import * as core from '@opentelemetry/core'; -import { ReadableSpan } from '@opentelemetry/tracing'; import { Resource } from '@opentelemetry/resources'; +import { ReadableSpan } from '@opentelemetry/tracing'; +import { opentelemetryProto } from './types'; import * as collectorTypes from './types'; +import ValueType = opentelemetryProto.common.v1.ValueType; +import { SDK_INFO } from '@opentelemetry/base'; const OT_MAX_STRING_LENGTH = 128; @@ -37,21 +40,19 @@ export function toCollectorTruncatableString( } /** - * convert attributes + * convert attributes to proto * @param attributes */ export function toCollectorAttributes( attributes: Attributes -): collectorTypes.Attributes { - const attributeMap: collectorTypes.AttributeMap = {}; - Object.keys(attributes || {}).forEach(key => { - attributeMap[key] = toCollectorEventValue(attributes[key]); +): opentelemetryProto.common.v1.AttributeKeyValue[] { + const keys = Object.keys(attributes); + const protoAttributes: opentelemetryProto.common.v1.AttributeKeyValue[] = []; + keys.forEach(key => { + protoAttributes.push(toCollectorEventValue(key, attributes[key])); }); - return { - droppedAttributesCount: 0, - attributeMap, - }; + return protoAttributes; } /** @@ -59,175 +60,143 @@ export function toCollectorAttributes( * @param value event value */ export function toCollectorEventValue( + key: string, value: unknown -): collectorTypes.AttributeValue { - const attributeValue: collectorTypes.AttributeValue = {}; - +): opentelemetryProto.common.v1.AttributeKeyValue { + let aType: opentelemetryProto.common.v1.ValueType = ValueType.STRING; + const attributeValue: opentelemetryProto.common.v1.AttributeKeyValue = { + key, + type: 0, + }; if (typeof value === 'string') { - attributeValue.stringValue = toCollectorTruncatableString(value); + attributeValue.stringValue = value; } else if (typeof value === 'boolean') { + aType = ValueType.BOOL; attributeValue.boolValue = value; } else if (typeof value === 'number') { // all numbers will be treated as double + aType = ValueType.DOUBLE; attributeValue.doubleValue = value; } + attributeValue.type = aType; + return attributeValue; } /** - * convert events + * + * convert events to proto * @param events array of events */ export function toCollectorEvents( - events: TimedEvent[] -): collectorTypes.TimeEvents { - let droppedAnnotationsCount = 0; - let droppedMessageEventsCount = 0; // not counting yet as messageEvent is not implemented - - const timeEvent: collectorTypes.TimeEvent[] = events.map( - (event: TimedEvent) => { - let attributes: collectorTypes.Attributes | undefined; - - if (event && event.attributes) { - attributes = toCollectorAttributes(event.attributes); - droppedAnnotationsCount += attributes.droppedAttributesCount || 0; - } - - let annotation: collectorTypes.Annotation = {}; - if (event.name || attributes) { - annotation = {}; - } - - if (event.name) { - annotation.description = toCollectorTruncatableString(event.name); - } - - if (typeof attributes !== 'undefined') { - annotation.attributes = attributes; - } - - // @TODO convert from event.attributes into appropriate MessageEvent - // const messageEvent: collectorTypes.MessageEvent; - - const timeEvent: collectorTypes.TimeEvent = { - time: core.hrTimeToTimeStamp(event.time), - // messageEvent, - }; - - if (annotation) { - timeEvent.annotation = annotation; - } - - return timeEvent; - } - ); - - return { - timeEvent, - droppedAnnotationsCount, - droppedMessageEventsCount, - }; -} - -/** - * determines the type of link, only parent link type can be determined now - * @TODO refactor this once such data is directly available from {@link Link} - * @param span - * @param link - */ -export function toCollectorLinkType( - span: ReadableSpan, - link: Link -): collectorTypes.LinkType { - const linkSpanId = link.context.spanId; - const linkTraceId = link.context.traceId; - const spanParentId = span.parentSpanId; - const spanTraceId = span.spanContext.traceId; - - if (linkSpanId === spanParentId && linkTraceId === spanTraceId) { - return collectorTypes.LinkType.PARENT_LINKED_SPAN; - } - return collectorTypes.LinkType.UNSPECIFIED; -} - -/** - * converts span links - * @param span - */ -export function toCollectorLinks(span: ReadableSpan): collectorTypes.Links { - const collectorLinks: collectorTypes.Link[] = span.links.map((link: Link) => { - const collectorLink: collectorTypes.Link = { - traceId: core.hexToBase64(link.context.traceId), - spanId: core.hexToBase64(link.context.spanId), - type: toCollectorLinkType(span, link), + timedEvents: TimedEvent[] +): opentelemetryProto.trace.v1.Span.Event[] { + const protoEvents: opentelemetryProto.trace.v1.Span.Event[] = []; + timedEvents.forEach(timedEvent => { + const timeUnixNano = core.hrTimeToNanoseconds(timedEvent.time); + const name = timedEvent.name; + const attributes = toCollectorAttributes(timedEvent.attributes || {}); + const droppedAttributesCount = 0; + + const protoEvent: opentelemetryProto.trace.v1.Span.Event = { + timeUnixNano, + name, + attributes, + droppedAttributesCount, }; - if (link.attributes) { - collectorLink.attributes = toCollectorAttributes(link.attributes); - } - - return collectorLink; + protoEvents.push(protoEvent); }); + return protoEvents; +} - return { - link: collectorLinks, - droppedLinksCount: 0, - }; +export function toCollectorLinks( + span: ReadableSpan +): opentelemetryProto.trace.v1.Span.Link[] { + const protoLinks: opentelemetryProto.trace.v1.Span.Link[] = span.links.map( + (link: Link) => { + const protoLink: opentelemetryProto.trace.v1.Span.Link = { + traceId: core.hexToBytes(link.context.traceId), + spanId: core.hexToBytes(link.context.spanId), + attributes: toCollectorAttributes(link.attributes || {}), + droppedAttributesCount: 0, + }; + return protoLink; + } + ); + return protoLinks; } -/** - * @param span - */ -export function toCollectorSpan(span: ReadableSpan): collectorTypes.Span { +export function toCollectorSpan( + span: ReadableSpan +): opentelemetryProto.trace.v1.Span { return { - traceId: core.hexToBase64(span.spanContext.traceId), - spanId: core.hexToBase64(span.spanContext.spanId), + traceId: core.hexToBytes(span.spanContext.traceId), + spanId: core.hexToBytes(span.spanContext.spanId), parentSpanId: span.parentSpanId - ? core.hexToBase64(span.parentSpanId) + ? core.hexToBytes(span.parentSpanId) : undefined, - tracestate: toCollectorTraceState(span.spanContext.traceState), + traceState: toCollectorTraceState(span.spanContext.traceState), name: toCollectorTruncatableString(span.name), - kind: span.kind, - startTime: core.hrTimeToTimeStamp(span.startTime), - endTime: core.hrTimeToTimeStamp(span.endTime), + kind: span.kind + 1, + startTimeUnixNano: core.hrTimeToNanoseconds(span.startTime), + endTimeUnixNano: core.hrTimeToNanoseconds(span.endTime), attributes: toCollectorAttributes(span.attributes), - // stackTrace: // not implemented - timeEvents: toCollectorEvents(span.events), + droppedAttributesCount: 0, + events: toCollectorEvents(span.events), + droppedEventsCount: 0, status: span.status, - sameProcessAsParentSpan: !!span.parentSpanId, links: toCollectorLinks(span), - // childSpanCount: // not implemented + droppedLinksCount: 0, }; } -/** - * converts span resource - * @param resource - */ export function toCollectorResource( - resource: Resource -): collectorTypes.Resource { - const labels: { [key: string]: string } = {}; - Object.keys(resource.labels).forEach( - name => (labels[name] = String(resource.labels[name])) - ); - // @TODO: add type support - return { labels }; + resource?: Resource +): opentelemetryProto.resource.v1.Resource { + const resourceProto: opentelemetryProto.resource.v1.Resource = { + attributes: toCollectorAttributes(resource ? resource.labels : {}), + droppedAttributesCount: 0, + }; + + return resourceProto; } /** * @param traceState */ -function toCollectorTraceState( +export function toCollectorTraceState( traceState?: TraceState -): collectorTypes.TraceState { - if (!traceState) return {}; - const entries = traceState.serialize().split(','); - const apiTraceState: collectorTypes.TraceState = {}; - for (const entry of entries) { - const [key, value] = entry.split('='); - apiTraceState[key] = value; - } - return apiTraceState; +): opentelemetryProto.trace.v1.Span.TraceState | undefined { + if (!traceState) return undefined; + return traceState.serialize(); +} + +/** + * + * @param spans spans in proto format + * @param resource Resource in proto format + * @param [name] Instrumentation Library Name + */ +export function toCollectorExportTraceServiceRequest( + spans: opentelemetryProto.trace.v1.Span[], + resource: opentelemetryProto.resource.v1.Resource, + name: string = '' +): opentelemetryProto.collector.trace.v1.ExportTraceServiceRequest { + const instrumentationLibrarySpans: opentelemetryProto.trace.v1.InstrumentationLibrarySpans = { + spans, + instrumentationLibrary: { + name: name || `${SDK_INFO.NAME} - ${SDK_INFO.LANGUAGE}`, + version: SDK_INFO.VERSION, + }, + }; + const resourceSpan: opentelemetryProto.trace.v1.ResourceSpans = { + resource, + instrumentationLibrarySpans: [instrumentationLibrarySpans], + }; + + return { + resourceSpans: [resourceSpan], + }; } diff --git a/packages/opentelemetry-exporter-collector/src/types.ts b/packages/opentelemetry-exporter-collector/src/types.ts index 914a17750a..7facee0e89 100644 --- a/packages/opentelemetry-exporter-collector/src/types.ts +++ b/packages/opentelemetry-exporter-collector/src/types.ts @@ -14,485 +14,156 @@ * limitations under the License. */ -import { SpanKind, Status } from '@opentelemetry/api'; +import * as api from '@opentelemetry/api'; // header to prevent instrumentation on request export const OT_REQUEST_HEADER = 'x-opentelemetry-outgoing-request'; -/** - * {@link https://github.com/open-telemetry/opentelemetry-proto/blob/master/opentelemetry/proto/agent/common/v1/common.proto#L66} - */ -export const enum LibraryInfoLanguage { - LANGUAGE_UNSPECIFIED = 0, - NODE_JS = 6, - WEB_JS = 10, -} - -export interface AttributeMap { - [key: string]: AttributeValue; -} - -/** - * A text annotation with a set of attributes. - */ -export interface Annotation { - /** - * A user-supplied message describing the event. - */ - description?: TruncatableString; - /** - * A set of attributes on the annotation. - */ - attributes?: Attributes; -} - -/** - * A set of attributes, each with a key and a value. - */ -export interface Attributes { - /** - * \"/instance_id\": \"my-instance\" \"/http/user_agent\": \"\" - * \"/http/server_latency\": 300 \"abc.com/myattribute\": true - */ - attributeMap?: AttributeMap; - /** - * The number of attributes that were discarded. Attributes can be discarded - * because their keys are too long or because there are too many attributes. - * If this value is 0, then no attributes were dropped. - */ - droppedAttributesCount?: number; -} - -/** - * The value of an Attribute. - */ -export interface AttributeValue { - /** - * A string up to 256 bytes long. - */ - stringValue?: TruncatableString; - /** - * A 64-bit signed integer. May be sent to the API as either number or string - * type (string is needed to accurately express some 64-bit ints). - */ - intValue?: string | number; - /** - * A Boolean value represented by `true` or `false`. - */ - boolValue?: boolean; - /** - * A double precision floating point value. - */ - doubleValue?: number; -} - -/** - * Format for an HTTP/JSON request to a grpc-gateway for a trace span exporter. - */ -export interface ExportTraceServiceRequest { - node?: Node; - - /** A list of Spans that belong to the last received Node. */ - spans?: Span[]; - - /** - * The resource for the spans in this message that do not have an explicit - * resource set. - * If unset, the most recently set resource in the RPC stream applies. It is - * valid to never be set within a stream, e.g. when no resource info is known. - */ - resource?: Resource; -} - -/** Information on OpenTelemetry library that produced the spans/metrics. */ -export interface LibraryInfo { - /** Language of OpenTelemetry Library. */ - language?: LibraryInfoLanguage; - - /** Version of collector exporter of Library. */ - exporterVersion?: string; - - /** Version of OpenTelemetry Library. */ - coreLibraryVersion?: string; -} - -/** - * A pointer from the current span to another span in the same trace or in a - * different trace. For example, this can be used in batching operations, where - * a single batch handler processes multiple requests from different traces or - * when the handler receives a request from a different project. - */ -export interface Link { - /** - * A unique identifier for a trace. All spans from the same trace share the - * same `trace_id`. The ID is a 16-byte array. - */ - traceId?: string; - /** - * A unique identifier for a span within a trace, assigned when the span is - * created. The ID is an 8-byte array. - */ - spanId?: string; - /** - * The relationship of the current span relative to the linked span. - */ - type?: LinkType; - /** - * A set of attributes on the link. - */ - attributes?: Attributes; -} - -/** - * A collection of links, which are references from this span to a span in the - * same or different trace. - */ -export interface Links { - /** - * A collection of links. - */ - link?: Link[]; - /** - * The number of dropped links after the maximum size was enforced. If this - * value is 0, then no links were dropped. - */ - droppedLinksCount?: number; -} - -/** - * The relationship of the current span relative to the linked span: child, - * parent, or unspecified. - */ -export const enum LinkType { - /** - * The relationship of the two spans is unknown, or known but other than - * parent-child. - */ - UNSPECIFIED, - /** The linked span is a child of the current span. */ - CHILD_LINKED_SPAN, - /** The linked span is a parent of the current span. */ - PARENT_LINKED_SPAN, -} - -/** - * An event describing a message sent/received between Spans. - */ -export interface MessageEvent { - /** - * The type of MessageEvent. Indicates whether the message was sent or - * received. - */ - type?: MessageEventType; - /** - * An identifier for the MessageEvent's message that can be used to match SENT - * and RECEIVED MessageEvents. For example, this field could represent a - * sequence ID for a streaming RPC. It is recommended to be unique within a - * Span. - */ - id?: string | number; - /** - * The number of uncompressed bytes sent or received. - */ - uncompressedSize?: string | number; - /** - * The number of compressed bytes sent or received. If zero, assumed to be the - * same size as uncompressed. - */ - compressedSize?: string | number; -} - -/** Indicates whether the message was sent or received. */ -export const enum MessageEventType { - /** Unknown message event type. */ - MESSAGE_EVENT_TYPE_UNSPECIFIED, - /** Indicates a sent message. */ - MESSAGE_EVENT_TYPE_SENT, - /** Indicates a received message. */ - MESSAGE_EVENT_TYPE_RECEIVED, -} - -/** - * A description of a binary module. - */ -export interface Module { - /** - * TODO: document the meaning of this field. For example: main binary, kernel - * modules, and dynamic libraries such as libc.so, sharedlib.so. - */ - module?: TruncatableString; - /** - * A unique identifier for the module, usually a hash of its contents. - */ - buildId?: TruncatableString; -} - -/** - * Identifier metadata of the Node (Application instrumented with OpenTelemetry) - * that connects to OpenTelemetry Agent. - * In the future we plan to extend the identifier proto definition to support - * additional information (e.g cloud id, etc.) - */ -export interface Node { - /** Identifier that uniquely identifies a process within a VM/container. */ - identifier?: ProcessIdentifier; - - /** Information on the OpenTelemetry Library that initiates the stream. */ - libraryInfo?: LibraryInfo; - - /** Additional information on service. */ - serviceInfo?: ServiceInfo; - - /** Additional attributes. */ - attributes?: { [key: string]: unknown }; -} - -/** - * Identifier that uniquely identifies a process within a VM/container. - * For OpenTelemetry Web, this identifies the domain name of the site. - */ -export interface ProcessIdentifier { - /** - * The host name. Usually refers to the machine/container name. - * For example: os.Hostname() in Go, socket.gethostname() in Python. - * This will be the value of `window.location.host` for OpenTelemetry Web. - */ - hostName?: string; - - /** Process id. Not used in OpenTelemetry Web. */ - pid?: number; - - /** Start time of this ProcessIdentifier. Represented in epoch time.. */ - startTimestamp?: string; -} - -/** Resource information. */ -export interface Resource { - /** Type identifier for the resource. */ - type?: string; - - /** Set of labels that describe the resource. */ - labels?: { [key: string]: string }; -} - -/** Additional service information. */ -export interface ServiceInfo { - /** Name of the service. */ - name?: string; -} - -/** - * A span represents a single operation within a trace. Spans can be nested to - * form a trace tree. Often, a trace contains a root span that describes the - * end-to-end latency, and one or more subspans for its sub-operations. A trace - * can also contain multiple root spans, or none at all. Spans do not need to be - * contiguous - there may be gaps or overlaps between spans in a trace. The - * next id is 16. - */ -export interface Span { - /** - * A unique identifier for a trace. All spans from the same trace share the - * same `trace_id`. The ID is a 16-byte array. This field is required. - */ - traceId: string; - /** - * A unique identifier for a span within a trace, assigned when the span is - * created. The ID is an 8-byte array. This field is required. - */ - spanId: string; - /** - * The `tracestate` field conveys information about request position in - * multiple distributed tracing graphs. There can be a maximum of 32 members - * in the map. The key must begin with a lowercase letter, and can only - * contain lowercase letters 'a'-'z', digits '0'-'9', underscores '_', dashes - * '-', asterisks '*', and forward slashes '/'. For multi-tenant vendors - * scenarios '@' sign can be used to prefix vendor name. The maximum length - * for the key is 256 characters. The value is opaque string up to 256 - * characters printable ASCII RFC0020 characters (i.e., the range 0x20 to - * 0x7E) except ',' and '='. Note that this also excludes tabs, newlines, - * carriage returns, etc. See the https://github.com/w3c/distributed-tracing - * for more details about this field. - */ - tracestate?: TraceState; - /** - * The `span_id` of this span's parent span. If this is a root span, then this - * field must be empty. The ID is an 8-byte array. - */ - parentSpanId?: string; - /** - * A description of the span's operation. For example, the name can be a - * qualified method name or a file name and a line number where the operation - * is called. A best practice is to use the same display name at the same call - * point in an application. This makes it easier to correlate spans in - * different traces. This field is required. - */ - name?: TruncatableString; - /** - * Distinguishes between spans generated in a particular context. For example, - * two spans with the same name may be distinguished using `CLIENT` and - * `SERVER` to identify queueing latency associated with the span. - */ - kind?: SpanKind; - /** - * The start time of the span. On the client side, this is the time kept by - * the local machine where the span execution starts. On the server side, this - * is the time when the server's application handler starts running. - * the format should be a timestamp for example '2019-11-15T18:59:36.489343982Z' - */ - startTime?: string; - /** - * The end time of the span. On the client side, this is the time kept by the - * local machine where the span execution ends. On the server side, this is - * the time when the server application handler stops running. - * the format should be a timestamp for example '2019-11-15T18:59:36.489343982Z' - */ - endTime?: string; - /** - * A set of attributes on the span. - */ - attributes?: Attributes; - /** - * A stack trace captured at the start of the span. - * Currently not used - */ - stackTrace?: StackTrace; - /** - * The included time events. - */ - timeEvents?: TimeEvents; - /** - * An optional final status for this span. - */ - status?: Status; - /** - * A highly recommended but not required flag that identifies when a trace - * crosses a process boundary. True when the parent_span belongs to the same - * process as the current span. - */ - sameProcessAsParentSpan?: boolean; - - //@TODO - do we use it in opentelemetry or it is not needed? - // /** - // * An optional number of child spans that were generated while this span was - // * active. If set, allows an implementation to detect missing child spans. - // */ - // childSpanCount?: number; - /** - * The included links. - */ - links?: Links; -} - -/** - * A single stack frame in a stack trace. - */ -export interface StackFrame { - /** - * The fully-qualified name that uniquely identifies the function or method - * that is active in this frame. - */ - functionName?: TruncatableString; - /** - * An un-mangled function name, if `function_name` is - * [mangled](http://www.avabodh.com/cxxin/namemangling.html). The name can be - * fully qualified. - */ - originalFunctionName?: TruncatableString; - /** - * The name of the source file where the function call appears. - */ - fileName?: TruncatableString; - /** - * The line number in `file_name` where the function call appears. - */ - lineNumber?: string; - /** - * The column number where the function call appears, if available. This is - * important in JavaScript because of its anonymous functions. - */ - columnNumber?: string; - /** - * The binary module from where the code was loaded. - */ - loadModule?: Module; - /** - * The version of the deployed source code. - */ - sourceVersion?: TruncatableString; -} - -/** - * A collection of stack frames, which can be truncated. - */ -export interface StackFrames { - /** - * Stack frames in this call stack. - */ - frame?: StackFrame[]; - /** - * The number of stack frames that were dropped because there were too many - * stack frames. If this value is 0, then no stack frames were dropped. - */ - droppedFramesCount?: number; -} - -/** - * The call stack which originated this span. - */ -export interface StackTrace { - /** - * Stack frames in this stack trace. - */ - stackFrames?: StackFrames; - /** - * The hash ID is used to conserve network bandwidth for duplicate stack - * traces within a single trace. Often multiple spans will have identical - * stack traces. The first occurrence of a stack trace should contain both - * `stack_frames` and a value in `stack_trace_hash_id`. Subsequent spans - * within the same request can refer to that stack trace by setting only - * `stack_trace_hash_id`. - */ - stackTraceHashId?: string; -} - -/** - * A time-stamped annotation or message event in the Span. - */ -export interface TimeEvent { - /** - * The time the event occurred. - */ - time?: string; - /** - * A text annotation with a set of attributes. - */ - annotation?: Annotation; - /** - * An event describing a message sent/received between Spans. - */ - messageEvent?: MessageEvent; -} - -/** - * A collection of `TimeEvent`s. A `TimeEvent` is a time-stamped annotation on - * the span, consisting of either user-supplied key-value pairs, or details of a - * message sent/received between Spans. - */ -export interface TimeEvents { - /** - * A collection of `TimeEvent`s. - */ - timeEvent?: TimeEvent[]; - /** - * The number of dropped annotations in all the included time events. If the - * value is 0, then no annotations were dropped. - */ - droppedAnnotationsCount?: number; - /** - * The number of dropped message events in all the included time events. If - * the value is 0, then no message events were dropped. - */ - droppedMessageEventsCount?: number; +export namespace opentelemetryProto { + export namespace collector { + export namespace trace.v1 { + export interface TraceService { + service: opentelemetryProto.collector.trace.v1.TraceService; + } + + export interface ExportTraceServiceRequest { + resourceSpans: opentelemetryProto.trace.v1.ResourceSpans[]; + } + + export interface ExportTraceServiceResponse {} + + export interface ExportTraceServiceError { + code: number; + details: string; + metadata: { [key: string]: unknown }; + message: string; + stack: string; + } + } + } + + export namespace resource.v1 { + export interface Resource { + attributes: opentelemetryProto.common.v1.AttributeKeyValue[]; + droppedAttributesCount: number; + } + } + + export namespace trace.v1 { + export namespace ConstantSampler { + export enum ConstantDecision { + ALWAYS_OFF = 0, + ALWAYS_ON = 1, + ALWAYS_PARENT = 2, + } + } + export namespace Span { + export interface Event { + timeUnixNano: number; + name: string; + attributes?: opentelemetryProto.common.v1.AttributeKeyValue[]; + droppedAttributesCount: number; + } + + export interface Link { + traceId: Uint8Array; + spanId: Uint8Array; + traceState?: TraceState; + attributes?: opentelemetryProto.common.v1.AttributeKeyValue[]; + droppedAttributesCount: number; + } + + export enum SpanKind { + SPAN_KIND_UNSPECIFIED, + INTERNAL, + SERVER, + CLIENT, + PRODUCER, + CONSUMER, + } + export type TraceState = string | undefined; + } + + export interface ConstantSampler { + decision?: opentelemetryProto.trace.v1.ConstantSampler.ConstantDecision; + } + + export interface InstrumentationLibrarySpans { + instrumentationLibrary: opentelemetryProto.common.v1.InstrumentationLibrary | null; + spans: opentelemetryProto.trace.v1.Span[]; + } + + export interface ProbabilitySampler { + samplingProbability?: number | null; + } + + export interface RateLimitingSampler { + qps?: number | null; + } + + export interface ResourceSpans { + resource?: opentelemetryProto.resource.v1.Resource; + instrumentationLibrarySpans: opentelemetryProto.trace.v1.InstrumentationLibrarySpans[]; + } + + export interface Span { + traceId: Uint8Array; + spanId: Uint8Array; + traceState: opentelemetryProto.trace.v1.Span.TraceState; + parentSpanId?: Uint8Array; + name?: opentelemetryProto.trace.v1.TruncatableString; + kind?: opentelemetryProto.trace.v1.Span.SpanKind; + startTimeUnixNano?: number; + endTimeUnixNano?: number; + attributes?: opentelemetryProto.common.v1.AttributeKeyValue[]; + droppedAttributesCount: number; + events?: opentelemetryProto.trace.v1.Span.Event[]; + droppedEventsCount: number; + links?: opentelemetryProto.trace.v1.Span.Link[]; + droppedLinksCount: number; + status?: Status; + } + + export interface Status extends api.Status {} + + export interface TraceConfig { + constantSampler?: ConstantSampler | null; + probabilitySampler?: ProbabilitySampler | null; + rateLimitingSampler?: RateLimitingSampler | null; + } + + export interface TruncatableString { + value?: string | null; + truncatedByteCount?: number | null; + } + } + export namespace common.v1 { + export interface AttributeKeyValue { + key: string; + type: opentelemetryProto.common.v1.ValueType; + stringValue?: string; + intValue?: number; + doubleValue?: number; + boolValue?: boolean; + } + + export interface InstrumentationLibrary { + name: string; + version: string; + } + + export interface StringKeyValue { + key: string; + value: string; + } + + export enum ValueType { + STRING, + INT, + DOUBLE, + BOOL, + } + } } /** @@ -521,3 +192,12 @@ export interface TruncatableString { export interface TraceState { [key: string]: string; } + +/** + * Interface for handling error + */ +export interface CollectorExporterError { + code?: number; + message?: string; + stack?: string; +} diff --git a/packages/opentelemetry-exporter-collector/test/browser/CollectorExporter.test.ts b/packages/opentelemetry-exporter-collector/test/browser/CollectorExporter.test.ts index 0f19fbe34a..fc98c1ea58 100644 --- a/packages/opentelemetry-exporter-collector/test/browser/CollectorExporter.test.ts +++ b/packages/opentelemetry-exporter-collector/test/browser/CollectorExporter.test.ts @@ -25,9 +25,9 @@ import { import * as collectorTypes from '../../src/types'; import { + ensureBrowserSpanIsCorrect, ensureExportTraceServiceRequestIsSet, - ensureResourceIsCorrect, - ensureSpanIsCorrect, + ensureWebResourceIsCorrect, mockedReadableSpan, } from '../helper'; const sendBeacon = navigator.sendBeacon; @@ -74,18 +74,19 @@ describe('CollectorExporter - web', () => { const body = args[1]; const json = JSON.parse( body - ) as collectorTypes.ExportTraceServiceRequest; - const span1 = json.spans && json.spans[0]; + ) as collectorTypes.opentelemetryProto.collector.trace.v1.ExportTraceServiceRequest; + const span1 = + json.resourceSpans[0].instrumentationLibrarySpans[0].spans[0]; assert.ok(typeof span1 !== 'undefined', "span doesn't exist"); if (span1) { - ensureSpanIsCorrect(span1); + ensureBrowserSpanIsCorrect(span1); } - const resource = json.resource; + const resource = json.resourceSpans[0].resource; assert.ok(typeof resource !== 'undefined', "resource doesn't exist"); if (resource) { - ensureResourceIsCorrect(resource); + ensureWebResourceIsCorrect(resource); } assert.strictEqual(url, 'http://foo.bar.com'); @@ -93,7 +94,7 @@ describe('CollectorExporter - web', () => { assert.strictEqual(spyOpen.callCount, 0); - ensureExportTraceServiceRequestIsSet(json, 10); + ensureExportTraceServiceRequestIsSet(json); done(); }); @@ -156,23 +157,24 @@ describe('CollectorExporter - web', () => { const body = request.requestBody; const json = JSON.parse( body - ) as collectorTypes.ExportTraceServiceRequest; - const span1 = json.spans && json.spans[0]; + ) as collectorTypes.opentelemetryProto.collector.trace.v1.ExportTraceServiceRequest; + const span1 = + json.resourceSpans[0].instrumentationLibrarySpans[0].spans[0]; assert.ok(typeof span1 !== 'undefined', "span doesn't exist"); if (span1) { - ensureSpanIsCorrect(span1); + ensureBrowserSpanIsCorrect(span1); } - const resource = json.resource; + const resource = json.resourceSpans[0].resource; assert.ok(typeof resource !== 'undefined', "resource doesn't exist"); if (resource) { - ensureResourceIsCorrect(resource); + ensureWebResourceIsCorrect(resource); } assert.strictEqual(spyBeacon.callCount, 0); - ensureExportTraceServiceRequestIsSet(json, 10); + ensureExportTraceServiceRequestIsSet(json); done(); }); diff --git a/packages/opentelemetry-exporter-collector/test/common/transform.test.ts b/packages/opentelemetry-exporter-collector/test/common/transform.test.ts index 544c7a136f..941e0cb6e2 100644 --- a/packages/opentelemetry-exporter-collector/test/common/transform.test.ts +++ b/packages/opentelemetry-exporter-collector/test/common/transform.test.ts @@ -1,5 +1,5 @@ /*! - * Copyright 2019, OpenTelemetry Authors + * Copyright 2020, OpenTelemetry Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -46,59 +46,36 @@ describe('transform', () => { const attributes: Attributes = { foo: 'bar', }; - assert.deepStrictEqual(transform.toCollectorAttributes(attributes), { - attributeMap: { - foo: { - stringValue: { - truncatedByteCount: 0, - value: 'bar', - }, - }, - }, - droppedAttributesCount: 0, - }); + assert.deepStrictEqual(transform.toCollectorAttributes(attributes), [ + { key: 'foo', type: 0, stringValue: 'bar' }, + ]); }); it('should convert attribute integer', () => { const attributes: Attributes = { foo: 13, }; - assert.deepStrictEqual(transform.toCollectorAttributes(attributes), { - attributeMap: { - foo: { - doubleValue: 13, - }, - }, - droppedAttributesCount: 0, - }); + assert.deepStrictEqual(transform.toCollectorAttributes(attributes), [ + { key: 'foo', type: 2, doubleValue: 13 }, + ]); }); it('should convert attribute boolean', () => { const attributes: Attributes = { foo: true, }; - assert.deepStrictEqual(transform.toCollectorAttributes(attributes), { - attributeMap: { - foo: { - boolValue: true, - }, - }, - droppedAttributesCount: 0, - }); + assert.deepStrictEqual(transform.toCollectorAttributes(attributes), [ + { key: 'foo', type: 3, boolValue: true }, + ]); }); it('should convert attribute double', () => { const attributes: Attributes = { foo: 1.34, }; - assert.deepStrictEqual(transform.toCollectorAttributes(attributes), { - attributeMap: { - foo: { - doubleValue: 1.34, - }, - }, - droppedAttributesCount: 0, - }); + assert.deepStrictEqual(transform.toCollectorAttributes(attributes), [ + { key: 'foo', type: 2, doubleValue: 1.34 }, + ]); }); }); @@ -112,36 +89,20 @@ describe('transform', () => { attributes: { c: 'd' }, }, ]; - assert.deepStrictEqual(transform.toCollectorEvents(events), { - timeEvent: [ - { - time: '1970-01-01T00:02:03.000000123Z', - annotation: { - description: { value: 'foo', truncatedByteCount: 0 }, - attributes: { - droppedAttributesCount: 0, - attributeMap: { - a: { stringValue: { value: 'b', truncatedByteCount: 0 } }, - }, - }, - }, - }, - { - time: '1970-01-01T00:05:21.000000321Z', - annotation: { - description: { value: 'foo2', truncatedByteCount: 0 }, - attributes: { - droppedAttributesCount: 0, - attributeMap: { - c: { stringValue: { value: 'd', truncatedByteCount: 0 } }, - }, - }, - }, - }, - ], - droppedAnnotationsCount: 0, - droppedMessageEventsCount: 0, - }); + assert.deepStrictEqual(transform.toCollectorEvents(events), [ + { + timeUnixNano: 123000000123, + name: 'foo', + attributes: [{ key: 'a', type: 0, stringValue: 'b' }], + droppedAttributesCount: 0, + }, + { + timeUnixNano: 321000000321, + name: 'foo2', + attributes: [{ key: 'c', type: 0, stringValue: 'd' }], + droppedAttributesCount: 0, + }, + ]); }); }); @@ -161,11 +122,20 @@ describe('transform', () => { }) ); assert.deepStrictEqual(resource, { - labels: { - service: 'ui', - version: '1', - success: 'true', - }, + attributes: [ + { + key: 'service', + type: 0, + stringValue: 'ui', + }, + { + key: 'version', + type: 2, + doubleValue: 1, + }, + { key: 'success', type: 3, boolValue: true }, + ], + droppedAttributesCount: 0, }); }); }); diff --git a/packages/opentelemetry-exporter-collector/test/helper.ts b/packages/opentelemetry-exporter-collector/test/helper.ts index 419c5a1292..375a95168e 100644 --- a/packages/opentelemetry-exporter-collector/test/helper.ts +++ b/packages/opentelemetry-exporter-collector/test/helper.ts @@ -15,13 +15,19 @@ */ import { TraceFlags } from '@opentelemetry/api'; -import * as core from '@opentelemetry/core'; import { ReadableSpan } from '@opentelemetry/tracing'; import { Resource } from '@opentelemetry/resources'; import * as assert from 'assert'; -import { opentelemetry } from '../src/platform/node/grpc/types'; import * as collectorTypes from '../src/types'; -import { VERSION } from '../src/version'; + +if (typeof Buffer === 'undefined') { + // @ts-ignore + window.Buffer = { + from: function(arr: []) { + return new Uint8Array(arr); + }, + }; +} export const mockedReadableSpan: ReadableSpan = { name: 'documentFetch', @@ -76,8 +82,257 @@ export const mockedReadableSpan: ReadableSpan = { }), }; -export function ensureProtoSpanIsCorrect( - span: opentelemetry.proto.trace.v1.Span +export function ensureSpanIsCorrect( + span: collectorTypes.opentelemetryProto.trace.v1.Span +) { + assert.deepStrictEqual(span, { + traceId: Buffer.from([ + 31, + 16, + 8, + 220, + 142, + 39, + 14, + 133, + 196, + 10, + 13, + 124, + 57, + 57, + 178, + 120, + ]), + spanId: Buffer.from([94, 16, 114, 97, 246, 79, 165, 62]), + parentSpanId: Buffer.from([120, 168, 145, 80, 152, 134, 67, 136]), + traceState: undefined, + name: { value: 'documentFetch', truncatedByteCount: 0 }, + kind: 1, + startTimeUnixNano: 1574120165429803000, + endTimeUnixNano: 1574120165438688000, + attributes: [ + { + key: 'component', + type: 0, + stringValue: 'document-load', + }, + ], + droppedAttributesCount: 0, + events: [ + { + timeUnixNano: 1574120165429803000, + name: 'fetchStart', + attributes: [], + droppedAttributesCount: 0, + }, + { + timeUnixNano: 1574120165429803000, + name: 'domainLookupStart', + attributes: [], + droppedAttributesCount: 0, + }, + { + timeUnixNano: 1574120165429803000, + name: 'domainLookupEnd', + attributes: [], + droppedAttributesCount: 0, + }, + { + timeUnixNano: 1574120165429803000, + name: 'connectStart', + attributes: [], + droppedAttributesCount: 0, + }, + { + timeUnixNano: 1574120165429803000, + name: 'connectEnd', + attributes: [], + droppedAttributesCount: 0, + }, + { + timeUnixNano: 1574120165435513000, + name: 'requestStart', + attributes: [], + droppedAttributesCount: 0, + }, + { + timeUnixNano: 1574120165436923100, + name: 'responseStart', + attributes: [], + droppedAttributesCount: 0, + }, + { + timeUnixNano: 1574120165438688000, + name: 'responseEnd', + attributes: [], + droppedAttributesCount: 0, + }, + ], + droppedEventsCount: 0, + status: { code: 0 }, + links: [ + { + traceId: Buffer.from([ + 31, + 16, + 8, + 220, + 142, + 39, + 14, + 133, + 196, + 10, + 13, + 124, + 57, + 57, + 178, + 120, + ]), + spanId: Buffer.from([120, 168, 145, 80, 152, 134, 67, 136]), + attributes: [ + { + key: 'component', + type: 0, + stringValue: 'document-load', + }, + ], + droppedAttributesCount: 0, + }, + ], + droppedLinksCount: 0, + }); +} + +export function ensureBrowserSpanIsCorrect( + span: collectorTypes.opentelemetryProto.trace.v1.Span +) { + const expected = { + traceId: new Uint8Array([ + 31, + 16, + 8, + 220, + 142, + 39, + 14, + 133, + 196, + 10, + 13, + 124, + 57, + 57, + 178, + 120, + ]), + spanId: new Uint8Array([94, 16, 114, 97, 246, 79, 165, 62]), + parentSpanId: new Uint8Array([120, 168, 145, 80, 152, 134, 67, 136]), + traceState: undefined, + name: { value: 'documentFetch', truncatedByteCount: 0 }, + kind: 1, + startTimeUnixNano: 1574120165429803000, + endTimeUnixNano: 1574120165438688000, + attributes: [ + { + key: 'component', + type: 0, + stringValue: 'document-load', + }, + ], + droppedAttributesCount: 0, + events: [ + { + timeUnixNano: 1574120165429803000, + name: 'fetchStart', + attributes: [], + droppedAttributesCount: 0, + }, + { + timeUnixNano: 1574120165429803000, + name: 'domainLookupStart', + attributes: [], + droppedAttributesCount: 0, + }, + { + timeUnixNano: 1574120165429803000, + name: 'domainLookupEnd', + attributes: [], + droppedAttributesCount: 0, + }, + { + timeUnixNano: 1574120165429803000, + name: 'connectStart', + attributes: [], + droppedAttributesCount: 0, + }, + { + timeUnixNano: 1574120165429803000, + name: 'connectEnd', + attributes: [], + droppedAttributesCount: 0, + }, + { + timeUnixNano: 1574120165435513000, + name: 'requestStart', + attributes: [], + droppedAttributesCount: 0, + }, + { + timeUnixNano: 1574120165436923100, + name: 'responseStart', + attributes: [], + droppedAttributesCount: 0, + }, + { + timeUnixNano: 1574120165438688000, + name: 'responseEnd', + attributes: [], + droppedAttributesCount: 0, + }, + ], + droppedEventsCount: 0, + status: { code: 0 }, + links: [ + { + traceId: new Uint8Array([ + 31, + 16, + 8, + 220, + 142, + 39, + 14, + 133, + 196, + 10, + 13, + 124, + 57, + 57, + 178, + 120, + ]), + spanId: new Uint8Array([120, 168, 145, 80, 152, 134, 67, 136]), + attributes: [ + { + key: 'component', + type: 0, + stringValue: 'document-load', + }, + ], + droppedAttributesCount: 0, + }, + ], + droppedLinksCount: 0, + }; + assert.deepStrictEqual(span, JSON.parse(JSON.stringify(expected))); +} + +export function ensureExportedSpanIsCorrect( + span: collectorTypes.opentelemetryProto.trace.v1.Span ) { assert.deepStrictEqual(span, { attributes: [ @@ -207,14 +462,29 @@ export function ensureProtoSpanIsCorrect( }); } -export function ensureResourceIsCorrect(resource: collectorTypes.Resource) { +export function ensureWebResourceIsCorrect( + resource: collectorTypes.opentelemetryProto.resource.v1.Resource +) { assert.deepStrictEqual(resource, { - labels: { service: 'ui', version: '1', cost: '112.12' }, + attributes: [ + { + key: 'service', + type: 0, + stringValue: 'ui', + }, + { key: 'version', type: 2, doubleValue: 1 }, + { + key: 'cost', + type: 2, + doubleValue: 112.12, + }, + ], + droppedAttributesCount: 0, }); } -export function ensureProtoResourceIsCorrect( - resource: opentelemetry.proto.resource.v1.Resource +export function ensureResourceIsCorrect( + resource: collectorTypes.opentelemetryProto.resource.v1.Resource ) { assert.deepStrictEqual(resource, { attributes: [ @@ -247,127 +517,35 @@ export function ensureProtoResourceIsCorrect( }); } -export function ensureSpanIsCorrect(span: collectorTypes.Span) { - assert.deepStrictEqual(span, { - traceId: 'HxAI3I4nDoXECg18OTmyeA==', - spanId: 'XhByYfZPpT4=', - parentSpanId: 'eKiRUJiGQ4g=', - tracestate: {}, - name: { value: 'documentFetch', truncatedByteCount: 0 }, - kind: 0, - startTime: '2019-11-18T23:36:05.429803070Z', - endTime: '2019-11-18T23:36:05.438688070Z', - attributes: { - droppedAttributesCount: 0, - attributeMap: { - component: { - stringValue: { value: 'document-load', truncatedByteCount: 0 }, - }, - }, - }, - timeEvents: { - timeEvent: [ - { - time: '2019-11-18T23:36:05.429803070Z', - annotation: { - description: { value: 'fetchStart', truncatedByteCount: 0 }, - }, - }, - { - time: '2019-11-18T23:36:05.429803070Z', - annotation: { - description: { - value: 'domainLookupStart', - truncatedByteCount: 0, - }, - }, - }, - { - time: '2019-11-18T23:36:05.429803070Z', - annotation: { - description: { - value: 'domainLookupEnd', - truncatedByteCount: 0, - }, - }, - }, - { - time: '2019-11-18T23:36:05.429803070Z', - annotation: { - description: { value: 'connectStart', truncatedByteCount: 0 }, - }, - }, - { - time: '2019-11-18T23:36:05.429803070Z', - annotation: { - description: { value: 'connectEnd', truncatedByteCount: 0 }, - }, - }, - { - time: '2019-11-18T23:36:05.435513070Z', - annotation: { - description: { value: 'requestStart', truncatedByteCount: 0 }, - }, - }, - { - time: '2019-11-18T23:36:05.436923070Z', - annotation: { - description: { value: 'responseStart', truncatedByteCount: 0 }, - }, - }, - { - time: '2019-11-18T23:36:05.438688070Z', - annotation: { - description: { value: 'responseEnd', truncatedByteCount: 0 }, - }, - }, - ], - droppedAnnotationsCount: 0, - droppedMessageEventsCount: 0, - }, - status: { code: 0 }, - sameProcessAsParentSpan: true, - links: { - droppedLinksCount: 0, - link: [ - { - traceId: 'HxAI3I4nDoXECg18OTmyeA==', - spanId: 'eKiRUJiGQ4g=', - type: 2, - attributes: { - droppedAttributesCount: 0, - attributeMap: { - component: { - stringValue: { value: 'document-load', truncatedByteCount: 0 }, - }, - }, - }, - }, - ], - }, - }); -} - export function ensureExportTraceServiceRequestIsSet( - json: collectorTypes.ExportTraceServiceRequest, - languageInfo: collectorTypes.LibraryInfoLanguage + json: collectorTypes.opentelemetryProto.collector.trace.v1.ExportTraceServiceRequest ) { - const libraryInfo = json.node && json.node.libraryInfo; - const serviceInfo = json.node && json.node.serviceInfo; - const identifier = json.node && json.node.identifier; - - const language = libraryInfo && libraryInfo.language; - assert.strictEqual(language, languageInfo, 'language is missing'); + const resourceSpans = json.resourceSpans; + assert.strictEqual( + resourceSpans && resourceSpans.length, + 1, + 'resourceSpans is missing' + ); - const exporterVersion = libraryInfo && libraryInfo.exporterVersion; - assert.strictEqual(exporterVersion, VERSION, 'version is missing'); + const resource = resourceSpans[0].resource; + assert.strictEqual(!!resource, true, 'resource is missing'); - const coreVersion = libraryInfo && libraryInfo.coreLibraryVersion; - assert.strictEqual(coreVersion, core.VERSION, 'core version is missing'); + const instrumentationLibrarySpans = + resourceSpans[0].instrumentationLibrarySpans; + assert.strictEqual( + instrumentationLibrarySpans && instrumentationLibrarySpans.length, + 1, + 'instrumentationLibrarySpans is missing' + ); - const name = serviceInfo && serviceInfo.name; - assert.strictEqual(name, 'bar', 'name is missing'); + const instrumentationLibrary = + instrumentationLibrarySpans[0].instrumentationLibrary; + assert.strictEqual( + !!instrumentationLibrary, + true, + 'instrumentationLibrary is missing' + ); - const hostName = identifier && identifier.hostName; - assert.strictEqual(hostName, 'foo', 'hostName is missing'); + const spans = instrumentationLibrarySpans[0].spans; + assert.strictEqual(spans && spans.length, 1, 'spans are missing'); } diff --git a/packages/opentelemetry-exporter-collector/test/node/CollectorExporter.test.ts b/packages/opentelemetry-exporter-collector/test/node/CollectorExporter.test.ts index 70013944ca..b26b9c9df7 100644 --- a/packages/opentelemetry-exporter-collector/test/node/CollectorExporter.test.ts +++ b/packages/opentelemetry-exporter-collector/test/node/CollectorExporter.test.ts @@ -25,27 +25,26 @@ import { import * as assert from 'assert'; import * as sinon from 'sinon'; import { CollectorExporter } from '../../src/CollectorExporter'; -import { opentelemetry } from '../../src/platform/node/grpc/types'; +import * as collectorTypes from '../../src/types'; import { - ensureProtoResourceIsCorrect, - ensureProtoSpanIsCorrect, + ensureResourceIsCorrect, + ensureExportedSpanIsCorrect, mockedReadableSpan, } from '../helper'; const traceServiceProtoPath = 'opentelemetry/proto/collector/trace/v1/trace_service.proto'; -const includeDirs = [ - path.resolve(__dirname, '../../src/platform/node/grpc/protos'), -]; - +const includeDirs = [path.resolve(__dirname, '../../src/platform/node/protos')]; // const address = '127.0.0.1:55679'; const address = '127.0.0.1:1501'; describe('CollectorExporter - node', () => { let collectorExporter: CollectorExporter; let server: grpc.Server; - let exportedData: opentelemetry.proto.trace.v1.ResourceSpans | undefined; + let exportedData: + | collectorTypes.opentelemetryProto.trace.v1.ResourceSpans + | undefined; before(done => { server = new grpc.Server(); @@ -67,7 +66,7 @@ describe('CollectorExporter - node', () => { .service, { Export: (data: { - request: opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest; + request: collectorTypes.opentelemetryProto.collector.trace.v1.ExportTraceServiceRequest; }) => { try { exportedData = data.request.resourceSpans[0]; @@ -121,11 +120,11 @@ describe('CollectorExporter - node', () => { if (exportedData) { spans = exportedData.instrumentationLibrarySpans[0].spans; resource = exportedData.resource; - ensureProtoSpanIsCorrect(spans[0]); + ensureExportedSpanIsCorrect(spans[0]); assert.ok(typeof resource !== 'undefined', "resource doesn't exist"); if (resource) { - ensureProtoResourceIsCorrect(resource); + ensureResourceIsCorrect(resource); } } done(); From 3e2e16963229bf0d1cbe75e0b9a15b7ca7c9d259 Mon Sep 17 00:00:00 2001 From: Bartlomiej Obecny Date: Wed, 25 Mar 2020 20:18:23 +0100 Subject: [PATCH 04/14] chore: fixing submodule --- .gitmodules | 3 - .../src/platform/node/protos/.gitattributes | 1 - .../src/platform/node/protos/.gitignore | 19 - .../src/platform/node/protos/.travis.yml | 10 - .../src/platform/node/protos/CHANGELOG.md | 5 - .../src/platform/node/protos/CODEOWNERS | 15 - .../src/platform/node/protos/CONTRIBUTING.md | 24 - .../src/platform/node/protos/LICENSE | 201 ---- .../src/platform/node/protos/README.md | 22 - .../src/platform/node/protos/RELEASING.md | 94 -- .../metrics/v1/metrics_service.pb.go | 215 ---- .../metrics/v1/metrics_service.pb.gw.go | 115 -- .../go/collector/trace/v1/trace_config.pb.go | 368 ------ .../go/collector/trace/v1/trace_service.pb.go | 215 ---- .../collector/trace/v1/trace_service.pb.gw.go | 115 -- .../node/protos/gen/go/common/v1/common.pb.go | 273 ----- .../protos/gen/go/metrics/v1/metrics.pb.go | 1045 ----------------- .../protos/gen/go/resource/v1/resource.pb.go | 100 -- .../node/protos/gen/go/trace/v1/trace.pb.go | 767 ------------ .../platform/node/protos/install-proto-osx.sh | 23 - .../src/platform/node/protos/install-proto.sh | 23 - .../src/platform/node/protos/makefile | 46 - .../opentelemetry/proto/collector/README.md | 9 - .../metrics/v1/metrics_service.proto | 45 - .../metrics/v1/metrics_service_http.yaml | 9 - .../collector/trace/v1/trace_service.proto | 48 - .../trace/v1/trace_service_http.yaml | 9 - .../proto/common/v1/common.proto | 62 - .../proto/metrics/v1/metrics.proto | 372 ------ .../proto/resource/v1/resource.proto | 34 - .../opentelemetry/proto/trace/v1/trace.proto | 261 ---- .../proto/trace/v1/trace_config.proto | 78 -- .../src/platform/node/protos/verify-go.sh | 32 - 33 files changed, 4658 deletions(-) delete mode 100644 .gitmodules delete mode 100644 packages/opentelemetry-exporter-collector/src/platform/node/protos/.gitattributes delete mode 100644 packages/opentelemetry-exporter-collector/src/platform/node/protos/.gitignore delete mode 100644 packages/opentelemetry-exporter-collector/src/platform/node/protos/.travis.yml delete mode 100644 packages/opentelemetry-exporter-collector/src/platform/node/protos/CHANGELOG.md delete mode 100644 packages/opentelemetry-exporter-collector/src/platform/node/protos/CODEOWNERS delete mode 100644 packages/opentelemetry-exporter-collector/src/platform/node/protos/CONTRIBUTING.md delete mode 100644 packages/opentelemetry-exporter-collector/src/platform/node/protos/LICENSE delete mode 100644 packages/opentelemetry-exporter-collector/src/platform/node/protos/README.md delete mode 100644 packages/opentelemetry-exporter-collector/src/platform/node/protos/RELEASING.md delete mode 100644 packages/opentelemetry-exporter-collector/src/platform/node/protos/gen/go/collector/metrics/v1/metrics_service.pb.go delete mode 100644 packages/opentelemetry-exporter-collector/src/platform/node/protos/gen/go/collector/metrics/v1/metrics_service.pb.gw.go delete mode 100644 packages/opentelemetry-exporter-collector/src/platform/node/protos/gen/go/collector/trace/v1/trace_config.pb.go delete mode 100644 packages/opentelemetry-exporter-collector/src/platform/node/protos/gen/go/collector/trace/v1/trace_service.pb.go delete mode 100644 packages/opentelemetry-exporter-collector/src/platform/node/protos/gen/go/collector/trace/v1/trace_service.pb.gw.go delete mode 100644 packages/opentelemetry-exporter-collector/src/platform/node/protos/gen/go/common/v1/common.pb.go delete mode 100644 packages/opentelemetry-exporter-collector/src/platform/node/protos/gen/go/metrics/v1/metrics.pb.go delete mode 100644 packages/opentelemetry-exporter-collector/src/platform/node/protos/gen/go/resource/v1/resource.pb.go delete mode 100644 packages/opentelemetry-exporter-collector/src/platform/node/protos/gen/go/trace/v1/trace.pb.go delete mode 100755 packages/opentelemetry-exporter-collector/src/platform/node/protos/install-proto-osx.sh delete mode 100755 packages/opentelemetry-exporter-collector/src/platform/node/protos/install-proto.sh delete mode 100755 packages/opentelemetry-exporter-collector/src/platform/node/protos/makefile delete mode 100644 packages/opentelemetry-exporter-collector/src/platform/node/protos/opentelemetry/proto/collector/README.md delete mode 100644 packages/opentelemetry-exporter-collector/src/platform/node/protos/opentelemetry/proto/collector/metrics/v1/metrics_service.proto delete mode 100644 packages/opentelemetry-exporter-collector/src/platform/node/protos/opentelemetry/proto/collector/metrics/v1/metrics_service_http.yaml delete mode 100644 packages/opentelemetry-exporter-collector/src/platform/node/protos/opentelemetry/proto/collector/trace/v1/trace_service.proto delete mode 100644 packages/opentelemetry-exporter-collector/src/platform/node/protos/opentelemetry/proto/collector/trace/v1/trace_service_http.yaml delete mode 100644 packages/opentelemetry-exporter-collector/src/platform/node/protos/opentelemetry/proto/common/v1/common.proto delete mode 100644 packages/opentelemetry-exporter-collector/src/platform/node/protos/opentelemetry/proto/metrics/v1/metrics.proto delete mode 100644 packages/opentelemetry-exporter-collector/src/platform/node/protos/opentelemetry/proto/resource/v1/resource.proto delete mode 100644 packages/opentelemetry-exporter-collector/src/platform/node/protos/opentelemetry/proto/trace/v1/trace.proto delete mode 100644 packages/opentelemetry-exporter-collector/src/platform/node/protos/opentelemetry/proto/trace/v1/trace_config.proto delete mode 100755 packages/opentelemetry-exporter-collector/src/platform/node/protos/verify-go.sh diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index 50b83a59cd..0000000000 --- a/.gitmodules +++ /dev/null @@ -1,3 +0,0 @@ -[submodule "packages/opentelemetry-exporter-collector/src/platform/node/protos"] - path = packages/opentelemetry-exporter-collector/src/platform/node/protos - url = git@github.com:open-telemetry/opentelemetry-proto.git diff --git a/packages/opentelemetry-exporter-collector/src/platform/node/protos/.gitattributes b/packages/opentelemetry-exporter-collector/src/platform/node/protos/.gitattributes deleted file mode 100644 index 6313b56c57..0000000000 --- a/packages/opentelemetry-exporter-collector/src/platform/node/protos/.gitattributes +++ /dev/null @@ -1 +0,0 @@ -* text=auto eol=lf diff --git a/packages/opentelemetry-exporter-collector/src/platform/node/protos/.gitignore b/packages/opentelemetry-exporter-collector/src/platform/node/protos/.gitignore deleted file mode 100644 index 21e871b49f..0000000000 --- a/packages/opentelemetry-exporter-collector/src/platform/node/protos/.gitignore +++ /dev/null @@ -1,19 +0,0 @@ -# IntelliJ IDEA -.idea -*.iml - -# VS Code -.vscode -.classpath -.project -.settings/ - -# OS X -.DS_Store - -# Emacs -*~ -\#*\# - -# Vim -.swp diff --git a/packages/opentelemetry-exporter-collector/src/platform/node/protos/.travis.yml b/packages/opentelemetry-exporter-collector/src/platform/node/protos/.travis.yml deleted file mode 100644 index aecd86e993..0000000000 --- a/packages/opentelemetry-exporter-collector/src/platform/node/protos/.travis.yml +++ /dev/null @@ -1,10 +0,0 @@ -sudo: required -dist: xenial -language: go - -install: - - ./install-proto.sh - -script: - - ./verify-go.sh - - make ci diff --git a/packages/opentelemetry-exporter-collector/src/platform/node/protos/CHANGELOG.md b/packages/opentelemetry-exporter-collector/src/platform/node/protos/CHANGELOG.md deleted file mode 100644 index 9240bce2cd..0000000000 --- a/packages/opentelemetry-exporter-collector/src/platform/node/protos/CHANGELOG.md +++ /dev/null @@ -1,5 +0,0 @@ -# Changelog - -## Unreleased - -- Initial protos for trace, metrics, resource and OTLP. diff --git a/packages/opentelemetry-exporter-collector/src/platform/node/protos/CODEOWNERS b/packages/opentelemetry-exporter-collector/src/platform/node/protos/CODEOWNERS deleted file mode 100644 index 64488e355c..0000000000 --- a/packages/opentelemetry-exporter-collector/src/platform/node/protos/CODEOWNERS +++ /dev/null @@ -1,15 +0,0 @@ -##################################################### -# -# List of approvers for OpenTelemetry Proto repository -# -##################################################### -# -# Learn about membership in OpenTelemetry community: -# https://github.com/open-telemetry/community/blob/master/community-membership.md -# -# -# Learn about CODEOWNERS file format: -# https://help.github.com/en/articles/about-code-owners -# - -* @bogdandrutu @carlosalberto @SergeyKanzhelev @yurishkuro @tedsuo @iredelmeier @arminru @c24t @reyang @tigrannajaryan @jmacd diff --git a/packages/opentelemetry-exporter-collector/src/platform/node/protos/CONTRIBUTING.md b/packages/opentelemetry-exporter-collector/src/platform/node/protos/CONTRIBUTING.md deleted file mode 100644 index 2f7197c000..0000000000 --- a/packages/opentelemetry-exporter-collector/src/platform/node/protos/CONTRIBUTING.md +++ /dev/null @@ -1,24 +0,0 @@ -# Contributing - -Read OpenTelemetry project [contributing -guide](https://github.com/open-telemetry/community/blob/master/CONTRIBUTING.md) -for general information about the project. - -## Prerequisites - -- Protocol Buffers compiler `protoc`. -- Protocol Buffers Go compiler `protoc-gen-go`. - -Install manually or use: - -- `install-proto.sh` (if on Linux). -- `install-proto-osx.sh` (for mac). - -## Making changes to the .proto files - -Non-backward compatible changes to .proto files are permitted until protocol schema is -declared complete. - -After making any changes to .proto files make sure to generate Go implementation by -running `make gen-go`. Generated files must be included in the same commit as the .proto -files. diff --git a/packages/opentelemetry-exporter-collector/src/platform/node/protos/LICENSE b/packages/opentelemetry-exporter-collector/src/platform/node/protos/LICENSE deleted file mode 100644 index 261eeb9e9f..0000000000 --- a/packages/opentelemetry-exporter-collector/src/platform/node/protos/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - 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 - - http://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. diff --git a/packages/opentelemetry-exporter-collector/src/platform/node/protos/README.md b/packages/opentelemetry-exporter-collector/src/platform/node/protos/README.md deleted file mode 100644 index a08404ec6b..0000000000 --- a/packages/opentelemetry-exporter-collector/src/platform/node/protos/README.md +++ /dev/null @@ -1,22 +0,0 @@ -# Language Independent Interface Types For OpenTelemetry - -The proto files can be consumed as GIT submodule or copied over and built directly in the consumer project. - -The compiled files are published to central repositories (Maven, NPM...) from OpenTelemetry client libraries. - -See [contribution guidelines](CONTRIBUTING.md) if you would like to make any changes. - -## Maturity Level - -Component | Maturity | --------------------------|----------| -collector/metrics/* | Alpha | -collector/trace/* | Beta | -common/* | Beta | -metrics/* | Alpha | -resource/* | Beta | -trace/trace.proto | Beta | -trace/trace_config.proto | Alpha | - -(See [maturity-matrix.yaml](https://github.com/open-telemetry/community/blob/47813530864b9fe5a5146f466a58bd2bb94edc72/maturity-matrix.yaml#L57) -for definition of maturity levels). \ No newline at end of file diff --git a/packages/opentelemetry-exporter-collector/src/platform/node/protos/RELEASING.md b/packages/opentelemetry-exporter-collector/src/platform/node/protos/RELEASING.md deleted file mode 100644 index 68c451b9b0..0000000000 --- a/packages/opentelemetry-exporter-collector/src/platform/node/protos/RELEASING.md +++ /dev/null @@ -1,94 +0,0 @@ -# How to Create a Release of OpenTelemetry Proto (for Maintainers Only) - -## Tagging the Release - -Our release branches follow the naming convention of `v..x`, while -the tags include the patch version `v..`. For example, the -same branch `v0.3.x` would be used to create all `v0.3` tags (e.g. `v0.3.0`, -`v0.3.1`). - -In this section upstream repository refers to the main opentelemetry-proto -github repository. - -Before any push to the upstream repository you need to create a [personal access -token](https://help.github.com/articles/creating-a-personal-access-token-for-the-command-line/). - -1. Create the release branch and push it to GitHub: - - ```bash - MAJOR=0 MINOR=3 PATCH=0 # Set appropriately for new release - git checkout -b v$MAJOR.$MINOR.x master - git push upstream v$MAJOR.$MINOR.x - ``` - -2. Enable branch protection for the new branch, if you have admin access. - Otherwise, let someone with admin access know that there is a new release - branch. - - - Open the branch protection settings for the new branch, by following - [Github's instructions](https://help.github.com/articles/configuring-protected-branches/). - - Copy the settings from a previous branch, i.e., check - - `Protect this branch` - - `Require pull request reviews before merging` - - `Require status checks to pass before merging` - - `Include administrators` - - Enable the following required status checks: - - `cla/linuxfoundation` - - `ci/circleci: build` - - Uncheck everything else. - - Click "Save changes". - -3. For `vMajor.Minor.x` branch: - - - Create and push a tag: - - ```bash - git checkout v$MAJOR.$MINOR.x - git pull upstream v$MAJOR.$MINOR.x - git tag -a v$MAJOR.$MINOR.$PATCH -m "Version $MAJOR.$MINOR.$PATCH" - git push upstream v$MAJOR.$MINOR.x - ``` - -## Patch Release - -All patch releases should include only bug-fixes, and must avoid -adding/modifying the public APIs. To cherry-pick one commit use the following -instructions: - -- Create and push a tag: - -```bash -COMMIT=1224f0a # Set the right commit hash. -git checkout -b cherrypick v$MAJOR.$MINOR.x -git cherry-pick -x $COMMIT -git commit -a -m "Cherry-pick commit $COMMIT" -``` - -- Go through PR review and merge it to GitHub v$MAJOR.$MINOR.x branch. - -- Tag a new patch release when all commits are merged. - -## Announcement - -Once deployment is done, go to Github [release -page](https://github.com/open-telemetry/opentelemetry-proto/releases), press -`Draft a new release` to write release notes about the new release. - -You can use `git log upstream/v$MAJOR.$((MINOR-1)).x..upstream/v$MAJOR.$MINOR.x --graph --first-parent` -or the Github [compare tool](https://github.com/open-telemetry/opentelemetry-proto/compare/) -to view a summary of all commits since last release as a reference. - -In addition, you can refer to -[CHANGELOG.md](https://github.com/open-telemetry/opentelemetry-proto/blob/master/CHANGELOG.md) -for a list of major changes since last release. - -## Update release versions in documentations and CHANGELOG files - -After releasing is done, you need to update -[README.md](https://github.com/open-telemetry/opentelemetry-proto/blob/master/README.md) and -[CHANGELOG.md](https://github.com/open-telemetry/opentelemetry-proto/blob/master/CHANGELOG.md). - -Create a PR to mark the new release in -[CHANGELOG.md](https://github.com/census-instrumentation/opencensus-java/blob/master/CHANGELOG.md) -on master branch. diff --git a/packages/opentelemetry-exporter-collector/src/platform/node/protos/gen/go/collector/metrics/v1/metrics_service.pb.go b/packages/opentelemetry-exporter-collector/src/platform/node/protos/gen/go/collector/metrics/v1/metrics_service.pb.go deleted file mode 100644 index 39a22f51ac..0000000000 --- a/packages/opentelemetry-exporter-collector/src/platform/node/protos/gen/go/collector/metrics/v1/metrics_service.pb.go +++ /dev/null @@ -1,215 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// source: opentelemetry/proto/collector/metrics/v1/metrics_service.proto - -package v1 - -import ( - context "context" - fmt "fmt" - proto "github.com/golang/protobuf/proto" - v1 "github.com/open-telemetry/opentelemetry-proto/gen/go/metrics/v1" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" - math "math" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package - -type ExportMetricsServiceRequest struct { - // An array of ResourceMetrics. - // For data coming from a single resource this array will typically contain one - // element. Intermediary nodes (such as OpenTelemetry Collector) that receive - // data from multiple origins typically batch the data before forwarding further and - // in that case this array will contain multiple elements. - ResourceMetrics []*v1.ResourceMetrics `protobuf:"bytes,1,rep,name=resource_metrics,json=resourceMetrics,proto3" json:"resource_metrics,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *ExportMetricsServiceRequest) Reset() { *m = ExportMetricsServiceRequest{} } -func (m *ExportMetricsServiceRequest) String() string { return proto.CompactTextString(m) } -func (*ExportMetricsServiceRequest) ProtoMessage() {} -func (*ExportMetricsServiceRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_75fb6015e6e64798, []int{0} -} - -func (m *ExportMetricsServiceRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ExportMetricsServiceRequest.Unmarshal(m, b) -} -func (m *ExportMetricsServiceRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ExportMetricsServiceRequest.Marshal(b, m, deterministic) -} -func (m *ExportMetricsServiceRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_ExportMetricsServiceRequest.Merge(m, src) -} -func (m *ExportMetricsServiceRequest) XXX_Size() int { - return xxx_messageInfo_ExportMetricsServiceRequest.Size(m) -} -func (m *ExportMetricsServiceRequest) XXX_DiscardUnknown() { - xxx_messageInfo_ExportMetricsServiceRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_ExportMetricsServiceRequest proto.InternalMessageInfo - -func (m *ExportMetricsServiceRequest) GetResourceMetrics() []*v1.ResourceMetrics { - if m != nil { - return m.ResourceMetrics - } - return nil -} - -type ExportMetricsServiceResponse struct { - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *ExportMetricsServiceResponse) Reset() { *m = ExportMetricsServiceResponse{} } -func (m *ExportMetricsServiceResponse) String() string { return proto.CompactTextString(m) } -func (*ExportMetricsServiceResponse) ProtoMessage() {} -func (*ExportMetricsServiceResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_75fb6015e6e64798, []int{1} -} - -func (m *ExportMetricsServiceResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ExportMetricsServiceResponse.Unmarshal(m, b) -} -func (m *ExportMetricsServiceResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ExportMetricsServiceResponse.Marshal(b, m, deterministic) -} -func (m *ExportMetricsServiceResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_ExportMetricsServiceResponse.Merge(m, src) -} -func (m *ExportMetricsServiceResponse) XXX_Size() int { - return xxx_messageInfo_ExportMetricsServiceResponse.Size(m) -} -func (m *ExportMetricsServiceResponse) XXX_DiscardUnknown() { - xxx_messageInfo_ExportMetricsServiceResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_ExportMetricsServiceResponse proto.InternalMessageInfo - -func init() { - proto.RegisterType((*ExportMetricsServiceRequest)(nil), "opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceRequest") - proto.RegisterType((*ExportMetricsServiceResponse)(nil), "opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceResponse") -} - -func init() { - proto.RegisterFile("opentelemetry/proto/collector/metrics/v1/metrics_service.proto", fileDescriptor_75fb6015e6e64798) -} - -var fileDescriptor_75fb6015e6e64798 = []byte{ - // 264 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xb2, 0xcb, 0x2f, 0x48, 0xcd, - 0x2b, 0x49, 0xcd, 0x49, 0xcd, 0x4d, 0x2d, 0x29, 0xaa, 0xd4, 0x2f, 0x28, 0xca, 0x2f, 0xc9, 0xd7, - 0x4f, 0xce, 0xcf, 0xc9, 0x49, 0x4d, 0x2e, 0xc9, 0x2f, 0xd2, 0x07, 0x89, 0x66, 0x26, 0x17, 0xeb, - 0x97, 0x19, 0xc2, 0x98, 0xf1, 0xc5, 0xa9, 0x45, 0x65, 0x99, 0xc9, 0xa9, 0x7a, 0x60, 0xa5, 0x42, - 0x1a, 0x28, 0xfa, 0x21, 0x82, 0x7a, 0x70, 0xfd, 0x7a, 0x50, 0x4d, 0x7a, 0x65, 0x86, 0x52, 0x3a, - 0xd8, 0x6c, 0xc2, 0x34, 0x1f, 0x62, 0x84, 0x52, 0x25, 0x97, 0xb4, 0x6b, 0x45, 0x41, 0x7e, 0x51, - 0x89, 0x2f, 0x44, 0x38, 0x18, 0x62, 0x6b, 0x50, 0x6a, 0x61, 0x69, 0x6a, 0x71, 0x89, 0x50, 0x14, - 0x97, 0x40, 0x51, 0x6a, 0x71, 0x7e, 0x69, 0x51, 0x72, 0x6a, 0x3c, 0x54, 0xa3, 0x04, 0xa3, 0x02, - 0xb3, 0x06, 0xb7, 0x91, 0xbe, 0x1e, 0x36, 0x17, 0x21, 0xdc, 0xa1, 0x17, 0x04, 0xd5, 0x07, 0x35, - 0x38, 0x88, 0xbf, 0x08, 0x55, 0x40, 0x49, 0x8e, 0x4b, 0x06, 0xbb, 0xd5, 0xc5, 0x05, 0xf9, 0x79, - 0xc5, 0xa9, 0x46, 0x6b, 0x18, 0xb9, 0xf8, 0x50, 0xa5, 0x84, 0x66, 0x32, 0x72, 0xb1, 0x41, 0xf4, - 0x08, 0xb9, 0xea, 0x11, 0x1b, 0x22, 0x7a, 0x78, 0x3c, 0x28, 0xe5, 0x46, 0xa9, 0x31, 0x10, 0xc7, - 0x2a, 0x31, 0x38, 0xf5, 0x33, 0x72, 0x69, 0x67, 0xe6, 0x13, 0x6d, 0x9c, 0x93, 0x30, 0xaa, 0x49, - 0x01, 0x20, 0x95, 0x01, 0x8c, 0x51, 0x9e, 0xe9, 0x99, 0x25, 0x19, 0xa5, 0x49, 0x7a, 0xc9, 0xf9, - 0xb9, 0xfa, 0x20, 0xb3, 0x74, 0x11, 0x51, 0x89, 0x62, 0xb4, 0x2e, 0x24, 0x62, 0xd3, 0x53, 0xf3, - 0xf4, 0xd3, 0xb1, 0xa7, 0xa4, 0x24, 0x36, 0xb0, 0x12, 0x63, 0x40, 0x00, 0x00, 0x00, 0xff, 0xff, - 0xaa, 0xdd, 0xdf, 0x49, 0x7c, 0x02, 0x00, 0x00, -} - -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConn - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion4 - -// MetricsServiceClient is the client API for MetricsService service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -type MetricsServiceClient interface { - // For performance reasons, it is recommended to keep this RPC - // alive for the entire life of the application. - Export(ctx context.Context, in *ExportMetricsServiceRequest, opts ...grpc.CallOption) (*ExportMetricsServiceResponse, error) -} - -type metricsServiceClient struct { - cc *grpc.ClientConn -} - -func NewMetricsServiceClient(cc *grpc.ClientConn) MetricsServiceClient { - return &metricsServiceClient{cc} -} - -func (c *metricsServiceClient) Export(ctx context.Context, in *ExportMetricsServiceRequest, opts ...grpc.CallOption) (*ExportMetricsServiceResponse, error) { - out := new(ExportMetricsServiceResponse) - err := c.cc.Invoke(ctx, "/opentelemetry.proto.collector.metrics.v1.MetricsService/Export", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// MetricsServiceServer is the server API for MetricsService service. -type MetricsServiceServer interface { - // For performance reasons, it is recommended to keep this RPC - // alive for the entire life of the application. - Export(context.Context, *ExportMetricsServiceRequest) (*ExportMetricsServiceResponse, error) -} - -// UnimplementedMetricsServiceServer can be embedded to have forward compatible implementations. -type UnimplementedMetricsServiceServer struct { -} - -func (*UnimplementedMetricsServiceServer) Export(ctx context.Context, req *ExportMetricsServiceRequest) (*ExportMetricsServiceResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Export not implemented") -} - -func RegisterMetricsServiceServer(s *grpc.Server, srv MetricsServiceServer) { - s.RegisterService(&_MetricsService_serviceDesc, srv) -} - -func _MetricsService_Export_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ExportMetricsServiceRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MetricsServiceServer).Export(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/opentelemetry.proto.collector.metrics.v1.MetricsService/Export", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MetricsServiceServer).Export(ctx, req.(*ExportMetricsServiceRequest)) - } - return interceptor(ctx, in, info, handler) -} - -var _MetricsService_serviceDesc = grpc.ServiceDesc{ - ServiceName: "opentelemetry.proto.collector.metrics.v1.MetricsService", - HandlerType: (*MetricsServiceServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "Export", - Handler: _MetricsService_Export_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "opentelemetry/proto/collector/metrics/v1/metrics_service.proto", -} diff --git a/packages/opentelemetry-exporter-collector/src/platform/node/protos/gen/go/collector/metrics/v1/metrics_service.pb.gw.go b/packages/opentelemetry-exporter-collector/src/platform/node/protos/gen/go/collector/metrics/v1/metrics_service.pb.gw.go deleted file mode 100644 index 3bd2374a42..0000000000 --- a/packages/opentelemetry-exporter-collector/src/platform/node/protos/gen/go/collector/metrics/v1/metrics_service.pb.gw.go +++ /dev/null @@ -1,115 +0,0 @@ -// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. -// source: opentelemetry/proto/collector/metrics/v1/metrics_service.proto - -/* -Package v1 is a reverse proxy. - -It translates gRPC into RESTful JSON APIs. -*/ -package v1 - -import ( - "context" - "io" - "net/http" - - "github.com/golang/protobuf/proto" - "github.com/grpc-ecosystem/grpc-gateway/runtime" - "github.com/grpc-ecosystem/grpc-gateway/utilities" - "google.golang.org/grpc" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/grpclog" - "google.golang.org/grpc/status" -) - -var _ codes.Code -var _ io.Reader -var _ status.Status -var _ = runtime.String -var _ = utilities.NewDoubleArray - -func request_MetricsService_Export_0(ctx context.Context, marshaler runtime.Marshaler, client MetricsServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq ExportMetricsServiceRequest - var metadata runtime.ServerMetadata - - newReader, berr := utilities.IOReaderFactory(req.Body) - if berr != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) - } - if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := client.Export(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -// RegisterMetricsServiceHandlerFromEndpoint is same as RegisterMetricsServiceHandler but -// automatically dials to "endpoint" and closes the connection when "ctx" gets done. -func RegisterMetricsServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { - conn, err := grpc.Dial(endpoint, opts...) - if err != nil { - return err - } - defer func() { - if err != nil { - if cerr := conn.Close(); cerr != nil { - grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) - } - return - } - go func() { - <-ctx.Done() - if cerr := conn.Close(); cerr != nil { - grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) - } - }() - }() - - return RegisterMetricsServiceHandler(ctx, mux, conn) -} - -// RegisterMetricsServiceHandler registers the http handlers for service MetricsService to "mux". -// The handlers forward requests to the grpc endpoint over "conn". -func RegisterMetricsServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { - return RegisterMetricsServiceHandlerClient(ctx, mux, NewMetricsServiceClient(conn)) -} - -// RegisterMetricsServiceHandlerClient registers the http handlers for service MetricsService -// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "MetricsServiceClient". -// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "MetricsServiceClient" -// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in -// "MetricsServiceClient" to call the correct interceptors. -func RegisterMetricsServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client MetricsServiceClient) error { - - mux.Handle("POST", pattern_MetricsService_Export_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_MetricsService_Export_0(rctx, inboundMarshaler, client, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_MetricsService_Export_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - return nil -} - -var ( - pattern_MetricsService_Export_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "metrics"}, "", runtime.AssumeColonVerbOpt(true))) -) - -var ( - forward_MetricsService_Export_0 = runtime.ForwardResponseMessage -) diff --git a/packages/opentelemetry-exporter-collector/src/platform/node/protos/gen/go/collector/trace/v1/trace_config.pb.go b/packages/opentelemetry-exporter-collector/src/platform/node/protos/gen/go/collector/trace/v1/trace_config.pb.go deleted file mode 100644 index 11781ccbe6..0000000000 --- a/packages/opentelemetry-exporter-collector/src/platform/node/protos/gen/go/collector/trace/v1/trace_config.pb.go +++ /dev/null @@ -1,368 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// source: opentelemetry/proto/trace/v1/trace_config.proto - -package v1 - -import ( - fmt "fmt" - proto "github.com/golang/protobuf/proto" - math "math" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package - -// How spans should be sampled: -// - Always off -// - Always on -// - Always follow the parent Span's decision (off if no parent). -type ConstantSampler_ConstantDecision int32 - -const ( - ConstantSampler_ALWAYS_OFF ConstantSampler_ConstantDecision = 0 - ConstantSampler_ALWAYS_ON ConstantSampler_ConstantDecision = 1 - ConstantSampler_ALWAYS_PARENT ConstantSampler_ConstantDecision = 2 -) - -var ConstantSampler_ConstantDecision_name = map[int32]string{ - 0: "ALWAYS_OFF", - 1: "ALWAYS_ON", - 2: "ALWAYS_PARENT", -} - -var ConstantSampler_ConstantDecision_value = map[string]int32{ - "ALWAYS_OFF": 0, - "ALWAYS_ON": 1, - "ALWAYS_PARENT": 2, -} - -func (x ConstantSampler_ConstantDecision) String() string { - return proto.EnumName(ConstantSampler_ConstantDecision_name, int32(x)) -} - -func (ConstantSampler_ConstantDecision) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_5936aa8fa6443e6f, []int{1, 0} -} - -// Global configuration of the trace service. All fields must be specified, or -// the default (zero) values will be used for each type. -type TraceConfig struct { - // The global default sampler used to make decisions on span sampling. - // - // Types that are valid to be assigned to Sampler: - // *TraceConfig_ConstantSampler - // *TraceConfig_ProbabilitySampler - // *TraceConfig_RateLimitingSampler - Sampler isTraceConfig_Sampler `protobuf_oneof:"sampler"` - // The global default max number of attributes per span. - MaxNumberOfAttributes int64 `protobuf:"varint,4,opt,name=max_number_of_attributes,json=maxNumberOfAttributes,proto3" json:"max_number_of_attributes,omitempty"` - // The global default max number of annotation events per span. - MaxNumberOfTimedEvents int64 `protobuf:"varint,5,opt,name=max_number_of_timed_events,json=maxNumberOfTimedEvents,proto3" json:"max_number_of_timed_events,omitempty"` - // The global default max number of attributes per timed event. - MaxNumberOfAttributesPerTimedEvent int64 `protobuf:"varint,6,opt,name=max_number_of_attributes_per_timed_event,json=maxNumberOfAttributesPerTimedEvent,proto3" json:"max_number_of_attributes_per_timed_event,omitempty"` - // The global default max number of link entries per span. - MaxNumberOfLinks int64 `protobuf:"varint,7,opt,name=max_number_of_links,json=maxNumberOfLinks,proto3" json:"max_number_of_links,omitempty"` - // The global default max number of attributes per span. - MaxNumberOfAttributesPerLink int64 `protobuf:"varint,8,opt,name=max_number_of_attributes_per_link,json=maxNumberOfAttributesPerLink,proto3" json:"max_number_of_attributes_per_link,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *TraceConfig) Reset() { *m = TraceConfig{} } -func (m *TraceConfig) String() string { return proto.CompactTextString(m) } -func (*TraceConfig) ProtoMessage() {} -func (*TraceConfig) Descriptor() ([]byte, []int) { - return fileDescriptor_5936aa8fa6443e6f, []int{0} -} - -func (m *TraceConfig) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_TraceConfig.Unmarshal(m, b) -} -func (m *TraceConfig) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_TraceConfig.Marshal(b, m, deterministic) -} -func (m *TraceConfig) XXX_Merge(src proto.Message) { - xxx_messageInfo_TraceConfig.Merge(m, src) -} -func (m *TraceConfig) XXX_Size() int { - return xxx_messageInfo_TraceConfig.Size(m) -} -func (m *TraceConfig) XXX_DiscardUnknown() { - xxx_messageInfo_TraceConfig.DiscardUnknown(m) -} - -var xxx_messageInfo_TraceConfig proto.InternalMessageInfo - -type isTraceConfig_Sampler interface { - isTraceConfig_Sampler() -} - -type TraceConfig_ConstantSampler struct { - ConstantSampler *ConstantSampler `protobuf:"bytes,1,opt,name=constant_sampler,json=constantSampler,proto3,oneof"` -} - -type TraceConfig_ProbabilitySampler struct { - ProbabilitySampler *ProbabilitySampler `protobuf:"bytes,2,opt,name=probability_sampler,json=probabilitySampler,proto3,oneof"` -} - -type TraceConfig_RateLimitingSampler struct { - RateLimitingSampler *RateLimitingSampler `protobuf:"bytes,3,opt,name=rate_limiting_sampler,json=rateLimitingSampler,proto3,oneof"` -} - -func (*TraceConfig_ConstantSampler) isTraceConfig_Sampler() {} - -func (*TraceConfig_ProbabilitySampler) isTraceConfig_Sampler() {} - -func (*TraceConfig_RateLimitingSampler) isTraceConfig_Sampler() {} - -func (m *TraceConfig) GetSampler() isTraceConfig_Sampler { - if m != nil { - return m.Sampler - } - return nil -} - -func (m *TraceConfig) GetConstantSampler() *ConstantSampler { - if x, ok := m.GetSampler().(*TraceConfig_ConstantSampler); ok { - return x.ConstantSampler - } - return nil -} - -func (m *TraceConfig) GetProbabilitySampler() *ProbabilitySampler { - if x, ok := m.GetSampler().(*TraceConfig_ProbabilitySampler); ok { - return x.ProbabilitySampler - } - return nil -} - -func (m *TraceConfig) GetRateLimitingSampler() *RateLimitingSampler { - if x, ok := m.GetSampler().(*TraceConfig_RateLimitingSampler); ok { - return x.RateLimitingSampler - } - return nil -} - -func (m *TraceConfig) GetMaxNumberOfAttributes() int64 { - if m != nil { - return m.MaxNumberOfAttributes - } - return 0 -} - -func (m *TraceConfig) GetMaxNumberOfTimedEvents() int64 { - if m != nil { - return m.MaxNumberOfTimedEvents - } - return 0 -} - -func (m *TraceConfig) GetMaxNumberOfAttributesPerTimedEvent() int64 { - if m != nil { - return m.MaxNumberOfAttributesPerTimedEvent - } - return 0 -} - -func (m *TraceConfig) GetMaxNumberOfLinks() int64 { - if m != nil { - return m.MaxNumberOfLinks - } - return 0 -} - -func (m *TraceConfig) GetMaxNumberOfAttributesPerLink() int64 { - if m != nil { - return m.MaxNumberOfAttributesPerLink - } - return 0 -} - -// XXX_OneofWrappers is for the internal use of the proto package. -func (*TraceConfig) XXX_OneofWrappers() []interface{} { - return []interface{}{ - (*TraceConfig_ConstantSampler)(nil), - (*TraceConfig_ProbabilitySampler)(nil), - (*TraceConfig_RateLimitingSampler)(nil), - } -} - -// Sampler that always makes a constant decision on span sampling. -type ConstantSampler struct { - Decision ConstantSampler_ConstantDecision `protobuf:"varint,1,opt,name=decision,proto3,enum=opentelemetry.proto.trace.v1.ConstantSampler_ConstantDecision" json:"decision,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *ConstantSampler) Reset() { *m = ConstantSampler{} } -func (m *ConstantSampler) String() string { return proto.CompactTextString(m) } -func (*ConstantSampler) ProtoMessage() {} -func (*ConstantSampler) Descriptor() ([]byte, []int) { - return fileDescriptor_5936aa8fa6443e6f, []int{1} -} - -func (m *ConstantSampler) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ConstantSampler.Unmarshal(m, b) -} -func (m *ConstantSampler) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ConstantSampler.Marshal(b, m, deterministic) -} -func (m *ConstantSampler) XXX_Merge(src proto.Message) { - xxx_messageInfo_ConstantSampler.Merge(m, src) -} -func (m *ConstantSampler) XXX_Size() int { - return xxx_messageInfo_ConstantSampler.Size(m) -} -func (m *ConstantSampler) XXX_DiscardUnknown() { - xxx_messageInfo_ConstantSampler.DiscardUnknown(m) -} - -var xxx_messageInfo_ConstantSampler proto.InternalMessageInfo - -func (m *ConstantSampler) GetDecision() ConstantSampler_ConstantDecision { - if m != nil { - return m.Decision - } - return ConstantSampler_ALWAYS_OFF -} - -// Sampler that tries to uniformly sample traces with a given probability. -// The probability of sampling a trace is equal to that of the specified probability. -type ProbabilitySampler struct { - // The desired probability of sampling. Must be within [0.0, 1.0]. - SamplingProbability float64 `protobuf:"fixed64,1,opt,name=samplingProbability,proto3" json:"samplingProbability,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *ProbabilitySampler) Reset() { *m = ProbabilitySampler{} } -func (m *ProbabilitySampler) String() string { return proto.CompactTextString(m) } -func (*ProbabilitySampler) ProtoMessage() {} -func (*ProbabilitySampler) Descriptor() ([]byte, []int) { - return fileDescriptor_5936aa8fa6443e6f, []int{2} -} - -func (m *ProbabilitySampler) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ProbabilitySampler.Unmarshal(m, b) -} -func (m *ProbabilitySampler) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ProbabilitySampler.Marshal(b, m, deterministic) -} -func (m *ProbabilitySampler) XXX_Merge(src proto.Message) { - xxx_messageInfo_ProbabilitySampler.Merge(m, src) -} -func (m *ProbabilitySampler) XXX_Size() int { - return xxx_messageInfo_ProbabilitySampler.Size(m) -} -func (m *ProbabilitySampler) XXX_DiscardUnknown() { - xxx_messageInfo_ProbabilitySampler.DiscardUnknown(m) -} - -var xxx_messageInfo_ProbabilitySampler proto.InternalMessageInfo - -func (m *ProbabilitySampler) GetSamplingProbability() float64 { - if m != nil { - return m.SamplingProbability - } - return 0 -} - -// Sampler that tries to sample with a rate per time window. -type RateLimitingSampler struct { - // Rate per second. - Qps int64 `protobuf:"varint,1,opt,name=qps,proto3" json:"qps,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *RateLimitingSampler) Reset() { *m = RateLimitingSampler{} } -func (m *RateLimitingSampler) String() string { return proto.CompactTextString(m) } -func (*RateLimitingSampler) ProtoMessage() {} -func (*RateLimitingSampler) Descriptor() ([]byte, []int) { - return fileDescriptor_5936aa8fa6443e6f, []int{3} -} - -func (m *RateLimitingSampler) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_RateLimitingSampler.Unmarshal(m, b) -} -func (m *RateLimitingSampler) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_RateLimitingSampler.Marshal(b, m, deterministic) -} -func (m *RateLimitingSampler) XXX_Merge(src proto.Message) { - xxx_messageInfo_RateLimitingSampler.Merge(m, src) -} -func (m *RateLimitingSampler) XXX_Size() int { - return xxx_messageInfo_RateLimitingSampler.Size(m) -} -func (m *RateLimitingSampler) XXX_DiscardUnknown() { - xxx_messageInfo_RateLimitingSampler.DiscardUnknown(m) -} - -var xxx_messageInfo_RateLimitingSampler proto.InternalMessageInfo - -func (m *RateLimitingSampler) GetQps() int64 { - if m != nil { - return m.Qps - } - return 0 -} - -func init() { - proto.RegisterEnum("opentelemetry.proto.trace.v1.ConstantSampler_ConstantDecision", ConstantSampler_ConstantDecision_name, ConstantSampler_ConstantDecision_value) - proto.RegisterType((*TraceConfig)(nil), "opentelemetry.proto.trace.v1.TraceConfig") - proto.RegisterType((*ConstantSampler)(nil), "opentelemetry.proto.trace.v1.ConstantSampler") - proto.RegisterType((*ProbabilitySampler)(nil), "opentelemetry.proto.trace.v1.ProbabilitySampler") - proto.RegisterType((*RateLimitingSampler)(nil), "opentelemetry.proto.trace.v1.RateLimitingSampler") -} - -func init() { - proto.RegisterFile("opentelemetry/proto/trace/v1/trace_config.proto", fileDescriptor_5936aa8fa6443e6f) -} - -var fileDescriptor_5936aa8fa6443e6f = []byte{ - // 509 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x94, 0x4d, 0x6f, 0x9b, 0x4c, - 0x14, 0x85, 0x43, 0xfc, 0xe6, 0xeb, 0x46, 0x49, 0x78, 0x07, 0xa5, 0x42, 0x55, 0xa4, 0xa6, 0x6c, - 0xea, 0x8d, 0x21, 0x4e, 0x17, 0x95, 0xba, 0xa8, 0x64, 0x27, 0x71, 0xba, 0xb0, 0x1c, 0x44, 0x2c, - 0x55, 0xf5, 0x06, 0xc1, 0x64, 0x4c, 0x47, 0x85, 0x19, 0x3a, 0x8c, 0xad, 0x64, 0xd3, 0x5d, 0x7f, - 0x51, 0xff, 0x60, 0xc5, 0x98, 0xf2, 0x11, 0x3b, 0x48, 0xdd, 0x71, 0xef, 0xe1, 0x3c, 0x67, 0xc6, - 0xbe, 0x5c, 0x70, 0x78, 0x4a, 0x98, 0x24, 0x31, 0x49, 0x88, 0x14, 0x4f, 0x4e, 0x2a, 0xb8, 0xe4, - 0x8e, 0x14, 0x01, 0x26, 0xce, 0xb2, 0xbf, 0x7a, 0xf0, 0x31, 0x67, 0x73, 0x1a, 0xd9, 0x4a, 0x43, - 0x67, 0x0d, 0xc3, 0xaa, 0x69, 0xab, 0xf7, 0xec, 0x65, 0xdf, 0xfa, 0xb5, 0x03, 0x87, 0xd3, 0xbc, - 0xb8, 0x52, 0x1e, 0x34, 0x03, 0x1d, 0x73, 0x96, 0xc9, 0x80, 0x49, 0x3f, 0x0b, 0x92, 0x34, 0x26, - 0xc2, 0xd4, 0xce, 0xb5, 0xee, 0xe1, 0x65, 0xcf, 0x6e, 0x03, 0xd9, 0x57, 0x85, 0xeb, 0x7e, 0x65, - 0xfa, 0xbc, 0xe5, 0x9d, 0xe0, 0x66, 0x0b, 0x61, 0x30, 0x52, 0xc1, 0xc3, 0x20, 0xa4, 0x31, 0x95, - 0x4f, 0x25, 0x7e, 0x5b, 0xe1, 0x2f, 0xda, 0xf1, 0x6e, 0x65, 0xac, 0x12, 0x50, 0xba, 0xd6, 0x45, - 0x11, 0x9c, 0x8a, 0x40, 0x12, 0x3f, 0xa6, 0x09, 0x95, 0x94, 0x45, 0x65, 0x4c, 0x47, 0xc5, 0xf4, - 0xdb, 0x63, 0xbc, 0x40, 0x92, 0x71, 0xe1, 0xac, 0x72, 0x0c, 0xb1, 0xde, 0x46, 0x1f, 0xc0, 0x4c, - 0x82, 0x47, 0x9f, 0x2d, 0x92, 0x90, 0x08, 0x9f, 0xcf, 0xfd, 0x40, 0x4a, 0x41, 0xc3, 0x85, 0x24, - 0x99, 0xf9, 0xdf, 0xb9, 0xd6, 0xed, 0x78, 0xa7, 0x49, 0xf0, 0x38, 0x51, 0xf2, 0xdd, 0x7c, 0x50, - 0x8a, 0xe8, 0x23, 0xbc, 0x6e, 0x1a, 0x25, 0x4d, 0xc8, 0x83, 0x4f, 0x96, 0x84, 0xc9, 0xcc, 0xdc, - 0x51, 0xd6, 0x57, 0x35, 0xeb, 0x34, 0x97, 0x6f, 0x94, 0x8a, 0xa6, 0xd0, 0x7d, 0x29, 0xd4, 0x4f, - 0x89, 0xa8, 0xa3, 0xcc, 0x5d, 0x45, 0xb2, 0x36, 0x1e, 0xc2, 0x25, 0xa2, 0xc2, 0xa2, 0x1e, 0x18, - 0x4d, 0x6a, 0x4c, 0xd9, 0xf7, 0xcc, 0xdc, 0x53, 0x00, 0xbd, 0x06, 0x18, 0xe7, 0x7d, 0x74, 0x0b, - 0x6f, 0x5b, 0x0f, 0x91, 0xbb, 0xcd, 0x7d, 0x65, 0x3e, 0x7b, 0x29, 0x3d, 0x27, 0x0d, 0x0f, 0x60, - 0xaf, 0xf8, 0x77, 0xac, 0xdf, 0x1a, 0x9c, 0x3c, 0x1b, 0x21, 0x34, 0x83, 0xfd, 0x07, 0x82, 0x69, - 0x46, 0x39, 0x53, 0x33, 0x78, 0x7c, 0xf9, 0xe9, 0x9f, 0x66, 0xb0, 0xac, 0xaf, 0x0b, 0x8a, 0x57, - 0xf2, 0xac, 0x6b, 0xd0, 0x9f, 0xab, 0xe8, 0x18, 0x60, 0x30, 0xfe, 0x32, 0xf8, 0x7a, 0xef, 0xdf, - 0x8d, 0x46, 0xfa, 0x16, 0x3a, 0x82, 0x83, 0xbf, 0xf5, 0x44, 0xd7, 0xd0, 0xff, 0x70, 0x54, 0x94, - 0xee, 0xc0, 0xbb, 0x99, 0x4c, 0xf5, 0x6d, 0x6b, 0x04, 0x68, 0x7d, 0x30, 0xd1, 0x05, 0x18, 0xea, - 0x5a, 0x94, 0x45, 0x35, 0x55, 0x5d, 0x41, 0xf3, 0x36, 0x49, 0xd6, 0x3b, 0x30, 0x36, 0x4c, 0x1e, - 0xd2, 0xa1, 0xf3, 0x23, 0xcd, 0x94, 0xb1, 0xe3, 0xe5, 0x8f, 0xc3, 0x9f, 0xf0, 0x86, 0xf2, 0xd6, - 0x1f, 0x61, 0xa8, 0xd7, 0x3e, 0x67, 0x37, 0x97, 0x5c, 0x6d, 0x76, 0x1b, 0x51, 0xf9, 0x6d, 0x11, - 0xda, 0x98, 0x27, 0x6a, 0x7f, 0xf4, 0xaa, 0x05, 0xd2, 0x60, 0xf5, 0x56, 0xeb, 0x24, 0x22, 0xcc, - 0x89, 0xb8, 0x83, 0x79, 0x1c, 0x13, 0x2c, 0xb9, 0x28, 0xf7, 0x4b, 0xb8, 0xab, 0x5e, 0x78, 0xff, - 0x27, 0x00, 0x00, 0xff, 0xff, 0xe4, 0x80, 0x54, 0x8b, 0x86, 0x04, 0x00, 0x00, -} diff --git a/packages/opentelemetry-exporter-collector/src/platform/node/protos/gen/go/collector/trace/v1/trace_service.pb.go b/packages/opentelemetry-exporter-collector/src/platform/node/protos/gen/go/collector/trace/v1/trace_service.pb.go deleted file mode 100644 index 705c8c1575..0000000000 --- a/packages/opentelemetry-exporter-collector/src/platform/node/protos/gen/go/collector/trace/v1/trace_service.pb.go +++ /dev/null @@ -1,215 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// source: opentelemetry/proto/collector/trace/v1/trace_service.proto - -package v1 - -import ( - context "context" - fmt "fmt" - proto "github.com/golang/protobuf/proto" - v1 "github.com/open-telemetry/opentelemetry-proto/gen/go/trace/v1" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" - math "math" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package - -type ExportTraceServiceRequest struct { - // An array of ResourceSpans. - // For data coming from a single resource this array will typically contain one - // element. Intermediary nodes (such as OpenTelemetry Collector) that receive - // data from multiple origins typically batch the data before forwarding further and - // in that case this array will contain multiple elements. - ResourceSpans []*v1.ResourceSpans `protobuf:"bytes,1,rep,name=resource_spans,json=resourceSpans,proto3" json:"resource_spans,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *ExportTraceServiceRequest) Reset() { *m = ExportTraceServiceRequest{} } -func (m *ExportTraceServiceRequest) String() string { return proto.CompactTextString(m) } -func (*ExportTraceServiceRequest) ProtoMessage() {} -func (*ExportTraceServiceRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_192a962890318cf4, []int{0} -} - -func (m *ExportTraceServiceRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ExportTraceServiceRequest.Unmarshal(m, b) -} -func (m *ExportTraceServiceRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ExportTraceServiceRequest.Marshal(b, m, deterministic) -} -func (m *ExportTraceServiceRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_ExportTraceServiceRequest.Merge(m, src) -} -func (m *ExportTraceServiceRequest) XXX_Size() int { - return xxx_messageInfo_ExportTraceServiceRequest.Size(m) -} -func (m *ExportTraceServiceRequest) XXX_DiscardUnknown() { - xxx_messageInfo_ExportTraceServiceRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_ExportTraceServiceRequest proto.InternalMessageInfo - -func (m *ExportTraceServiceRequest) GetResourceSpans() []*v1.ResourceSpans { - if m != nil { - return m.ResourceSpans - } - return nil -} - -type ExportTraceServiceResponse struct { - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *ExportTraceServiceResponse) Reset() { *m = ExportTraceServiceResponse{} } -func (m *ExportTraceServiceResponse) String() string { return proto.CompactTextString(m) } -func (*ExportTraceServiceResponse) ProtoMessage() {} -func (*ExportTraceServiceResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_192a962890318cf4, []int{1} -} - -func (m *ExportTraceServiceResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ExportTraceServiceResponse.Unmarshal(m, b) -} -func (m *ExportTraceServiceResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ExportTraceServiceResponse.Marshal(b, m, deterministic) -} -func (m *ExportTraceServiceResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_ExportTraceServiceResponse.Merge(m, src) -} -func (m *ExportTraceServiceResponse) XXX_Size() int { - return xxx_messageInfo_ExportTraceServiceResponse.Size(m) -} -func (m *ExportTraceServiceResponse) XXX_DiscardUnknown() { - xxx_messageInfo_ExportTraceServiceResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_ExportTraceServiceResponse proto.InternalMessageInfo - -func init() { - proto.RegisterType((*ExportTraceServiceRequest)(nil), "opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest") - proto.RegisterType((*ExportTraceServiceResponse)(nil), "opentelemetry.proto.collector.trace.v1.ExportTraceServiceResponse") -} - -func init() { - proto.RegisterFile("opentelemetry/proto/collector/trace/v1/trace_service.proto", fileDescriptor_192a962890318cf4) -} - -var fileDescriptor_192a962890318cf4 = []byte{ - // 265 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xb2, 0xca, 0x2f, 0x48, 0xcd, - 0x2b, 0x49, 0xcd, 0x49, 0xcd, 0x4d, 0x2d, 0x29, 0xaa, 0xd4, 0x2f, 0x28, 0xca, 0x2f, 0xc9, 0xd7, - 0x4f, 0xce, 0xcf, 0xc9, 0x49, 0x4d, 0x2e, 0xc9, 0x2f, 0xd2, 0x2f, 0x29, 0x4a, 0x4c, 0x4e, 0xd5, - 0x2f, 0x33, 0x84, 0x30, 0xe2, 0x8b, 0x53, 0x8b, 0xca, 0x32, 0x93, 0x53, 0xf5, 0xc0, 0xca, 0x84, - 0xd4, 0x50, 0xf4, 0x42, 0x04, 0xf5, 0xe0, 0x7a, 0xf5, 0xc0, 0x5a, 0xf4, 0xca, 0x0c, 0xa5, 0x34, - 0xb0, 0xd9, 0x81, 0x6a, 0x32, 0x44, 0xb3, 0x52, 0x3e, 0x97, 0xa4, 0x6b, 0x45, 0x41, 0x7e, 0x51, - 0x49, 0x08, 0x48, 0x30, 0x18, 0x62, 0x5b, 0x50, 0x6a, 0x61, 0x69, 0x6a, 0x71, 0x89, 0x50, 0x10, - 0x17, 0x5f, 0x51, 0x6a, 0x71, 0x7e, 0x69, 0x11, 0xc8, 0x21, 0x05, 0x89, 0x79, 0xc5, 0x12, 0x8c, - 0x0a, 0xcc, 0x1a, 0xdc, 0x46, 0xda, 0x7a, 0xd8, 0xdc, 0x01, 0xb3, 0x5d, 0x2f, 0x08, 0xaa, 0x27, - 0x18, 0xa4, 0x25, 0x88, 0xb7, 0x08, 0x99, 0xab, 0x24, 0xc3, 0x25, 0x85, 0xcd, 0xc2, 0xe2, 0x82, - 0xfc, 0xbc, 0xe2, 0x54, 0xa3, 0x45, 0x8c, 0x5c, 0x3c, 0xc8, 0x12, 0x42, 0x13, 0x19, 0xb9, 0xd8, - 0x20, 0xea, 0x85, 0x1c, 0xf5, 0x88, 0xf3, 0xbd, 0x1e, 0x4e, 0x0f, 0x49, 0x39, 0x51, 0x62, 0x04, - 0xc4, 0x89, 0x4a, 0x0c, 0x4e, 0x9d, 0x8c, 0x5c, 0x9a, 0x99, 0xf9, 0x44, 0x1a, 0xe5, 0x24, 0x88, - 0x6c, 0x4a, 0x00, 0x48, 0x55, 0x00, 0x63, 0x94, 0x7b, 0x7a, 0x66, 0x49, 0x46, 0x69, 0x92, 0x5e, - 0x72, 0x7e, 0xae, 0x3e, 0xc8, 0x1c, 0x5d, 0x44, 0x64, 0xa1, 0x18, 0xab, 0x0b, 0x89, 0xba, 0xf4, - 0xd4, 0x3c, 0xfd, 0x74, 0x6c, 0xa9, 0x24, 0x89, 0x0d, 0xac, 0xc0, 0x18, 0x10, 0x00, 0x00, 0xff, - 0xff, 0xc1, 0x6e, 0x1a, 0x15, 0x56, 0x02, 0x00, 0x00, -} - -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConn - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion4 - -// TraceServiceClient is the client API for TraceService service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -type TraceServiceClient interface { - // For performance reasons, it is recommended to keep this RPC - // alive for the entire life of the application. - Export(ctx context.Context, in *ExportTraceServiceRequest, opts ...grpc.CallOption) (*ExportTraceServiceResponse, error) -} - -type traceServiceClient struct { - cc *grpc.ClientConn -} - -func NewTraceServiceClient(cc *grpc.ClientConn) TraceServiceClient { - return &traceServiceClient{cc} -} - -func (c *traceServiceClient) Export(ctx context.Context, in *ExportTraceServiceRequest, opts ...grpc.CallOption) (*ExportTraceServiceResponse, error) { - out := new(ExportTraceServiceResponse) - err := c.cc.Invoke(ctx, "/opentelemetry.proto.collector.trace.v1.TraceService/Export", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// TraceServiceServer is the server API for TraceService service. -type TraceServiceServer interface { - // For performance reasons, it is recommended to keep this RPC - // alive for the entire life of the application. - Export(context.Context, *ExportTraceServiceRequest) (*ExportTraceServiceResponse, error) -} - -// UnimplementedTraceServiceServer can be embedded to have forward compatible implementations. -type UnimplementedTraceServiceServer struct { -} - -func (*UnimplementedTraceServiceServer) Export(ctx context.Context, req *ExportTraceServiceRequest) (*ExportTraceServiceResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Export not implemented") -} - -func RegisterTraceServiceServer(s *grpc.Server, srv TraceServiceServer) { - s.RegisterService(&_TraceService_serviceDesc, srv) -} - -func _TraceService_Export_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ExportTraceServiceRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(TraceServiceServer).Export(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/opentelemetry.proto.collector.trace.v1.TraceService/Export", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(TraceServiceServer).Export(ctx, req.(*ExportTraceServiceRequest)) - } - return interceptor(ctx, in, info, handler) -} - -var _TraceService_serviceDesc = grpc.ServiceDesc{ - ServiceName: "opentelemetry.proto.collector.trace.v1.TraceService", - HandlerType: (*TraceServiceServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "Export", - Handler: _TraceService_Export_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "opentelemetry/proto/collector/trace/v1/trace_service.proto", -} diff --git a/packages/opentelemetry-exporter-collector/src/platform/node/protos/gen/go/collector/trace/v1/trace_service.pb.gw.go b/packages/opentelemetry-exporter-collector/src/platform/node/protos/gen/go/collector/trace/v1/trace_service.pb.gw.go deleted file mode 100644 index df329e393e..0000000000 --- a/packages/opentelemetry-exporter-collector/src/platform/node/protos/gen/go/collector/trace/v1/trace_service.pb.gw.go +++ /dev/null @@ -1,115 +0,0 @@ -// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. -// source: opentelemetry/proto/collector/trace/v1/trace_service.proto - -/* -Package v1 is a reverse proxy. - -It translates gRPC into RESTful JSON APIs. -*/ -package v1 - -import ( - "context" - "io" - "net/http" - - "github.com/golang/protobuf/proto" - "github.com/grpc-ecosystem/grpc-gateway/runtime" - "github.com/grpc-ecosystem/grpc-gateway/utilities" - "google.golang.org/grpc" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/grpclog" - "google.golang.org/grpc/status" -) - -var _ codes.Code -var _ io.Reader -var _ status.Status -var _ = runtime.String -var _ = utilities.NewDoubleArray - -func request_TraceService_Export_0(ctx context.Context, marshaler runtime.Marshaler, client TraceServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq ExportTraceServiceRequest - var metadata runtime.ServerMetadata - - newReader, berr := utilities.IOReaderFactory(req.Body) - if berr != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) - } - if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := client.Export(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -// RegisterTraceServiceHandlerFromEndpoint is same as RegisterTraceServiceHandler but -// automatically dials to "endpoint" and closes the connection when "ctx" gets done. -func RegisterTraceServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { - conn, err := grpc.Dial(endpoint, opts...) - if err != nil { - return err - } - defer func() { - if err != nil { - if cerr := conn.Close(); cerr != nil { - grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) - } - return - } - go func() { - <-ctx.Done() - if cerr := conn.Close(); cerr != nil { - grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) - } - }() - }() - - return RegisterTraceServiceHandler(ctx, mux, conn) -} - -// RegisterTraceServiceHandler registers the http handlers for service TraceService to "mux". -// The handlers forward requests to the grpc endpoint over "conn". -func RegisterTraceServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { - return RegisterTraceServiceHandlerClient(ctx, mux, NewTraceServiceClient(conn)) -} - -// RegisterTraceServiceHandlerClient registers the http handlers for service TraceService -// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "TraceServiceClient". -// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "TraceServiceClient" -// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in -// "TraceServiceClient" to call the correct interceptors. -func RegisterTraceServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client TraceServiceClient) error { - - mux.Handle("POST", pattern_TraceService_Export_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_TraceService_Export_0(rctx, inboundMarshaler, client, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_TraceService_Export_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - return nil -} - -var ( - pattern_TraceService_Export_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "trace"}, "", runtime.AssumeColonVerbOpt(true))) -) - -var ( - forward_TraceService_Export_0 = runtime.ForwardResponseMessage -) diff --git a/packages/opentelemetry-exporter-collector/src/platform/node/protos/gen/go/common/v1/common.pb.go b/packages/opentelemetry-exporter-collector/src/platform/node/protos/gen/go/common/v1/common.pb.go deleted file mode 100644 index 3930f9134d..0000000000 --- a/packages/opentelemetry-exporter-collector/src/platform/node/protos/gen/go/common/v1/common.pb.go +++ /dev/null @@ -1,273 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// source: opentelemetry/proto/common/v1/common.proto - -package v1 - -import ( - fmt "fmt" - proto "github.com/golang/protobuf/proto" - math "math" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package - -// ValueType is the enumeration of possible types that value can have. -type AttributeKeyValue_ValueType int32 - -const ( - AttributeKeyValue_STRING AttributeKeyValue_ValueType = 0 - AttributeKeyValue_INT AttributeKeyValue_ValueType = 1 - AttributeKeyValue_DOUBLE AttributeKeyValue_ValueType = 2 - AttributeKeyValue_BOOL AttributeKeyValue_ValueType = 3 -) - -var AttributeKeyValue_ValueType_name = map[int32]string{ - 0: "STRING", - 1: "INT", - 2: "DOUBLE", - 3: "BOOL", -} - -var AttributeKeyValue_ValueType_value = map[string]int32{ - "STRING": 0, - "INT": 1, - "DOUBLE": 2, - "BOOL": 3, -} - -func (x AttributeKeyValue_ValueType) String() string { - return proto.EnumName(AttributeKeyValue_ValueType_name, int32(x)) -} - -func (AttributeKeyValue_ValueType) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_62ba46dcb97aa817, []int{0, 0} -} - -// AttributeKeyValue is a key-value pair that is used to store Span attributes, Link -// attributes, etc. -type AttributeKeyValue struct { - // key part of the key-value pair. - Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` - // type of the value. - Type AttributeKeyValue_ValueType `protobuf:"varint,2,opt,name=type,proto3,enum=opentelemetry.proto.common.v1.AttributeKeyValue_ValueType" json:"type,omitempty"` - StringValue string `protobuf:"bytes,3,opt,name=string_value,json=stringValue,proto3" json:"string_value,omitempty"` - IntValue int64 `protobuf:"varint,4,opt,name=int_value,json=intValue,proto3" json:"int_value,omitempty"` - DoubleValue float64 `protobuf:"fixed64,5,opt,name=double_value,json=doubleValue,proto3" json:"double_value,omitempty"` - BoolValue bool `protobuf:"varint,6,opt,name=bool_value,json=boolValue,proto3" json:"bool_value,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *AttributeKeyValue) Reset() { *m = AttributeKeyValue{} } -func (m *AttributeKeyValue) String() string { return proto.CompactTextString(m) } -func (*AttributeKeyValue) ProtoMessage() {} -func (*AttributeKeyValue) Descriptor() ([]byte, []int) { - return fileDescriptor_62ba46dcb97aa817, []int{0} -} - -func (m *AttributeKeyValue) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_AttributeKeyValue.Unmarshal(m, b) -} -func (m *AttributeKeyValue) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_AttributeKeyValue.Marshal(b, m, deterministic) -} -func (m *AttributeKeyValue) XXX_Merge(src proto.Message) { - xxx_messageInfo_AttributeKeyValue.Merge(m, src) -} -func (m *AttributeKeyValue) XXX_Size() int { - return xxx_messageInfo_AttributeKeyValue.Size(m) -} -func (m *AttributeKeyValue) XXX_DiscardUnknown() { - xxx_messageInfo_AttributeKeyValue.DiscardUnknown(m) -} - -var xxx_messageInfo_AttributeKeyValue proto.InternalMessageInfo - -func (m *AttributeKeyValue) GetKey() string { - if m != nil { - return m.Key - } - return "" -} - -func (m *AttributeKeyValue) GetType() AttributeKeyValue_ValueType { - if m != nil { - return m.Type - } - return AttributeKeyValue_STRING -} - -func (m *AttributeKeyValue) GetStringValue() string { - if m != nil { - return m.StringValue - } - return "" -} - -func (m *AttributeKeyValue) GetIntValue() int64 { - if m != nil { - return m.IntValue - } - return 0 -} - -func (m *AttributeKeyValue) GetDoubleValue() float64 { - if m != nil { - return m.DoubleValue - } - return 0 -} - -func (m *AttributeKeyValue) GetBoolValue() bool { - if m != nil { - return m.BoolValue - } - return false -} - -// StringKeyValue is a pair of key/value strings. This is the simpler (and faster) version -// of AttributeKeyValue that only supports string values. -type StringKeyValue struct { - Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` - Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *StringKeyValue) Reset() { *m = StringKeyValue{} } -func (m *StringKeyValue) String() string { return proto.CompactTextString(m) } -func (*StringKeyValue) ProtoMessage() {} -func (*StringKeyValue) Descriptor() ([]byte, []int) { - return fileDescriptor_62ba46dcb97aa817, []int{1} -} - -func (m *StringKeyValue) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_StringKeyValue.Unmarshal(m, b) -} -func (m *StringKeyValue) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_StringKeyValue.Marshal(b, m, deterministic) -} -func (m *StringKeyValue) XXX_Merge(src proto.Message) { - xxx_messageInfo_StringKeyValue.Merge(m, src) -} -func (m *StringKeyValue) XXX_Size() int { - return xxx_messageInfo_StringKeyValue.Size(m) -} -func (m *StringKeyValue) XXX_DiscardUnknown() { - xxx_messageInfo_StringKeyValue.DiscardUnknown(m) -} - -var xxx_messageInfo_StringKeyValue proto.InternalMessageInfo - -func (m *StringKeyValue) GetKey() string { - if m != nil { - return m.Key - } - return "" -} - -func (m *StringKeyValue) GetValue() string { - if m != nil { - return m.Value - } - return "" -} - -// InstrumentationLibrary is a message representing the instrumentation library information -// such as the fully qualified name and version. -type InstrumentationLibrary struct { - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - Version string `protobuf:"bytes,2,opt,name=version,proto3" json:"version,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *InstrumentationLibrary) Reset() { *m = InstrumentationLibrary{} } -func (m *InstrumentationLibrary) String() string { return proto.CompactTextString(m) } -func (*InstrumentationLibrary) ProtoMessage() {} -func (*InstrumentationLibrary) Descriptor() ([]byte, []int) { - return fileDescriptor_62ba46dcb97aa817, []int{2} -} - -func (m *InstrumentationLibrary) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_InstrumentationLibrary.Unmarshal(m, b) -} -func (m *InstrumentationLibrary) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_InstrumentationLibrary.Marshal(b, m, deterministic) -} -func (m *InstrumentationLibrary) XXX_Merge(src proto.Message) { - xxx_messageInfo_InstrumentationLibrary.Merge(m, src) -} -func (m *InstrumentationLibrary) XXX_Size() int { - return xxx_messageInfo_InstrumentationLibrary.Size(m) -} -func (m *InstrumentationLibrary) XXX_DiscardUnknown() { - xxx_messageInfo_InstrumentationLibrary.DiscardUnknown(m) -} - -var xxx_messageInfo_InstrumentationLibrary proto.InternalMessageInfo - -func (m *InstrumentationLibrary) GetName() string { - if m != nil { - return m.Name - } - return "" -} - -func (m *InstrumentationLibrary) GetVersion() string { - if m != nil { - return m.Version - } - return "" -} - -func init() { - proto.RegisterEnum("opentelemetry.proto.common.v1.AttributeKeyValue_ValueType", AttributeKeyValue_ValueType_name, AttributeKeyValue_ValueType_value) - proto.RegisterType((*AttributeKeyValue)(nil), "opentelemetry.proto.common.v1.AttributeKeyValue") - proto.RegisterType((*StringKeyValue)(nil), "opentelemetry.proto.common.v1.StringKeyValue") - proto.RegisterType((*InstrumentationLibrary)(nil), "opentelemetry.proto.common.v1.InstrumentationLibrary") -} - -func init() { - proto.RegisterFile("opentelemetry/proto/common/v1/common.proto", fileDescriptor_62ba46dcb97aa817) -} - -var fileDescriptor_62ba46dcb97aa817 = []byte{ - // 377 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x92, 0xdb, 0x8b, 0x9b, 0x40, - 0x18, 0xc5, 0x3b, 0x6a, 0x2e, 0x7e, 0x09, 0xc1, 0x0e, 0xa5, 0x08, 0x25, 0x60, 0x7c, 0x92, 0x42, - 0x94, 0xb4, 0x50, 0x4a, 0x1f, 0x0a, 0xb5, 0x37, 0x42, 0x43, 0x12, 0x4c, 0xda, 0x87, 0xbe, 0x14, - 0x6d, 0x07, 0x3b, 0xac, 0xce, 0xb8, 0x93, 0x51, 0xf0, 0xaf, 0xda, 0x7f, 0x71, 0x71, 0xc6, 0xbd, - 0x84, 0x85, 0xbc, 0xc8, 0x99, 0xdf, 0x39, 0x9e, 0xf9, 0xd0, 0x0f, 0x5e, 0xf3, 0x8a, 0x30, 0x49, - 0x0a, 0x52, 0x12, 0x29, 0xda, 0xa8, 0x12, 0x5c, 0xf2, 0xe8, 0x2f, 0x2f, 0x4b, 0xce, 0xa2, 0x66, - 0xd5, 0xab, 0x50, 0x61, 0x3c, 0x3f, 0xcb, 0x6a, 0x18, 0xf6, 0x89, 0x66, 0xe5, 0xdf, 0x18, 0xf0, - 0xfc, 0x93, 0x94, 0x82, 0x66, 0xb5, 0x24, 0x3f, 0x48, 0xfb, 0x2b, 0x2d, 0x6a, 0x82, 0x1d, 0x30, - 0xaf, 0x48, 0xeb, 0x22, 0x0f, 0x05, 0x76, 0xd2, 0x49, 0xbc, 0x05, 0x4b, 0xb6, 0x15, 0x71, 0x0d, - 0x0f, 0x05, 0xb3, 0x37, 0x1f, 0xc2, 0x8b, 0xad, 0xe1, 0x93, 0xc6, 0x50, 0x3d, 0x8f, 0x6d, 0x45, - 0x12, 0xd5, 0x83, 0x17, 0x30, 0x3d, 0x49, 0x41, 0x59, 0xfe, 0xa7, 0xe9, 0x1c, 0xd7, 0x54, 0x57, - 0x4d, 0x34, 0xd3, 0x43, 0xbc, 0x02, 0x9b, 0x32, 0xd9, 0xfb, 0x96, 0x87, 0x02, 0x33, 0x19, 0x53, - 0x26, 0xb5, 0xb9, 0x80, 0xe9, 0x3f, 0x5e, 0x67, 0x05, 0xe9, 0xfd, 0x81, 0x87, 0x02, 0x94, 0x4c, - 0x34, 0xd3, 0x91, 0x39, 0x40, 0xc6, 0x79, 0xd1, 0x07, 0x86, 0x1e, 0x0a, 0xc6, 0x89, 0xdd, 0x11, - 0x65, 0xfb, 0xef, 0xc0, 0xbe, 0x1f, 0x0a, 0x03, 0x0c, 0x0f, 0xc7, 0x64, 0xbd, 0xfd, 0xee, 0x3c, - 0xc3, 0x23, 0x30, 0xd7, 0xdb, 0xa3, 0x83, 0x3a, 0xf8, 0x65, 0xf7, 0x33, 0xde, 0x7c, 0x75, 0x0c, - 0x3c, 0x06, 0x2b, 0xde, 0xed, 0x36, 0x8e, 0xe9, 0xbf, 0x87, 0xd9, 0x41, 0x4d, 0x79, 0xe1, 0x6b, - 0xbd, 0x80, 0x81, 0xbe, 0xd5, 0x50, 0x4c, 0x1f, 0xfc, 0x6f, 0xf0, 0x72, 0xcd, 0x4e, 0x52, 0xd4, - 0x25, 0x61, 0x32, 0x95, 0x94, 0xb3, 0x0d, 0xcd, 0x44, 0x2a, 0x5a, 0x8c, 0xc1, 0x62, 0x69, 0x49, - 0xfa, 0x0a, 0xa5, 0xb1, 0x0b, 0xa3, 0x86, 0x88, 0x13, 0xe5, 0xac, 0x6f, 0xb9, 0x3b, 0xc6, 0xd7, - 0xe0, 0x51, 0x7e, 0xf9, 0x0f, 0xc4, 0x93, 0xcf, 0x4a, 0xee, 0x3b, 0xbc, 0x47, 0xbf, 0x3f, 0xe6, - 0x54, 0xfe, 0xaf, 0xb3, 0x2e, 0x10, 0x75, 0x2f, 0x2e, 0x1f, 0xb6, 0xe7, 0xac, 0x67, 0xa9, 0x77, - 0x29, 0x27, 0x2c, 0xca, 0x1f, 0xad, 0x54, 0x36, 0x54, 0xfc, 0xed, 0x6d, 0x00, 0x00, 0x00, 0xff, - 0xff, 0x84, 0x93, 0x08, 0x5f, 0x7a, 0x02, 0x00, 0x00, -} diff --git a/packages/opentelemetry-exporter-collector/src/platform/node/protos/gen/go/metrics/v1/metrics.pb.go b/packages/opentelemetry-exporter-collector/src/platform/node/protos/gen/go/metrics/v1/metrics.pb.go deleted file mode 100644 index 61fe5b7d35..0000000000 --- a/packages/opentelemetry-exporter-collector/src/platform/node/protos/gen/go/metrics/v1/metrics.pb.go +++ /dev/null @@ -1,1045 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// source: opentelemetry/proto/metrics/v1/metrics.proto - -package v1 - -import ( - fmt "fmt" - proto "github.com/golang/protobuf/proto" - v11 "github.com/open-telemetry/opentelemetry-proto/gen/go/common/v1" - v1 "github.com/open-telemetry/opentelemetry-proto/gen/go/resource/v1" - math "math" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package - -// Type of the metric. It describes how the data is reported. -// -// A gauge is an instantaneous measurement of a value. -// -// A counter/cumulative measurement is a value accumulated over a time -// interval. In a time series, cumulative measurements should have the same -// start time, increasing values, until an event resets the cumulative value -// to zero and sets a new start time for the subsequent points. -type MetricDescriptor_Type int32 - -const ( - // Do not use this default value. - MetricDescriptor_UNSPECIFIED MetricDescriptor_Type = 0 - // Integer gauge. The value can go both up and down over time. - // Corresponding values are stored in Int64DataPoint. - MetricDescriptor_GAUGE_INT64 MetricDescriptor_Type = 1 - // Floating point gauge. The value can go both up and down over time. - // Corresponding values are stored in DoubleDataPoint. - MetricDescriptor_GAUGE_DOUBLE MetricDescriptor_Type = 2 - // Histogram gauge measurement. - // Used in scenarios like a snapshot of time that current items in a queue - // have spent there. - // Corresponding values are stored in HistogramDataPoint. The count and sum of the - // histogram can go both up and down over time. Recorded values are always >= 0. - MetricDescriptor_GAUGE_HISTOGRAM MetricDescriptor_Type = 3 - // Integer counter measurement. The value cannot decrease; if value is reset then - // start_time_unix_nano should also be reset. - // Corresponding values are stored in Int64DataPoint. - MetricDescriptor_COUNTER_INT64 MetricDescriptor_Type = 4 - // Floating point counter measurement. The value cannot decrease, if - // resets then the start_time_unix_nano should also be reset. - // Recorded values are always >= 0. - // Corresponding values are stored in DoubleDataPoint. - MetricDescriptor_COUNTER_DOUBLE MetricDescriptor_Type = 5 - // Histogram cumulative measurement. - // Corresponding values are stored in HistogramDataPoint. The count and sum of the - // histogram cannot decrease; if values are reset then start_time_unix_nano - // should also be reset to the new start timestamp. - MetricDescriptor_CUMULATIVE_HISTOGRAM MetricDescriptor_Type = 6 - // Summary value. Some frameworks implemented Histograms as a summary of observations - // (usually things like request durations and response sizes). While it - // also provides a total count of observations and a sum of all observed - // values, it calculates configurable percentiles over a sliding time - // window. - // Corresponding values are stored in SummaryDataPoint. - MetricDescriptor_SUMMARY MetricDescriptor_Type = 7 -) - -var MetricDescriptor_Type_name = map[int32]string{ - 0: "UNSPECIFIED", - 1: "GAUGE_INT64", - 2: "GAUGE_DOUBLE", - 3: "GAUGE_HISTOGRAM", - 4: "COUNTER_INT64", - 5: "COUNTER_DOUBLE", - 6: "CUMULATIVE_HISTOGRAM", - 7: "SUMMARY", -} - -var MetricDescriptor_Type_value = map[string]int32{ - "UNSPECIFIED": 0, - "GAUGE_INT64": 1, - "GAUGE_DOUBLE": 2, - "GAUGE_HISTOGRAM": 3, - "COUNTER_INT64": 4, - "COUNTER_DOUBLE": 5, - "CUMULATIVE_HISTOGRAM": 6, - "SUMMARY": 7, -} - -func (x MetricDescriptor_Type) String() string { - return proto.EnumName(MetricDescriptor_Type_name, int32(x)) -} - -func (MetricDescriptor_Type) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_3c3112f9fa006917, []int{3, 0} -} - -// A collection of InstrumentationLibraryMetrics from a Resource. -type ResourceMetrics struct { - // The resource for the metrics in this message. - // If this field is not set then no resource info is known. - Resource *v1.Resource `protobuf:"bytes,1,opt,name=resource,proto3" json:"resource,omitempty"` - // A list of metrics that originate from a resource. - InstrumentationLibraryMetrics []*InstrumentationLibraryMetrics `protobuf:"bytes,2,rep,name=instrumentation_library_metrics,json=instrumentationLibraryMetrics,proto3" json:"instrumentation_library_metrics,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *ResourceMetrics) Reset() { *m = ResourceMetrics{} } -func (m *ResourceMetrics) String() string { return proto.CompactTextString(m) } -func (*ResourceMetrics) ProtoMessage() {} -func (*ResourceMetrics) Descriptor() ([]byte, []int) { - return fileDescriptor_3c3112f9fa006917, []int{0} -} - -func (m *ResourceMetrics) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ResourceMetrics.Unmarshal(m, b) -} -func (m *ResourceMetrics) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ResourceMetrics.Marshal(b, m, deterministic) -} -func (m *ResourceMetrics) XXX_Merge(src proto.Message) { - xxx_messageInfo_ResourceMetrics.Merge(m, src) -} -func (m *ResourceMetrics) XXX_Size() int { - return xxx_messageInfo_ResourceMetrics.Size(m) -} -func (m *ResourceMetrics) XXX_DiscardUnknown() { - xxx_messageInfo_ResourceMetrics.DiscardUnknown(m) -} - -var xxx_messageInfo_ResourceMetrics proto.InternalMessageInfo - -func (m *ResourceMetrics) GetResource() *v1.Resource { - if m != nil { - return m.Resource - } - return nil -} - -func (m *ResourceMetrics) GetInstrumentationLibraryMetrics() []*InstrumentationLibraryMetrics { - if m != nil { - return m.InstrumentationLibraryMetrics - } - return nil -} - -// A collection of Metrics produced by an InstrumentationLibrary. -type InstrumentationLibraryMetrics struct { - // The instrumentation library information for the metrics in this message. - // If this field is not set then no library info is known. - InstrumentationLibrary *v11.InstrumentationLibrary `protobuf:"bytes,1,opt,name=instrumentation_library,json=instrumentationLibrary,proto3" json:"instrumentation_library,omitempty"` - // A list of metrics that originate from an instrumentation library. - Metrics []*Metric `protobuf:"bytes,2,rep,name=metrics,proto3" json:"metrics,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *InstrumentationLibraryMetrics) Reset() { *m = InstrumentationLibraryMetrics{} } -func (m *InstrumentationLibraryMetrics) String() string { return proto.CompactTextString(m) } -func (*InstrumentationLibraryMetrics) ProtoMessage() {} -func (*InstrumentationLibraryMetrics) Descriptor() ([]byte, []int) { - return fileDescriptor_3c3112f9fa006917, []int{1} -} - -func (m *InstrumentationLibraryMetrics) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_InstrumentationLibraryMetrics.Unmarshal(m, b) -} -func (m *InstrumentationLibraryMetrics) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_InstrumentationLibraryMetrics.Marshal(b, m, deterministic) -} -func (m *InstrumentationLibraryMetrics) XXX_Merge(src proto.Message) { - xxx_messageInfo_InstrumentationLibraryMetrics.Merge(m, src) -} -func (m *InstrumentationLibraryMetrics) XXX_Size() int { - return xxx_messageInfo_InstrumentationLibraryMetrics.Size(m) -} -func (m *InstrumentationLibraryMetrics) XXX_DiscardUnknown() { - xxx_messageInfo_InstrumentationLibraryMetrics.DiscardUnknown(m) -} - -var xxx_messageInfo_InstrumentationLibraryMetrics proto.InternalMessageInfo - -func (m *InstrumentationLibraryMetrics) GetInstrumentationLibrary() *v11.InstrumentationLibrary { - if m != nil { - return m.InstrumentationLibrary - } - return nil -} - -func (m *InstrumentationLibraryMetrics) GetMetrics() []*Metric { - if m != nil { - return m.Metrics - } - return nil -} - -// Defines a Metric which has one or more timeseries. -// -// The data model and relation between entities is shown in the diagram below. -// -// - Metric is composed of a MetricDescriptor and a list of data points. -// - MetricDescriptor contains a list of label keys (shown horizontally). -// - Data is a list of DataPoints (shown vertically). -// - DataPoint contains a list of label values and a value. -// -// Metric -// +----------+ +------------------------+ -// |descriptor|-------->| MetricDescriptor | -// | | |+-----+-----+ +-----+ | -// | | ||label|label|...|label| | -// | data|--+ ||key1 |key2 | |keyN | | -// +----------+ | |+-----+-----+ +-----+ | -// | +------------------------+ -// | -// | +---------------------------+ -// | |DataPoint 1 | -// v |+------+------+ +------+ | -// +-----+ ||label |label |...|label | | -// | 1 |-->||value1|value2|...|valueN| | -// +-----+ |+------+------+ +------+ | -// | . | |+-----+ | -// | . | ||value| | -// | . | |+-----+ | -// | . | +---------------------------+ -// | . | . -// | . | . -// | . | . -// | . | +---------------------------+ -// | . | |DataPoint M | -// +-----+ |+------+------+ +------+ | -// | M |-->||label |label |...|label | | -// +-----+ ||value1|value2|...|valueN| | -// |+------+------+ +------+ | -// |+-----+ | -// ||value| | -// |+-----+ | -// +---------------------------+ -// -//----------------------------------------------------------------------- -// DataPoint is a value of specific type corresponding to a given moment in -// time. Each DataPoint is timestamped. -// -// DataPoint is strongly typed: each DataPoint type has a specific Protobuf message -// depending on the value type of the metric and thus there are currently 4 DataPoint -// messages, which correspond to the types of metric values. -type Metric struct { - // metric_descriptor describes the Metric. - MetricDescriptor *MetricDescriptor `protobuf:"bytes,1,opt,name=metric_descriptor,json=metricDescriptor,proto3" json:"metric_descriptor,omitempty"` - // Data is a list of one or more DataPoints for a single metric. Only one of the - // following fields is used for the data, depending on the type of the metric defined - // by MetricDescriptor.type field. - Int64DataPoints []*Int64DataPoint `protobuf:"bytes,2,rep,name=int64_data_points,json=int64DataPoints,proto3" json:"int64_data_points,omitempty"` - DoubleDataPoints []*DoubleDataPoint `protobuf:"bytes,3,rep,name=double_data_points,json=doubleDataPoints,proto3" json:"double_data_points,omitempty"` - HistogramDataPoints []*HistogramDataPoint `protobuf:"bytes,4,rep,name=histogram_data_points,json=histogramDataPoints,proto3" json:"histogram_data_points,omitempty"` - SummaryDataPoints []*SummaryDataPoint `protobuf:"bytes,5,rep,name=summary_data_points,json=summaryDataPoints,proto3" json:"summary_data_points,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Metric) Reset() { *m = Metric{} } -func (m *Metric) String() string { return proto.CompactTextString(m) } -func (*Metric) ProtoMessage() {} -func (*Metric) Descriptor() ([]byte, []int) { - return fileDescriptor_3c3112f9fa006917, []int{2} -} - -func (m *Metric) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Metric.Unmarshal(m, b) -} -func (m *Metric) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Metric.Marshal(b, m, deterministic) -} -func (m *Metric) XXX_Merge(src proto.Message) { - xxx_messageInfo_Metric.Merge(m, src) -} -func (m *Metric) XXX_Size() int { - return xxx_messageInfo_Metric.Size(m) -} -func (m *Metric) XXX_DiscardUnknown() { - xxx_messageInfo_Metric.DiscardUnknown(m) -} - -var xxx_messageInfo_Metric proto.InternalMessageInfo - -func (m *Metric) GetMetricDescriptor() *MetricDescriptor { - if m != nil { - return m.MetricDescriptor - } - return nil -} - -func (m *Metric) GetInt64DataPoints() []*Int64DataPoint { - if m != nil { - return m.Int64DataPoints - } - return nil -} - -func (m *Metric) GetDoubleDataPoints() []*DoubleDataPoint { - if m != nil { - return m.DoubleDataPoints - } - return nil -} - -func (m *Metric) GetHistogramDataPoints() []*HistogramDataPoint { - if m != nil { - return m.HistogramDataPoints - } - return nil -} - -func (m *Metric) GetSummaryDataPoints() []*SummaryDataPoint { - if m != nil { - return m.SummaryDataPoints - } - return nil -} - -// Defines a metric type and its schema. -type MetricDescriptor struct { - // name of the metric, including its DNS name prefix. It must be unique. - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - // description of the metric, which can be used in documentation. - Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` - // unit in which the metric value is reported. Follows the format - // described by http://unitsofmeasure.org/ucum.html. - Unit string `protobuf:"bytes,3,opt,name=unit,proto3" json:"unit,omitempty"` - Type MetricDescriptor_Type `protobuf:"varint,4,opt,name=type,proto3,enum=opentelemetry.proto.metrics.v1.MetricDescriptor_Type" json:"type,omitempty"` - // The set of labels associated with the metric descriptor. Labels in this list apply to - // all data points. - Labels []*v11.StringKeyValue `protobuf:"bytes,5,rep,name=labels,proto3" json:"labels,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *MetricDescriptor) Reset() { *m = MetricDescriptor{} } -func (m *MetricDescriptor) String() string { return proto.CompactTextString(m) } -func (*MetricDescriptor) ProtoMessage() {} -func (*MetricDescriptor) Descriptor() ([]byte, []int) { - return fileDescriptor_3c3112f9fa006917, []int{3} -} - -func (m *MetricDescriptor) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_MetricDescriptor.Unmarshal(m, b) -} -func (m *MetricDescriptor) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_MetricDescriptor.Marshal(b, m, deterministic) -} -func (m *MetricDescriptor) XXX_Merge(src proto.Message) { - xxx_messageInfo_MetricDescriptor.Merge(m, src) -} -func (m *MetricDescriptor) XXX_Size() int { - return xxx_messageInfo_MetricDescriptor.Size(m) -} -func (m *MetricDescriptor) XXX_DiscardUnknown() { - xxx_messageInfo_MetricDescriptor.DiscardUnknown(m) -} - -var xxx_messageInfo_MetricDescriptor proto.InternalMessageInfo - -func (m *MetricDescriptor) GetName() string { - if m != nil { - return m.Name - } - return "" -} - -func (m *MetricDescriptor) GetDescription() string { - if m != nil { - return m.Description - } - return "" -} - -func (m *MetricDescriptor) GetUnit() string { - if m != nil { - return m.Unit - } - return "" -} - -func (m *MetricDescriptor) GetType() MetricDescriptor_Type { - if m != nil { - return m.Type - } - return MetricDescriptor_UNSPECIFIED -} - -func (m *MetricDescriptor) GetLabels() []*v11.StringKeyValue { - if m != nil { - return m.Labels - } - return nil -} - -// Int64DataPoint is a single data point in a timeseries that describes the time-varying -// values of a int64 metric. -type Int64DataPoint struct { - // The set of labels that uniquely identify this timeseries. - Labels []*v11.StringKeyValue `protobuf:"bytes,1,rep,name=labels,proto3" json:"labels,omitempty"` - // start_time_unix_nano is the time when the cumulative value was reset to zero. - // This is used for Counter type only. For Gauge the value is not specified and - // defaults to 0. - // - // The cumulative value is over the time interval (start_time_unix_nano, time_unix_nano]. - // Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January 1970. - // - // Value of 0 indicates that the timestamp is unspecified. In that case the timestamp - // may be decided by the backend. - StartTimeUnixNano uint64 `protobuf:"fixed64,2,opt,name=start_time_unix_nano,json=startTimeUnixNano,proto3" json:"start_time_unix_nano,omitempty"` - // time_unix_nano is the moment when this value was recorded. - // Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January 1970. - TimeUnixNano uint64 `protobuf:"fixed64,3,opt,name=time_unix_nano,json=timeUnixNano,proto3" json:"time_unix_nano,omitempty"` - // value itself. - Value int64 `protobuf:"varint,4,opt,name=value,proto3" json:"value,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Int64DataPoint) Reset() { *m = Int64DataPoint{} } -func (m *Int64DataPoint) String() string { return proto.CompactTextString(m) } -func (*Int64DataPoint) ProtoMessage() {} -func (*Int64DataPoint) Descriptor() ([]byte, []int) { - return fileDescriptor_3c3112f9fa006917, []int{4} -} - -func (m *Int64DataPoint) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Int64DataPoint.Unmarshal(m, b) -} -func (m *Int64DataPoint) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Int64DataPoint.Marshal(b, m, deterministic) -} -func (m *Int64DataPoint) XXX_Merge(src proto.Message) { - xxx_messageInfo_Int64DataPoint.Merge(m, src) -} -func (m *Int64DataPoint) XXX_Size() int { - return xxx_messageInfo_Int64DataPoint.Size(m) -} -func (m *Int64DataPoint) XXX_DiscardUnknown() { - xxx_messageInfo_Int64DataPoint.DiscardUnknown(m) -} - -var xxx_messageInfo_Int64DataPoint proto.InternalMessageInfo - -func (m *Int64DataPoint) GetLabels() []*v11.StringKeyValue { - if m != nil { - return m.Labels - } - return nil -} - -func (m *Int64DataPoint) GetStartTimeUnixNano() uint64 { - if m != nil { - return m.StartTimeUnixNano - } - return 0 -} - -func (m *Int64DataPoint) GetTimeUnixNano() uint64 { - if m != nil { - return m.TimeUnixNano - } - return 0 -} - -func (m *Int64DataPoint) GetValue() int64 { - if m != nil { - return m.Value - } - return 0 -} - -// DoubleDataPoint is a single data point in a timeseries that describes the time-varying -// value of a double metric. -type DoubleDataPoint struct { - // The set of labels that uniquely identify this timeseries. - Labels []*v11.StringKeyValue `protobuf:"bytes,1,rep,name=labels,proto3" json:"labels,omitempty"` - // start_time_unix_nano is the time when the cumulative value was reset to zero. - // This is used for Counter type only. For Gauge the value is not specified and - // defaults to 0. - // - // The cumulative value is over the time interval (start_time_unix_nano, time_unix_nano]. - // Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January 1970. - // - // Value of 0 indicates that the timestamp is unspecified. In that case the timestamp - // may be decided by the backend. - StartTimeUnixNano uint64 `protobuf:"fixed64,2,opt,name=start_time_unix_nano,json=startTimeUnixNano,proto3" json:"start_time_unix_nano,omitempty"` - // time_unix_nano is the moment when this value was recorded. - // Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January 1970. - TimeUnixNano uint64 `protobuf:"fixed64,3,opt,name=time_unix_nano,json=timeUnixNano,proto3" json:"time_unix_nano,omitempty"` - // value itself. - Value float64 `protobuf:"fixed64,4,opt,name=value,proto3" json:"value,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *DoubleDataPoint) Reset() { *m = DoubleDataPoint{} } -func (m *DoubleDataPoint) String() string { return proto.CompactTextString(m) } -func (*DoubleDataPoint) ProtoMessage() {} -func (*DoubleDataPoint) Descriptor() ([]byte, []int) { - return fileDescriptor_3c3112f9fa006917, []int{5} -} - -func (m *DoubleDataPoint) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_DoubleDataPoint.Unmarshal(m, b) -} -func (m *DoubleDataPoint) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_DoubleDataPoint.Marshal(b, m, deterministic) -} -func (m *DoubleDataPoint) XXX_Merge(src proto.Message) { - xxx_messageInfo_DoubleDataPoint.Merge(m, src) -} -func (m *DoubleDataPoint) XXX_Size() int { - return xxx_messageInfo_DoubleDataPoint.Size(m) -} -func (m *DoubleDataPoint) XXX_DiscardUnknown() { - xxx_messageInfo_DoubleDataPoint.DiscardUnknown(m) -} - -var xxx_messageInfo_DoubleDataPoint proto.InternalMessageInfo - -func (m *DoubleDataPoint) GetLabels() []*v11.StringKeyValue { - if m != nil { - return m.Labels - } - return nil -} - -func (m *DoubleDataPoint) GetStartTimeUnixNano() uint64 { - if m != nil { - return m.StartTimeUnixNano - } - return 0 -} - -func (m *DoubleDataPoint) GetTimeUnixNano() uint64 { - if m != nil { - return m.TimeUnixNano - } - return 0 -} - -func (m *DoubleDataPoint) GetValue() float64 { - if m != nil { - return m.Value - } - return 0 -} - -// HistogramDataPoint is a single data point in a timeseries that describes the time-varying -// values of a Histogram. A Histogram contains summary statistics for a population of values, -// it may optionally contain the distribution of those values across a set of buckets. -type HistogramDataPoint struct { - // The set of labels that uniquely identify this timeseries. - Labels []*v11.StringKeyValue `protobuf:"bytes,1,rep,name=labels,proto3" json:"labels,omitempty"` - // start_time_unix_nano is the time when the cumulative value was reset to zero. - // - // The cumulative value is over the time interval (start_time_unix_nano, time_unix_nano]. - // Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January 1970. - // - // Value of 0 indicates that the timestamp is unspecified. In that case the timestamp - // may be decided by the backend. - // Note: this field is always unspecified and ignored if MetricDescriptor.type==GAUGE_HISTOGRAM. - StartTimeUnixNano uint64 `protobuf:"fixed64,2,opt,name=start_time_unix_nano,json=startTimeUnixNano,proto3" json:"start_time_unix_nano,omitempty"` - // time_unix_nano is the moment when this value was recorded. - // Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January 1970. - TimeUnixNano uint64 `protobuf:"fixed64,3,opt,name=time_unix_nano,json=timeUnixNano,proto3" json:"time_unix_nano,omitempty"` - // count is the number of values in the population. Must be non-negative. This value - // must be equal to the sum of the "count" fields in buckets if a histogram is provided. - Count uint64 `protobuf:"varint,4,opt,name=count,proto3" json:"count,omitempty"` - // sum of the values in the population. If count is zero then this field - // must be zero. This value must be equal to the sum of the "sum" fields in buckets if - // a histogram is provided. - Sum float64 `protobuf:"fixed64,5,opt,name=sum,proto3" json:"sum,omitempty"` - // buckets is an optional field contains the values of histogram for each bucket. - // - // The sum of the values in the buckets "count" field must equal the value in the count field. - // - // The number of elements in buckets array must be by one greater than the - // number of elements in bucket_bounds array. - // - // Note: if HistogramDataPoint.bucket_options defines bucket bounds then this field - // must also be present and number of elements in this field must be equal to the - // number of buckets defined by bucket_options. - Buckets []*HistogramDataPoint_Bucket `protobuf:"bytes,6,rep,name=buckets,proto3" json:"buckets,omitempty"` - // explicit_bounds specifies buckets with explicitly defined bounds for values. - // The bucket boundaries are described by "bounds" field. - // - // This defines size(bounds) + 1 (= N) buckets. The boundaries for bucket - // at index i are: - // - // [0, bounds[i]) for i == 0 - // [bounds[i-1], bounds[i]) for 0 < i < N-1 - // [bounds[i], +infinity) for i == N-1 - // The values in bounds array must be strictly increasing and > 0. - // - // Note: only [a, b) intervals are currently supported for each bucket. If we decides - // to also support (a, b] intervals we should add support for these by defining a boolean - // value which decides what type of intervals to use. - ExplicitBounds []float64 `protobuf:"fixed64,7,rep,packed,name=explicit_bounds,json=explicitBounds,proto3" json:"explicit_bounds,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *HistogramDataPoint) Reset() { *m = HistogramDataPoint{} } -func (m *HistogramDataPoint) String() string { return proto.CompactTextString(m) } -func (*HistogramDataPoint) ProtoMessage() {} -func (*HistogramDataPoint) Descriptor() ([]byte, []int) { - return fileDescriptor_3c3112f9fa006917, []int{6} -} - -func (m *HistogramDataPoint) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_HistogramDataPoint.Unmarshal(m, b) -} -func (m *HistogramDataPoint) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_HistogramDataPoint.Marshal(b, m, deterministic) -} -func (m *HistogramDataPoint) XXX_Merge(src proto.Message) { - xxx_messageInfo_HistogramDataPoint.Merge(m, src) -} -func (m *HistogramDataPoint) XXX_Size() int { - return xxx_messageInfo_HistogramDataPoint.Size(m) -} -func (m *HistogramDataPoint) XXX_DiscardUnknown() { - xxx_messageInfo_HistogramDataPoint.DiscardUnknown(m) -} - -var xxx_messageInfo_HistogramDataPoint proto.InternalMessageInfo - -func (m *HistogramDataPoint) GetLabels() []*v11.StringKeyValue { - if m != nil { - return m.Labels - } - return nil -} - -func (m *HistogramDataPoint) GetStartTimeUnixNano() uint64 { - if m != nil { - return m.StartTimeUnixNano - } - return 0 -} - -func (m *HistogramDataPoint) GetTimeUnixNano() uint64 { - if m != nil { - return m.TimeUnixNano - } - return 0 -} - -func (m *HistogramDataPoint) GetCount() uint64 { - if m != nil { - return m.Count - } - return 0 -} - -func (m *HistogramDataPoint) GetSum() float64 { - if m != nil { - return m.Sum - } - return 0 -} - -func (m *HistogramDataPoint) GetBuckets() []*HistogramDataPoint_Bucket { - if m != nil { - return m.Buckets - } - return nil -} - -func (m *HistogramDataPoint) GetExplicitBounds() []float64 { - if m != nil { - return m.ExplicitBounds - } - return nil -} - -// Bucket contains values for a bucket. -type HistogramDataPoint_Bucket struct { - // The number of values in each bucket of the histogram, as described by - // bucket_options. - Count uint64 `protobuf:"varint,1,opt,name=count,proto3" json:"count,omitempty"` - // exemplar is an optional representative value of the bucket. - Exemplar *HistogramDataPoint_Bucket_Exemplar `protobuf:"bytes,2,opt,name=exemplar,proto3" json:"exemplar,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *HistogramDataPoint_Bucket) Reset() { *m = HistogramDataPoint_Bucket{} } -func (m *HistogramDataPoint_Bucket) String() string { return proto.CompactTextString(m) } -func (*HistogramDataPoint_Bucket) ProtoMessage() {} -func (*HistogramDataPoint_Bucket) Descriptor() ([]byte, []int) { - return fileDescriptor_3c3112f9fa006917, []int{6, 0} -} - -func (m *HistogramDataPoint_Bucket) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_HistogramDataPoint_Bucket.Unmarshal(m, b) -} -func (m *HistogramDataPoint_Bucket) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_HistogramDataPoint_Bucket.Marshal(b, m, deterministic) -} -func (m *HistogramDataPoint_Bucket) XXX_Merge(src proto.Message) { - xxx_messageInfo_HistogramDataPoint_Bucket.Merge(m, src) -} -func (m *HistogramDataPoint_Bucket) XXX_Size() int { - return xxx_messageInfo_HistogramDataPoint_Bucket.Size(m) -} -func (m *HistogramDataPoint_Bucket) XXX_DiscardUnknown() { - xxx_messageInfo_HistogramDataPoint_Bucket.DiscardUnknown(m) -} - -var xxx_messageInfo_HistogramDataPoint_Bucket proto.InternalMessageInfo - -func (m *HistogramDataPoint_Bucket) GetCount() uint64 { - if m != nil { - return m.Count - } - return 0 -} - -func (m *HistogramDataPoint_Bucket) GetExemplar() *HistogramDataPoint_Bucket_Exemplar { - if m != nil { - return m.Exemplar - } - return nil -} - -// Exemplars are example points that may be used to annotate aggregated -// Histogram values. They are metadata that gives information about a -// particular value added to a Histogram bucket. -type HistogramDataPoint_Bucket_Exemplar struct { - // Value of the exemplar point. It determines which bucket the exemplar belongs to. - // If bucket_options define bounds for this bucket then this value must be within - // the defined bounds. - Value float64 `protobuf:"fixed64,1,opt,name=value,proto3" json:"value,omitempty"` - // time_unix_nano is the moment when this exemplar was recorded. - // Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January 1970. - TimeUnixNano uint64 `protobuf:"fixed64,2,opt,name=time_unix_nano,json=timeUnixNano,proto3" json:"time_unix_nano,omitempty"` - // exemplar_attachments are contextual information about the example value. - // Keys in this list must be unique. - Attachments []*v11.StringKeyValue `protobuf:"bytes,3,rep,name=attachments,proto3" json:"attachments,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *HistogramDataPoint_Bucket_Exemplar) Reset() { *m = HistogramDataPoint_Bucket_Exemplar{} } -func (m *HistogramDataPoint_Bucket_Exemplar) String() string { return proto.CompactTextString(m) } -func (*HistogramDataPoint_Bucket_Exemplar) ProtoMessage() {} -func (*HistogramDataPoint_Bucket_Exemplar) Descriptor() ([]byte, []int) { - return fileDescriptor_3c3112f9fa006917, []int{6, 0, 0} -} - -func (m *HistogramDataPoint_Bucket_Exemplar) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_HistogramDataPoint_Bucket_Exemplar.Unmarshal(m, b) -} -func (m *HistogramDataPoint_Bucket_Exemplar) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_HistogramDataPoint_Bucket_Exemplar.Marshal(b, m, deterministic) -} -func (m *HistogramDataPoint_Bucket_Exemplar) XXX_Merge(src proto.Message) { - xxx_messageInfo_HistogramDataPoint_Bucket_Exemplar.Merge(m, src) -} -func (m *HistogramDataPoint_Bucket_Exemplar) XXX_Size() int { - return xxx_messageInfo_HistogramDataPoint_Bucket_Exemplar.Size(m) -} -func (m *HistogramDataPoint_Bucket_Exemplar) XXX_DiscardUnknown() { - xxx_messageInfo_HistogramDataPoint_Bucket_Exemplar.DiscardUnknown(m) -} - -var xxx_messageInfo_HistogramDataPoint_Bucket_Exemplar proto.InternalMessageInfo - -func (m *HistogramDataPoint_Bucket_Exemplar) GetValue() float64 { - if m != nil { - return m.Value - } - return 0 -} - -func (m *HistogramDataPoint_Bucket_Exemplar) GetTimeUnixNano() uint64 { - if m != nil { - return m.TimeUnixNano - } - return 0 -} - -func (m *HistogramDataPoint_Bucket_Exemplar) GetAttachments() []*v11.StringKeyValue { - if m != nil { - return m.Attachments - } - return nil -} - -// SummaryDataPoint is a single data point in a timeseries that describes the time-varying -// values of a Summary metric. -type SummaryDataPoint struct { - // The set of labels that uniquely identify this timeseries. - Labels []*v11.StringKeyValue `protobuf:"bytes,1,rep,name=labels,proto3" json:"labels,omitempty"` - // start_time_unix_nano is the time when the cumulative value was reset to zero. - // - // The cumulative value is over the time interval (start_time_unix_nano, time_unix_nano]. - // Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January 1970. - // - // Value of 0 indicates that the timestamp is unspecified. In that case the timestamp - // may be decided by the backend. - StartTimeUnixNano uint64 `protobuf:"fixed64,2,opt,name=start_time_unix_nano,json=startTimeUnixNano,proto3" json:"start_time_unix_nano,omitempty"` - // time_unix_nano is the moment when this value was recorded. - // Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January 1970. - TimeUnixNano uint64 `protobuf:"fixed64,3,opt,name=time_unix_nano,json=timeUnixNano,proto3" json:"time_unix_nano,omitempty"` - // The total number of recorded values since start_time. Optional since - // some systems don't expose this. - Count uint64 `protobuf:"varint,4,opt,name=count,proto3" json:"count,omitempty"` - // The total sum of recorded values since start_time. Optional since some - // systems don't expose this. If count is zero then this field must be zero. - Sum float64 `protobuf:"fixed64,5,opt,name=sum,proto3" json:"sum,omitempty"` - // A list of values at different percentiles of the distribution calculated - // from the current snapshot. The percentiles must be strictly increasing. - PercentileValues []*SummaryDataPoint_ValueAtPercentile `protobuf:"bytes,6,rep,name=percentile_values,json=percentileValues,proto3" json:"percentile_values,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *SummaryDataPoint) Reset() { *m = SummaryDataPoint{} } -func (m *SummaryDataPoint) String() string { return proto.CompactTextString(m) } -func (*SummaryDataPoint) ProtoMessage() {} -func (*SummaryDataPoint) Descriptor() ([]byte, []int) { - return fileDescriptor_3c3112f9fa006917, []int{7} -} - -func (m *SummaryDataPoint) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_SummaryDataPoint.Unmarshal(m, b) -} -func (m *SummaryDataPoint) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_SummaryDataPoint.Marshal(b, m, deterministic) -} -func (m *SummaryDataPoint) XXX_Merge(src proto.Message) { - xxx_messageInfo_SummaryDataPoint.Merge(m, src) -} -func (m *SummaryDataPoint) XXX_Size() int { - return xxx_messageInfo_SummaryDataPoint.Size(m) -} -func (m *SummaryDataPoint) XXX_DiscardUnknown() { - xxx_messageInfo_SummaryDataPoint.DiscardUnknown(m) -} - -var xxx_messageInfo_SummaryDataPoint proto.InternalMessageInfo - -func (m *SummaryDataPoint) GetLabels() []*v11.StringKeyValue { - if m != nil { - return m.Labels - } - return nil -} - -func (m *SummaryDataPoint) GetStartTimeUnixNano() uint64 { - if m != nil { - return m.StartTimeUnixNano - } - return 0 -} - -func (m *SummaryDataPoint) GetTimeUnixNano() uint64 { - if m != nil { - return m.TimeUnixNano - } - return 0 -} - -func (m *SummaryDataPoint) GetCount() uint64 { - if m != nil { - return m.Count - } - return 0 -} - -func (m *SummaryDataPoint) GetSum() float64 { - if m != nil { - return m.Sum - } - return 0 -} - -func (m *SummaryDataPoint) GetPercentileValues() []*SummaryDataPoint_ValueAtPercentile { - if m != nil { - return m.PercentileValues - } - return nil -} - -// Represents the value at a given percentile of a distribution. -// -// To record Min and Max values following conventions are used: -// - The 100th percentile is equivalent to the maximum value observed. -// - The 0th percentile is equivalent to the minimum value observed. -// -// See the following issue for more context: -// https://github.com/open-telemetry/opentelemetry-proto/issues/125 -type SummaryDataPoint_ValueAtPercentile struct { - // The percentile of a distribution. Must be in the interval - // [0.0, 100.0]. - Percentile float64 `protobuf:"fixed64,1,opt,name=percentile,proto3" json:"percentile,omitempty"` - // The value at the given percentile of a distribution. - Value float64 `protobuf:"fixed64,2,opt,name=value,proto3" json:"value,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *SummaryDataPoint_ValueAtPercentile) Reset() { *m = SummaryDataPoint_ValueAtPercentile{} } -func (m *SummaryDataPoint_ValueAtPercentile) String() string { return proto.CompactTextString(m) } -func (*SummaryDataPoint_ValueAtPercentile) ProtoMessage() {} -func (*SummaryDataPoint_ValueAtPercentile) Descriptor() ([]byte, []int) { - return fileDescriptor_3c3112f9fa006917, []int{7, 0} -} - -func (m *SummaryDataPoint_ValueAtPercentile) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_SummaryDataPoint_ValueAtPercentile.Unmarshal(m, b) -} -func (m *SummaryDataPoint_ValueAtPercentile) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_SummaryDataPoint_ValueAtPercentile.Marshal(b, m, deterministic) -} -func (m *SummaryDataPoint_ValueAtPercentile) XXX_Merge(src proto.Message) { - xxx_messageInfo_SummaryDataPoint_ValueAtPercentile.Merge(m, src) -} -func (m *SummaryDataPoint_ValueAtPercentile) XXX_Size() int { - return xxx_messageInfo_SummaryDataPoint_ValueAtPercentile.Size(m) -} -func (m *SummaryDataPoint_ValueAtPercentile) XXX_DiscardUnknown() { - xxx_messageInfo_SummaryDataPoint_ValueAtPercentile.DiscardUnknown(m) -} - -var xxx_messageInfo_SummaryDataPoint_ValueAtPercentile proto.InternalMessageInfo - -func (m *SummaryDataPoint_ValueAtPercentile) GetPercentile() float64 { - if m != nil { - return m.Percentile - } - return 0 -} - -func (m *SummaryDataPoint_ValueAtPercentile) GetValue() float64 { - if m != nil { - return m.Value - } - return 0 -} - -func init() { - proto.RegisterEnum("opentelemetry.proto.metrics.v1.MetricDescriptor_Type", MetricDescriptor_Type_name, MetricDescriptor_Type_value) - proto.RegisterType((*ResourceMetrics)(nil), "opentelemetry.proto.metrics.v1.ResourceMetrics") - proto.RegisterType((*InstrumentationLibraryMetrics)(nil), "opentelemetry.proto.metrics.v1.InstrumentationLibraryMetrics") - proto.RegisterType((*Metric)(nil), "opentelemetry.proto.metrics.v1.Metric") - proto.RegisterType((*MetricDescriptor)(nil), "opentelemetry.proto.metrics.v1.MetricDescriptor") - proto.RegisterType((*Int64DataPoint)(nil), "opentelemetry.proto.metrics.v1.Int64DataPoint") - proto.RegisterType((*DoubleDataPoint)(nil), "opentelemetry.proto.metrics.v1.DoubleDataPoint") - proto.RegisterType((*HistogramDataPoint)(nil), "opentelemetry.proto.metrics.v1.HistogramDataPoint") - proto.RegisterType((*HistogramDataPoint_Bucket)(nil), "opentelemetry.proto.metrics.v1.HistogramDataPoint.Bucket") - proto.RegisterType((*HistogramDataPoint_Bucket_Exemplar)(nil), "opentelemetry.proto.metrics.v1.HistogramDataPoint.Bucket.Exemplar") - proto.RegisterType((*SummaryDataPoint)(nil), "opentelemetry.proto.metrics.v1.SummaryDataPoint") - proto.RegisterType((*SummaryDataPoint_ValueAtPercentile)(nil), "opentelemetry.proto.metrics.v1.SummaryDataPoint.ValueAtPercentile") -} - -func init() { - proto.RegisterFile("opentelemetry/proto/metrics/v1/metrics.proto", fileDescriptor_3c3112f9fa006917) -} - -var fileDescriptor_3c3112f9fa006917 = []byte{ - // 952 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xdc, 0x56, 0xdf, 0x6e, 0x2a, 0x45, - 0x18, 0x77, 0x59, 0x0a, 0xf5, 0xa3, 0xc2, 0x32, 0xad, 0x4a, 0x48, 0xce, 0x11, 0x89, 0xd1, 0x6a, - 0xec, 0x62, 0x6b, 0x6d, 0xe2, 0x85, 0x51, 0x28, 0xd8, 0x43, 0x2c, 0x2d, 0x19, 0xe0, 0x24, 0x9e, - 0xe4, 0xb8, 0x2e, 0x30, 0xd2, 0x89, 0xec, 0x0c, 0xd9, 0x9d, 0x6d, 0xca, 0x03, 0x78, 0xeb, 0x95, - 0x89, 0xde, 0xf8, 0x36, 0xfa, 0x00, 0xbe, 0x81, 0x0f, 0xe0, 0x9d, 0x2f, 0x60, 0x76, 0x66, 0x17, - 0x76, 0x29, 0x2d, 0x56, 0x6f, 0xf4, 0xdc, 0xcd, 0xfe, 0xbe, 0xef, 0xf7, 0xfb, 0xfe, 0xee, 0xee, - 0xc0, 0xfb, 0x7c, 0x46, 0x98, 0x20, 0x53, 0xe2, 0x10, 0xe1, 0xce, 0x6b, 0x33, 0x97, 0x0b, 0x5e, - 0x0b, 0xce, 0x74, 0xe4, 0xd5, 0xae, 0x0f, 0xa3, 0xa3, 0x29, 0x0d, 0xe8, 0x71, 0xc2, 0x5b, 0x81, - 0x66, 0xe4, 0x72, 0x7d, 0x58, 0x7e, 0x6f, 0x9d, 0xda, 0x88, 0x3b, 0x0e, 0x67, 0x81, 0x98, 0x3a, - 0x29, 0x5a, 0xd9, 0x5c, 0xe7, 0xeb, 0x12, 0x8f, 0xfb, 0xee, 0x88, 0x04, 0xde, 0xd1, 0x59, 0xf9, - 0x57, 0x7f, 0xd7, 0xa0, 0x80, 0x43, 0xa8, 0xa3, 0x42, 0xa2, 0x16, 0x6c, 0x47, 0x5e, 0x25, 0xad, - 0xa2, 0xed, 0xe7, 0x8e, 0xde, 0x35, 0xd7, 0xa5, 0xb8, 0x90, 0xba, 0x3e, 0x34, 0x23, 0x0d, 0xbc, - 0xa0, 0xa2, 0xef, 0x34, 0x78, 0x83, 0x32, 0x4f, 0xb8, 0xbe, 0x43, 0x98, 0xb0, 0x05, 0xe5, 0xcc, - 0x9a, 0xd2, 0xa1, 0x6b, 0xbb, 0x73, 0x2b, 0xac, 0xae, 0x94, 0xaa, 0xe8, 0xfb, 0xb9, 0xa3, 0x4f, - 0xcc, 0xfb, 0x3b, 0x60, 0xb6, 0x93, 0x32, 0xe7, 0x4a, 0x25, 0xcc, 0x17, 0x3f, 0xa2, 0xf7, 0x99, - 0xab, 0xbf, 0x69, 0xf0, 0xe8, 0x5e, 0x01, 0xc4, 0xe0, 0xf5, 0x3b, 0x12, 0x0d, 0xeb, 0xff, 0x68, - 0x6d, 0x82, 0x61, 0xe3, 0xef, 0xcc, 0x0f, 0xbf, 0xb6, 0x3e, 0x31, 0xf4, 0x19, 0x64, 0x93, 0x0d, - 0x78, 0x7b, 0x53, 0x03, 0x54, 0xa6, 0x38, 0xa2, 0x55, 0xff, 0xd0, 0x21, 0xa3, 0x30, 0xf4, 0x1c, - 0x8a, 0x0a, 0xb5, 0xc6, 0xc4, 0x1b, 0xb9, 0x74, 0x26, 0xb8, 0x1b, 0xa6, 0xfd, 0xc1, 0xdf, 0x93, - 0x6d, 0x2e, 0x78, 0xd8, 0x70, 0x56, 0x10, 0xf4, 0x0c, 0x8a, 0x94, 0x89, 0x93, 0x63, 0x6b, 0x6c, - 0x0b, 0xdb, 0x9a, 0x71, 0xca, 0x44, 0x94, 0xb5, 0xb9, 0x79, 0x6c, 0xe2, 0xe4, 0xb8, 0x69, 0x0b, - 0xbb, 0x1b, 0xd0, 0x70, 0x81, 0x26, 0x9e, 0x3d, 0xf4, 0x1c, 0xd0, 0x98, 0xfb, 0xc3, 0x29, 0x49, - 0x88, 0xeb, 0x52, 0xbc, 0xb6, 0x49, 0xbc, 0x29, 0x99, 0x4b, 0x75, 0x63, 0x9c, 0x04, 0x3c, 0xf4, - 0x0d, 0xbc, 0x7a, 0x45, 0x3d, 0xc1, 0x27, 0xae, 0xed, 0x24, 0x22, 0xa4, 0x65, 0x84, 0xa3, 0x4d, - 0x11, 0x9e, 0x44, 0xe4, 0x65, 0x90, 0xdd, 0xab, 0x5b, 0x98, 0x87, 0xbe, 0x86, 0x5d, 0xcf, 0x77, - 0x9c, 0x60, 0xaf, 0xe3, 0x51, 0xb6, 0x64, 0x94, 0x8d, 0x33, 0xe8, 0x29, 0xea, 0x32, 0x46, 0xd1, - 0x5b, 0x41, 0xbc, 0xea, 0xf7, 0x3a, 0x18, 0xab, 0xb3, 0x42, 0x08, 0xd2, 0xcc, 0x76, 0xd4, 0x2b, - 0xfa, 0x32, 0x96, 0x67, 0x54, 0x81, 0x5c, 0xb4, 0x05, 0x94, 0xb3, 0x52, 0x4a, 0x9a, 0xe2, 0x50, - 0xc0, 0xf2, 0x19, 0x15, 0x25, 0x5d, 0xb1, 0x82, 0x33, 0x6a, 0x43, 0x5a, 0xcc, 0x67, 0xa4, 0x94, - 0xae, 0x68, 0xfb, 0xf9, 0x3b, 0x96, 0xfd, 0x9e, 0xad, 0x31, 0xfb, 0xf3, 0x19, 0xc1, 0x52, 0x02, - 0xb5, 0x20, 0x33, 0xb5, 0x87, 0x64, 0x1a, 0x95, 0x7f, 0xb0, 0xe1, 0xcd, 0xe9, 0x09, 0x97, 0xb2, - 0xc9, 0x17, 0x64, 0xfe, 0xd4, 0x9e, 0xfa, 0x04, 0x87, 0xe4, 0xea, 0xcf, 0x1a, 0xa4, 0x03, 0x55, - 0x54, 0x80, 0xdc, 0xe0, 0xa2, 0xd7, 0x6d, 0x9d, 0xb6, 0x3f, 0x6f, 0xb7, 0x9a, 0xc6, 0x4b, 0x01, - 0x70, 0x56, 0x1f, 0x9c, 0xb5, 0xac, 0xf6, 0x45, 0xff, 0xe4, 0xd8, 0xd0, 0x90, 0x01, 0x3b, 0x0a, - 0x68, 0x5e, 0x0e, 0x1a, 0xe7, 0x2d, 0x23, 0x85, 0x76, 0xa1, 0xa0, 0x90, 0x27, 0xed, 0x5e, 0xff, - 0xf2, 0x0c, 0xd7, 0x3b, 0x86, 0x8e, 0x8a, 0xf0, 0xca, 0xe9, 0xe5, 0xe0, 0xa2, 0xdf, 0xc2, 0x21, - 0x33, 0x8d, 0x10, 0xe4, 0x23, 0x28, 0xe4, 0x6e, 0xa1, 0x12, 0xec, 0x9d, 0x0e, 0x3a, 0x83, 0xf3, - 0x7a, 0xbf, 0xfd, 0x34, 0x2e, 0x90, 0x41, 0x39, 0xc8, 0xf6, 0x06, 0x9d, 0x4e, 0x1d, 0x7f, 0x69, - 0x64, 0xab, 0xbf, 0x68, 0x90, 0x4f, 0x6e, 0x77, 0xac, 0x72, 0xed, 0x5f, 0x54, 0x8e, 0x6a, 0xb0, - 0xe7, 0x09, 0xdb, 0x15, 0x96, 0xa0, 0x0e, 0xb1, 0x7c, 0x46, 0x6f, 0x2c, 0x66, 0x33, 0x2e, 0x47, - 0x99, 0xc1, 0x45, 0x69, 0xeb, 0x53, 0x87, 0x0c, 0x18, 0xbd, 0xb9, 0xb0, 0x19, 0x47, 0x6f, 0x41, - 0x7e, 0xc5, 0x55, 0x97, 0xae, 0x3b, 0x22, 0xee, 0xb5, 0x07, 0x5b, 0xd7, 0x41, 0x1c, 0x39, 0x63, - 0x1d, 0xab, 0x87, 0xea, 0xaf, 0x1a, 0x14, 0x56, 0xde, 0xa3, 0xff, 0x53, 0x1d, 0x5a, 0x54, 0xc7, - 0x9f, 0x69, 0x40, 0xb7, 0xdf, 0xd6, 0xff, 0x7e, 0x29, 0x23, 0xee, 0x33, 0x21, 0x4b, 0x49, 0x63, - 0xf5, 0x80, 0x0c, 0xd0, 0x3d, 0xdf, 0x29, 0x6d, 0xc9, 0xf2, 0x82, 0x23, 0xea, 0x41, 0x76, 0xe8, - 0x8f, 0xbe, 0x25, 0xc2, 0x2b, 0x65, 0x64, 0x19, 0x1f, 0x3f, 0xfc, 0xc3, 0x65, 0x36, 0xa4, 0x02, - 0x8e, 0x94, 0xd0, 0x3b, 0x50, 0x20, 0x37, 0xb3, 0x29, 0x1d, 0x51, 0x61, 0x0d, 0xb9, 0xcf, 0xc6, - 0x5e, 0x29, 0x5b, 0xd1, 0xf7, 0x35, 0x9c, 0x8f, 0xe0, 0x86, 0x44, 0xcb, 0x3f, 0xa5, 0x20, 0xa3, - 0xc8, 0xcb, 0x84, 0xb5, 0x78, 0xc2, 0x5f, 0xc1, 0x36, 0xb9, 0x21, 0xce, 0x6c, 0x6a, 0xbb, 0xb2, - 0x23, 0xb9, 0xa3, 0xc6, 0x3f, 0xce, 0xcf, 0x6c, 0x85, 0x4a, 0x78, 0xa1, 0x59, 0xfe, 0x51, 0x83, - 0xed, 0x08, 0x5e, 0x8e, 0x5f, 0x8b, 0x8d, 0x7f, 0x4d, 0xbf, 0x53, 0x6b, 0xfa, 0x7d, 0x09, 0x39, - 0x5b, 0x08, 0x7b, 0x74, 0x15, 0xfc, 0x8f, 0xa3, 0xdf, 0xcc, 0x03, 0x57, 0x22, 0xae, 0x50, 0xfd, - 0x41, 0x07, 0x63, 0xf5, 0xeb, 0xfd, 0x82, 0xec, 0x1c, 0x87, 0xe2, 0x8c, 0xb8, 0x23, 0xc2, 0x04, - 0x9d, 0x12, 0x4b, 0x76, 0x39, 0xda, 0xbe, 0xc6, 0x43, 0x7f, 0x68, 0xa6, 0xac, 0xac, 0x2e, 0xba, - 0x0b, 0x41, 0x6c, 0x2c, 0xc5, 0xa5, 0xd1, 0x2b, 0xb7, 0xa1, 0x78, 0xcb, 0x0d, 0x3d, 0x06, 0x58, - 0x3a, 0x86, 0x23, 0x8f, 0x21, 0xcb, 0x6d, 0x48, 0xc5, 0xb6, 0xa1, 0x21, 0xe0, 0x4d, 0xca, 0x37, - 0x24, 0xd9, 0xd8, 0x09, 0xef, 0x7e, 0xdd, 0xc0, 0xd0, 0xd5, 0x9e, 0x7d, 0x3a, 0xa1, 0xe2, 0xca, - 0x1f, 0x06, 0x83, 0xa9, 0x05, 0xd4, 0x83, 0xe5, 0x1d, 0x3a, 0xa1, 0x74, 0xa0, 0x6e, 0xd4, 0x13, - 0xc2, 0x6a, 0x93, 0xf8, 0x95, 0x7e, 0x98, 0x91, 0x86, 0x0f, 0xff, 0x0a, 0x00, 0x00, 0xff, 0xff, - 0x28, 0xab, 0x2b, 0x39, 0xfb, 0x0b, 0x00, 0x00, -} diff --git a/packages/opentelemetry-exporter-collector/src/platform/node/protos/gen/go/resource/v1/resource.pb.go b/packages/opentelemetry-exporter-collector/src/platform/node/protos/gen/go/resource/v1/resource.pb.go deleted file mode 100644 index cfc41c45ef..0000000000 --- a/packages/opentelemetry-exporter-collector/src/platform/node/protos/gen/go/resource/v1/resource.pb.go +++ /dev/null @@ -1,100 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// source: opentelemetry/proto/resource/v1/resource.proto - -package v1 - -import ( - fmt "fmt" - proto "github.com/golang/protobuf/proto" - v1 "github.com/open-telemetry/opentelemetry-proto/gen/go/common/v1" - math "math" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package - -// Resource information. -type Resource struct { - // Set of labels that describe the resource. - Attributes []*v1.AttributeKeyValue `protobuf:"bytes,1,rep,name=attributes,proto3" json:"attributes,omitempty"` - // dropped_attributes_count is the number of dropped attributes. If the value is 0, then - // no attributes were dropped. - DroppedAttributesCount uint32 `protobuf:"varint,2,opt,name=dropped_attributes_count,json=droppedAttributesCount,proto3" json:"dropped_attributes_count,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Resource) Reset() { *m = Resource{} } -func (m *Resource) String() string { return proto.CompactTextString(m) } -func (*Resource) ProtoMessage() {} -func (*Resource) Descriptor() ([]byte, []int) { - return fileDescriptor_446f73eacf88f3f5, []int{0} -} - -func (m *Resource) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Resource.Unmarshal(m, b) -} -func (m *Resource) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Resource.Marshal(b, m, deterministic) -} -func (m *Resource) XXX_Merge(src proto.Message) { - xxx_messageInfo_Resource.Merge(m, src) -} -func (m *Resource) XXX_Size() int { - return xxx_messageInfo_Resource.Size(m) -} -func (m *Resource) XXX_DiscardUnknown() { - xxx_messageInfo_Resource.DiscardUnknown(m) -} - -var xxx_messageInfo_Resource proto.InternalMessageInfo - -func (m *Resource) GetAttributes() []*v1.AttributeKeyValue { - if m != nil { - return m.Attributes - } - return nil -} - -func (m *Resource) GetDroppedAttributesCount() uint32 { - if m != nil { - return m.DroppedAttributesCount - } - return 0 -} - -func init() { - proto.RegisterType((*Resource)(nil), "opentelemetry.proto.resource.v1.Resource") -} - -func init() { - proto.RegisterFile("opentelemetry/proto/resource/v1/resource.proto", fileDescriptor_446f73eacf88f3f5) -} - -var fileDescriptor_446f73eacf88f3f5 = []byte{ - // 231 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xd2, 0xcb, 0x2f, 0x48, 0xcd, - 0x2b, 0x49, 0xcd, 0x49, 0xcd, 0x4d, 0x2d, 0x29, 0xaa, 0xd4, 0x2f, 0x28, 0xca, 0x2f, 0xc9, 0xd7, - 0x2f, 0x4a, 0x2d, 0xce, 0x2f, 0x2d, 0x4a, 0x4e, 0xd5, 0x2f, 0x33, 0x84, 0xb3, 0xf5, 0xc0, 0x52, - 0x42, 0xf2, 0x28, 0xea, 0x21, 0x82, 0x7a, 0x70, 0x35, 0x65, 0x86, 0x52, 0x5a, 0xd8, 0x0c, 0x4c, - 0xce, 0xcf, 0xcd, 0xcd, 0xcf, 0x03, 0x19, 0x07, 0x61, 0x41, 0xf4, 0x29, 0x4d, 0x63, 0xe4, 0xe2, - 0x08, 0x82, 0xea, 0x15, 0x0a, 0xe0, 0xe2, 0x4a, 0x2c, 0x29, 0x29, 0xca, 0x4c, 0x2a, 0x2d, 0x49, - 0x2d, 0x96, 0x60, 0x54, 0x60, 0xd6, 0xe0, 0x36, 0x32, 0xd0, 0xc3, 0x66, 0x1d, 0xd4, 0x8c, 0x32, - 0x43, 0x3d, 0x47, 0x98, 0x06, 0xef, 0xd4, 0xca, 0xb0, 0xc4, 0x9c, 0xd2, 0xd4, 0x20, 0x24, 0x33, - 0x84, 0x2c, 0xb8, 0x24, 0x52, 0x8a, 0xf2, 0x0b, 0x0a, 0x52, 0x53, 0xe2, 0x11, 0xa2, 0xf1, 0xc9, - 0xf9, 0xa5, 0x79, 0x25, 0x12, 0x4c, 0x0a, 0x8c, 0x1a, 0xbc, 0x41, 0x62, 0x50, 0x79, 0xb8, 0x39, - 0xc5, 0xce, 0x20, 0x59, 0xa7, 0x72, 0x2e, 0xa5, 0xcc, 0x7c, 0x3d, 0x02, 0x5e, 0x75, 0xe2, 0x85, - 0xb9, 0x3d, 0x00, 0x24, 0x15, 0xc0, 0x18, 0xe5, 0x90, 0x9e, 0x59, 0x92, 0x51, 0x9a, 0x04, 0x72, - 0xa0, 0x3e, 0x48, 0xb3, 0x2e, 0x22, 0x1c, 0x50, 0xcc, 0xd2, 0x85, 0x84, 0x4a, 0x7a, 0x6a, 0x9e, - 0x7e, 0x3a, 0x4a, 0x68, 0x27, 0xb1, 0x81, 0x65, 0x8c, 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0xc9, - 0xc6, 0x84, 0x9f, 0x97, 0x01, 0x00, 0x00, -} diff --git a/packages/opentelemetry-exporter-collector/src/platform/node/protos/gen/go/trace/v1/trace.pb.go b/packages/opentelemetry-exporter-collector/src/platform/node/protos/gen/go/trace/v1/trace.pb.go deleted file mode 100644 index 7bda6aadb9..0000000000 --- a/packages/opentelemetry-exporter-collector/src/platform/node/protos/gen/go/trace/v1/trace.pb.go +++ /dev/null @@ -1,767 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// source: opentelemetry/proto/trace/v1/trace.proto - -package v1 - -import ( - fmt "fmt" - proto "github.com/golang/protobuf/proto" - v11 "github.com/open-telemetry/opentelemetry-proto/gen/go/common/v1" - v1 "github.com/open-telemetry/opentelemetry-proto/gen/go/resource/v1" - math "math" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package - -// SpanKind is the type of span. Can be used to specify additional relationships between spans -// in addition to a parent/child relationship. -type Span_SpanKind int32 - -const ( - // Unspecified. Do NOT use as default. - // Implementations MAY assume SpanKind to be INTERNAL when receiving UNSPECIFIED. - Span_SPAN_KIND_UNSPECIFIED Span_SpanKind = 0 - // Indicates that the span represents an internal operation within an application, - // as opposed to an operations happening at the boundaries. Default value. - Span_INTERNAL Span_SpanKind = 1 - // Indicates that the span covers server-side handling of an RPC or other - // remote network request. - Span_SERVER Span_SpanKind = 2 - // Indicates that the span describes a request to some remote service. - Span_CLIENT Span_SpanKind = 3 - // Indicates that the span describes a producer sending a message to a broker. - // Unlike CLIENT and SERVER, there is often no direct critical path latency relationship - // between producer and consumer spans. A PRODUCER span ends when the message was accepted - // by the broker while the logical processing of the message might span a much longer time. - Span_PRODUCER Span_SpanKind = 4 - // Indicates that the span describes consumer receiving a message from a broker. - // Like the PRODUCER kind, there is often no direct critical path latency relationship - // between producer and consumer spans. - Span_CONSUMER Span_SpanKind = 5 -) - -var Span_SpanKind_name = map[int32]string{ - 0: "SPAN_KIND_UNSPECIFIED", - 1: "INTERNAL", - 2: "SERVER", - 3: "CLIENT", - 4: "PRODUCER", - 5: "CONSUMER", -} - -var Span_SpanKind_value = map[string]int32{ - "SPAN_KIND_UNSPECIFIED": 0, - "INTERNAL": 1, - "SERVER": 2, - "CLIENT": 3, - "PRODUCER": 4, - "CONSUMER": 5, -} - -func (x Span_SpanKind) String() string { - return proto.EnumName(Span_SpanKind_name, int32(x)) -} - -func (Span_SpanKind) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_5c407ac9c675a601, []int{2, 0} -} - -// StatusCode mirrors the codes defined at -// https://github.com/open-telemetry/opentelemetry-specification/blob/master/specification/api-tracing.md#statuscanonicalcode -type Status_StatusCode int32 - -const ( - Status_Ok Status_StatusCode = 0 - Status_Cancelled Status_StatusCode = 1 - Status_UnknownError Status_StatusCode = 2 - Status_InvalidArgument Status_StatusCode = 3 - Status_DeadlineExceeded Status_StatusCode = 4 - Status_NotFound Status_StatusCode = 5 - Status_AlreadyExists Status_StatusCode = 6 - Status_PermissionDenied Status_StatusCode = 7 - Status_ResourceExhausted Status_StatusCode = 8 - Status_FailedPrecondition Status_StatusCode = 9 - Status_Aborted Status_StatusCode = 10 - Status_OutOfRange Status_StatusCode = 11 - Status_Unimplemented Status_StatusCode = 12 - Status_InternalError Status_StatusCode = 13 - Status_Unavailable Status_StatusCode = 14 - Status_DataLoss Status_StatusCode = 15 - Status_Unauthenticated Status_StatusCode = 16 -) - -var Status_StatusCode_name = map[int32]string{ - 0: "Ok", - 1: "Cancelled", - 2: "UnknownError", - 3: "InvalidArgument", - 4: "DeadlineExceeded", - 5: "NotFound", - 6: "AlreadyExists", - 7: "PermissionDenied", - 8: "ResourceExhausted", - 9: "FailedPrecondition", - 10: "Aborted", - 11: "OutOfRange", - 12: "Unimplemented", - 13: "InternalError", - 14: "Unavailable", - 15: "DataLoss", - 16: "Unauthenticated", -} - -var Status_StatusCode_value = map[string]int32{ - "Ok": 0, - "Cancelled": 1, - "UnknownError": 2, - "InvalidArgument": 3, - "DeadlineExceeded": 4, - "NotFound": 5, - "AlreadyExists": 6, - "PermissionDenied": 7, - "ResourceExhausted": 8, - "FailedPrecondition": 9, - "Aborted": 10, - "OutOfRange": 11, - "Unimplemented": 12, - "InternalError": 13, - "Unavailable": 14, - "DataLoss": 15, - "Unauthenticated": 16, -} - -func (x Status_StatusCode) String() string { - return proto.EnumName(Status_StatusCode_name, int32(x)) -} - -func (Status_StatusCode) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_5c407ac9c675a601, []int{3, 0} -} - -// A collection of InstrumentationLibrarySpans from a Resource. -type ResourceSpans struct { - // The resource for the spans in this message. - // If this field is not set then no resource info is known. - Resource *v1.Resource `protobuf:"bytes,1,opt,name=resource,proto3" json:"resource,omitempty"` - // A list of InstrumentationLibrarySpans that originate from a resource. - InstrumentationLibrarySpans []*InstrumentationLibrarySpans `protobuf:"bytes,2,rep,name=instrumentation_library_spans,json=instrumentationLibrarySpans,proto3" json:"instrumentation_library_spans,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *ResourceSpans) Reset() { *m = ResourceSpans{} } -func (m *ResourceSpans) String() string { return proto.CompactTextString(m) } -func (*ResourceSpans) ProtoMessage() {} -func (*ResourceSpans) Descriptor() ([]byte, []int) { - return fileDescriptor_5c407ac9c675a601, []int{0} -} - -func (m *ResourceSpans) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ResourceSpans.Unmarshal(m, b) -} -func (m *ResourceSpans) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ResourceSpans.Marshal(b, m, deterministic) -} -func (m *ResourceSpans) XXX_Merge(src proto.Message) { - xxx_messageInfo_ResourceSpans.Merge(m, src) -} -func (m *ResourceSpans) XXX_Size() int { - return xxx_messageInfo_ResourceSpans.Size(m) -} -func (m *ResourceSpans) XXX_DiscardUnknown() { - xxx_messageInfo_ResourceSpans.DiscardUnknown(m) -} - -var xxx_messageInfo_ResourceSpans proto.InternalMessageInfo - -func (m *ResourceSpans) GetResource() *v1.Resource { - if m != nil { - return m.Resource - } - return nil -} - -func (m *ResourceSpans) GetInstrumentationLibrarySpans() []*InstrumentationLibrarySpans { - if m != nil { - return m.InstrumentationLibrarySpans - } - return nil -} - -// A collection of Spans produced by an InstrumentationLibrary. -type InstrumentationLibrarySpans struct { - // The instrumentation library information for the spans in this message. - // If this field is not set then no library info is known. - InstrumentationLibrary *v11.InstrumentationLibrary `protobuf:"bytes,1,opt,name=instrumentation_library,json=instrumentationLibrary,proto3" json:"instrumentation_library,omitempty"` - // A list of Spans that originate from an instrumentation library. - Spans []*Span `protobuf:"bytes,2,rep,name=spans,proto3" json:"spans,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *InstrumentationLibrarySpans) Reset() { *m = InstrumentationLibrarySpans{} } -func (m *InstrumentationLibrarySpans) String() string { return proto.CompactTextString(m) } -func (*InstrumentationLibrarySpans) ProtoMessage() {} -func (*InstrumentationLibrarySpans) Descriptor() ([]byte, []int) { - return fileDescriptor_5c407ac9c675a601, []int{1} -} - -func (m *InstrumentationLibrarySpans) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_InstrumentationLibrarySpans.Unmarshal(m, b) -} -func (m *InstrumentationLibrarySpans) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_InstrumentationLibrarySpans.Marshal(b, m, deterministic) -} -func (m *InstrumentationLibrarySpans) XXX_Merge(src proto.Message) { - xxx_messageInfo_InstrumentationLibrarySpans.Merge(m, src) -} -func (m *InstrumentationLibrarySpans) XXX_Size() int { - return xxx_messageInfo_InstrumentationLibrarySpans.Size(m) -} -func (m *InstrumentationLibrarySpans) XXX_DiscardUnknown() { - xxx_messageInfo_InstrumentationLibrarySpans.DiscardUnknown(m) -} - -var xxx_messageInfo_InstrumentationLibrarySpans proto.InternalMessageInfo - -func (m *InstrumentationLibrarySpans) GetInstrumentationLibrary() *v11.InstrumentationLibrary { - if m != nil { - return m.InstrumentationLibrary - } - return nil -} - -func (m *InstrumentationLibrarySpans) GetSpans() []*Span { - if m != nil { - return m.Spans - } - return nil -} - -// Span represents a single operation within a trace. Spans can be -// nested to form a trace tree. Spans may also be linked to other spans -// from the same or different trace and form graphs. Often, a trace -// contains a root span that describes the end-to-end latency, and one -// or more subspans for its sub-operations. A trace can also contain -// multiple root spans, or none at all. Spans do not need to be -// contiguous - there may be gaps or overlaps between spans in a trace. -// -// The next available field id is 17. -type Span struct { - // A unique identifier for a trace. All spans from the same trace share - // the same `trace_id`. The ID is a 16-byte array. An ID with all zeroes - // is considered invalid. - // - // This field is semantically required. Receiver should generate new - // random trace_id if empty or invalid trace_id was received. - // - // This field is required. - TraceId []byte `protobuf:"bytes,1,opt,name=trace_id,json=traceId,proto3" json:"trace_id,omitempty"` - // A unique identifier for a span within a trace, assigned when the span - // is created. The ID is an 8-byte array. An ID with all zeroes is considered - // invalid. - // - // This field is semantically required. Receiver should generate new - // random span_id if empty or invalid span_id was received. - // - // This field is required. - SpanId []byte `protobuf:"bytes,2,opt,name=span_id,json=spanId,proto3" json:"span_id,omitempty"` - // trace_state conveys information about request position in multiple distributed tracing graphs. - // It is a trace_state in w3c-trace-context format: https://www.w3.org/TR/trace-context/#tracestate-header - // See also https://github.com/w3c/distributed-tracing for more details about this field. - TraceState string `protobuf:"bytes,3,opt,name=trace_state,json=traceState,proto3" json:"trace_state,omitempty"` - // The `span_id` of this span's parent span. If this is a root span, then this - // field must be empty. The ID is an 8-byte array. - ParentSpanId []byte `protobuf:"bytes,4,opt,name=parent_span_id,json=parentSpanId,proto3" json:"parent_span_id,omitempty"` - // A description of the span's operation. - // - // For example, the name can be a qualified method name or a file name - // and a line number where the operation is called. A best practice is to use - // the same display name at the same call point in an application. - // This makes it easier to correlate spans in different traces. - // - // This field is semantically required to be set to non-empty string. - // When null or empty string received - receiver may use string "name" - // as a replacement. There might be smarted algorithms implemented by - // receiver to fix the empty span name. - // - // This field is required. - Name string `protobuf:"bytes,5,opt,name=name,proto3" json:"name,omitempty"` - // Distinguishes between spans generated in a particular context. For example, - // two spans with the same name may be distinguished using `CLIENT` (caller) - // and `SERVER` (callee) to identify queueing latency associated with the span. - Kind Span_SpanKind `protobuf:"varint,6,opt,name=kind,proto3,enum=opentelemetry.proto.trace.v1.Span_SpanKind" json:"kind,omitempty"` - // start_time_unix_nano is the start time of the span. On the client side, this is the time - // kept by the local machine where the span execution starts. On the server side, this - // is the time when the server's application handler starts running. - // Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January 1970. - // - // This field is semantically required and it is expected that end_time >= start_time. - StartTimeUnixNano uint64 `protobuf:"fixed64,7,opt,name=start_time_unix_nano,json=startTimeUnixNano,proto3" json:"start_time_unix_nano,omitempty"` - // end_time_unix_nano is the end time of the span. On the client side, this is the time - // kept by the local machine where the span execution ends. On the server side, this - // is the time when the server application handler stops running. - // Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January 1970. - // - // This field is semantically required and it is expected that end_time >= start_time. - EndTimeUnixNano uint64 `protobuf:"fixed64,8,opt,name=end_time_unix_nano,json=endTimeUnixNano,proto3" json:"end_time_unix_nano,omitempty"` - // attributes is a collection of key/value pairs. The value can be a string, - // an integer, a double or the Boolean values `true` or `false`. Note, global attributes - // like server name can be set using the resource API. Examples of attributes: - // - // "/http/user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36" - // "/http/server_latency": 300 - // "abc.com/myattribute": true - // "abc.com/score": 10.239 - Attributes []*v11.AttributeKeyValue `protobuf:"bytes,9,rep,name=attributes,proto3" json:"attributes,omitempty"` - // dropped_attributes_count is the number of attributes that were discarded. Attributes - // can be discarded because their keys are too long or because there are too many - // attributes. If this value is 0, then no attributes were dropped. - DroppedAttributesCount uint32 `protobuf:"varint,10,opt,name=dropped_attributes_count,json=droppedAttributesCount,proto3" json:"dropped_attributes_count,omitempty"` - // events is a collection of Event items. - Events []*Span_Event `protobuf:"bytes,11,rep,name=events,proto3" json:"events,omitempty"` - // dropped_events_count is the number of dropped events. If the value is 0, then no - // events were dropped. - DroppedEventsCount uint32 `protobuf:"varint,12,opt,name=dropped_events_count,json=droppedEventsCount,proto3" json:"dropped_events_count,omitempty"` - // links is a collection of Links, which are references from this span to a span - // in the same or different trace. - Links []*Span_Link `protobuf:"bytes,13,rep,name=links,proto3" json:"links,omitempty"` - // dropped_links_count is the number of dropped links after the maximum size was - // enforced. If this value is 0, then no links were dropped. - DroppedLinksCount uint32 `protobuf:"varint,14,opt,name=dropped_links_count,json=droppedLinksCount,proto3" json:"dropped_links_count,omitempty"` - // An optional final status for this span. Semantically when Status - // wasn't set it is means span ended without errors and assume - // Status.Ok (code = 0). - Status *Status `protobuf:"bytes,15,opt,name=status,proto3" json:"status,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Span) Reset() { *m = Span{} } -func (m *Span) String() string { return proto.CompactTextString(m) } -func (*Span) ProtoMessage() {} -func (*Span) Descriptor() ([]byte, []int) { - return fileDescriptor_5c407ac9c675a601, []int{2} -} - -func (m *Span) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Span.Unmarshal(m, b) -} -func (m *Span) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Span.Marshal(b, m, deterministic) -} -func (m *Span) XXX_Merge(src proto.Message) { - xxx_messageInfo_Span.Merge(m, src) -} -func (m *Span) XXX_Size() int { - return xxx_messageInfo_Span.Size(m) -} -func (m *Span) XXX_DiscardUnknown() { - xxx_messageInfo_Span.DiscardUnknown(m) -} - -var xxx_messageInfo_Span proto.InternalMessageInfo - -func (m *Span) GetTraceId() []byte { - if m != nil { - return m.TraceId - } - return nil -} - -func (m *Span) GetSpanId() []byte { - if m != nil { - return m.SpanId - } - return nil -} - -func (m *Span) GetTraceState() string { - if m != nil { - return m.TraceState - } - return "" -} - -func (m *Span) GetParentSpanId() []byte { - if m != nil { - return m.ParentSpanId - } - return nil -} - -func (m *Span) GetName() string { - if m != nil { - return m.Name - } - return "" -} - -func (m *Span) GetKind() Span_SpanKind { - if m != nil { - return m.Kind - } - return Span_SPAN_KIND_UNSPECIFIED -} - -func (m *Span) GetStartTimeUnixNano() uint64 { - if m != nil { - return m.StartTimeUnixNano - } - return 0 -} - -func (m *Span) GetEndTimeUnixNano() uint64 { - if m != nil { - return m.EndTimeUnixNano - } - return 0 -} - -func (m *Span) GetAttributes() []*v11.AttributeKeyValue { - if m != nil { - return m.Attributes - } - return nil -} - -func (m *Span) GetDroppedAttributesCount() uint32 { - if m != nil { - return m.DroppedAttributesCount - } - return 0 -} - -func (m *Span) GetEvents() []*Span_Event { - if m != nil { - return m.Events - } - return nil -} - -func (m *Span) GetDroppedEventsCount() uint32 { - if m != nil { - return m.DroppedEventsCount - } - return 0 -} - -func (m *Span) GetLinks() []*Span_Link { - if m != nil { - return m.Links - } - return nil -} - -func (m *Span) GetDroppedLinksCount() uint32 { - if m != nil { - return m.DroppedLinksCount - } - return 0 -} - -func (m *Span) GetStatus() *Status { - if m != nil { - return m.Status - } - return nil -} - -// Event is a time-stamped annotation of the span, consisting of user-supplied -// text description and key-value pairs. -type Span_Event struct { - // time_unix_nano is the time the event occurred. - TimeUnixNano uint64 `protobuf:"fixed64,1,opt,name=time_unix_nano,json=timeUnixNano,proto3" json:"time_unix_nano,omitempty"` - // name of the event. - // This field is semantically required to be set to non-empty string. - Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` - // attributes is a collection of attribute key/value pairs on the event. - Attributes []*v11.AttributeKeyValue `protobuf:"bytes,3,rep,name=attributes,proto3" json:"attributes,omitempty"` - // dropped_attributes_count is the number of dropped attributes. If the value is 0, - // then no attributes were dropped. - DroppedAttributesCount uint32 `protobuf:"varint,4,opt,name=dropped_attributes_count,json=droppedAttributesCount,proto3" json:"dropped_attributes_count,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Span_Event) Reset() { *m = Span_Event{} } -func (m *Span_Event) String() string { return proto.CompactTextString(m) } -func (*Span_Event) ProtoMessage() {} -func (*Span_Event) Descriptor() ([]byte, []int) { - return fileDescriptor_5c407ac9c675a601, []int{2, 0} -} - -func (m *Span_Event) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Span_Event.Unmarshal(m, b) -} -func (m *Span_Event) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Span_Event.Marshal(b, m, deterministic) -} -func (m *Span_Event) XXX_Merge(src proto.Message) { - xxx_messageInfo_Span_Event.Merge(m, src) -} -func (m *Span_Event) XXX_Size() int { - return xxx_messageInfo_Span_Event.Size(m) -} -func (m *Span_Event) XXX_DiscardUnknown() { - xxx_messageInfo_Span_Event.DiscardUnknown(m) -} - -var xxx_messageInfo_Span_Event proto.InternalMessageInfo - -func (m *Span_Event) GetTimeUnixNano() uint64 { - if m != nil { - return m.TimeUnixNano - } - return 0 -} - -func (m *Span_Event) GetName() string { - if m != nil { - return m.Name - } - return "" -} - -func (m *Span_Event) GetAttributes() []*v11.AttributeKeyValue { - if m != nil { - return m.Attributes - } - return nil -} - -func (m *Span_Event) GetDroppedAttributesCount() uint32 { - if m != nil { - return m.DroppedAttributesCount - } - return 0 -} - -// A pointer from the current span to another span in the same trace or in a -// different trace. For example, this can be used in batching operations, -// where a single batch handler processes multiple requests from different -// traces or when the handler receives a request from a different project. -type Span_Link struct { - // A unique identifier of a trace that this linked span is part of. The ID is a - // 16-byte array. - TraceId []byte `protobuf:"bytes,1,opt,name=trace_id,json=traceId,proto3" json:"trace_id,omitempty"` - // A unique identifier for the linked span. The ID is an 8-byte array. - SpanId []byte `protobuf:"bytes,2,opt,name=span_id,json=spanId,proto3" json:"span_id,omitempty"` - // The trace_state associated with the link. - TraceState string `protobuf:"bytes,3,opt,name=trace_state,json=traceState,proto3" json:"trace_state,omitempty"` - // attributes is a collection of attribute key/value pairs on the link. - Attributes []*v11.AttributeKeyValue `protobuf:"bytes,4,rep,name=attributes,proto3" json:"attributes,omitempty"` - // dropped_attributes_count is the number of dropped attributes. If the value is 0, - // then no attributes were dropped. - DroppedAttributesCount uint32 `protobuf:"varint,5,opt,name=dropped_attributes_count,json=droppedAttributesCount,proto3" json:"dropped_attributes_count,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Span_Link) Reset() { *m = Span_Link{} } -func (m *Span_Link) String() string { return proto.CompactTextString(m) } -func (*Span_Link) ProtoMessage() {} -func (*Span_Link) Descriptor() ([]byte, []int) { - return fileDescriptor_5c407ac9c675a601, []int{2, 1} -} - -func (m *Span_Link) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Span_Link.Unmarshal(m, b) -} -func (m *Span_Link) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Span_Link.Marshal(b, m, deterministic) -} -func (m *Span_Link) XXX_Merge(src proto.Message) { - xxx_messageInfo_Span_Link.Merge(m, src) -} -func (m *Span_Link) XXX_Size() int { - return xxx_messageInfo_Span_Link.Size(m) -} -func (m *Span_Link) XXX_DiscardUnknown() { - xxx_messageInfo_Span_Link.DiscardUnknown(m) -} - -var xxx_messageInfo_Span_Link proto.InternalMessageInfo - -func (m *Span_Link) GetTraceId() []byte { - if m != nil { - return m.TraceId - } - return nil -} - -func (m *Span_Link) GetSpanId() []byte { - if m != nil { - return m.SpanId - } - return nil -} - -func (m *Span_Link) GetTraceState() string { - if m != nil { - return m.TraceState - } - return "" -} - -func (m *Span_Link) GetAttributes() []*v11.AttributeKeyValue { - if m != nil { - return m.Attributes - } - return nil -} - -func (m *Span_Link) GetDroppedAttributesCount() uint32 { - if m != nil { - return m.DroppedAttributesCount - } - return 0 -} - -// The Status type defines a logical error model that is suitable for different -// programming environments, including REST APIs and RPC APIs. -type Status struct { - // The status code. This is optional field. It is safe to assume 0 (OK) - // when not set. - Code Status_StatusCode `protobuf:"varint,1,opt,name=code,proto3,enum=opentelemetry.proto.trace.v1.Status_StatusCode" json:"code,omitempty"` - // A developer-facing human readable error message. - Message string `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Status) Reset() { *m = Status{} } -func (m *Status) String() string { return proto.CompactTextString(m) } -func (*Status) ProtoMessage() {} -func (*Status) Descriptor() ([]byte, []int) { - return fileDescriptor_5c407ac9c675a601, []int{3} -} - -func (m *Status) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Status.Unmarshal(m, b) -} -func (m *Status) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Status.Marshal(b, m, deterministic) -} -func (m *Status) XXX_Merge(src proto.Message) { - xxx_messageInfo_Status.Merge(m, src) -} -func (m *Status) XXX_Size() int { - return xxx_messageInfo_Status.Size(m) -} -func (m *Status) XXX_DiscardUnknown() { - xxx_messageInfo_Status.DiscardUnknown(m) -} - -var xxx_messageInfo_Status proto.InternalMessageInfo - -func (m *Status) GetCode() Status_StatusCode { - if m != nil { - return m.Code - } - return Status_Ok -} - -func (m *Status) GetMessage() string { - if m != nil { - return m.Message - } - return "" -} - -func init() { - proto.RegisterEnum("opentelemetry.proto.trace.v1.Span_SpanKind", Span_SpanKind_name, Span_SpanKind_value) - proto.RegisterEnum("opentelemetry.proto.trace.v1.Status_StatusCode", Status_StatusCode_name, Status_StatusCode_value) - proto.RegisterType((*ResourceSpans)(nil), "opentelemetry.proto.trace.v1.ResourceSpans") - proto.RegisterType((*InstrumentationLibrarySpans)(nil), "opentelemetry.proto.trace.v1.InstrumentationLibrarySpans") - proto.RegisterType((*Span)(nil), "opentelemetry.proto.trace.v1.Span") - proto.RegisterType((*Span_Event)(nil), "opentelemetry.proto.trace.v1.Span.Event") - proto.RegisterType((*Span_Link)(nil), "opentelemetry.proto.trace.v1.Span.Link") - proto.RegisterType((*Status)(nil), "opentelemetry.proto.trace.v1.Status") -} - -func init() { - proto.RegisterFile("opentelemetry/proto/trace/v1/trace.proto", fileDescriptor_5c407ac9c675a601) -} - -var fileDescriptor_5c407ac9c675a601 = []byte{ - // 1008 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x56, 0xcd, 0x6e, 0x1b, 0x37, - 0x10, 0xce, 0xea, 0xdf, 0xa3, 0x1f, 0xaf, 0x19, 0xc7, 0xd9, 0x38, 0x2d, 0x22, 0x08, 0x01, 0xaa, - 0x36, 0x88, 0x14, 0xbb, 0x28, 0x90, 0x02, 0x0d, 0x5a, 0x45, 0x5a, 0x03, 0x82, 0x5d, 0x59, 0xa0, - 0xac, 0x1c, 0x7a, 0x59, 0x50, 0x22, 0x2b, 0x13, 0x5e, 0x91, 0xc2, 0x2e, 0x57, 0xb5, 0x0f, 0xbd, - 0xf5, 0x5d, 0xfa, 0x14, 0x3d, 0xf7, 0xd4, 0x63, 0x9f, 0xa1, 0xaf, 0x51, 0x90, 0xbb, 0x6b, 0x5b, - 0x81, 0x2c, 0xfb, 0xe2, 0x8b, 0x44, 0xce, 0x7c, 0xdf, 0x7c, 0x33, 0x9c, 0x59, 0x90, 0xd0, 0x94, - 0x0b, 0x26, 0x14, 0xf3, 0xd9, 0x9c, 0xa9, 0xe0, 0xaa, 0xbd, 0x08, 0xa4, 0x92, 0x6d, 0x15, 0x90, - 0x29, 0x6b, 0x2f, 0x0f, 0xe2, 0x45, 0xcb, 0x18, 0xd1, 0x17, 0x2b, 0xc8, 0xd8, 0xd8, 0x8a, 0x01, - 0xcb, 0x83, 0xfd, 0x6f, 0xd6, 0xc5, 0x99, 0xca, 0xf9, 0x5c, 0x0a, 0x1d, 0x28, 0x5e, 0xc5, 0xa4, - 0xfd, 0xd6, 0x3a, 0x6c, 0xc0, 0x42, 0x19, 0x05, 0xb1, 0x6c, 0xba, 0x8e, 0xf1, 0x8d, 0x7f, 0x2d, - 0xa8, 0xe2, 0xc4, 0x34, 0x5a, 0x10, 0x11, 0x22, 0x17, 0x4a, 0x29, 0xc6, 0xb1, 0xea, 0x56, 0xb3, - 0x7c, 0xf8, 0x75, 0x6b, 0x5d, 0x7a, 0xd7, 0x81, 0x96, 0x07, 0xad, 0x34, 0x02, 0xbe, 0xa6, 0xa2, - 0xdf, 0xe1, 0x4b, 0x2e, 0x42, 0x15, 0x44, 0x73, 0x26, 0x14, 0x51, 0x5c, 0x0a, 0xcf, 0xe7, 0x93, - 0x80, 0x04, 0x57, 0x5e, 0xa8, 0x75, 0x9c, 0x4c, 0x3d, 0xdb, 0x2c, 0x1f, 0x7e, 0xdf, 0xda, 0x54, - 0x7a, 0xab, 0xbf, 0x1a, 0xe2, 0x24, 0x8e, 0x60, 0x12, 0xc5, 0x2f, 0xf9, 0xdd, 0xce, 0xc6, 0xdf, - 0x16, 0xbc, 0xdc, 0x40, 0x46, 0x02, 0x9e, 0xdf, 0x91, 0x5e, 0x52, 0xf4, 0x77, 0x6b, 0x13, 0x4b, - 0xce, 0xfa, 0xce, 0xcc, 0xf0, 0xde, 0xfa, 0xa4, 0xd0, 0x7b, 0xc8, 0xdf, 0x2e, 0xbb, 0xb1, 0xb9, - 0x6c, 0x9d, 0x23, 0x8e, 0x09, 0x8d, 0x3f, 0x00, 0x72, 0x7a, 0x8f, 0x5e, 0x40, 0xc9, 0x00, 0x3c, - 0x4e, 0x4d, 0x8e, 0x15, 0x5c, 0x34, 0xfb, 0x3e, 0x45, 0xcf, 0xa1, 0xa8, 0xc1, 0xda, 0x93, 0x31, - 0x9e, 0x82, 0xde, 0xf6, 0x29, 0x7a, 0x05, 0xe5, 0x98, 0x13, 0x2a, 0xa2, 0x98, 0x93, 0xad, 0x5b, - 0xcd, 0x2d, 0x0c, 0xc6, 0x34, 0xd2, 0x16, 0xf4, 0x1a, 0x6a, 0x0b, 0x12, 0x30, 0xa1, 0xbc, 0x34, - 0x40, 0xce, 0x04, 0xa8, 0xc4, 0xd6, 0x51, 0x1c, 0x06, 0x41, 0x4e, 0x90, 0x39, 0x73, 0xf2, 0x86, - 0x6f, 0xd6, 0xe8, 0x47, 0xc8, 0x5d, 0x70, 0x41, 0x9d, 0x42, 0xdd, 0x6a, 0xd6, 0x0e, 0xdf, 0xdc, - 0x5f, 0x90, 0xf9, 0x39, 0xe6, 0x82, 0x62, 0x43, 0x44, 0x6d, 0xd8, 0x0d, 0x15, 0x09, 0x94, 0xa7, - 0xf8, 0x9c, 0x79, 0x91, 0xe0, 0x97, 0x9e, 0x20, 0x42, 0x3a, 0xc5, 0xba, 0xd5, 0x2c, 0xe0, 0x1d, - 0xe3, 0x3b, 0xe3, 0x73, 0x36, 0x16, 0xfc, 0x72, 0x40, 0x84, 0x44, 0x6f, 0x00, 0x31, 0x41, 0x3f, - 0x87, 0x97, 0x0c, 0x7c, 0x9b, 0x09, 0xba, 0x02, 0x1e, 0x02, 0x10, 0xa5, 0x02, 0x3e, 0x89, 0x14, - 0x0b, 0x9d, 0x2d, 0x73, 0xea, 0xef, 0xee, 0xe9, 0x69, 0x27, 0x25, 0x1c, 0xb3, 0xab, 0x4f, 0xc4, - 0x8f, 0x18, 0xbe, 0x15, 0x03, 0xbd, 0x07, 0x87, 0x06, 0x72, 0xb1, 0x60, 0xd4, 0xbb, 0xb1, 0x7a, - 0x53, 0x19, 0x09, 0xe5, 0x40, 0xdd, 0x6a, 0x56, 0xf1, 0x5e, 0xe2, 0xbf, 0x8e, 0x13, 0x76, 0xb5, - 0x17, 0xfd, 0x04, 0x05, 0xb6, 0x64, 0x42, 0x85, 0x4e, 0xd9, 0xe4, 0xd1, 0x7c, 0xc0, 0x61, 0xb9, - 0x9a, 0x80, 0x13, 0x1e, 0x7a, 0x07, 0xbb, 0xa9, 0x76, 0x6c, 0x49, 0x74, 0x2b, 0x46, 0x17, 0x25, - 0x3e, 0xc3, 0x49, 0x34, 0x3f, 0x40, 0xde, 0xe7, 0xe2, 0x22, 0x74, 0xaa, 0x46, 0xf2, 0xab, 0x07, - 0x48, 0x9e, 0x70, 0x71, 0x81, 0x63, 0x16, 0x6a, 0xc1, 0xd3, 0x54, 0xd0, 0x18, 0x12, 0xbd, 0x9a, - 0xd1, 0xdb, 0x49, 0x5c, 0x9a, 0x90, 0xc8, 0xfd, 0x00, 0x05, 0x3d, 0x62, 0x51, 0xe8, 0x6c, 0x9b, - 0xcf, 0xe7, 0xf5, 0x3d, 0x7a, 0x06, 0x8b, 0x13, 0xce, 0xfe, 0x3f, 0x16, 0xe4, 0x4d, 0xf2, 0x7a, - 0x1e, 0x3f, 0xeb, 0xaf, 0x65, 0xfa, 0x5b, 0x51, 0xb7, 0x9b, 0x9b, 0xce, 0x63, 0xe6, 0xd6, 0x3c, - 0xae, 0x36, 0x3c, 0xfb, 0xc8, 0x0d, 0xcf, 0x6d, 0x6a, 0xf8, 0xfe, 0x7f, 0x16, 0xe4, 0xf4, 0xe1, - 0x3c, 0xce, 0x37, 0xbb, 0x5a, 0x69, 0xee, 0x91, 0x2b, 0xcd, 0x6f, 0xaa, 0xb4, 0x31, 0x83, 0x52, - 0xfa, 0x59, 0xa3, 0x17, 0xf0, 0x6c, 0x34, 0xec, 0x0c, 0xbc, 0xe3, 0xfe, 0xa0, 0xe7, 0x8d, 0x07, - 0xa3, 0xa1, 0xdb, 0xed, 0x1f, 0xf5, 0xdd, 0x9e, 0xfd, 0x04, 0x55, 0xa0, 0xd4, 0x1f, 0x9c, 0xb9, - 0x78, 0xd0, 0x39, 0xb1, 0x2d, 0x04, 0x50, 0x18, 0xb9, 0xf8, 0x93, 0x8b, 0xed, 0x8c, 0x5e, 0x77, - 0x4f, 0xfa, 0xee, 0xe0, 0xcc, 0xce, 0x6a, 0xd4, 0x10, 0x9f, 0xf6, 0xc6, 0x5d, 0x17, 0xdb, 0x39, - 0xbd, 0xeb, 0x9e, 0x0e, 0x46, 0xe3, 0x9f, 0x5d, 0x6c, 0xe7, 0x1b, 0x7f, 0x66, 0xa1, 0x10, 0x4f, - 0x0d, 0xea, 0x42, 0x6e, 0x2a, 0x69, 0x7c, 0x3b, 0xd5, 0x0e, 0xdb, 0x0f, 0x99, 0xb4, 0xe4, 0xaf, - 0x2b, 0x29, 0xc3, 0x86, 0x8c, 0x1c, 0x28, 0xce, 0x59, 0x18, 0x92, 0x59, 0x3a, 0x45, 0xe9, 0xb6, - 0xf1, 0x57, 0x06, 0xe0, 0x06, 0x8e, 0x0a, 0x90, 0x39, 0xbd, 0xb0, 0x9f, 0xa0, 0x2a, 0x6c, 0x75, - 0x89, 0x98, 0x32, 0xdf, 0x67, 0xd4, 0xb6, 0x90, 0x0d, 0x95, 0xb1, 0xb8, 0x10, 0xf2, 0x37, 0xe1, - 0x06, 0x81, 0x0c, 0xec, 0x0c, 0x7a, 0x0a, 0xdb, 0x7d, 0xb1, 0x24, 0x3e, 0xa7, 0x9d, 0x60, 0x66, - 0x6e, 0x00, 0x3b, 0x8b, 0x76, 0xc1, 0xee, 0x31, 0x42, 0x7d, 0x2e, 0x98, 0x7b, 0x39, 0x65, 0x8c, - 0x32, 0x1a, 0x97, 0x36, 0x90, 0xea, 0x48, 0x46, 0x82, 0xda, 0x79, 0xb4, 0x03, 0xd5, 0x8e, 0x1f, - 0x30, 0x42, 0xaf, 0xdc, 0x4b, 0x1e, 0xaa, 0xd0, 0x2e, 0x68, 0xda, 0x90, 0x05, 0x73, 0x1e, 0x86, - 0x5c, 0x8a, 0x1e, 0x13, 0x9c, 0x51, 0xbb, 0x88, 0x9e, 0xc1, 0x4e, 0x7a, 0xd3, 0xba, 0x97, 0xe7, - 0x24, 0x0a, 0x15, 0xa3, 0x76, 0x09, 0xed, 0x01, 0x3a, 0x22, 0xdc, 0x67, 0x74, 0x18, 0xb0, 0xa9, - 0x14, 0x94, 0xeb, 0x8b, 0xc7, 0xde, 0x42, 0x65, 0x28, 0x76, 0x26, 0x32, 0xd0, 0x20, 0x40, 0x35, - 0x80, 0xd3, 0x48, 0x9d, 0xfe, 0x8a, 0x89, 0x98, 0x31, 0xbb, 0xac, 0x45, 0xc7, 0x82, 0xcf, 0x17, - 0xfa, 0xd8, 0x84, 0x86, 0x54, 0xb4, 0xa9, 0x2f, 0x14, 0x0b, 0x04, 0xf1, 0xe3, 0x9a, 0xaa, 0x68, - 0x1b, 0xca, 0x63, 0x41, 0x96, 0x84, 0xfb, 0x64, 0xe2, 0x33, 0xbb, 0xa6, 0x33, 0xef, 0x11, 0x45, - 0x4e, 0x64, 0x18, 0xda, 0xdb, 0xba, 0xe4, 0xb1, 0x20, 0x91, 0x3a, 0x67, 0x42, 0xf1, 0x29, 0xd1, - 0x61, 0xec, 0x8f, 0x02, 0x5e, 0x71, 0xb9, 0xb1, 0x29, 0x1f, 0xe1, 0x4c, 0xaf, 0x86, 0xda, 0x38, - 0xb4, 0x7e, 0xf9, 0x30, 0xe3, 0xea, 0x3c, 0x9a, 0xe8, 0x69, 0x6d, 0x6b, 0xda, 0xdb, 0x9b, 0xf7, - 0xcb, 0x4a, 0x94, 0xb7, 0xf1, 0x6b, 0x66, 0xc6, 0x44, 0x7b, 0x76, 0xf3, 0x90, 0x9a, 0x14, 0x8c, - 0xf9, 0xdb, 0xff, 0x03, 0x00, 0x00, 0xff, 0xff, 0x17, 0xf4, 0x60, 0x4c, 0x6f, 0x09, 0x00, 0x00, -} diff --git a/packages/opentelemetry-exporter-collector/src/platform/node/protos/install-proto-osx.sh b/packages/opentelemetry-exporter-collector/src/platform/node/protos/install-proto-osx.sh deleted file mode 100755 index c1e86e48b3..0000000000 --- a/packages/opentelemetry-exporter-collector/src/platform/node/protos/install-proto-osx.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/usr/bin/env bash - -set -e - -DIR="${DIR:-/tmp}" -cd ${DIR} - -wget https://github.com/grpc-ecosystem/grpc-gateway/releases/download/v1.9.6/protoc-gen-swagger-v1.9.6-darwin-x86_64 \ - && chmod +x protoc-gen-swagger-v1.9.6-darwin-x86_64 \ - && sudo ln -s -f ${DIR}/protoc-gen-swagger-v1.9.6-darwin-x86_64 /usr/local/bin/protoc-gen-swagger - -wget https://github.com/grpc-ecosystem/grpc-gateway/releases/download/v1.9.6/protoc-gen-grpc-gateway-v1.9.6-darwin-x86_64 \ - && chmod +x protoc-gen-grpc-gateway-v1.9.6-darwin-x86_64 \ - && sudo ln -s -f ${DIR}/protoc-gen-grpc-gateway-v1.9.6-darwin-x86_64 /usr/local/bin/protoc-gen-grpc-gateway - -wget https://github.com/protocolbuffers/protobuf/releases/download/v3.9.1/protoc-3.9.1-osx-x86_64.zip \ - && unzip protoc-3.9.1-osx-x86_64.zip \ - && sudo ln -s -f ${DIR}/bin/protoc /usr/local/bin/protoc - -GIT_TAG="v1.3.2" -go get -d -u github.com/golang/protobuf/protoc-gen-go -git -C "$(go env GOPATH)"/src/github.com/golang/protobuf checkout $GIT_TAG -go install github.com/golang/protobuf/protoc-gen-go diff --git a/packages/opentelemetry-exporter-collector/src/platform/node/protos/install-proto.sh b/packages/opentelemetry-exporter-collector/src/platform/node/protos/install-proto.sh deleted file mode 100755 index f33c0a1d8e..0000000000 --- a/packages/opentelemetry-exporter-collector/src/platform/node/protos/install-proto.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/usr/bin/env bash - -set -e - -DIR="${DIR:-/tmp}" -cd ${DIR} - -wget https://github.com/grpc-ecosystem/grpc-gateway/releases/download/v1.9.6/protoc-gen-swagger-v1.9.6-linux-x86_64 \ - && chmod +x protoc-gen-swagger-v1.9.6-linux-x86_64 \ - && sudo ln -s ${DIR}/protoc-gen-swagger-v1.9.6-linux-x86_64 /usr/bin/protoc-gen-swagger - -wget https://github.com/grpc-ecosystem/grpc-gateway/releases/download/v1.9.6/protoc-gen-grpc-gateway-v1.9.6-linux-x86_64 \ - && chmod +x protoc-gen-grpc-gateway-v1.9.6-linux-x86_64 \ - && sudo ln -s -f ${DIR}/protoc-gen-grpc-gateway-v1.9.6-linux-x86_64 /usr/local/bin/protoc-gen-grpc-gateway - -wget https://github.com/protocolbuffers/protobuf/releases/download/v3.9.1/protoc-3.9.1-linux-x86_64.zip \ - && unzip protoc-3.9.1-linux-x86_64.zip \ - && sudo ln -s ${DIR}/bin/protoc /usr/bin/protoc - -GIT_TAG="v1.3.2" -go get -d -u github.com/golang/protobuf/protoc-gen-go -git -C "$(go env GOPATH)"/src/github.com/golang/protobuf checkout $GIT_TAG -go install github.com/golang/protobuf/protoc-gen-go diff --git a/packages/opentelemetry-exporter-collector/src/platform/node/protos/makefile b/packages/opentelemetry-exporter-collector/src/platform/node/protos/makefile deleted file mode 100755 index 6635b904a4..0000000000 --- a/packages/opentelemetry-exporter-collector/src/platform/node/protos/makefile +++ /dev/null @@ -1,46 +0,0 @@ -GOPATH_DIR := $(GOPATH)/src/github.com/open-telemetry/opentelemetry-proto -GENDIR := gen -OPENAPI_OUTDIR := "./$(GENDIR)/openapi" -GOPATH_GENDIR := $(GOPATH_DIR)/$(GENDIR) - -# Find all .proto files. -PROTO_FILES := $(wildcard opentelemetry/proto/*/v1/*.proto opentelemetry/proto/collector/*/v1/*.proto) - -# Function to execute a command. Note the empty line before endef to make sure each command -# gets executed separately instead of concatenated with previous one. -# Accepts command to execute as first parameter. -define exec-command -$(1) - -endef - -# CI build -.PHONY: ci -ci: gen-go gen-java gen-swagger - -# Generate ProtoBuf implementation for Go. -.PHONY: gen-go -gen-go: - rm -rf ./$(GENDIR)/go - $(foreach file,$(PROTO_FILES),$(call exec-command,protoc --go_out=plugins=grpc:$(GOPATH)/src $(file))) - protoc --grpc-gateway_out=logtostderr=true,grpc_api_configuration=opentelemetry/proto/collector/trace/v1/trace_service_http.yaml:$(GOPATH)/src opentelemetry/proto/collector/trace/v1/trace_service.proto - protoc --grpc-gateway_out=logtostderr=true,grpc_api_configuration=opentelemetry/proto/collector/metrics/v1/metrics_service_http.yaml:$(GOPATH)/src opentelemetry/proto/collector/metrics/v1/metrics_service.proto -# Only need to copy generated files if repo was checked out -# into a directory different from the standard GOPATH based one. -ifneq ($(PWD), $(GOPATH_DIR)) - cp -R $(GOPATH_GENDIR)/go ./$(GENDIR)/ -endif - -# Generate ProtoBuf implementation for Java. -.PHONY: gen-java -gen-java: - rm -rf ./$(GENDIR)/java - mkdir -p ./$(GENDIR)/java - $(foreach file,$(PROTO_FILES),$(call exec-command, protoc --java_out=./$(GENDIR)/java $(file))) - -# Generate Swagger -.PHONY: gen-swagger -gen-swagger: - mkdir -p $(OPENAPI_OUTDIR) - protoc --plugin=protoc-gen-swagger=/usr/bin/protoc-gen-swagger --swagger_out=logtostderr=true,grpc_api_configuration=opentelemetry/proto/collector/trace/v1/trace_service_http.yaml:$(OPENAPI_OUTDIR) opentelemetry/proto/collector/trace/v1/trace_service.proto - protoc --plugin=protoc-gen-swagger=/usr/bin/protoc-gen-swagger --swagger_out=logtostderr=true,grpc_api_configuration=opentelemetry/proto/collector/metrics/v1/metrics_service_http.yaml:$(OPENAPI_OUTDIR) opentelemetry/proto/collector/metrics/v1/metrics_service.proto diff --git a/packages/opentelemetry-exporter-collector/src/platform/node/protos/opentelemetry/proto/collector/README.md b/packages/opentelemetry-exporter-collector/src/platform/node/protos/opentelemetry/proto/collector/README.md deleted file mode 100644 index 4a73a31ed8..0000000000 --- a/packages/opentelemetry-exporter-collector/src/platform/node/protos/opentelemetry/proto/collector/README.md +++ /dev/null @@ -1,9 +0,0 @@ -# OpenTelemetry Collector Proto - -This package describes the OpenTelemetry collector protocol. - -## Packages - -1. `common` package contains the common messages shared between different services. -2. `trace` package contains the Trace Service protos. -3. `metrics` package contains the Metrics Service protos. diff --git a/packages/opentelemetry-exporter-collector/src/platform/node/protos/opentelemetry/proto/collector/metrics/v1/metrics_service.proto b/packages/opentelemetry-exporter-collector/src/platform/node/protos/opentelemetry/proto/collector/metrics/v1/metrics_service.proto deleted file mode 100644 index 5a3cbee4c9..0000000000 --- a/packages/opentelemetry-exporter-collector/src/platform/node/protos/opentelemetry/proto/collector/metrics/v1/metrics_service.proto +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2019, 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 -// -// http://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. - -syntax = "proto3"; - -package opentelemetry.proto.collector.metrics.v1; - -import "opentelemetry/proto/metrics/v1/metrics.proto"; - -option java_multiple_files = true; -option java_package = "io.opentelemetry.proto.collector.metrics.v1"; -option java_outer_classname = "MetricsServiceProto"; -option go_package = "github.com/open-telemetry/opentelemetry-proto/gen/go/collector/metrics/v1"; - -// Service that can be used to push metrics between one Application -// instrumented with OpenTelemetry and a collector, or between a collector and a -// central collector. -service MetricsService { - // For performance reasons, it is recommended to keep this RPC - // alive for the entire life of the application. - rpc Export(ExportMetricsServiceRequest) returns (ExportMetricsServiceResponse) {} -} - -message ExportMetricsServiceRequest { - // An array of ResourceMetrics. - // For data coming from a single resource this array will typically contain one - // element. Intermediary nodes (such as OpenTelemetry Collector) that receive - // data from multiple origins typically batch the data before forwarding further and - // in that case this array will contain multiple elements. - repeated opentelemetry.proto.metrics.v1.ResourceMetrics resource_metrics = 1; -} - -message ExportMetricsServiceResponse { -} diff --git a/packages/opentelemetry-exporter-collector/src/platform/node/protos/opentelemetry/proto/collector/metrics/v1/metrics_service_http.yaml b/packages/opentelemetry-exporter-collector/src/platform/node/protos/opentelemetry/proto/collector/metrics/v1/metrics_service_http.yaml deleted file mode 100644 index a545650260..0000000000 --- a/packages/opentelemetry-exporter-collector/src/platform/node/protos/opentelemetry/proto/collector/metrics/v1/metrics_service_http.yaml +++ /dev/null @@ -1,9 +0,0 @@ -# This is an API configuration to generate an HTTP/JSON -> gRPC gateway for the -# OpenTelemetry service using github.com/grpc-ecosystem/grpc-gateway. -type: google.api.Service -config_version: 3 -http: - rules: - - selector: opentelemetry.proto.collector.metrics.v1.MetricsService.Export - post: /v1/metrics - body: "*" \ No newline at end of file diff --git a/packages/opentelemetry-exporter-collector/src/platform/node/protos/opentelemetry/proto/collector/trace/v1/trace_service.proto b/packages/opentelemetry-exporter-collector/src/platform/node/protos/opentelemetry/proto/collector/trace/v1/trace_service.proto deleted file mode 100644 index 16784c666a..0000000000 --- a/packages/opentelemetry-exporter-collector/src/platform/node/protos/opentelemetry/proto/collector/trace/v1/trace_service.proto +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright 2019, 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 -// -// http://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. - -syntax = "proto3"; - -// NOTE: This proto is experimental and is subject to change at this point. -// Please do not use it at the moment. - -package opentelemetry.proto.collector.trace.v1; - -import "opentelemetry/proto/trace/v1/trace.proto"; - -option java_multiple_files = true; -option java_package = "io.opentelemetry.proto.collector.trace.v1"; -option java_outer_classname = "TraceServiceProto"; -option go_package = "github.com/open-telemetry/opentelemetry-proto/gen/go/collector/trace/v1"; - -// Service that can be used to push spans between one Application instrumented with -// OpenTelemetry and an collector, or between an collector and a central collector (in this -// case spans are sent/received to/from multiple Applications). -service TraceService { - // For performance reasons, it is recommended to keep this RPC - // alive for the entire life of the application. - rpc Export(ExportTraceServiceRequest) returns (ExportTraceServiceResponse) {} -} - -message ExportTraceServiceRequest { - // An array of ResourceSpans. - // For data coming from a single resource this array will typically contain one - // element. Intermediary nodes (such as OpenTelemetry Collector) that receive - // data from multiple origins typically batch the data before forwarding further and - // in that case this array will contain multiple elements. - repeated opentelemetry.proto.trace.v1.ResourceSpans resource_spans = 1; -} - -message ExportTraceServiceResponse { -} diff --git a/packages/opentelemetry-exporter-collector/src/platform/node/protos/opentelemetry/proto/collector/trace/v1/trace_service_http.yaml b/packages/opentelemetry-exporter-collector/src/platform/node/protos/opentelemetry/proto/collector/trace/v1/trace_service_http.yaml deleted file mode 100644 index 287473597c..0000000000 --- a/packages/opentelemetry-exporter-collector/src/platform/node/protos/opentelemetry/proto/collector/trace/v1/trace_service_http.yaml +++ /dev/null @@ -1,9 +0,0 @@ -# This is an API configuration to generate an HTTP/JSON -> gRPC gateway for the -# OpenTelemetry service using github.com/grpc-ecosystem/grpc-gateway. -type: google.api.Service -config_version: 3 -http: - rules: - - selector: opentelemetry.proto.collector.trace.v1.TraceService.Export - post: /v1/trace - body: "*" \ No newline at end of file diff --git a/packages/opentelemetry-exporter-collector/src/platform/node/protos/opentelemetry/proto/common/v1/common.proto b/packages/opentelemetry-exporter-collector/src/platform/node/protos/opentelemetry/proto/common/v1/common.proto deleted file mode 100644 index 45fbcdb755..0000000000 --- a/packages/opentelemetry-exporter-collector/src/platform/node/protos/opentelemetry/proto/common/v1/common.proto +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2019, 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 -// -// http://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. - -syntax = "proto3"; - -package opentelemetry.proto.common.v1; - -option java_multiple_files = true; -option java_package = "io.opentelemetry.proto.common.v1"; -option java_outer_classname = "CommonProto"; -option go_package = "github.com/open-telemetry/opentelemetry-proto/gen/go/common/v1"; - -// AttributeKeyValue is a key-value pair that is used to store Span attributes, Link -// attributes, etc. -message AttributeKeyValue { - // ValueType is the enumeration of possible types that value can have. - enum ValueType { - STRING = 0; - INT = 1; - DOUBLE = 2; - BOOL = 3; - }; - - // key part of the key-value pair. - string key = 1; - - // type of the value. - ValueType type = 2; - - // Only one of the following fields is supposed to contain data (determined by `type` field). - // This is deliberately not using Protobuf `oneof` for performance reasons (verified by benchmarks). - - string string_value = 3; - int64 int_value = 4; - double double_value = 5; - bool bool_value = 6; -} - -// StringKeyValue is a pair of key/value strings. This is the simpler (and faster) version -// of AttributeKeyValue that only supports string values. -message StringKeyValue { - string key = 1; - string value = 2; -} - -// InstrumentationLibrary is a message representing the instrumentation library information -// such as the fully qualified name and version. -message InstrumentationLibrary { - string name = 1; - string version = 2; -} diff --git a/packages/opentelemetry-exporter-collector/src/platform/node/protos/opentelemetry/proto/metrics/v1/metrics.proto b/packages/opentelemetry-exporter-collector/src/platform/node/protos/opentelemetry/proto/metrics/v1/metrics.proto deleted file mode 100644 index ebfb242712..0000000000 --- a/packages/opentelemetry-exporter-collector/src/platform/node/protos/opentelemetry/proto/metrics/v1/metrics.proto +++ /dev/null @@ -1,372 +0,0 @@ -// Copyright 2019, 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 -// -// http://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. - -syntax = "proto3"; - -package opentelemetry.proto.metrics.v1; - -import "opentelemetry/proto/common/v1/common.proto"; -import "opentelemetry/proto/resource/v1/resource.proto"; - -option java_multiple_files = true; -option java_package = "io.opentelemetry.proto.metrics.v1"; -option java_outer_classname = "MetricsProto"; -option go_package = "github.com/open-telemetry/opentelemetry-proto/gen/go/metrics/v1"; - -// A collection of InstrumentationLibraryMetrics from a Resource. -message ResourceMetrics { - // The resource for the metrics in this message. - // If this field is not set then no resource info is known. - opentelemetry.proto.resource.v1.Resource resource = 1; - - // A list of metrics that originate from a resource. - repeated InstrumentationLibraryMetrics instrumentation_library_metrics = 2; -} - -// A collection of Metrics produced by an InstrumentationLibrary. -message InstrumentationLibraryMetrics { - // The instrumentation library information for the metrics in this message. - // If this field is not set then no library info is known. - opentelemetry.proto.common.v1.InstrumentationLibrary instrumentation_library = 1; - - // A list of metrics that originate from an instrumentation library. - repeated Metric metrics = 2; -} - -// Defines a Metric which has one or more timeseries. -// -// The data model and relation between entities is shown in the diagram below. -// -// - Metric is composed of a MetricDescriptor and a list of data points. -// - MetricDescriptor contains a list of label keys (shown horizontally). -// - Data is a list of DataPoints (shown vertically). -// - DataPoint contains a list of label values and a value. -// -// Metric -// +----------+ +------------------------+ -// |descriptor|-------->| MetricDescriptor | -// | | |+-----+-----+ +-----+ | -// | | ||label|label|...|label| | -// | data|--+ ||key1 |key2 | |keyN | | -// +----------+ | |+-----+-----+ +-----+ | -// | +------------------------+ -// | -// | +---------------------------+ -// | |DataPoint 1 | -// v |+------+------+ +------+ | -// +-----+ ||label |label |...|label | | -// | 1 |-->||value1|value2|...|valueN| | -// +-----+ |+------+------+ +------+ | -// | . | |+-----+ | -// | . | ||value| | -// | . | |+-----+ | -// | . | +---------------------------+ -// | . | . -// | . | . -// | . | . -// | . | +---------------------------+ -// | . | |DataPoint M | -// +-----+ |+------+------+ +------+ | -// | M |-->||label |label |...|label | | -// +-----+ ||value1|value2|...|valueN| | -// |+------+------+ +------+ | -// |+-----+ | -// ||value| | -// |+-----+ | -// +---------------------------+ -// -//----------------------------------------------------------------------- -// DataPoint is a value of specific type corresponding to a given moment in -// time. Each DataPoint is timestamped. -// -// DataPoint is strongly typed: each DataPoint type has a specific Protobuf message -// depending on the value type of the metric and thus there are currently 4 DataPoint -// messages, which correspond to the types of metric values. -message Metric { - // metric_descriptor describes the Metric. - MetricDescriptor metric_descriptor = 1; - - // Data is a list of one or more DataPoints for a single metric. Only one of the - // following fields is used for the data, depending on the type of the metric defined - // by MetricDescriptor.type field. - repeated Int64DataPoint int64_data_points = 2; - repeated DoubleDataPoint double_data_points = 3; - repeated HistogramDataPoint histogram_data_points = 4; - repeated SummaryDataPoint summary_data_points = 5; -} - -// Defines a metric type and its schema. -message MetricDescriptor { - // name of the metric, including its DNS name prefix. It must be unique. - string name = 1; - - // description of the metric, which can be used in documentation. - string description = 2; - - // unit in which the metric value is reported. Follows the format - // described by http://unitsofmeasure.org/ucum.html. - string unit = 3; - - // Type of the metric. It describes how the data is reported. - // - // A gauge is an instantaneous measurement of a value. - // - // A counter/cumulative measurement is a value accumulated over a time - // interval. In a time series, cumulative measurements should have the same - // start time, increasing values, until an event resets the cumulative value - // to zero and sets a new start time for the subsequent points. - enum Type { - // Do not use this default value. - UNSPECIFIED = 0; - - // Integer gauge. The value can go both up and down over time. - // Corresponding values are stored in Int64DataPoint. - GAUGE_INT64 = 1; - - // Floating point gauge. The value can go both up and down over time. - // Corresponding values are stored in DoubleDataPoint. - GAUGE_DOUBLE = 2; - - // Histogram gauge measurement. - // Used in scenarios like a snapshot of time that current items in a queue - // have spent there. - // Corresponding values are stored in HistogramDataPoint. The count and sum of the - // histogram can go both up and down over time. Recorded values are always >= 0. - GAUGE_HISTOGRAM = 3; - - // Integer counter measurement. The value cannot decrease; if value is reset then - // start_time_unix_nano should also be reset. - // Corresponding values are stored in Int64DataPoint. - COUNTER_INT64 = 4; - - // Floating point counter measurement. The value cannot decrease, if - // resets then the start_time_unix_nano should also be reset. - // Recorded values are always >= 0. - // Corresponding values are stored in DoubleDataPoint. - COUNTER_DOUBLE = 5; - - // Histogram cumulative measurement. - // Corresponding values are stored in HistogramDataPoint. The count and sum of the - // histogram cannot decrease; if values are reset then start_time_unix_nano - // should also be reset to the new start timestamp. - CUMULATIVE_HISTOGRAM = 6; - - // Summary value. Some frameworks implemented Histograms as a summary of observations - // (usually things like request durations and response sizes). While it - // also provides a total count of observations and a sum of all observed - // values, it calculates configurable percentiles over a sliding time - // window. - // Corresponding values are stored in SummaryDataPoint. - SUMMARY = 7; - } - Type type = 4; - - // The set of labels associated with the metric descriptor. Labels in this list apply to - // all data points. - repeated opentelemetry.proto.common.v1.StringKeyValue labels = 5; -} - -// Int64DataPoint is a single data point in a timeseries that describes the time-varying -// values of a int64 metric. -message Int64DataPoint { - // The set of labels that uniquely identify this timeseries. - repeated opentelemetry.proto.common.v1.StringKeyValue labels = 1; - - // start_time_unix_nano is the time when the cumulative value was reset to zero. - // This is used for Counter type only. For Gauge the value is not specified and - // defaults to 0. - // - // The cumulative value is over the time interval (start_time_unix_nano, time_unix_nano]. - // Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January 1970. - // - // Value of 0 indicates that the timestamp is unspecified. In that case the timestamp - // may be decided by the backend. - fixed64 start_time_unix_nano = 2; - - // time_unix_nano is the moment when this value was recorded. - // Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January 1970. - fixed64 time_unix_nano = 3; - - // value itself. - int64 value = 4; -} - -// DoubleDataPoint is a single data point in a timeseries that describes the time-varying -// value of a double metric. -message DoubleDataPoint { - // The set of labels that uniquely identify this timeseries. - repeated opentelemetry.proto.common.v1.StringKeyValue labels = 1; - - // start_time_unix_nano is the time when the cumulative value was reset to zero. - // This is used for Counter type only. For Gauge the value is not specified and - // defaults to 0. - // - // The cumulative value is over the time interval (start_time_unix_nano, time_unix_nano]. - // Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January 1970. - // - // Value of 0 indicates that the timestamp is unspecified. In that case the timestamp - // may be decided by the backend. - fixed64 start_time_unix_nano = 2; - - // time_unix_nano is the moment when this value was recorded. - // Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January 1970. - fixed64 time_unix_nano = 3; - - // value itself. - double value = 4; -} - -// HistogramDataPoint is a single data point in a timeseries that describes the time-varying -// values of a Histogram. A Histogram contains summary statistics for a population of values, -// it may optionally contain the distribution of those values across a set of buckets. -message HistogramDataPoint { - // The set of labels that uniquely identify this timeseries. - repeated opentelemetry.proto.common.v1.StringKeyValue labels = 1; - - // start_time_unix_nano is the time when the cumulative value was reset to zero. - // - // The cumulative value is over the time interval (start_time_unix_nano, time_unix_nano]. - // Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January 1970. - // - // Value of 0 indicates that the timestamp is unspecified. In that case the timestamp - // may be decided by the backend. - // Note: this field is always unspecified and ignored if MetricDescriptor.type==GAUGE_HISTOGRAM. - fixed64 start_time_unix_nano = 2; - - // time_unix_nano is the moment when this value was recorded. - // Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January 1970. - fixed64 time_unix_nano = 3; - - // count is the number of values in the population. Must be non-negative. This value - // must be equal to the sum of the "count" fields in buckets if a histogram is provided. - uint64 count = 4; - - // sum of the values in the population. If count is zero then this field - // must be zero. This value must be equal to the sum of the "sum" fields in buckets if - // a histogram is provided. - double sum = 5; - - // Bucket contains values for a bucket. - message Bucket { - // The number of values in each bucket of the histogram, as described by - // bucket_options. - uint64 count = 1; - - // Exemplars are example points that may be used to annotate aggregated - // Histogram values. They are metadata that gives information about a - // particular value added to a Histogram bucket. - message Exemplar { - // Value of the exemplar point. It determines which bucket the exemplar belongs to. - // If bucket_options define bounds for this bucket then this value must be within - // the defined bounds. - double value = 1; - - // time_unix_nano is the moment when this exemplar was recorded. - // Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January 1970. - fixed64 time_unix_nano = 2; - - // exemplar_attachments are contextual information about the example value. - // Keys in this list must be unique. - repeated opentelemetry.proto.common.v1.StringKeyValue attachments = 3; - } - - // exemplar is an optional representative value of the bucket. - Exemplar exemplar = 2; - } - - // buckets is an optional field contains the values of histogram for each bucket. - // - // The sum of the values in the buckets "count" field must equal the value in the count field. - // - // The number of elements in buckets array must be by one greater than the - // number of elements in bucket_bounds array. - // - // Note: if HistogramDataPoint.bucket_options defines bucket bounds then this field - // must also be present and number of elements in this field must be equal to the - // number of buckets defined by bucket_options. - repeated Bucket buckets = 6; - - // A histogram may optionally contain the distribution of the values in the population. - // In that case one of the option fields below and "buckets" field both must be defined. - // Otherwise all option fields and "buckets" field must be omitted in which case the - // distribution of values in the histogram is unknown and only the total count and sum are known. - - // explicit_bounds is the only supported bucket option currently. - // TODO: Add more bucket options. - - // explicit_bounds specifies buckets with explicitly defined bounds for values. - // The bucket boundaries are described by "bounds" field. - // - // This defines size(bounds) + 1 (= N) buckets. The boundaries for bucket - // at index i are: - // - // [0, bounds[i]) for i == 0 - // [bounds[i-1], bounds[i]) for 0 < i < N-1 - // [bounds[i], +infinity) for i == N-1 - // The values in bounds array must be strictly increasing and > 0. - // - // Note: only [a, b) intervals are currently supported for each bucket. If we decides - // to also support (a, b] intervals we should add support for these by defining a boolean - // value which decides what type of intervals to use. - repeated double explicit_bounds = 7; -} - -// SummaryDataPoint is a single data point in a timeseries that describes the time-varying -// values of a Summary metric. -message SummaryDataPoint { - // The set of labels that uniquely identify this timeseries. - repeated opentelemetry.proto.common.v1.StringKeyValue labels = 1; - - // start_time_unix_nano is the time when the cumulative value was reset to zero. - // - // The cumulative value is over the time interval (start_time_unix_nano, time_unix_nano]. - // Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January 1970. - // - // Value of 0 indicates that the timestamp is unspecified. In that case the timestamp - // may be decided by the backend. - fixed64 start_time_unix_nano = 2; - - // time_unix_nano is the moment when this value was recorded. - // Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January 1970. - fixed64 time_unix_nano = 3; - - // The total number of recorded values since start_time. Optional since - // some systems don't expose this. - uint64 count = 4; - - // The total sum of recorded values since start_time. Optional since some - // systems don't expose this. If count is zero then this field must be zero. - double sum = 5; - - // Represents the value at a given percentile of a distribution. - // - // To record Min and Max values following conventions are used: - // - The 100th percentile is equivalent to the maximum value observed. - // - The 0th percentile is equivalent to the minimum value observed. - // - // See the following issue for more context: - // https://github.com/open-telemetry/opentelemetry-proto/issues/125 - message ValueAtPercentile { - // The percentile of a distribution. Must be in the interval - // [0.0, 100.0]. - double percentile = 1; - - // The value at the given percentile of a distribution. - double value = 2; - } - - // A list of values at different percentiles of the distribution calculated - // from the current snapshot. The percentiles must be strictly increasing. - repeated ValueAtPercentile percentile_values = 6; -} diff --git a/packages/opentelemetry-exporter-collector/src/platform/node/protos/opentelemetry/proto/resource/v1/resource.proto b/packages/opentelemetry-exporter-collector/src/platform/node/protos/opentelemetry/proto/resource/v1/resource.proto deleted file mode 100644 index a9e1711af4..0000000000 --- a/packages/opentelemetry-exporter-collector/src/platform/node/protos/opentelemetry/proto/resource/v1/resource.proto +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2019, 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 -// -// http://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. - -syntax = "proto3"; - -package opentelemetry.proto.resource.v1; - -import "opentelemetry/proto/common/v1/common.proto"; - -option java_multiple_files = true; -option java_package = "io.opentelemetry.proto.resource.v1"; -option java_outer_classname = "ResourceProto"; -option go_package = "github.com/open-telemetry/opentelemetry-proto/gen/go/resource/v1"; - -// Resource information. -message Resource { - // Set of labels that describe the resource. - repeated opentelemetry.proto.common.v1.AttributeKeyValue attributes = 1; - - // dropped_attributes_count is the number of dropped attributes. If the value is 0, then - // no attributes were dropped. - uint32 dropped_attributes_count = 2; -} diff --git a/packages/opentelemetry-exporter-collector/src/platform/node/protos/opentelemetry/proto/trace/v1/trace.proto b/packages/opentelemetry-exporter-collector/src/platform/node/protos/opentelemetry/proto/trace/v1/trace.proto deleted file mode 100644 index 33a6aea076..0000000000 --- a/packages/opentelemetry-exporter-collector/src/platform/node/protos/opentelemetry/proto/trace/v1/trace.proto +++ /dev/null @@ -1,261 +0,0 @@ -// Copyright 2019, 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 -// -// http://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. - -syntax = "proto3"; - -package opentelemetry.proto.trace.v1; - -import "opentelemetry/proto/common/v1/common.proto"; -import "opentelemetry/proto/resource/v1/resource.proto"; - -option java_multiple_files = true; -option java_package = "io.opentelemetry.proto.trace.v1"; -option java_outer_classname = "TraceProto"; -option go_package = "github.com/open-telemetry/opentelemetry-proto/gen/go/trace/v1"; - -// A collection of InstrumentationLibrarySpans from a Resource. -message ResourceSpans { - // The resource for the spans in this message. - // If this field is not set then no resource info is known. - opentelemetry.proto.resource.v1.Resource resource = 1; - - // A list of InstrumentationLibrarySpans that originate from a resource. - repeated InstrumentationLibrarySpans instrumentation_library_spans = 2; -} - -// A collection of Spans produced by an InstrumentationLibrary. -message InstrumentationLibrarySpans { - // The instrumentation library information for the spans in this message. - // If this field is not set then no library info is known. - opentelemetry.proto.common.v1.InstrumentationLibrary instrumentation_library = 1; - - // A list of Spans that originate from an instrumentation library. - repeated Span spans = 2; -} - -// Span represents a single operation within a trace. Spans can be -// nested to form a trace tree. Spans may also be linked to other spans -// from the same or different trace and form graphs. Often, a trace -// contains a root span that describes the end-to-end latency, and one -// or more subspans for its sub-operations. A trace can also contain -// multiple root spans, or none at all. Spans do not need to be -// contiguous - there may be gaps or overlaps between spans in a trace. -// -// The next available field id is 17. -message Span { - // A unique identifier for a trace. All spans from the same trace share - // the same `trace_id`. The ID is a 16-byte array. An ID with all zeroes - // is considered invalid. - // - // This field is semantically required. Receiver should generate new - // random trace_id if empty or invalid trace_id was received. - // - // This field is required. - bytes trace_id = 1; - - // A unique identifier for a span within a trace, assigned when the span - // is created. The ID is an 8-byte array. An ID with all zeroes is considered - // invalid. - // - // This field is semantically required. Receiver should generate new - // random span_id if empty or invalid span_id was received. - // - // This field is required. - bytes span_id = 2; - - // trace_state conveys information about request position in multiple distributed tracing graphs. - // It is a trace_state in w3c-trace-context format: https://www.w3.org/TR/trace-context/#tracestate-header - // See also https://github.com/w3c/distributed-tracing for more details about this field. - string trace_state = 3; - - // The `span_id` of this span's parent span. If this is a root span, then this - // field must be empty. The ID is an 8-byte array. - bytes parent_span_id = 4; - - // A description of the span's operation. - // - // For example, the name can be a qualified method name or a file name - // and a line number where the operation is called. A best practice is to use - // the same display name at the same call point in an application. - // This makes it easier to correlate spans in different traces. - // - // This field is semantically required to be set to non-empty string. - // When null or empty string received - receiver may use string "name" - // as a replacement. There might be smarted algorithms implemented by - // receiver to fix the empty span name. - // - // This field is required. - string name = 5; - - // SpanKind is the type of span. Can be used to specify additional relationships between spans - // in addition to a parent/child relationship. - enum SpanKind { - // Unspecified. Do NOT use as default. - // Implementations MAY assume SpanKind to be INTERNAL when receiving UNSPECIFIED. - SPAN_KIND_UNSPECIFIED = 0; - - // Indicates that the span represents an internal operation within an application, - // as opposed to an operations happening at the boundaries. Default value. - INTERNAL = 1; - - // Indicates that the span covers server-side handling of an RPC or other - // remote network request. - SERVER = 2; - - // Indicates that the span describes a request to some remote service. - CLIENT = 3; - - // Indicates that the span describes a producer sending a message to a broker. - // Unlike CLIENT and SERVER, there is often no direct critical path latency relationship - // between producer and consumer spans. A PRODUCER span ends when the message was accepted - // by the broker while the logical processing of the message might span a much longer time. - PRODUCER = 4; - - // Indicates that the span describes consumer receiving a message from a broker. - // Like the PRODUCER kind, there is often no direct critical path latency relationship - // between producer and consumer spans. - CONSUMER = 5; - } - - // Distinguishes between spans generated in a particular context. For example, - // two spans with the same name may be distinguished using `CLIENT` (caller) - // and `SERVER` (callee) to identify queueing latency associated with the span. - SpanKind kind = 6; - - // start_time_unix_nano is the start time of the span. On the client side, this is the time - // kept by the local machine where the span execution starts. On the server side, this - // is the time when the server's application handler starts running. - // Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January 1970. - // - // This field is semantically required and it is expected that end_time >= start_time. - fixed64 start_time_unix_nano = 7; - - // end_time_unix_nano is the end time of the span. On the client side, this is the time - // kept by the local machine where the span execution ends. On the server side, this - // is the time when the server application handler stops running. - // Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January 1970. - // - // This field is semantically required and it is expected that end_time >= start_time. - fixed64 end_time_unix_nano = 8; - - // attributes is a collection of key/value pairs. The value can be a string, - // an integer, a double or the Boolean values `true` or `false`. Note, global attributes - // like server name can be set using the resource API. Examples of attributes: - // - // "/http/user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36" - // "/http/server_latency": 300 - // "abc.com/myattribute": true - // "abc.com/score": 10.239 - repeated opentelemetry.proto.common.v1.AttributeKeyValue attributes = 9; - - // dropped_attributes_count is the number of attributes that were discarded. Attributes - // can be discarded because their keys are too long or because there are too many - // attributes. If this value is 0, then no attributes were dropped. - uint32 dropped_attributes_count = 10; - - // Event is a time-stamped annotation of the span, consisting of user-supplied - // text description and key-value pairs. - message Event { - // time_unix_nano is the time the event occurred. - fixed64 time_unix_nano = 1; - - // name of the event. - // This field is semantically required to be set to non-empty string. - string name = 2; - - // attributes is a collection of attribute key/value pairs on the event. - repeated opentelemetry.proto.common.v1.AttributeKeyValue attributes = 3; - - // dropped_attributes_count is the number of dropped attributes. If the value is 0, - // then no attributes were dropped. - uint32 dropped_attributes_count = 4; - } - - // events is a collection of Event items. - repeated Event events = 11; - - // dropped_events_count is the number of dropped events. If the value is 0, then no - // events were dropped. - uint32 dropped_events_count = 12; - - // A pointer from the current span to another span in the same trace or in a - // different trace. For example, this can be used in batching operations, - // where a single batch handler processes multiple requests from different - // traces or when the handler receives a request from a different project. - message Link { - // A unique identifier of a trace that this linked span is part of. The ID is a - // 16-byte array. - bytes trace_id = 1; - - // A unique identifier for the linked span. The ID is an 8-byte array. - bytes span_id = 2; - - // The trace_state associated with the link. - string trace_state = 3; - - // attributes is a collection of attribute key/value pairs on the link. - repeated opentelemetry.proto.common.v1.AttributeKeyValue attributes = 4; - - // dropped_attributes_count is the number of dropped attributes. If the value is 0, - // then no attributes were dropped. - uint32 dropped_attributes_count = 5; - } - - // links is a collection of Links, which are references from this span to a span - // in the same or different trace. - repeated Link links = 13; - - // dropped_links_count is the number of dropped links after the maximum size was - // enforced. If this value is 0, then no links were dropped. - uint32 dropped_links_count = 14; - - // An optional final status for this span. Semantically when Status - // wasn't set it is means span ended without errors and assume - // Status.Ok (code = 0). - Status status = 15; -} - -// The Status type defines a logical error model that is suitable for different -// programming environments, including REST APIs and RPC APIs. -message Status { - - // StatusCode mirrors the codes defined at - // https://github.com/open-telemetry/opentelemetry-specification/blob/master/specification/api-tracing.md#statuscanonicalcode - enum StatusCode { - Ok = 0; - Cancelled = 1; - UnknownError = 2; - InvalidArgument = 3; - DeadlineExceeded = 4; - NotFound = 5; - AlreadyExists = 6; - PermissionDenied = 7; - ResourceExhausted = 8; - FailedPrecondition = 9; - Aborted = 10; - OutOfRange = 11; - Unimplemented = 12; - InternalError = 13; - Unavailable = 14; - DataLoss = 15; - Unauthenticated = 16; - }; - - // The status code. This is optional field. It is safe to assume 0 (OK) - // when not set. - StatusCode code = 1; - - // A developer-facing human readable error message. - string message = 2; -} diff --git a/packages/opentelemetry-exporter-collector/src/platform/node/protos/opentelemetry/proto/trace/v1/trace_config.proto b/packages/opentelemetry-exporter-collector/src/platform/node/protos/opentelemetry/proto/trace/v1/trace_config.proto deleted file mode 100644 index 7269da1ee8..0000000000 --- a/packages/opentelemetry-exporter-collector/src/platform/node/protos/opentelemetry/proto/trace/v1/trace_config.proto +++ /dev/null @@ -1,78 +0,0 @@ -// Copyright 2019, 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 -// -// http://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. - -syntax = "proto3"; - -package opentelemetry.proto.trace.v1; - -option java_multiple_files = true; -option java_package = "io.opentelemetry.proto.trace.v1"; -option java_outer_classname = "TraceConfigProto"; -option go_package = "github.com/open-telemetry/opentelemetry-proto/gen/go/collector/trace/v1"; - -// Global configuration of the trace service. All fields must be specified, or -// the default (zero) values will be used for each type. -message TraceConfig { - - // The global default sampler used to make decisions on span sampling. - oneof sampler { - ConstantSampler constant_sampler = 1; - - ProbabilitySampler probability_sampler = 2; - - RateLimitingSampler rate_limiting_sampler = 3; - } - - // The global default max number of attributes per span. - int64 max_number_of_attributes = 4; - - // The global default max number of annotation events per span. - int64 max_number_of_timed_events= 5; - - // The global default max number of attributes per timed event. - int64 max_number_of_attributes_per_timed_event = 6; - - // The global default max number of link entries per span. - int64 max_number_of_links = 7; - - // The global default max number of attributes per span. - int64 max_number_of_attributes_per_link = 8; -} - -// Sampler that always makes a constant decision on span sampling. -message ConstantSampler { - // How spans should be sampled: - // - Always off - // - Always on - // - Always follow the parent Span's decision (off if no parent). - enum ConstantDecision { - ALWAYS_OFF = 0; - ALWAYS_ON = 1; - ALWAYS_PARENT = 2; - } - ConstantDecision decision = 1; -} - -// Sampler that tries to uniformly sample traces with a given probability. -// The probability of sampling a trace is equal to that of the specified probability. -message ProbabilitySampler { - // The desired probability of sampling. Must be within [0.0, 1.0]. - double samplingProbability = 1; -} - -// Sampler that tries to sample with a rate per time window. -message RateLimitingSampler { - // Rate per second. - int64 qps = 1; -} diff --git a/packages/opentelemetry-exporter-collector/src/platform/node/protos/verify-go.sh b/packages/opentelemetry-exporter-collector/src/platform/node/protos/verify-go.sh deleted file mode 100755 index e1c86196a5..0000000000 --- a/packages/opentelemetry-exporter-collector/src/platform/node/protos/verify-go.sh +++ /dev/null @@ -1,32 +0,0 @@ -#!/usr/bin/env bash - -set -e - - -# Calculating checksum of the 'gen' subdirectory. -# This is more portable than git status which doesn't work with detached HEAD in Travis CI. -gen_checksum() -{ - find ./gen -type f -exec md5sum {} \; | sort -k 2 | md5sum -} - -# Print checksum for each file in the 'gen' subdirectory. -# Useful to see which specific files need updating when the directory is out of sync. -print_checksum_details() -{ - find ./gen -type f -exec md5sum {} \; | sort -k 2 -} - -print_checksum_details -CHECKSUM_BEFORE=$(gen_checksum) -echo "checksum before: ${CHECKSUM_BEFORE}" -make gen-go -CHECKSUM_AFTER=$(gen_checksum) -echo "checksum after: ${CHECKSUM_AFTER}" - -if [ "${CHECKSUM_BEFORE}" != "${CHECKSUM_AFTER}" ] -then - print_checksum_details - echo "'gen' directory is out of sync with protos. Please run 'gen-go.sh' and commit changes." - exit 1 -fi \ No newline at end of file From 939c5f43b497601c2fa44de8e2f14b9cc29a4028 Mon Sep 17 00:00:00 2001 From: Bartlomiej Obecny Date: Wed, 25 Mar 2020 20:19:07 +0100 Subject: [PATCH 05/14] chore: adding protos submodule --- .gitmodules | 3 +++ .../opentelemetry-exporter-collector/src/platform/node/protos | 1 + 2 files changed, 4 insertions(+) create mode 100644 .gitmodules create mode 160000 packages/opentelemetry-exporter-collector/src/platform/node/protos diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000000..50b83a59cd --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "packages/opentelemetry-exporter-collector/src/platform/node/protos"] + path = packages/opentelemetry-exporter-collector/src/platform/node/protos + url = git@github.com:open-telemetry/opentelemetry-proto.git diff --git a/packages/opentelemetry-exporter-collector/src/platform/node/protos b/packages/opentelemetry-exporter-collector/src/platform/node/protos new file mode 160000 index 0000000000..e6c3c4a74d --- /dev/null +++ b/packages/opentelemetry-exporter-collector/src/platform/node/protos @@ -0,0 +1 @@ +Subproject commit e6c3c4a74d57f870a0d781bada02cb2b2c497d14 From 0c9273d694f1c26652dbdd0454a0de2eafe3c494 Mon Sep 17 00:00:00 2001 From: Bartlomiej Obecny Date: Wed, 25 Mar 2020 20:23:19 +0100 Subject: [PATCH 06/14] chore: cleanup --- .../docker/ot/collector-config.yaml | 4 +- .../src/platform/node/transform.ts.old | 183 ------------------ 2 files changed, 2 insertions(+), 185 deletions(-) delete mode 100644 packages/opentelemetry-exporter-collector/src/platform/node/transform.ts.old diff --git a/examples/basic-tracer-node/docker/ot/collector-config.yaml b/examples/basic-tracer-node/docker/ot/collector-config.yaml index f3df32db08..b4bc9cb9fc 100644 --- a/examples/basic-tracer-node/docker/ot/collector-config.yaml +++ b/examples/basic-tracer-node/docker/ot/collector-config.yaml @@ -1,5 +1,5 @@ receivers: - opentelemetry: + opencensus: endpoint: 0.0.0.0:55678 exporters: @@ -13,6 +13,6 @@ processors: service: pipelines: traces: - receivers: [opentelemetry] + receivers: [opencensus] exporters: [zipkin] processors: [batch, queued_retry] diff --git a/packages/opentelemetry-exporter-collector/src/platform/node/transform.ts.old b/packages/opentelemetry-exporter-collector/src/platform/node/transform.ts.old deleted file mode 100644 index 714168bf86..0000000000 --- a/packages/opentelemetry-exporter-collector/src/platform/node/transform.ts.old +++ /dev/null @@ -1,183 +0,0 @@ -/*! - * Copyright 2020, 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 { Attributes, Link, TimedEvent, TraceState } from '@opentelemetry/api'; -import * as core from '@opentelemetry/core'; -import { Resource } from '@opentelemetry/resources'; -import { ReadableSpan } from '@opentelemetry/tracing'; -import { toCollectorTruncatableString } from '../../transform'; -import { VERSION } from '../../version'; -import { opentelemetry } from './grpc/types'; -import ValueType = opentelemetry.proto.common.v1.ValueType; - -/** - * convert attributes to proto - * @param attributes - */ -export function toCollectorProtoAttributes( - attributes: Attributes -): opentelemetry.proto.common.v1.AttributeKeyValue[] { - const keys = Object.keys(attributes); - const protoAttributes: opentelemetry.proto.common.v1.AttributeKeyValue[] = []; - keys.forEach(key => { - protoAttributes.push(toCollectorEventProtoValue(key, attributes[key])); - }); - - return protoAttributes; -} - -/** - * convert event value - * @param value event value - */ -export function toCollectorEventProtoValue( - key: string, - value: unknown -): opentelemetry.proto.common.v1.AttributeKeyValue { - let aType: opentelemetry.proto.common.v1.ValueType = ValueType.STRING; - const attributeValue: opentelemetry.proto.common.v1.AttributeKeyValue = { - key, - type: 0, - }; - if (typeof value === 'string') { - attributeValue.stringValue = value; - } else if (typeof value === 'boolean') { - aType = ValueType.BOOL; - attributeValue.boolValue = value; - } else if (typeof value === 'number') { - // all numbers will be treated as double - aType = ValueType.DOUBLE; - attributeValue.doubleValue = value; - } - - attributeValue.type = aType; - - return attributeValue; -} - -/** - * - * convert events to proto - * @param events array of events - */ -export function toCollectorProtoEvents( - timedEvents: TimedEvent[] -): opentelemetry.proto.trace.v1.Span.Event[] { - const protoEvents: opentelemetry.proto.trace.v1.Span.Event[] = []; - timedEvents.forEach(timedEvent => { - const timeUnixNano = core.hrTimeToNanoseconds(timedEvent.time); - const name = timedEvent.name; - const attributes = toCollectorProtoAttributes(timedEvent.attributes || {}); - const droppedAttributesCount = 0; - - const protoEvent: opentelemetry.proto.trace.v1.Span.Event = { - timeUnixNano, - name, - attributes, - droppedAttributesCount, - }; - - protoEvents.push(protoEvent); - }); - return protoEvents; -} - -export function toCollectorProtoLinks( - span: ReadableSpan -): opentelemetry.proto.trace.v1.Span.Link[] { - const protoLinks: opentelemetry.proto.trace.v1.Span.Link[] = span.links.map( - (link: Link) => { - const protoLink: opentelemetry.proto.trace.v1.Span.Link = { - traceId: Buffer.from(core.hexToBase64(link.context.traceId), 'base64'), - spanId: Buffer.from(core.hexToBase64(link.context.spanId), 'base64'), - attributes: toCollectorProtoAttributes(link.attributes || {}), - droppedAttributesCount: 0, - }; - return protoLink; - } - ); - return protoLinks; -} - -export function toCollectorProtoSpan( - span: ReadableSpan -): opentelemetry.proto.trace.v1.Span { - return { - traceId: Buffer.from(core.hexToBase64(span.spanContext.traceId), 'base64'), - spanId: Buffer.from(core.hexToBase64(span.spanContext.spanId), 'base64'), - parentSpanId: span.parentSpanId - ? Buffer.from(core.hexToBase64(span.parentSpanId), 'base64') - : undefined, - traceState: toCollectorProtoTraceState(span.spanContext.traceState), - name: toCollectorTruncatableString(span.name), - kind: span.kind + 1, - startTimeUnixNano: core.hrTimeToNanoseconds(span.startTime), - endTimeUnixNano: core.hrTimeToNanoseconds(span.endTime), - attributes: toCollectorProtoAttributes(span.attributes), - droppedAttributesCount: 0, - events: toCollectorProtoEvents(span.events), - droppedEventsCount: 0, - status: span.status, - links: toCollectorProtoLinks(span), - droppedLinksCount: 0, - }; -} - -export function toCollectorProtoResource( - resource?: Resource -): opentelemetry.proto.resource.v1.Resource { - const resourceProto: opentelemetry.proto.resource.v1.Resource = { - attributes: toCollectorProtoAttributes(resource ? resource.labels : {}), - droppedAttributesCount: 0, - }; - - return resourceProto; -} - -/** - * @param traceState - */ -export function toCollectorProtoTraceState( - traceState?: TraceState -): opentelemetry.proto.trace.v1.Span.TraceState | undefined { - if (!traceState) return undefined; - return traceState.serialize(); -} - -/** - * - * @param spans - */ -export function toCollectorProtoExportTraceServiceRequest( - spans: opentelemetry.proto.trace.v1.Span[], - resource: opentelemetry.proto.resource.v1.Resource -): opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest { - const instrumentationLibrarySpans: opentelemetry.proto.trace.v1.InstrumentationLibrarySpans = { - spans, - instrumentationLibrary: { - name: '', - version: VERSION, - }, - }; - const resourceSpan: opentelemetry.proto.trace.v1.ResourceSpans = { - resource, - instrumentationLibrarySpans: [instrumentationLibrarySpans], - }; - - return { - resourceSpans: [resourceSpan], - }; -} From 3cd6d74394712ec3ecb232d8d1aab5df7a489e3f Mon Sep 17 00:00:00 2001 From: Bartlomiej Obecny Date: Wed, 25 Mar 2020 20:26:40 +0100 Subject: [PATCH 07/14] chore: cleanup --- .../opentelemetry-core/src/platform/browser/hex-to-bytes.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/opentelemetry-core/src/platform/browser/hex-to-bytes.ts b/packages/opentelemetry-core/src/platform/browser/hex-to-bytes.ts index 3d2afaba43..f0af79b5e9 100644 --- a/packages/opentelemetry-core/src/platform/browser/hex-to-bytes.ts +++ b/packages/opentelemetry-core/src/platform/browser/hex-to-bytes.ts @@ -1,5 +1,5 @@ /*! - * Copyright 2019, OpenTelemetry Authors + * Copyright 2020, OpenTelemetry Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. From 9abf4c1978e0215532e5de6199b358d828f33e5b Mon Sep 17 00:00:00 2001 From: Bartlomiej Obecny Date: Wed, 25 Mar 2020 21:05:29 +0100 Subject: [PATCH 08/14] chore: adding sync for submodule --- packages/opentelemetry-exporter-collector/package.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/opentelemetry-exporter-collector/package.json b/packages/opentelemetry-exporter-collector/package.json index e5598c4cc3..6724d25e96 100644 --- a/packages/opentelemetry-exporter-collector/package.json +++ b/packages/opentelemetry-exporter-collector/package.json @@ -16,9 +16,10 @@ "codecov:browser": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../", "precompile": "tsc --version", "compile": "npm run version:update && tsc -p .", - "postcompile": "npm run protos:copy", + "postcompile": "npm run submodule && npm run protos:copy", "prepare": "npm run compile", "protos:copy": "cpx src/platform/node/protos/opentelemetry/**/*.* build/src/platform/node/protos/opentelemetry", + "submodule": "git submodule sync --recursive && git submodule update --init --recursive", "tdd": "npm run test -- --watch-extensions ts --watch", "tdd:browser": "karma start", "test": "nyc ts-mocha -p tsconfig.json 'test/**/*.test.ts' --exclude 'test/browser/**/*.ts'", From 9bc6a03db6a8055b79a3c16410173f49dba5a48c Mon Sep 17 00:00:00 2001 From: Bartlomiej Obecny Date: Thu, 2 Apr 2020 00:39:19 +0200 Subject: [PATCH 09/14] chore: testing submodule --- .../opentelemetry-exporter-collector/src/platform/node/protos | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/opentelemetry-exporter-collector/src/platform/node/protos b/packages/opentelemetry-exporter-collector/src/platform/node/protos index e6c3c4a74d..e76584d224 160000 --- a/packages/opentelemetry-exporter-collector/src/platform/node/protos +++ b/packages/opentelemetry-exporter-collector/src/platform/node/protos @@ -1 +1 @@ -Subproject commit e6c3c4a74d57f870a0d781bada02cb2b2c497d14 +Subproject commit e76584d22418e37ae9a1ee782ce56ae7e2651ccf From bbb025577c0b48c94b72d07901815293ce63f0dc Mon Sep 17 00:00:00 2001 From: Bartlomiej Obecny Date: Thu, 2 Apr 2020 00:45:53 +0200 Subject: [PATCH 10/14] chore: updating submodule for opentelemetry-proto --- .../opentelemetry-exporter-collector/src/platform/node/protos | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/opentelemetry-exporter-collector/src/platform/node/protos b/packages/opentelemetry-exporter-collector/src/platform/node/protos index e76584d224..e6c3c4a74d 160000 --- a/packages/opentelemetry-exporter-collector/src/platform/node/protos +++ b/packages/opentelemetry-exporter-collector/src/platform/node/protos @@ -1 +1 @@ -Subproject commit e76584d22418e37ae9a1ee782ce56ae7e2651ccf +Subproject commit e6c3c4a74d57f870a0d781bada02cb2b2c497d14 From c1c1a2d40e611ebf83ea32158a9fdb216fd07553 Mon Sep 17 00:00:00 2001 From: Bartlomiej Obecny Date: Thu, 2 Apr 2020 18:59:35 +0200 Subject: [PATCH 11/14] chore: updates and fixes after testing with collector, refactored helper for tests --- .../src/CollectorExporter.ts | 24 +- .../src/platform/browser/sendSpans.ts | 27 +- .../src/platform/node/README.md | 45 ++ .../src/platform/node/sendSpans.ts | 30 +- .../src/platform/node/util.ts | 31 ++ .../src/transform.ts | 86 +-- .../src/types.ts | 45 +- .../test/browser/CollectorExporter.test.ts | 12 +- .../test/common/transform.test.ts | 20 - .../test/helper.ts | 491 ++++++++---------- .../test/node/CollectorExporter.test.ts | 10 +- 11 files changed, 400 insertions(+), 421 deletions(-) create mode 100644 packages/opentelemetry-exporter-collector/src/platform/node/README.md create mode 100644 packages/opentelemetry-exporter-collector/src/platform/node/util.ts diff --git a/packages/opentelemetry-exporter-collector/src/CollectorExporter.ts b/packages/opentelemetry-exporter-collector/src/CollectorExporter.ts index 370c50d742..7199848da8 100644 --- a/packages/opentelemetry-exporter-collector/src/CollectorExporter.ts +++ b/packages/opentelemetry-exporter-collector/src/CollectorExporter.ts @@ -19,7 +19,7 @@ import { NoopLogger } from '@opentelemetry/core'; import { ReadableSpan, SpanExporter } from '@opentelemetry/tracing'; import { Attributes, Logger } from '@opentelemetry/api'; import { onInit, onShutdown, sendSpans } from './platform/index'; -import { CollectorExporterError } from './types'; +import { opentelemetryProto } from './types'; /** * Collector Exporter Config @@ -84,16 +84,20 @@ export class CollectorExporter implements SpanExporter { .then(() => { resultCallback(ExportResult.SUCCESS); }) - .catch((error: CollectorExporterError) => { - if (error.message) { - this.logger.error(error.message); + .catch( + ( + error: opentelemetryProto.collector.trace.v1.ExportTraceServiceError + ) => { + if (error.message) { + this.logger.error(error.message); + } + if (error.code && error.code < 500) { + resultCallback(ExportResult.FAILED_NOT_RETRYABLE); + } else { + resultCallback(ExportResult.FAILED_RETRYABLE); + } } - if (error.code && error.code < 500) { - resultCallback(ExportResult.FAILED_NOT_RETRYABLE); - } else { - resultCallback(ExportResult.FAILED_RETRYABLE); - } - }); + ); } private _exportSpans(spans: ReadableSpan[]): Promise { diff --git a/packages/opentelemetry-exporter-collector/src/platform/browser/sendSpans.ts b/packages/opentelemetry-exporter-collector/src/platform/browser/sendSpans.ts index 8cc3110652..78755a05b9 100644 --- a/packages/opentelemetry-exporter-collector/src/platform/browser/sendSpans.ts +++ b/packages/opentelemetry-exporter-collector/src/platform/browser/sendSpans.ts @@ -1,5 +1,5 @@ /*! - * Copyright 2019, OpenTelemetry Authors + * Copyright 2020, OpenTelemetry Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,14 +15,9 @@ */ import { Logger } from '@opentelemetry/api'; -import { Resource } from '@opentelemetry/resources'; import { ReadableSpan } from '@opentelemetry/tracing'; import { CollectorExporter } from '../../CollectorExporter'; -import { - toCollectorExportTraceServiceRequest, - toCollectorResource, - toCollectorSpan, -} from '../../transform'; +import { toCollectorExportTraceServiceRequest } from '../../transform'; import * as collectorTypes from '../../types'; /** @@ -55,15 +50,9 @@ export function sendSpans( onError: (error: collectorTypes.CollectorExporterError) => void, collectorExporter: CollectorExporter ) { - const spansToBeSent: collectorTypes.opentelemetryProto.trace.v1.Span[] = spans.map( - span => toCollectorSpan(span) - ); - const resource: Resource | undefined = - spans.length > 0 ? spans[0].resource : Resource.empty(); - const exportTraceServiceRequest = toCollectorExportTraceServiceRequest( - spansToBeSent, - toCollectorResource(resource) + spans, + collectorExporter ); const body = JSON.stringify(exportTraceServiceRequest); @@ -121,7 +110,7 @@ function sendSpansWithBeacon( * @param collectorUrl */ function sendSpansWithXhr( - body: any, + body: string, onSuccess: () => void, onError: (error: collectorTypes.CollectorExporterError) => void, logger: Logger, @@ -130,7 +119,8 @@ function sendSpansWithXhr( const xhr = new XMLHttpRequest(); xhr.open('POST', collectorUrl); xhr.setRequestHeader(collectorTypes.OT_REQUEST_HEADER, '1'); - // xhr.setRequestHeader('Content-Length', String(body.length)); + xhr.setRequestHeader('Accept', 'application/octet-stream'); + xhr.setRequestHeader('Content-Type', 'application/json'); xhr.send(body); xhr.onreadystatechange = () => { @@ -139,7 +129,8 @@ function sendSpansWithXhr( logger.debug('xhr success', body); onSuccess(); } else { - logger.error('xhr error', xhr.status, body); + logger.error('body', body); + logger.error('xhr error', xhr); onError({ code: xhr.status, message: xhr.responseText, diff --git a/packages/opentelemetry-exporter-collector/src/platform/node/README.md b/packages/opentelemetry-exporter-collector/src/platform/node/README.md new file mode 100644 index 0000000000..aee8555b64 --- /dev/null +++ b/packages/opentelemetry-exporter-collector/src/platform/node/README.md @@ -0,0 +1,45 @@ +### Important! +**Submodule is always pointing to certain revision number. So updating the master of the submodule repo will not have impact on your code. +Knowing this if you want to change the submodule to point to a different version (when for example proto has changed) here is how to do it:** + +### Updating submodule to point to certain revision number + +1. Make sure you are in the same folder as this instruction + +2. Update your submodules by running this command + +```shell script + git submodule sync --recursive + git submodule update --init --recursive +``` + +3. Find the SHA which you want to update to and copy it (the long one) +the latest sha when this guide was written is `e6c3c4a74d57f870a0d781bada02cb2b2c497d14` + +4. Enter a submodule directory from this directory + +```shell script + cd protos +``` + +5. Updates files in the submodule tree to given commit: + +```shell script + git checkout -q +``` + +6. Return to the main directory: + +```shell script + cd ../ +``` + +7. Please run `git status` you should see something like `Head detached at`. This is correct, go to next step + +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 opentelemetry-proto" +``` + +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 diff --git a/packages/opentelemetry-exporter-collector/src/platform/node/sendSpans.ts b/packages/opentelemetry-exporter-collector/src/platform/node/sendSpans.ts index 90535cc9f8..e8f13af023 100644 --- a/packages/opentelemetry-exporter-collector/src/platform/node/sendSpans.ts +++ b/packages/opentelemetry-exporter-collector/src/platform/node/sendSpans.ts @@ -15,19 +15,15 @@ */ import * as protoLoader from '@grpc/proto-loader'; -import { Resource } from '@opentelemetry/resources'; import { ReadableSpan } from '@opentelemetry/tracing'; import * as grpc from 'grpc'; import * as path from 'path'; import { CollectorExporter } from '../../CollectorExporter'; import * as collectorTypes from '../../types'; -import { - toCollectorExportTraceServiceRequest, - toCollectorResource, - toCollectorSpan, -} from '../../transform'; +import { toCollectorExportTraceServiceRequest } from '../../transform'; import { CollectorData, GRPCQueueItem } from './types'; +import { fixGRPCUrl } from './util'; const traceServiceClients: WeakMap< CollectorExporter, @@ -43,7 +39,7 @@ export function onInit(collectorExporter: CollectorExporter) { isShutDown: false, grpcSpansQueue: [], }); - const serverAddress = collectorExporter.url; + const serverAddress = fixGRPCUrl(collectorExporter.url); const credentials: grpc.ChannelCredentials = grpc.credentials.createInsecure(); const traceServiceProtoPath = @@ -118,15 +114,9 @@ export function sendSpans( return; } if (exporter.traceServiceClient) { - const spansToBeSent: collectorTypes.opentelemetryProto.trace.v1.Span[] = spans.map( - span => toCollectorSpan(span) - ); - const resource: Resource | undefined = - spans.length > 0 ? spans[0].resource : Resource.empty(); - const exportTraceServiceRequest = toCollectorExportTraceServiceRequest( - spansToBeSent, - toCollectorResource(resource) + spans, + collectorExporter ); exporter.traceServiceClient.export( @@ -135,11 +125,11 @@ export function sendSpans( err: collectorTypes.opentelemetryProto.collector.trace.v1.ExportTraceServiceError ) => { if (err) { - onError({ - code: err.code, - message: err.message, - stack: err.stack, - }); + collectorExporter.logger.error( + 'exportTraceServiceRequest', + exportTraceServiceRequest + ); + onError(err); } else { onSuccess(); } diff --git a/packages/opentelemetry-exporter-collector/src/platform/node/util.ts b/packages/opentelemetry-exporter-collector/src/platform/node/util.ts new file mode 100644 index 0000000000..edcf21e39e --- /dev/null +++ b/packages/opentelemetry-exporter-collector/src/platform/node/util.ts @@ -0,0 +1,31 @@ +/*! + * Copyright 2020, 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. + */ + +/** + * It will remove http or https from the link as grpc requires link without + * protocol + * @param url + */ +export function fixGRPCUrl(url: string): string { + let fixedUrl = url; + const removeArr = ['http://', 'https://']; + removeArr.forEach(el => { + if (fixedUrl.indexOf(el) === 0) { + fixedUrl = fixedUrl.replace(el, ''); + } + }); + return fixedUrl; +} diff --git a/packages/opentelemetry-exporter-collector/src/transform.ts b/packages/opentelemetry-exporter-collector/src/transform.ts index 6a154c16fd..f7fbc91baa 100644 --- a/packages/opentelemetry-exporter-collector/src/transform.ts +++ b/packages/opentelemetry-exporter-collector/src/transform.ts @@ -18,27 +18,11 @@ import { Attributes, Link, TimedEvent, TraceState } from '@opentelemetry/api'; import * as core from '@opentelemetry/core'; import { Resource } from '@opentelemetry/resources'; import { ReadableSpan } from '@opentelemetry/tracing'; +import { CollectorExporter } from './CollectorExporter'; import { opentelemetryProto } from './types'; -import * as collectorTypes from './types'; import ValueType = opentelemetryProto.common.v1.ValueType; import { SDK_INFO } from '@opentelemetry/base'; -const OT_MAX_STRING_LENGTH = 128; - -/** - * convert string to maximum length of 128, providing information of truncated bytes - * @param name - string to be converted - */ -export function toCollectorTruncatableString( - name: string -): collectorTypes.TruncatableString { - const value = name.substr(0, OT_MAX_STRING_LENGTH); - const truncatedByteCount = - name.length > OT_MAX_STRING_LENGTH ? name.length - OT_MAX_STRING_LENGTH : 0; - - return { value, truncatedByteCount }; -} - /** * convert attributes to proto * @param attributes @@ -49,7 +33,7 @@ export function toCollectorAttributes( const keys = Object.keys(attributes); const protoAttributes: opentelemetryProto.common.v1.AttributeKeyValue[] = []; keys.forEach(key => { - protoAttributes.push(toCollectorEventValue(key, attributes[key])); + protoAttributes.push(toCollectorAttributeKeyValue(key, attributes[key])); }); return protoAttributes; @@ -59,29 +43,29 @@ export function toCollectorAttributes( * convert event value * @param value event value */ -export function toCollectorEventValue( +export function toCollectorAttributeKeyValue( key: string, value: unknown ): opentelemetryProto.common.v1.AttributeKeyValue { let aType: opentelemetryProto.common.v1.ValueType = ValueType.STRING; - const attributeValue: opentelemetryProto.common.v1.AttributeKeyValue = { + const AttributeKeyValue: opentelemetryProto.common.v1.AttributeKeyValue = { key, type: 0, }; if (typeof value === 'string') { - attributeValue.stringValue = value; + AttributeKeyValue.stringValue = value; } else if (typeof value === 'boolean') { aType = ValueType.BOOL; - attributeValue.boolValue = value; + AttributeKeyValue.boolValue = value; } else if (typeof value === 'number') { // all numbers will be treated as double aType = ValueType.DOUBLE; - attributeValue.doubleValue = value; + AttributeKeyValue.doubleValue = value; } - attributeValue.type = aType; + AttributeKeyValue.type = aType; - return attributeValue; + return AttributeKeyValue; } /** @@ -117,8 +101,8 @@ export function toCollectorLinks( const protoLinks: opentelemetryProto.trace.v1.Span.Link[] = span.links.map( (link: Link) => { const protoLink: opentelemetryProto.trace.v1.Span.Link = { - traceId: core.hexToBytes(link.context.traceId), - spanId: core.hexToBytes(link.context.spanId), + traceId: core.hexToBase64(link.context.traceId), + spanId: core.hexToBase64(link.context.spanId), attributes: toCollectorAttributes(link.attributes || {}), droppedAttributesCount: 0, }; @@ -132,13 +116,13 @@ export function toCollectorSpan( span: ReadableSpan ): opentelemetryProto.trace.v1.Span { return { - traceId: core.hexToBytes(span.spanContext.traceId), - spanId: core.hexToBytes(span.spanContext.spanId), + traceId: core.hexToBase64(span.spanContext.traceId), + spanId: core.hexToBase64(span.spanContext.spanId), parentSpanId: span.parentSpanId - ? core.hexToBytes(span.parentSpanId) + ? core.hexToBase64(span.parentSpanId) : undefined, traceState: toCollectorTraceState(span.spanContext.traceState), - name: toCollectorTruncatableString(span.name), + name: span.name, kind: span.kind + 1, startTimeUnixNano: core.hrTimeToNanoseconds(span.startTime), endTimeUnixNano: core.hrTimeToNanoseconds(span.endTime), @@ -153,10 +137,16 @@ export function toCollectorSpan( } export function toCollectorResource( - resource?: Resource + resource?: Resource, + additionalAttributes: { [key: string]: any } = {} ): opentelemetryProto.resource.v1.Resource { + const attr = Object.assign( + {}, + additionalAttributes, + resource ? resource.labels : {} + ); const resourceProto: opentelemetryProto.resource.v1.Resource = { - attributes: toCollectorAttributes(resource ? resource.labels : {}), + attributes: toCollectorAttributes(attr), droppedAttributesCount: 0, }; @@ -174,25 +164,41 @@ export function toCollectorTraceState( } /** - * - * @param spans spans in proto format - * @param resource Resource in proto format + * @param spans spans + * @param collectorExporter * @param [name] Instrumentation Library Name */ export function toCollectorExportTraceServiceRequest( - spans: opentelemetryProto.trace.v1.Span[], - resource: opentelemetryProto.resource.v1.Resource, + spans: ReadableSpan[], + collectorExporter: CollectorExporter, name: string = '' ): opentelemetryProto.collector.trace.v1.ExportTraceServiceRequest { + const spansToBeSent: opentelemetryProto.trace.v1.Span[] = spans.map(span => + toCollectorSpan(span) + ); + const resource: Resource | undefined = + spans.length > 0 ? spans[0].resource : Resource.empty(); + + const additionalAttributes = Object.assign( + {}, + collectorExporter.attributes || {}, + { + 'service.name': collectorExporter.serviceName, + } + ); + const protoResource: opentelemetryProto.resource.v1.Resource = toCollectorResource( + resource, + additionalAttributes + ); const instrumentationLibrarySpans: opentelemetryProto.trace.v1.InstrumentationLibrarySpans = { - spans, + spans: spansToBeSent, instrumentationLibrary: { name: name || `${SDK_INFO.NAME} - ${SDK_INFO.LANGUAGE}`, version: SDK_INFO.VERSION, }, }; const resourceSpan: opentelemetryProto.trace.v1.ResourceSpans = { - resource, + resource: protoResource, instrumentationLibrarySpans: [instrumentationLibrarySpans], }; diff --git a/packages/opentelemetry-exporter-collector/src/types.ts b/packages/opentelemetry-exporter-collector/src/types.ts index 7facee0e89..f46c5a8065 100644 --- a/packages/opentelemetry-exporter-collector/src/types.ts +++ b/packages/opentelemetry-exporter-collector/src/types.ts @@ -1,5 +1,5 @@ /*! - * Copyright 2019, OpenTelemetry Authors + * Copyright 2020, OpenTelemetry Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -66,9 +66,9 @@ export namespace opentelemetryProto { } export interface Link { - traceId: Uint8Array; - spanId: Uint8Array; - traceState?: TraceState; + traceId: string; + spanId: string; + traceState?: opentelemetryProto.trace.v1.Span.TraceState; attributes?: opentelemetryProto.common.v1.AttributeKeyValue[]; droppedAttributesCount: number; } @@ -89,7 +89,7 @@ export namespace opentelemetryProto { } export interface InstrumentationLibrarySpans { - instrumentationLibrary: opentelemetryProto.common.v1.InstrumentationLibrary | null; + instrumentationLibrary?: opentelemetryProto.common.v1.InstrumentationLibrary; spans: opentelemetryProto.trace.v1.Span[]; } @@ -107,11 +107,11 @@ export namespace opentelemetryProto { } export interface Span { - traceId: Uint8Array; - spanId: Uint8Array; + traceId: string; + spanId: string; traceState: opentelemetryProto.trace.v1.Span.TraceState; - parentSpanId?: Uint8Array; - name?: opentelemetryProto.trace.v1.TruncatableString; + parentSpanId?: string; + name?: string; kind?: opentelemetryProto.trace.v1.Span.SpanKind; startTimeUnixNano?: number; endTimeUnixNano?: number; @@ -166,33 +166,6 @@ export namespace opentelemetryProto { } } -/** - * A string that might be shortened to a specified length. - */ -export interface TruncatableString { - /** - * The shortened string. For example, if the original string was 500 bytes - * long and the limit of the string was 128 bytes, then this value contains - * the first 128 bytes of the 500-byte string. Note that truncation always - * happens on a character boundary, to ensure that a truncated string is still - * valid UTF-8. Because it may contain multi-byte characters, the size of the - * truncated string may be less than the truncation limit. - */ - value?: string; - /** - * The number of bytes removed from the original string. If this value is 0, - * then the string was not shortened. - */ - truncatedByteCount?: number; -} - -/** - * Interface to represent a trace state - */ -export interface TraceState { - [key: string]: string; -} - /** * Interface for handling error */ diff --git a/packages/opentelemetry-exporter-collector/test/browser/CollectorExporter.test.ts b/packages/opentelemetry-exporter-collector/test/browser/CollectorExporter.test.ts index fc98c1ea58..d17551c866 100644 --- a/packages/opentelemetry-exporter-collector/test/browser/CollectorExporter.test.ts +++ b/packages/opentelemetry-exporter-collector/test/browser/CollectorExporter.test.ts @@ -25,7 +25,7 @@ import { import * as collectorTypes from '../../src/types'; import { - ensureBrowserSpanIsCorrect, + ensureSpanIsCorrect, ensureExportTraceServiceRequestIsSet, ensureWebResourceIsCorrect, mockedReadableSpan, @@ -80,7 +80,7 @@ describe('CollectorExporter - web', () => { assert.ok(typeof span1 !== 'undefined', "span doesn't exist"); if (span1) { - ensureBrowserSpanIsCorrect(span1); + ensureSpanIsCorrect(span1); } const resource = json.resourceSpans[0].resource; @@ -163,7 +163,7 @@ describe('CollectorExporter - web', () => { assert.ok(typeof span1 !== 'undefined', "span doesn't exist"); if (span1) { - ensureBrowserSpanIsCorrect(span1); + ensureSpanIsCorrect(span1); } const resource = json.resourceSpans[0].resource; @@ -208,8 +208,10 @@ describe('CollectorExporter - web', () => { const request = server.requests[0]; request.respond(400); - const response: any = spyLoggerError.args[0][0]; - assert.strictEqual(response, 'xhr error'); + const response1: any = spyLoggerError.args[0][0]; + const response2: any = spyLoggerError.args[1][0]; + assert.strictEqual(response1, 'body'); + assert.strictEqual(response2, 'xhr error'); assert.strictEqual(spyBeacon.callCount, 0); done(); diff --git a/packages/opentelemetry-exporter-collector/test/common/transform.test.ts b/packages/opentelemetry-exporter-collector/test/common/transform.test.ts index 941e0cb6e2..266b83aa5c 100644 --- a/packages/opentelemetry-exporter-collector/test/common/transform.test.ts +++ b/packages/opentelemetry-exporter-collector/test/common/transform.test.ts @@ -21,26 +21,6 @@ import { ensureSpanIsCorrect, mockedReadableSpan } from '../helper'; import { Resource } from '@opentelemetry/resources'; describe('transform', () => { - describe('toCollectorTruncatableString', () => { - it('should convert string to TruncatableString', () => { - assert.deepStrictEqual(transform.toCollectorTruncatableString('foo'), { - truncatedByteCount: 0, - value: 'foo', - }); - }); - - it('should convert long string to TruncatableString', () => { - let foo = - 'foo1234567890foo1234567890foo1234567890foo1234567890foo1234567890foo1234567890foo1234567890'; - foo += foo; - assert.deepStrictEqual(transform.toCollectorTruncatableString(foo), { - truncatedByteCount: 54, - value: - 'foo1234567890foo1234567890foo1234567890foo1234567890foo1234567890foo1234567890foo1234567890foo1234567890foo1234567890foo12345678', - }); - }); - }); - describe('toCollectorAttributes', () => { it('should convert attribute string', () => { const attributes: Attributes = { diff --git a/packages/opentelemetry-exporter-collector/test/helper.ts b/packages/opentelemetry-exporter-collector/test/helper.ts index 375a95168e..29302aa6ad 100644 --- a/packages/opentelemetry-exporter-collector/test/helper.ts +++ b/packages/opentelemetry-exporter-collector/test/helper.ts @@ -1,5 +1,5 @@ /*! - * Copyright 2019, OpenTelemetry Authors + * Copyright 2020, OpenTelemetry Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,6 +18,7 @@ import { TraceFlags } from '@opentelemetry/api'; import { ReadableSpan } from '@opentelemetry/tracing'; import { Resource } from '@opentelemetry/resources'; import * as assert from 'assert'; +import { opentelemetryProto } from '../src/types'; import * as collectorTypes from '../src/types'; if (typeof Buffer === 'undefined') { @@ -29,6 +30,31 @@ if (typeof Buffer === 'undefined') { }; } +const traceIdArr = [ + 31, + 16, + 8, + 220, + 142, + 39, + 14, + 133, + 196, + 10, + 13, + 124, + 57, + 57, + 178, + 120, +]; +const spanIdArr = [94, 16, 114, 97, 246, 79, 165, 62]; +const parentIdArr = [120, 168, 145, 80, 152, 134, 67, 136]; + +const traceIdBase64 = 'HxAI3I4nDoXECg18OTmyeA=='; +const spanIdBase64 = 'XhByYfZPpT4='; +const parentIdBase64 = 'eKiRUJiGQ4g='; + export const mockedReadableSpan: ReadableSpan = { name: 'documentFetch', kind: 0, @@ -82,168 +108,117 @@ export const mockedReadableSpan: ReadableSpan = { }), }; -export function ensureSpanIsCorrect( - span: collectorTypes.opentelemetryProto.trace.v1.Span +export function ensureExportedEventsAreCorrect( + events: opentelemetryProto.trace.v1.Span.Event[] ) { - assert.deepStrictEqual(span, { - traceId: Buffer.from([ - 31, - 16, - 8, - 220, - 142, - 39, - 14, - 133, - 196, - 10, - 13, - 124, - 57, - 57, - 178, - 120, - ]), - spanId: Buffer.from([94, 16, 114, 97, 246, 79, 165, 62]), - parentSpanId: Buffer.from([120, 168, 145, 80, 152, 134, 67, 136]), - traceState: undefined, - name: { value: 'documentFetch', truncatedByteCount: 0 }, - kind: 1, - startTimeUnixNano: 1574120165429803000, - endTimeUnixNano: 1574120165438688000, - attributes: [ + assert.deepStrictEqual( + events, + [ { - key: 'component', - type: 0, - stringValue: 'document-load', - }, - ], - droppedAttributesCount: 0, - events: [ - { - timeUnixNano: 1574120165429803000, - name: 'fetchStart', attributes: [], + timeUnixNano: '1574120165429803008', + name: 'fetchStart', droppedAttributesCount: 0, }, { - timeUnixNano: 1574120165429803000, - name: 'domainLookupStart', attributes: [], + timeUnixNano: '1574120165429803008', + name: 'domainLookupStart', droppedAttributesCount: 0, }, { - timeUnixNano: 1574120165429803000, - name: 'domainLookupEnd', attributes: [], + timeUnixNano: '1574120165429803008', + name: 'domainLookupEnd', droppedAttributesCount: 0, }, { - timeUnixNano: 1574120165429803000, - name: 'connectStart', attributes: [], + timeUnixNano: '1574120165429803008', + name: 'connectStart', droppedAttributesCount: 0, }, { - timeUnixNano: 1574120165429803000, - name: 'connectEnd', attributes: [], + timeUnixNano: '1574120165429803008', + name: 'connectEnd', droppedAttributesCount: 0, }, { - timeUnixNano: 1574120165435513000, - name: 'requestStart', attributes: [], + timeUnixNano: '1574120165435513088', + name: 'requestStart', droppedAttributesCount: 0, }, { - timeUnixNano: 1574120165436923100, - name: 'responseStart', attributes: [], + timeUnixNano: '1574120165436923136', + name: 'responseStart', droppedAttributesCount: 0, }, { - timeUnixNano: 1574120165438688000, - name: 'responseEnd', attributes: [], + timeUnixNano: '1574120165438688000', + name: 'responseEnd', droppedAttributesCount: 0, }, ], - droppedEventsCount: 0, - status: { code: 0 }, - links: [ + 'exported events are incorrect' + ); +} + +export function ensureExportedAttributesAreCorrect( + attributes: opentelemetryProto.common.v1.AttributeKeyValue[] +) { + assert.deepStrictEqual( + attributes, + [ + { + key: 'component', + type: 'STRING', + stringValue: 'document-load', + intValue: '0', + doubleValue: 0, + boolValue: false, + }, + ], + 'exported attributes are incorrect' + ); +} + +export function ensureExportedLinksAreCorrect( + attributes: opentelemetryProto.trace.v1.Span.Link[] +) { + assert.deepStrictEqual( + attributes, + [ { - traceId: Buffer.from([ - 31, - 16, - 8, - 220, - 142, - 39, - 14, - 133, - 196, - 10, - 13, - 124, - 57, - 57, - 178, - 120, - ]), - spanId: Buffer.from([120, 168, 145, 80, 152, 134, 67, 136]), attributes: [ { key: 'component', - type: 0, + type: 'STRING', stringValue: 'document-load', + intValue: '0', + doubleValue: 0, + boolValue: false, }, ], + traceId: Buffer.from(traceIdArr), + spanId: Buffer.from(parentIdArr), + traceState: '', droppedAttributesCount: 0, }, ], - droppedLinksCount: 0, - }); + 'exported links are incorrect' + ); } -export function ensureBrowserSpanIsCorrect( - span: collectorTypes.opentelemetryProto.trace.v1.Span +export function ensureEventsAreCorrect( + events: opentelemetryProto.trace.v1.Span.Event[] ) { - const expected = { - traceId: new Uint8Array([ - 31, - 16, - 8, - 220, - 142, - 39, - 14, - 133, - 196, - 10, - 13, - 124, - 57, - 57, - 178, - 120, - ]), - spanId: new Uint8Array([94, 16, 114, 97, 246, 79, 165, 62]), - parentSpanId: new Uint8Array([120, 168, 145, 80, 152, 134, 67, 136]), - traceState: undefined, - name: { value: 'documentFetch', truncatedByteCount: 0 }, - kind: 1, - startTimeUnixNano: 1574120165429803000, - endTimeUnixNano: 1574120165438688000, - attributes: [ - { - key: 'component', - type: 0, - stringValue: 'document-load', - }, - ], - droppedAttributesCount: 0, - events: [ + assert.deepStrictEqual( + events, + [ { timeUnixNano: 1574120165429803000, name: 'fetchStart', @@ -293,173 +268,146 @@ export function ensureBrowserSpanIsCorrect( droppedAttributesCount: 0, }, ], - droppedEventsCount: 0, - status: { code: 0 }, - links: [ - { - traceId: new Uint8Array([ - 31, - 16, - 8, - 220, - 142, - 39, - 14, - 133, - 196, - 10, - 13, - 124, - 57, - 57, - 178, - 120, - ]), - spanId: new Uint8Array([120, 168, 145, 80, 152, 134, 67, 136]), - attributes: [ - { - key: 'component', - type: 0, - stringValue: 'document-load', - }, - ], - droppedAttributesCount: 0, - }, - ], - droppedLinksCount: 0, - }; - assert.deepStrictEqual(span, JSON.parse(JSON.stringify(expected))); + 'events are incorrect' + ); } -export function ensureExportedSpanIsCorrect( - span: collectorTypes.opentelemetryProto.trace.v1.Span +export function ensureAttributesAreCorrect( + attributes: opentelemetryProto.common.v1.AttributeKeyValue[] ) { - assert.deepStrictEqual(span, { - attributes: [ + assert.deepStrictEqual( + attributes, + [ { key: 'component', - type: 'STRING', + type: 0, stringValue: 'document-load', - intValue: '0', - doubleValue: 0, - boolValue: false, }, ], - events: [ - { - attributes: [], - timeUnixNano: '1574120165429803008', - name: 'fetchStart', - droppedAttributesCount: 0, - }, - { - attributes: [], - timeUnixNano: '1574120165429803008', - name: 'domainLookupStart', - droppedAttributesCount: 0, - }, - { - attributes: [], - timeUnixNano: '1574120165429803008', - name: 'domainLookupEnd', - droppedAttributesCount: 0, - }, - { - attributes: [], - timeUnixNano: '1574120165429803008', - name: 'connectStart', - droppedAttributesCount: 0, - }, - { - attributes: [], - timeUnixNano: '1574120165429803008', - name: 'connectEnd', - droppedAttributesCount: 0, - }, - { - attributes: [], - timeUnixNano: '1574120165435513088', - name: 'requestStart', - droppedAttributesCount: 0, - }, - { - attributes: [], - timeUnixNano: '1574120165436923136', - name: 'responseStart', - droppedAttributesCount: 0, - }, - { - attributes: [], - timeUnixNano: '1574120165438688000', - name: 'responseEnd', - droppedAttributesCount: 0, - }, - ], - links: [ + 'attributes are incorrect' + ); +} + +export function ensureLinksAreCorrect( + attributes: opentelemetryProto.trace.v1.Span.Link[] +) { + assert.deepStrictEqual( + attributes, + [ { + traceId: traceIdBase64, + spanId: parentIdBase64, attributes: [ { key: 'component', - type: 'STRING', + type: 0, stringValue: 'document-load', - intValue: '0', - doubleValue: 0, - boolValue: false, }, ], - traceId: Buffer.from([ - 31, - 16, - 8, - 220, - 142, - 39, - 14, - 133, - 196, - 10, - 13, - 124, - 57, - 57, - 178, - 120, - ]), - spanId: Buffer.from([120, 168, 145, 80, 152, 134, 67, 136]), - traceState: '', droppedAttributesCount: 0, }, ], - traceId: Buffer.from([ - 31, - 16, - 8, - 220, - 142, - 39, - 14, - 133, - 196, - 10, - 13, - 124, - 57, - 57, - 178, - 120, - ]), - spanId: Buffer.from([94, 16, 114, 97, 246, 79, 165, 62]), - traceState: '', - parentSpanId: Buffer.from([120, 168, 145, 80, 152, 134, 67, 136]), - name: '[object Object]', - kind: 'INTERNAL', - startTimeUnixNano: '1574120165429803008', - endTimeUnixNano: '1574120165438688000', - droppedAttributesCount: 0, - droppedEventsCount: 0, - droppedLinksCount: 0, - status: { code: 'Ok', message: '' }, - }); + 'links are incorrect' + ); +} + +export function ensureSpanIsCorrect( + span: collectorTypes.opentelemetryProto.trace.v1.Span +) { + if (span.attributes) { + ensureAttributesAreCorrect(span.attributes); + } + if (span.events) { + ensureEventsAreCorrect(span.events); + } + if (span.links) { + ensureLinksAreCorrect(span.links); + } + assert.deepStrictEqual(span.traceId, traceIdBase64, 'traceId is wrong'); + assert.deepStrictEqual(span.spanId, spanIdBase64, 'spanId is wrong'); + assert.deepStrictEqual( + span.parentSpanId, + parentIdBase64, + 'parentIdArr is wrong' + ); + assert.strictEqual(span.name, 'documentFetch', 'name is wrong'); + assert.strictEqual( + span.kind, + opentelemetryProto.trace.v1.Span.SpanKind.INTERNAL, + 'kind is wrong' + ); + assert.strictEqual( + span.startTimeUnixNano, + 1574120165429803008, + 'startTimeUnixNano is wrong' + ); + assert.strictEqual( + span.endTimeUnixNano, + 1574120165438688000, + 'endTimeUnixNano is wrong' + ); + assert.strictEqual( + span.droppedAttributesCount, + 0, + 'droppedAttributesCount is wrong' + ); + assert.strictEqual(span.droppedEventsCount, 0, 'droppedEventsCount is wrong'); + assert.strictEqual(span.droppedLinksCount, 0, 'droppedLinksCount is wrong'); + assert.deepStrictEqual(span.status, { code: 0 }, 'status is wrong'); +} + +export function ensureExportedSpanIsCorrect( + span: collectorTypes.opentelemetryProto.trace.v1.Span +) { + if (span.attributes) { + ensureExportedAttributesAreCorrect(span.attributes); + } + if (span.events) { + ensureExportedEventsAreCorrect(span.events); + } + if (span.links) { + ensureExportedLinksAreCorrect(span.links); + } + assert.deepStrictEqual( + span.traceId, + Buffer.from(traceIdArr), + 'traceId is wrong' + ); + assert.deepStrictEqual( + span.spanId, + Buffer.from(spanIdArr), + 'spanId is wrong' + ); + assert.strictEqual(span.traceState, '', 'traceState is wrong'); + assert.deepStrictEqual( + span.parentSpanId, + Buffer.from(parentIdArr), + 'parentIdArr is wrong' + ); + assert.strictEqual(span.name, 'documentFetch', 'name is wrong'); + assert.strictEqual(span.kind, 'INTERNAL', 'kind is wrong'); + assert.strictEqual( + span.startTimeUnixNano, + '1574120165429803008', + 'startTimeUnixNano is wrong' + ); + assert.strictEqual( + span.endTimeUnixNano, + '1574120165438688000', + 'endTimeUnixNano is wrong' + ); + assert.strictEqual( + span.droppedAttributesCount, + 0, + 'droppedAttributesCount is wrong' + ); + assert.strictEqual(span.droppedEventsCount, 0, 'droppedEventsCount is wrong'); + assert.strictEqual(span.droppedLinksCount, 0, 'droppedLinksCount is wrong'); + assert.deepStrictEqual( + span.status, + { code: 'Ok', message: '' }, + 'status is wrong' + ); } export function ensureWebResourceIsCorrect( @@ -467,6 +415,11 @@ export function ensureWebResourceIsCorrect( ) { assert.deepStrictEqual(resource, { attributes: [ + { + key: 'service.name', + type: 0, + stringValue: 'bar', + }, { key: 'service', type: 0, @@ -488,6 +441,14 @@ export function ensureResourceIsCorrect( ) { assert.deepStrictEqual(resource, { attributes: [ + { + key: 'service.name', + type: 'STRING', + stringValue: 'basic-service', + intValue: '0', + doubleValue: 0, + boolValue: false, + }, { key: 'service', type: 'STRING', diff --git a/packages/opentelemetry-exporter-collector/test/node/CollectorExporter.test.ts b/packages/opentelemetry-exporter-collector/test/node/CollectorExporter.test.ts index b26b9c9df7..027b3d7af0 100644 --- a/packages/opentelemetry-exporter-collector/test/node/CollectorExporter.test.ts +++ b/packages/opentelemetry-exporter-collector/test/node/CollectorExporter.test.ts @@ -36,7 +36,7 @@ import { const traceServiceProtoPath = 'opentelemetry/proto/collector/trace/v1/trace_service.proto'; const includeDirs = [path.resolve(__dirname, '../../src/platform/node/protos')]; -// const address = '127.0.0.1:55679'; + const address = '127.0.0.1:1501'; describe('CollectorExporter - node', () => { @@ -78,9 +78,7 @@ describe('CollectorExporter - node', () => { ); server.bind(address, grpc.ServerCredentials.createInsecure()); server.start(); - setTimeout(() => { - done(); - }, 200); + done(); }); }); @@ -96,9 +94,7 @@ describe('CollectorExporter - node', () => { const provider = new BasicTracerProvider(); provider.addSpanProcessor(new SimpleSpanProcessor(collectorExporter)); - setTimeout(() => { - done(); - }, 200); + done(); }); afterEach(() => { From bb2ba8bb8c0e666012c8f8d089107a35b0d87dcd Mon Sep 17 00:00:00 2001 From: Bartlomiej Obecny Date: Tue, 7 Apr 2020 16:19:25 +0200 Subject: [PATCH 12/14] chore: reviews --- .../src/platform/browser/hex-to-bytes.ts | 30 ------ .../src/platform/browser/index.ts | 1 - .../src/platform/node/hex-to-bytes.ts | 31 ------- .../src/platform/node/index.ts | 1 - .../src/platform/browser/sendSpans.ts | 2 +- .../src/platform/node/sendSpans.ts | 4 +- .../src/platform/node/util.ts | 11 +-- .../src/transform.ts | 92 +++++++++++++------ 8 files changed, 68 insertions(+), 104 deletions(-) delete mode 100644 packages/opentelemetry-core/src/platform/browser/hex-to-bytes.ts delete mode 100644 packages/opentelemetry-core/src/platform/node/hex-to-bytes.ts diff --git a/packages/opentelemetry-core/src/platform/browser/hex-to-bytes.ts b/packages/opentelemetry-core/src/platform/browser/hex-to-bytes.ts deleted file mode 100644 index f0af79b5e9..0000000000 --- a/packages/opentelemetry-core/src/platform/browser/hex-to-bytes.ts +++ /dev/null @@ -1,30 +0,0 @@ -/*! - * Copyright 2020, 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. - */ - -/** - * converts id string into Uint8Array - * @param hexStr - id of span - */ -export function hexToBytes(hexStr: string): any { - const hexStrLen = hexStr.length; - const arr = []; - for (let i = 0; i < hexStrLen; i += 2) { - const hexPair = hexStr.substring(i, i + 2); - const hexVal = parseInt(hexPair, 16); - arr.push(hexVal); - } - return new Uint8Array(arr); -} diff --git a/packages/opentelemetry-core/src/platform/browser/index.ts b/packages/opentelemetry-core/src/platform/browser/index.ts index 1c67bf624f..4668bb35aa 100644 --- a/packages/opentelemetry-core/src/platform/browser/index.ts +++ b/packages/opentelemetry-core/src/platform/browser/index.ts @@ -18,4 +18,3 @@ export * from './id'; export * from './performance'; export * from './timer-util'; export * from './hex-to-base64'; -export * from './hex-to-bytes'; diff --git a/packages/opentelemetry-core/src/platform/node/hex-to-bytes.ts b/packages/opentelemetry-core/src/platform/node/hex-to-bytes.ts deleted file mode 100644 index 9a2111525b..0000000000 --- a/packages/opentelemetry-core/src/platform/node/hex-to-bytes.ts +++ /dev/null @@ -1,31 +0,0 @@ -/*! - * Copyright 2020, 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. - */ - -/** - * converts id string into bytes - * @param hexStr - id of span - */ -export function hexToBytes(hexStr: string): Uint8Array { - const hexStrLen = hexStr.length; - let hexAsciiCharsStr = ''; - for (let i = 0; i < hexStrLen; i += 2) { - const hexPair = hexStr.substring(i, i + 2); - const hexVal = parseInt(hexPair, 16); - hexAsciiCharsStr += String.fromCharCode(hexVal); - } - - return Buffer.from(hexAsciiCharsStr, 'ascii'); -} diff --git a/packages/opentelemetry-core/src/platform/node/index.ts b/packages/opentelemetry-core/src/platform/node/index.ts index 1c67bf624f..4668bb35aa 100644 --- a/packages/opentelemetry-core/src/platform/node/index.ts +++ b/packages/opentelemetry-core/src/platform/node/index.ts @@ -18,4 +18,3 @@ export * from './id'; export * from './performance'; export * from './timer-util'; export * from './hex-to-base64'; -export * from './hex-to-bytes'; diff --git a/packages/opentelemetry-exporter-collector/src/platform/browser/sendSpans.ts b/packages/opentelemetry-exporter-collector/src/platform/browser/sendSpans.ts index 78755a05b9..a718cf17d4 100644 --- a/packages/opentelemetry-exporter-collector/src/platform/browser/sendSpans.ts +++ b/packages/opentelemetry-exporter-collector/src/platform/browser/sendSpans.ts @@ -119,7 +119,7 @@ function sendSpansWithXhr( const xhr = new XMLHttpRequest(); xhr.open('POST', collectorUrl); xhr.setRequestHeader(collectorTypes.OT_REQUEST_HEADER, '1'); - xhr.setRequestHeader('Accept', 'application/octet-stream'); + xhr.setRequestHeader('Accept', 'application/json'); xhr.setRequestHeader('Content-Type', 'application/json'); xhr.send(body); diff --git a/packages/opentelemetry-exporter-collector/src/platform/node/sendSpans.ts b/packages/opentelemetry-exporter-collector/src/platform/node/sendSpans.ts index e8f13af023..5b7c9035b7 100644 --- a/packages/opentelemetry-exporter-collector/src/platform/node/sendSpans.ts +++ b/packages/opentelemetry-exporter-collector/src/platform/node/sendSpans.ts @@ -23,7 +23,7 @@ import { CollectorExporter } from '../../CollectorExporter'; import * as collectorTypes from '../../types'; import { toCollectorExportTraceServiceRequest } from '../../transform'; import { CollectorData, GRPCQueueItem } from './types'; -import { fixGRPCUrl } from './util'; +import { removeProtocol } from './util'; const traceServiceClients: WeakMap< CollectorExporter, @@ -39,7 +39,7 @@ export function onInit(collectorExporter: CollectorExporter) { isShutDown: false, grpcSpansQueue: [], }); - const serverAddress = fixGRPCUrl(collectorExporter.url); + const serverAddress = removeProtocol(collectorExporter.url); const credentials: grpc.ChannelCredentials = grpc.credentials.createInsecure(); const traceServiceProtoPath = diff --git a/packages/opentelemetry-exporter-collector/src/platform/node/util.ts b/packages/opentelemetry-exporter-collector/src/platform/node/util.ts index edcf21e39e..ccc4fb8205 100644 --- a/packages/opentelemetry-exporter-collector/src/platform/node/util.ts +++ b/packages/opentelemetry-exporter-collector/src/platform/node/util.ts @@ -19,13 +19,6 @@ * protocol * @param url */ -export function fixGRPCUrl(url: string): string { - let fixedUrl = url; - const removeArr = ['http://', 'https://']; - removeArr.forEach(el => { - if (fixedUrl.indexOf(el) === 0) { - fixedUrl = fixedUrl.replace(el, ''); - } - }); - return fixedUrl; +export function removeProtocol(url: string): string { + return url.replace(/^https?\:\/\//, ''); } diff --git a/packages/opentelemetry-exporter-collector/src/transform.ts b/packages/opentelemetry-exporter-collector/src/transform.ts index f7fbc91baa..75c2d36651 100644 --- a/packages/opentelemetry-exporter-collector/src/transform.ts +++ b/packages/opentelemetry-exporter-collector/src/transform.ts @@ -14,33 +14,35 @@ * limitations under the License. */ -import { Attributes, Link, TimedEvent, TraceState } from '@opentelemetry/api'; +import { + Attributes, + Link, + SpanKind, + TimedEvent, + TraceState, +} from '@opentelemetry/api'; +import { SDK_INFO } from '@opentelemetry/base'; import * as core from '@opentelemetry/core'; import { Resource } from '@opentelemetry/resources'; import { ReadableSpan } from '@opentelemetry/tracing'; import { CollectorExporter } from './CollectorExporter'; import { opentelemetryProto } from './types'; import ValueType = opentelemetryProto.common.v1.ValueType; -import { SDK_INFO } from '@opentelemetry/base'; /** - * convert attributes to proto + * Converts attributes * @param attributes */ export function toCollectorAttributes( attributes: Attributes ): opentelemetryProto.common.v1.AttributeKeyValue[] { - const keys = Object.keys(attributes); - const protoAttributes: opentelemetryProto.common.v1.AttributeKeyValue[] = []; - keys.forEach(key => { - protoAttributes.push(toCollectorAttributeKeyValue(key, attributes[key])); + return Object.keys(attributes).map(key => { + return toCollectorAttributeKeyValue(key, attributes[key]); }); - - return protoAttributes; } /** - * convert event value + * Converts key and value to AttributeKeyValue * @param value event value */ export function toCollectorAttributeKeyValue( @@ -70,14 +72,13 @@ export function toCollectorAttributeKeyValue( /** * - * convert events to proto + * Converts events * @param events array of events */ export function toCollectorEvents( timedEvents: TimedEvent[] ): opentelemetryProto.trace.v1.Span.Event[] { - const protoEvents: opentelemetryProto.trace.v1.Span.Event[] = []; - timedEvents.forEach(timedEvent => { + return timedEvents.map(timedEvent => { const timeUnixNano = core.hrTimeToNanoseconds(timedEvent.time); const name = timedEvent.name; const attributes = toCollectorAttributes(timedEvent.attributes || {}); @@ -90,28 +91,32 @@ export function toCollectorEvents( droppedAttributesCount, }; - protoEvents.push(protoEvent); + return protoEvent; }); - return protoEvents; } +/** + * Converts links + * @param span + */ export function toCollectorLinks( span: ReadableSpan ): opentelemetryProto.trace.v1.Span.Link[] { - const protoLinks: opentelemetryProto.trace.v1.Span.Link[] = span.links.map( - (link: Link) => { - const protoLink: opentelemetryProto.trace.v1.Span.Link = { - traceId: core.hexToBase64(link.context.traceId), - spanId: core.hexToBase64(link.context.spanId), - attributes: toCollectorAttributes(link.attributes || {}), - droppedAttributesCount: 0, - }; - return protoLink; - } - ); - return protoLinks; + return span.links.map((link: Link) => { + const protoLink: opentelemetryProto.trace.v1.Span.Link = { + traceId: core.hexToBase64(link.context.traceId), + spanId: core.hexToBase64(link.context.spanId), + attributes: toCollectorAttributes(link.attributes || {}), + droppedAttributesCount: 0, + }; + return protoLink; + }); } +/** + * Converts span + * @param span + */ export function toCollectorSpan( span: ReadableSpan ): opentelemetryProto.trace.v1.Span { @@ -123,7 +128,7 @@ export function toCollectorSpan( : undefined, traceState: toCollectorTraceState(span.spanContext.traceState), name: span.name, - kind: span.kind + 1, + kind: toCollectorKind(span.kind), startTimeUnixNano: core.hrTimeToNanoseconds(span.startTime), endTimeUnixNano: core.hrTimeToNanoseconds(span.endTime), attributes: toCollectorAttributes(span.attributes), @@ -136,6 +141,11 @@ export function toCollectorSpan( }; } +/** + * Converts resource + * @param resource + * @param additionalAttributes + */ export function toCollectorResource( resource?: Resource, additionalAttributes: { [key: string]: any } = {} @@ -154,6 +164,29 @@ export function toCollectorResource( } /** + * Converts span kind + * @param kind + */ +export function toCollectorKind( + kind: SpanKind +): opentelemetryProto.trace.v1.Span.SpanKind { + if (kind === SpanKind.INTERNAL) { + return opentelemetryProto.trace.v1.Span.SpanKind.INTERNAL; + } else if (kind === SpanKind.SERVER) { + return opentelemetryProto.trace.v1.Span.SpanKind.SERVER; + } else if (kind === SpanKind.CLIENT) { + return opentelemetryProto.trace.v1.Span.SpanKind.CLIENT; + } else if (kind === SpanKind.PRODUCER) { + return opentelemetryProto.trace.v1.Span.SpanKind.PRODUCER; + } else if (kind === SpanKind.CONSUMER) { + return opentelemetryProto.trace.v1.Span.SpanKind.CONSUMER; + } + + return opentelemetryProto.trace.v1.Span.SpanKind.SPAN_KIND_UNSPECIFIED; +} + +/** + * Converts traceState * @param traceState */ export function toCollectorTraceState( @@ -164,6 +197,7 @@ export function toCollectorTraceState( } /** + * Prepares trace service request to be sent to collector * @param spans spans * @param collectorExporter * @param [name] Instrumentation Library Name @@ -176,7 +210,7 @@ export function toCollectorExportTraceServiceRequest( const spansToBeSent: opentelemetryProto.trace.v1.Span[] = spans.map(span => toCollectorSpan(span) ); - const resource: Resource | undefined = + const resource: Resource = spans.length > 0 ? spans[0].resource : Resource.empty(); const additionalAttributes = Object.assign( From fd9be01de1849f6f9142a9ca3077d9514bbf870c Mon Sep 17 00:00:00 2001 From: Bartlomiej Obecny Date: Wed, 8 Apr 2020 00:00:43 +0200 Subject: [PATCH 13/14] chore: removing TruncatableString --- packages/opentelemetry-exporter-collector/src/types.ts | 5 ----- 1 file changed, 5 deletions(-) diff --git a/packages/opentelemetry-exporter-collector/src/types.ts b/packages/opentelemetry-exporter-collector/src/types.ts index f46c5a8065..b107e741c0 100644 --- a/packages/opentelemetry-exporter-collector/src/types.ts +++ b/packages/opentelemetry-exporter-collector/src/types.ts @@ -131,11 +131,6 @@ export namespace opentelemetryProto { probabilitySampler?: ProbabilitySampler | null; rateLimitingSampler?: RateLimitingSampler | null; } - - export interface TruncatableString { - value?: string | null; - truncatedByteCount?: number | null; - } } export namespace common.v1 { export interface AttributeKeyValue { From e31dc0b75a2894143c21f95d9780aab7ee37f7a0 Mon Sep 17 00:00:00 2001 From: Bartlomiej Obecny Date: Thu, 9 Apr 2020 15:43:01 +0200 Subject: [PATCH 14/14] chore: reviews --- .../src/transform.ts | 19 +++++-------------- .../src/types.ts | 12 ++++++++++++ 2 files changed, 17 insertions(+), 14 deletions(-) diff --git a/packages/opentelemetry-exporter-collector/src/transform.ts b/packages/opentelemetry-exporter-collector/src/transform.ts index 75c2d36651..580434c990 100644 --- a/packages/opentelemetry-exporter-collector/src/transform.ts +++ b/packages/opentelemetry-exporter-collector/src/transform.ts @@ -26,7 +26,7 @@ import * as core from '@opentelemetry/core'; import { Resource } from '@opentelemetry/resources'; import { ReadableSpan } from '@opentelemetry/tracing'; import { CollectorExporter } from './CollectorExporter'; -import { opentelemetryProto } from './types'; +import { COLLETOR_SPAN_KIND_MAPPING, opentelemetryProto } from './types'; import ValueType = opentelemetryProto.common.v1.ValueType; /** @@ -170,19 +170,10 @@ export function toCollectorResource( export function toCollectorKind( kind: SpanKind ): opentelemetryProto.trace.v1.Span.SpanKind { - if (kind === SpanKind.INTERNAL) { - return opentelemetryProto.trace.v1.Span.SpanKind.INTERNAL; - } else if (kind === SpanKind.SERVER) { - return opentelemetryProto.trace.v1.Span.SpanKind.SERVER; - } else if (kind === SpanKind.CLIENT) { - return opentelemetryProto.trace.v1.Span.SpanKind.CLIENT; - } else if (kind === SpanKind.PRODUCER) { - return opentelemetryProto.trace.v1.Span.SpanKind.PRODUCER; - } else if (kind === SpanKind.CONSUMER) { - return opentelemetryProto.trace.v1.Span.SpanKind.CONSUMER; - } - - return opentelemetryProto.trace.v1.Span.SpanKind.SPAN_KIND_UNSPECIFIED; + const collectorKind = COLLETOR_SPAN_KIND_MAPPING[kind]; + return typeof collectorKind === 'number' + ? collectorKind + : opentelemetryProto.trace.v1.Span.SpanKind.SPAN_KIND_UNSPECIFIED; } /** diff --git a/packages/opentelemetry-exporter-collector/src/types.ts b/packages/opentelemetry-exporter-collector/src/types.ts index b107e741c0..99eacdd0cf 100644 --- a/packages/opentelemetry-exporter-collector/src/types.ts +++ b/packages/opentelemetry-exporter-collector/src/types.ts @@ -14,6 +14,7 @@ * limitations under the License. */ +import { SpanKind } from '@opentelemetry/api'; import * as api from '@opentelemetry/api'; // header to prevent instrumentation on request @@ -169,3 +170,14 @@ export interface CollectorExporterError { message?: string; stack?: string; } + +/** + * Mapping between api SpanKind and proto SpanKind + */ +export const COLLETOR_SPAN_KIND_MAPPING = { + [SpanKind.INTERNAL]: opentelemetryProto.trace.v1.Span.SpanKind.INTERNAL, + [SpanKind.SERVER]: opentelemetryProto.trace.v1.Span.SpanKind.SERVER, + [SpanKind.CLIENT]: opentelemetryProto.trace.v1.Span.SpanKind.CLIENT, + [SpanKind.PRODUCER]: opentelemetryProto.trace.v1.Span.SpanKind.PRODUCER, + [SpanKind.CONSUMER]: opentelemetryProto.trace.v1.Span.SpanKind.CONSUMER, +};