diff --git a/examples/opentelemetry-web/package.json b/examples/opentelemetry-web/package.json index 3685297eba..f99b49e3f7 100644 --- a/examples/opentelemetry-web/package.json +++ b/examples/opentelemetry-web/package.json @@ -43,7 +43,6 @@ }, "dependencies": { "@opentelemetry/api": "^1.0.2", -<<<<<<< HEAD "@opentelemetry/api-metrics": "0.33.0", "@opentelemetry/context-zone": "1.7.0", "@opentelemetry/core": "1.7.0", @@ -58,23 +57,6 @@ "@opentelemetry/sdk-trace-base": "1.7.0", "@opentelemetry/sdk-trace-web": "1.7.0", "@opentelemetry/semantic-conventions": "1.7.0" -======= - "@opentelemetry/api-metrics": "0.32.0", - "@opentelemetry/context-zone": "1.6.0", - "@opentelemetry/core": "1.6.0", - "@opentelemetry/exporter-metrics-otlp-http": "0.32.0", - "@opentelemetry/exporter-trace-otlp-http": "0.32.0", - "@opentelemetry/exporter-trace-otlp-proto": "^0.32.0", - "@opentelemetry/exporter-zipkin": "1.6.0", - "@opentelemetry/instrumentation": "0.32.0", - "@opentelemetry/instrumentation-fetch": "0.32.0", - "@opentelemetry/instrumentation-xml-http-request": "0.32.0", - "@opentelemetry/propagator-b3": "1.6.0", - "@opentelemetry/sdk-metrics": "0.32.0", - "@opentelemetry/sdk-trace-base": "1.6.0", - "@opentelemetry/sdk-trace-web": "1.6.0", - "@opentelemetry/semantic-conventions": "1.6.0" ->>>>>>> 36c16bdb (add node & browser platform for exporter-trace-otlp-proto) }, "homepage": "https://github.com/open-telemetry/opentelemetry-js/tree/main/examples/tracer-web" } diff --git a/experimental/packages/otlp-exporter-base/src/platform/browser/index.ts b/experimental/packages/otlp-exporter-base/src/platform/browser/index.ts index 4f6f6faf81..7a32ab0bd1 100644 --- a/experimental/packages/otlp-exporter-base/src/platform/browser/index.ts +++ b/experimental/packages/otlp-exporter-base/src/platform/browser/index.ts @@ -15,4 +15,4 @@ */ export * from './OTLPExporterBrowserBase'; -export { sendWithXhr } from './util' +export { sendWithXhr } from './util'; diff --git a/experimental/packages/otlp-proto-exporter-base/src/index.ts b/experimental/packages/otlp-proto-exporter-base/src/index.ts index 86119dbd0e..e76b3a3593 100644 --- a/experimental/packages/otlp-proto-exporter-base/src/index.ts +++ b/experimental/packages/otlp-proto-exporter-base/src/index.ts @@ -1 +1,16 @@ -export * from './platform' +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +export * from './platform'; diff --git a/experimental/packages/otlp-proto-exporter-base/src/platform/browser/OTLPProtoExporterBrowserBase.ts b/experimental/packages/otlp-proto-exporter-base/src/platform/browser/OTLPProtoExporterBrowserBase.ts index bae00c5849..7a9abeac28 100644 --- a/experimental/packages/otlp-proto-exporter-base/src/platform/browser/OTLPProtoExporterBrowserBase.ts +++ b/experimental/packages/otlp-proto-exporter-base/src/platform/browser/OTLPProtoExporterBrowserBase.ts @@ -1,7 +1,3 @@ -// export const OTLPProtoExporterBrowserBase = () => { -// console.log('otlp-proto-exporter-base') -// } - /* * Copyright The OpenTelemetry Authors * @@ -26,7 +22,7 @@ import { OTLPExporterError, OTLPExporterConfigBase } from '@opentelemetry/otlp-exporter-base'; -import { send } from './util' +import { send } from './util'; type SendFn = (collector: OTLPProtoExporterBrowserBase, objects: ExportItem[], @@ -34,53 +30,53 @@ type SendFn = (collector: OTLPProtoExporterBrowserBa onSuccess: () => void, onError: (error: OTLPExporterError) => void) => void; - /** +/** * Collector Exporter abstract base class */ export abstract class OTLPProtoExporterBrowserBase< ExportItem, ServiceRequest > extends OTLPExporterBaseMain { -private _send!: SendFn; + private _send!: SendFn; -constructor(config: OTLPExporterConfigBase = {}) { - super(config); -} + constructor(config: OTLPExporterConfigBase = {}) { + super(config); + } -private _sendPromise( - objects: ExportItem[], - onSuccess: () => void, - onError: (error: OTLPExporterError) => void -): void { - const promise = new Promise((resolve, reject) => { - this._send(this, objects, resolve, reject); - }) - .then(onSuccess, onError); + private _sendPromise( + objects: ExportItem[], + onSuccess: () => void, + onError: (error: OTLPExporterError) => void + ): void { + const promise = new Promise((resolve, reject) => { + this._send(this, objects, resolve, reject); + }) + .then(onSuccess, onError); - this._sendingPromises.push(promise); - const popPromise = () => { - const index = this._sendingPromises.indexOf(promise); - this._sendingPromises.splice(index, 1); - }; - promise.then(popPromise, popPromise); -} - -override send( - objects: ExportItem[], - onSuccess: () => void, - onError: (error: OTLPExporterError) => void -): void { - if (this._shutdownOnce.isCalled) { - diag.debug('Shutdown already started. Cannot send objects'); - return; + this._sendingPromises.push(promise); + const popPromise = () => { + const index = this._sendingPromises.indexOf(promise); + this._sendingPromises.splice(index, 1); + }; + promise.then(popPromise, popPromise); } - if (!this._send) { - this._send = send; - this._sendPromise(objects, onSuccess, onError); - } else { - this._sendPromise(objects, onSuccess, onError); + + override send( + objects: ExportItem[], + onSuccess: () => void, + onError: (error: OTLPExporterError) => void + ): void { + if (this._shutdownOnce.isCalled) { + diag.debug('Shutdown already started. Cannot send objects'); + return; + } + if (!this._send) { + this._send = send; + this._sendPromise(objects, onSuccess, onError); + } else { + this._sendPromise(objects, onSuccess, onError); + } } -} abstract getServiceClientType(): ServiceClientType; } diff --git a/experimental/packages/otlp-proto-exporter-base/src/platform/browser/index.ts b/experimental/packages/otlp-proto-exporter-base/src/platform/browser/index.ts index f1bb5a3a75..cb6fbbd4ea 100644 --- a/experimental/packages/otlp-proto-exporter-base/src/platform/browser/index.ts +++ b/experimental/packages/otlp-proto-exporter-base/src/platform/browser/index.ts @@ -1,2 +1,17 @@ -export * from './OTLPProtoExporterBrowserBase' -export * from '../types' +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +export * from './OTLPProtoExporterBrowserBase'; +export * from '../types'; diff --git a/experimental/packages/otlp-proto-exporter-base/src/platform/index.ts b/experimental/packages/otlp-proto-exporter-base/src/platform/index.ts index d03841cfa8..23ebc39a79 100644 --- a/experimental/packages/otlp-proto-exporter-base/src/platform/index.ts +++ b/experimental/packages/otlp-proto-exporter-base/src/platform/index.ts @@ -1,2 +1,17 @@ -export * from './node' -export * from './browser' +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +export * from './node'; +export * from './browser';