You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: experimental/CHANGELOG.md
+1Lines changed: 1 addition & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -81,6 +81,7 @@ All notable changes to experimental packages in this project will be documented
81
81
82
82
* fix(sdk-node): use resource interface instead of concrete class [#3803](https://github.com/open-telemetry/opentelemetry-js/pull/3803)@blumamir
83
83
* fix(sdk-logs): remove includeTraceContext configuration and use LogRecord context when available [#3817](https://github.com/open-telemetry/opentelemetry-js/pull/3817)@hectorhdzg
(argasMetadata)['internalRepr']&&// changed from _internal_repr in grpc --> @grpc/grpc-js https://github.com/grpc/grpc-node/blob/95289edcaf36979cccf12797cc27335da8d01f03/packages/grpc-js/src/metadata.ts#L88
200
201
typeof(argasMetadata).getMap==='function'
201
202
);
202
203
});
204
+
}
205
+
206
+
/**
207
+
* Returns the metadata argument from user provided arguments (`args`)
208
+
* If no metadata is provided in `args`: adds empty metadata to `args` and returns that empty metadata
209
+
*/
210
+
exportfunctionextractMetadataOrSplice(
211
+
grpcLib: typeofgrpcJs,
212
+
args: Array<unknown|grpcJs.Metadata>,
213
+
spliceIndex: number
214
+
){
215
+
letmetadata: grpcJs.Metadata;
216
+
constmetadataIndex=getMetadataIndex(args);
203
217
if(metadataIndex===-1){
204
-
metadata=newgrpcClient.Metadata();
205
-
if(!original.requestStream){
206
-
// unary or server stream
207
-
metadataIndex=1;
208
-
}else{
209
-
// client stream or bidi
210
-
metadataIndex=0;
211
-
}
212
-
args.splice(metadataIndex,0,metadata);
218
+
// Create metadata if it does not exist
219
+
metadata=newgrpcLib.Metadata();
220
+
args.splice(spliceIndex,0,metadata);
213
221
}else{
214
222
metadata=args[metadataIndex]asMetadata;
215
223
}
216
224
returnmetadata;
217
225
}
218
226
227
+
/**
228
+
* Returns the metadata argument from user provided arguments (`args`)
229
+
* Adds empty metadata to arguments if the default is used.
230
+
*/
231
+
exportfunctionextractMetadataOrSpliceDefault(
232
+
grpcClient: typeofgrpcJs,
233
+
original: GrpcClientFunc,
234
+
args: Array<unknown|grpcJs.Metadata>
235
+
): grpcJs.Metadata{
236
+
returnextractMetadataOrSplice(
237
+
grpcClient,
238
+
args,
239
+
original.requestStream ? 0 : 1
240
+
);
241
+
}
242
+
219
243
/**
220
244
* Inject opentelemetry trace context into `metadata` for use by another
0 commit comments