Skip to content

Commit

Permalink
fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
pkanal committed Oct 3, 2022
1 parent d33f9bb commit 3dd4e17
Show file tree
Hide file tree
Showing 6 changed files with 88 additions and 65 deletions.
18 changes: 0 additions & 18 deletions examples/opentelemetry-web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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"
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@
*/

export * from './OTLPExporterBrowserBase';
export { sendWithXhr } from './util'
export { sendWithXhr } from './util';
17 changes: 16 additions & 1 deletion experimental/packages/otlp-proto-exporter-base/src/index.ts
Original file line number Diff line number Diff line change
@@ -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';
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
// export const OTLPProtoExporterBrowserBase = () => {
// console.log('otlp-proto-exporter-base')
// }

/*
* Copyright The OpenTelemetry Authors
*
Expand All @@ -26,61 +22,61 @@ import {
OTLPExporterError,
OTLPExporterConfigBase
} from '@opentelemetry/otlp-exporter-base';
import { send } from './util'
import { send } from './util';

type SendFn = <ExportItem, ServiceRequest>(collector: OTLPProtoExporterBrowserBase<ExportItem, ServiceRequest>,
objects: ExportItem[],
// compression: CompressionAlgorithm,
onSuccess: () => void,
onError: (error: OTLPExporterError) => void) => void;

/**
/**
* Collector Exporter abstract base class
*/
export abstract class OTLPProtoExporterBrowserBase<
ExportItem,
ServiceRequest
> extends OTLPExporterBaseMain<ExportItem, ServiceRequest> {
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<void>((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<void>((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;

}
Original file line number Diff line number Diff line change
@@ -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';
Original file line number Diff line number Diff line change
@@ -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';

0 comments on commit 3dd4e17

Please sign in to comment.