@@ -21,7 +21,7 @@ import * as http from 'http';
21
21
import * as sinon from 'sinon' ;
22
22
import { Stream , PassThrough } from 'stream' ;
23
23
import * as zlib from 'zlib' ;
24
- import { OTLPLogsExporter } from '../../src' ;
24
+ import { OTLPLogExporter } from '../../src' ;
25
25
import {
26
26
ensureExportLogsServiceRequestIsSet ,
27
27
ensureExportedLogRecordIsCorrect ,
@@ -42,8 +42,8 @@ import { ReadableLogRecord } from '@opentelemetry/sdk-logs';
42
42
43
43
let fakeRequest : PassThrough ;
44
44
45
- describe ( 'OTLPLogsExporter - node with proto over http' , ( ) => {
46
- let collectorExporter : OTLPLogsExporter ;
45
+ describe ( 'OTLPLogExporter - node with proto over http' , ( ) => {
46
+ let collectorExporter : OTLPLogExporter ;
47
47
let collectorExporterConfig : OTLPExporterNodeConfigBase ;
48
48
let logs : ReadableLogRecord [ ] ;
49
49
@@ -56,7 +56,7 @@ describe('OTLPLogsExporter - node with proto over http', () => {
56
56
const envSource = process . env ;
57
57
it ( 'should use url defined in env that ends with root path and append version and signal path' , ( ) => {
58
58
envSource . OTEL_EXPORTER_OTLP_ENDPOINT = 'http://foo.bar/' ;
59
- const collectorExporter = new OTLPLogsExporter ( ) ;
59
+ const collectorExporter = new OTLPLogExporter ( ) ;
60
60
assert . strictEqual (
61
61
collectorExporter . url ,
62
62
`${ envSource . OTEL_EXPORTER_OTLP_ENDPOINT } v1/logs`
@@ -65,7 +65,7 @@ describe('OTLPLogsExporter - node with proto over http', () => {
65
65
} ) ;
66
66
it ( 'should use url defined in env without checking if path is already present' , ( ) => {
67
67
envSource . OTEL_EXPORTER_OTLP_ENDPOINT = 'http://foo.bar/v1/logs' ;
68
- const collectorExporter = new OTLPLogsExporter ( ) ;
68
+ const collectorExporter = new OTLPLogExporter ( ) ;
69
69
assert . strictEqual (
70
70
collectorExporter . url ,
71
71
`${ envSource . OTEL_EXPORTER_OTLP_ENDPOINT } /v1/logs`
@@ -74,7 +74,7 @@ describe('OTLPLogsExporter - node with proto over http', () => {
74
74
} ) ;
75
75
it ( 'should use url defined in env and append version and signal' , ( ) => {
76
76
envSource . OTEL_EXPORTER_OTLP_ENDPOINT = 'http://foo.bar' ;
77
- const collectorExporter = new OTLPLogsExporter ( ) ;
77
+ const collectorExporter = new OTLPLogExporter ( ) ;
78
78
assert . strictEqual (
79
79
collectorExporter . url ,
80
80
`${ envSource . OTEL_EXPORTER_OTLP_ENDPOINT } /v1/logs`
@@ -84,7 +84,7 @@ describe('OTLPLogsExporter - node with proto over http', () => {
84
84
it ( 'should override global exporter url with signal url defined in env' , ( ) => {
85
85
envSource . OTEL_EXPORTER_OTLP_ENDPOINT = 'http://foo.bar/' ;
86
86
envSource . OTEL_EXPORTER_OTLP_LOGS_ENDPOINT = 'http://foo.logs/' ;
87
- const collectorExporter = new OTLPLogsExporter ( ) ;
87
+ const collectorExporter = new OTLPLogExporter ( ) ;
88
88
assert . strictEqual (
89
89
collectorExporter . url ,
90
90
envSource . OTEL_EXPORTER_OTLP_LOGS_ENDPOINT
@@ -94,7 +94,7 @@ describe('OTLPLogsExporter - node with proto over http', () => {
94
94
} ) ;
95
95
it ( 'should add root path when signal url defined in env contains no path and no root path' , ( ) => {
96
96
envSource . OTEL_EXPORTER_OTLP_LOGS_ENDPOINT = 'http://foo.bar' ;
97
- const collectorExporter = new OTLPLogsExporter ( ) ;
97
+ const collectorExporter = new OTLPLogExporter ( ) ;
98
98
assert . strictEqual (
99
99
collectorExporter . url ,
100
100
`${ envSource . OTEL_EXPORTER_OTLP_LOGS_ENDPOINT } /`
@@ -103,7 +103,7 @@ describe('OTLPLogsExporter - node with proto over http', () => {
103
103
} ) ;
104
104
it ( 'should not add root path when signal url defined in env contains root path but no path' , ( ) => {
105
105
envSource . OTEL_EXPORTER_OTLP_LOGS_ENDPOINT = 'http://foo.bar/' ;
106
- const collectorExporter = new OTLPLogsExporter ( ) ;
106
+ const collectorExporter = new OTLPLogExporter ( ) ;
107
107
assert . strictEqual (
108
108
collectorExporter . url ,
109
109
`${ envSource . OTEL_EXPORTER_OTLP_LOGS_ENDPOINT } `
@@ -112,7 +112,7 @@ describe('OTLPLogsExporter - node with proto over http', () => {
112
112
} ) ;
113
113
it ( 'should not add root path when signal url defined in env contains path' , ( ) => {
114
114
envSource . OTEL_EXPORTER_OTLP_LOGS_ENDPOINT = 'http://foo.bar/v1/logs' ;
115
- const collectorExporter = new OTLPLogsExporter ( ) ;
115
+ const collectorExporter = new OTLPLogExporter ( ) ;
116
116
assert . strictEqual (
117
117
collectorExporter . url ,
118
118
`${ envSource . OTEL_EXPORTER_OTLP_LOGS_ENDPOINT } `
@@ -121,7 +121,7 @@ describe('OTLPLogsExporter - node with proto over http', () => {
121
121
} ) ;
122
122
it ( 'should not add root path when signal url defined in env contains path and ends in /' , ( ) => {
123
123
envSource . OTEL_EXPORTER_OTLP_LOGS_ENDPOINT = 'http://foo.bar/v1/logs/' ;
124
- const collectorExporter = new OTLPLogsExporter ( ) ;
124
+ const collectorExporter = new OTLPLogExporter ( ) ;
125
125
assert . strictEqual (
126
126
collectorExporter . url ,
127
127
`${ envSource . OTEL_EXPORTER_OTLP_LOGS_ENDPOINT } `
@@ -130,14 +130,14 @@ describe('OTLPLogsExporter - node with proto over http', () => {
130
130
} ) ;
131
131
it ( 'should use headers defined via env' , ( ) => {
132
132
envSource . OTEL_EXPORTER_OTLP_LOGS_HEADERS = 'foo=bar' ;
133
- const collectorExporter = new OTLPLogsExporter ( ) ;
133
+ const collectorExporter = new OTLPLogExporter ( ) ;
134
134
assert . strictEqual ( collectorExporter . headers . foo , 'bar' ) ;
135
135
envSource . OTEL_EXPORTER_OTLP_HEADERS = '' ;
136
136
} ) ;
137
137
it ( 'should override global headers config with signal headers defined via env' , ( ) => {
138
138
envSource . OTEL_EXPORTER_OTLP_HEADERS = 'foo=bar,bar=foo' ;
139
139
envSource . OTEL_EXPORTER_OTLP_LOGS_HEADERS = 'foo=boo' ;
140
- const collectorExporter = new OTLPLogsExporter ( ) ;
140
+ const collectorExporter = new OTLPLogExporter ( ) ;
141
141
assert . strictEqual ( collectorExporter . headers . foo , 'boo' ) ;
142
142
assert . strictEqual ( collectorExporter . headers . bar , 'foo' ) ;
143
143
envSource . OTEL_EXPORTER_OTLP_LOGS_HEADERS = '' ;
@@ -156,7 +156,7 @@ describe('OTLPLogsExporter - node with proto over http', () => {
156
156
keepAlive : true ,
157
157
httpAgentOptions : { keepAliveMsecs : 2000 } ,
158
158
} ;
159
- collectorExporter = new OTLPLogsExporter ( collectorExporterConfig ) ;
159
+ collectorExporter = new OTLPLogExporter ( collectorExporterConfig ) ;
160
160
logs = [ ] ;
161
161
logs . push ( Object . assign ( { } , mockedReadableLogRecord ) ) ;
162
162
} ) ;
@@ -286,7 +286,7 @@ describe('OTLPLogsExporter - node with proto over http', () => {
286
286
compression : CompressionAlgorithm . GZIP ,
287
287
httpAgentOptions : { keepAliveMsecs : 2000 } ,
288
288
} ;
289
- collectorExporter = new OTLPLogsExporter ( collectorExporterConfig ) ;
289
+ collectorExporter = new OTLPLogExporter ( collectorExporterConfig ) ;
290
290
logs = [ ] ;
291
291
logs . push ( Object . assign ( { } , mockedReadableLogRecord ) ) ;
292
292
} ) ;
@@ -331,7 +331,7 @@ describe('OTLPLogsExporter - node with proto over http', () => {
331
331
} ) ;
332
332
333
333
describe ( 'export - real http request destroyed before response received' , ( ) => {
334
- let collectorExporter : OTLPLogsExporter ;
334
+ let collectorExporter : OTLPLogExporter ;
335
335
let collectorExporterConfig : OTLPExporterNodeConfigBase ;
336
336
let logs : ReadableLogRecord [ ] ;
337
337
const server = http . createServer ( ( _ , res ) => {
@@ -351,7 +351,7 @@ describe('export - real http request destroyed before response received', () =>
351
351
url : 'http://localhost:8082' ,
352
352
timeoutMillis : 1 ,
353
353
} ;
354
- collectorExporter = new OTLPLogsExporter ( collectorExporterConfig ) ;
354
+ collectorExporter = new OTLPLogExporter ( collectorExporterConfig ) ;
355
355
logs = [ ] ;
356
356
logs . push ( Object . assign ( { } , mockedReadableLogRecord ) ) ;
357
357
@@ -368,7 +368,7 @@ describe('export - real http request destroyed before response received', () =>
368
368
url : 'http://localhost:8082' ,
369
369
timeoutMillis : 100 ,
370
370
} ;
371
- collectorExporter = new OTLPLogsExporter ( collectorExporterConfig ) ;
371
+ collectorExporter = new OTLPLogExporter ( collectorExporterConfig ) ;
372
372
logs = [ ] ;
373
373
logs . push ( Object . assign ( { } , mockedReadableLogRecord ) ) ;
374
374
@@ -383,7 +383,7 @@ describe('export - real http request destroyed before response received', () =>
383
383
} ) ;
384
384
385
385
describe ( 'export - real http request destroyed after response received' , ( ) => {
386
- let collectorExporter : OTLPLogsExporter ;
386
+ let collectorExporter : OTLPLogExporter ;
387
387
let collectorExporterConfig : OTLPExporterNodeConfigBase ;
388
388
let logs : ReadableLogRecord [ ] ;
389
389
@@ -401,7 +401,7 @@ describe('export - real http request destroyed after response received', () => {
401
401
url : 'http://localhost:8082' ,
402
402
timeoutMillis : 300 ,
403
403
} ;
404
- collectorExporter = new OTLPLogsExporter ( collectorExporterConfig ) ;
404
+ collectorExporter = new OTLPLogExporter ( collectorExporterConfig ) ;
405
405
logs = [ ] ;
406
406
logs . push ( Object . assign ( { } , mockedReadableLogRecord ) ) ;
407
407
0 commit comments