Skip to content

Commit 6a6ec9e

Browse files
committed
chore(exporter-logs-otlp-proto): rename OTLPLogsExporter to OTLPLogExporter for consistency
Fixes #4139
1 parent faf939c commit 6a6ec9e

File tree

9 files changed

+36
-36
lines changed

9 files changed

+36
-36
lines changed

experimental/packages/exporter-logs-otlp-proto/README.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ To see documentation and sample code for the metric exporter, see the [exporter-
2222

2323
```js
2424
const { LoggerProvider, SimpleLogRecordProcessor } = require('@opentelemetry/sdk-logs');
25-
const { OTLPLogsExporter } = require('@opentelemetry/exporter-logs-otlp-proto');
25+
const { OTLPLogExporter } = require('@opentelemetry/exporter-logs-otlp-proto');
2626

2727
const collectorOptions = {
2828
url: '<opentelemetry-collector-url>', // url is optional and can be omitted - default is http://localhost:4318/v1/logs
@@ -32,7 +32,7 @@ const collectorOptions = {
3232
};
3333

3434
const logProvider = new LoggerProvider({resource: new Resource({'service.name': 'testApp'})});
35-
const logExporter = new OTLPLogsExporter(collectorOptions);
35+
const logExporter = new OTLPLogExporter(collectorOptions);
3636
logProvider.addLogRecordProcessor(new SimpleLogRecordProcessor(exporter));
3737

3838
const logger = logProvider.getLogger('test_log_instrumentation');
@@ -44,7 +44,7 @@ logger.emit({
4444

4545
## Exporter Timeout Configuration
4646

47-
The OTLPLogsExporter has a timeout configuration option which is the maximum time, in milliseconds, the OTLP exporter will wait for each batch export. The default value is 10000ms.
47+
The OTLPLogExporter has a timeout configuration option which is the maximum time, in milliseconds, the OTLP exporter will wait for each batch export. The default value is 10000ms.
4848

4949
To override the default timeout duration, use the following options:
5050

@@ -57,7 +57,7 @@ To override the default timeout duration, use the following options:
5757

5858
> `OTEL_EXPORTER_OTLP_LOGS_TIMEOUT` takes precedence and overrides `OTEL_EXPORTER_OTLP_TIMEOUT`.
5959
60-
+ Provide `timeoutMillis` to OTLPLogsExporter with `collectorOptions`:
60+
+ Provide `timeoutMillis` to OTLPLogExporter with `collectorOptions`:
6161

6262
```js
6363
const collectorOptions = {
@@ -68,7 +68,7 @@ To override the default timeout duration, use the following options:
6868
}, //an optional object containing custom headers to be sent with each request will only work with http
6969
};
7070

71-
const exporter = new OTLPLogsExporter(collectorOptions);
71+
const exporter = new OTLPLogExporter(collectorOptions);
7272
```
7373

7474
> Providing `timeoutMillis` with `collectorOptions` takes precedence and overrides timeout set with environment variables.

experimental/packages/exporter-logs-otlp-proto/src/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16-
export { OTLPLogsExporter } from './platform';
16+
export { OTLPLogExporter } from './platform';

experimental/packages/exporter-logs-otlp-proto/src/platform/browser/OTLPLogsExporter.ts renamed to experimental/packages/exporter-logs-otlp-proto/src/platform/browser/OTLPLogExporter.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ const DEFAULT_COLLECTOR_URL = `http://localhost:4318/${DEFAULT_COLLECTOR_RESOURC
3737
/**
3838
* Collector Trace Exporter for Web
3939
*/
40-
export class OTLPLogsExporter
40+
export class OTLPLogExporter
4141
extends OTLPProtoExporterBrowserBase<
4242
ReadableLogRecord,
4343
IExportLogsServiceRequest

experimental/packages/exporter-logs-otlp-proto/src/platform/browser/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16-
export { OTLPLogsExporter } from './OTLPLogsExporter';
16+
export { OTLPLogExporter } from './OTLPLogExporter';

experimental/packages/exporter-logs-otlp-proto/src/platform/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16-
export { OTLPLogsExporter } from './node';
16+
export { OTLPLogExporter } from './node';

experimental/packages/exporter-logs-otlp-proto/src/platform/node/OTLPLogsExporter.ts renamed to experimental/packages/exporter-logs-otlp-proto/src/platform/node/OTLPLogExporter.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ const DEFAULT_COLLECTOR_URL = `http://localhost:4318/${DEFAULT_COLLECTOR_RESOURC
3737
/**
3838
* Collector Trace Exporter for Node
3939
*/
40-
export class OTLPLogsExporter
40+
export class OTLPLogExporter
4141
extends OTLPProtoExporterNodeBase<
4242
ReadableLogRecord,
4343
IExportLogsServiceRequest

experimental/packages/exporter-logs-otlp-proto/src/platform/node/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@
1414
* limitations under the License.
1515
*/
1616

17-
export { OTLPLogsExporter } from './OTLPLogsExporter';
17+
export { OTLPLogExporter } from './OTLPLogExporter';

experimental/packages/exporter-logs-otlp-proto/test/browser/OTLPLogsExporter.test.ts renamed to experimental/packages/exporter-logs-otlp-proto/test/browser/OTLPLogExporter.test.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,19 @@
1616

1717
import * as assert from 'assert';
1818
import * as sinon from 'sinon';
19-
import { OTLPLogsExporter } from '../../src/platform/browser/index';
19+
import { OTLPLogExporter } from '../../src/platform/browser/index';
2020

21-
describe('OTLPLogsExporter - web', () => {
22-
let collectorLogsExporter: OTLPLogsExporter;
21+
describe('OTLPLogExporter - web', () => {
22+
let collectorLogsExporter: OTLPLogExporter;
2323
describe('constructor', () => {
2424
let onInitSpy: any;
2525
beforeEach(() => {
26-
onInitSpy = sinon.stub(OTLPLogsExporter.prototype, 'onInit');
26+
onInitSpy = sinon.stub(OTLPLogExporter.prototype, 'onInit');
2727
const collectorExporterConfig = {
2828
hostname: 'foo',
2929
url: 'http://foo.bar.com',
3030
};
31-
collectorLogsExporter = new OTLPLogsExporter(collectorExporterConfig);
31+
collectorLogsExporter = new OTLPLogExporter(collectorExporterConfig);
3232
});
3333
afterEach(() => {
3434
sinon.restore();

experimental/packages/exporter-logs-otlp-proto/test/node/OTLPLogsExporter.test.ts renamed to experimental/packages/exporter-logs-otlp-proto/test/node/OTLPLogExporter.test.ts

+20-20
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import * as http from 'http';
2121
import * as sinon from 'sinon';
2222
import { Stream, PassThrough } from 'stream';
2323
import * as zlib from 'zlib';
24-
import { OTLPLogsExporter } from '../../src';
24+
import { OTLPLogExporter } from '../../src';
2525
import {
2626
ensureExportLogsServiceRequestIsSet,
2727
ensureExportedLogRecordIsCorrect,
@@ -42,8 +42,8 @@ import { ReadableLogRecord } from '@opentelemetry/sdk-logs';
4242

4343
let fakeRequest: PassThrough;
4444

45-
describe('OTLPLogsExporter - node with proto over http', () => {
46-
let collectorExporter: OTLPLogsExporter;
45+
describe('OTLPLogExporter - node with proto over http', () => {
46+
let collectorExporter: OTLPLogExporter;
4747
let collectorExporterConfig: OTLPExporterNodeConfigBase;
4848
let logs: ReadableLogRecord[];
4949

@@ -56,7 +56,7 @@ describe('OTLPLogsExporter - node with proto over http', () => {
5656
const envSource = process.env;
5757
it('should use url defined in env that ends with root path and append version and signal path', () => {
5858
envSource.OTEL_EXPORTER_OTLP_ENDPOINT = 'http://foo.bar/';
59-
const collectorExporter = new OTLPLogsExporter();
59+
const collectorExporter = new OTLPLogExporter();
6060
assert.strictEqual(
6161
collectorExporter.url,
6262
`${envSource.OTEL_EXPORTER_OTLP_ENDPOINT}v1/logs`
@@ -65,7 +65,7 @@ describe('OTLPLogsExporter - node with proto over http', () => {
6565
});
6666
it('should use url defined in env without checking if path is already present', () => {
6767
envSource.OTEL_EXPORTER_OTLP_ENDPOINT = 'http://foo.bar/v1/logs';
68-
const collectorExporter = new OTLPLogsExporter();
68+
const collectorExporter = new OTLPLogExporter();
6969
assert.strictEqual(
7070
collectorExporter.url,
7171
`${envSource.OTEL_EXPORTER_OTLP_ENDPOINT}/v1/logs`
@@ -74,7 +74,7 @@ describe('OTLPLogsExporter - node with proto over http', () => {
7474
});
7575
it('should use url defined in env and append version and signal', () => {
7676
envSource.OTEL_EXPORTER_OTLP_ENDPOINT = 'http://foo.bar';
77-
const collectorExporter = new OTLPLogsExporter();
77+
const collectorExporter = new OTLPLogExporter();
7878
assert.strictEqual(
7979
collectorExporter.url,
8080
`${envSource.OTEL_EXPORTER_OTLP_ENDPOINT}/v1/logs`
@@ -84,7 +84,7 @@ describe('OTLPLogsExporter - node with proto over http', () => {
8484
it('should override global exporter url with signal url defined in env', () => {
8585
envSource.OTEL_EXPORTER_OTLP_ENDPOINT = 'http://foo.bar/';
8686
envSource.OTEL_EXPORTER_OTLP_LOGS_ENDPOINT = 'http://foo.logs/';
87-
const collectorExporter = new OTLPLogsExporter();
87+
const collectorExporter = new OTLPLogExporter();
8888
assert.strictEqual(
8989
collectorExporter.url,
9090
envSource.OTEL_EXPORTER_OTLP_LOGS_ENDPOINT
@@ -94,7 +94,7 @@ describe('OTLPLogsExporter - node with proto over http', () => {
9494
});
9595
it('should add root path when signal url defined in env contains no path and no root path', () => {
9696
envSource.OTEL_EXPORTER_OTLP_LOGS_ENDPOINT = 'http://foo.bar';
97-
const collectorExporter = new OTLPLogsExporter();
97+
const collectorExporter = new OTLPLogExporter();
9898
assert.strictEqual(
9999
collectorExporter.url,
100100
`${envSource.OTEL_EXPORTER_OTLP_LOGS_ENDPOINT}/`
@@ -103,7 +103,7 @@ describe('OTLPLogsExporter - node with proto over http', () => {
103103
});
104104
it('should not add root path when signal url defined in env contains root path but no path', () => {
105105
envSource.OTEL_EXPORTER_OTLP_LOGS_ENDPOINT = 'http://foo.bar/';
106-
const collectorExporter = new OTLPLogsExporter();
106+
const collectorExporter = new OTLPLogExporter();
107107
assert.strictEqual(
108108
collectorExporter.url,
109109
`${envSource.OTEL_EXPORTER_OTLP_LOGS_ENDPOINT}`
@@ -112,7 +112,7 @@ describe('OTLPLogsExporter - node with proto over http', () => {
112112
});
113113
it('should not add root path when signal url defined in env contains path', () => {
114114
envSource.OTEL_EXPORTER_OTLP_LOGS_ENDPOINT = 'http://foo.bar/v1/logs';
115-
const collectorExporter = new OTLPLogsExporter();
115+
const collectorExporter = new OTLPLogExporter();
116116
assert.strictEqual(
117117
collectorExporter.url,
118118
`${envSource.OTEL_EXPORTER_OTLP_LOGS_ENDPOINT}`
@@ -121,7 +121,7 @@ describe('OTLPLogsExporter - node with proto over http', () => {
121121
});
122122
it('should not add root path when signal url defined in env contains path and ends in /', () => {
123123
envSource.OTEL_EXPORTER_OTLP_LOGS_ENDPOINT = 'http://foo.bar/v1/logs/';
124-
const collectorExporter = new OTLPLogsExporter();
124+
const collectorExporter = new OTLPLogExporter();
125125
assert.strictEqual(
126126
collectorExporter.url,
127127
`${envSource.OTEL_EXPORTER_OTLP_LOGS_ENDPOINT}`
@@ -130,14 +130,14 @@ describe('OTLPLogsExporter - node with proto over http', () => {
130130
});
131131
it('should use headers defined via env', () => {
132132
envSource.OTEL_EXPORTER_OTLP_LOGS_HEADERS = 'foo=bar';
133-
const collectorExporter = new OTLPLogsExporter();
133+
const collectorExporter = new OTLPLogExporter();
134134
assert.strictEqual(collectorExporter.headers.foo, 'bar');
135135
envSource.OTEL_EXPORTER_OTLP_HEADERS = '';
136136
});
137137
it('should override global headers config with signal headers defined via env', () => {
138138
envSource.OTEL_EXPORTER_OTLP_HEADERS = 'foo=bar,bar=foo';
139139
envSource.OTEL_EXPORTER_OTLP_LOGS_HEADERS = 'foo=boo';
140-
const collectorExporter = new OTLPLogsExporter();
140+
const collectorExporter = new OTLPLogExporter();
141141
assert.strictEqual(collectorExporter.headers.foo, 'boo');
142142
assert.strictEqual(collectorExporter.headers.bar, 'foo');
143143
envSource.OTEL_EXPORTER_OTLP_LOGS_HEADERS = '';
@@ -156,7 +156,7 @@ describe('OTLPLogsExporter - node with proto over http', () => {
156156
keepAlive: true,
157157
httpAgentOptions: { keepAliveMsecs: 2000 },
158158
};
159-
collectorExporter = new OTLPLogsExporter(collectorExporterConfig);
159+
collectorExporter = new OTLPLogExporter(collectorExporterConfig);
160160
logs = [];
161161
logs.push(Object.assign({}, mockedReadableLogRecord));
162162
});
@@ -286,7 +286,7 @@ describe('OTLPLogsExporter - node with proto over http', () => {
286286
compression: CompressionAlgorithm.GZIP,
287287
httpAgentOptions: { keepAliveMsecs: 2000 },
288288
};
289-
collectorExporter = new OTLPLogsExporter(collectorExporterConfig);
289+
collectorExporter = new OTLPLogExporter(collectorExporterConfig);
290290
logs = [];
291291
logs.push(Object.assign({}, mockedReadableLogRecord));
292292
});
@@ -331,7 +331,7 @@ describe('OTLPLogsExporter - node with proto over http', () => {
331331
});
332332

333333
describe('export - real http request destroyed before response received', () => {
334-
let collectorExporter: OTLPLogsExporter;
334+
let collectorExporter: OTLPLogExporter;
335335
let collectorExporterConfig: OTLPExporterNodeConfigBase;
336336
let logs: ReadableLogRecord[];
337337
const server = http.createServer((_, res) => {
@@ -351,7 +351,7 @@ describe('export - real http request destroyed before response received', () =>
351351
url: 'http://localhost:8082',
352352
timeoutMillis: 1,
353353
};
354-
collectorExporter = new OTLPLogsExporter(collectorExporterConfig);
354+
collectorExporter = new OTLPLogExporter(collectorExporterConfig);
355355
logs = [];
356356
logs.push(Object.assign({}, mockedReadableLogRecord));
357357

@@ -368,7 +368,7 @@ describe('export - real http request destroyed before response received', () =>
368368
url: 'http://localhost:8082',
369369
timeoutMillis: 100,
370370
};
371-
collectorExporter = new OTLPLogsExporter(collectorExporterConfig);
371+
collectorExporter = new OTLPLogExporter(collectorExporterConfig);
372372
logs = [];
373373
logs.push(Object.assign({}, mockedReadableLogRecord));
374374

@@ -383,7 +383,7 @@ describe('export - real http request destroyed before response received', () =>
383383
});
384384

385385
describe('export - real http request destroyed after response received', () => {
386-
let collectorExporter: OTLPLogsExporter;
386+
let collectorExporter: OTLPLogExporter;
387387
let collectorExporterConfig: OTLPExporterNodeConfigBase;
388388
let logs: ReadableLogRecord[];
389389

@@ -401,7 +401,7 @@ describe('export - real http request destroyed after response received', () => {
401401
url: 'http://localhost:8082',
402402
timeoutMillis: 300,
403403
};
404-
collectorExporter = new OTLPLogsExporter(collectorExporterConfig);
404+
collectorExporter = new OTLPLogExporter(collectorExporterConfig);
405405
logs = [];
406406
logs.push(Object.assign({}, mockedReadableLogRecord));
407407

0 commit comments

Comments
 (0)