File tree 2 files changed +8
-8
lines changed
packages/opentelemetry-exporter-collector/src/platform
2 files changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -68,19 +68,14 @@ export abstract class CollectorExporterBrowserBase<
68
68
const serviceRequest = this . convert ( items ) ;
69
69
const body = JSON . stringify ( serviceRequest ) ;
70
70
71
- const promise = new Promise ( resolve => {
71
+ const promise = new Promise < void > ( resolve => {
72
72
const _onSuccess = ( ) : void => {
73
73
onSuccess ( ) ;
74
- _onFinish ( ) ;
74
+ resolve ( ) ;
75
75
} ;
76
76
const _onError = ( error : collectorTypes . CollectorExporterError ) : void => {
77
77
onError ( error ) ;
78
- _onFinish ( ) ;
79
- } ;
80
- const _onFinish = ( ) => {
81
78
resolve ( ) ;
82
- const index = this . _sendingPromises . indexOf ( promise ) ;
83
- this . _sendingPromises . splice ( index , 1 ) ;
84
79
} ;
85
80
86
81
if ( this . _useXHR ) {
@@ -97,5 +92,10 @@ export abstract class CollectorExporterBrowserBase<
97
92
}
98
93
} ) ;
99
94
this . _sendingPromises . push ( promise ) ;
95
+ const _onFinish = ( ) => {
96
+ const index = this . _sendingPromises . indexOf ( promise ) ;
97
+ this . _sendingPromises . splice ( index , 1 ) ;
98
+ } ;
99
+ promise . then ( _onFinish ) ;
100
100
}
101
101
}
Original file line number Diff line number Diff line change @@ -40,7 +40,7 @@ export abstract class CollectorExporterNodeBase<
40
40
httpAgentOptions : http . AgentOptions | https . AgentOptions = { } ;
41
41
constructor ( config : CollectorExporterNodeConfigBase = { } ) {
42
42
super ( config ) ;
43
- if ( ( config as any ) . metadata ) {
43
+ if ( 'metadata' in config ) {
44
44
this . logger . warn ( 'Metadata cannot be set when using http' ) ;
45
45
}
46
46
this . headers =
You can’t perform that action at this time.
0 commit comments