You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by GitBox <gi...@apache.org> on 2021/11/26 08:14:58 UTC

[GitHub] [skywalking-nodejs] kezhenxu94 commented on a change in pull request #65: update grpc

kezhenxu94 commented on a change in pull request #65:
URL: https://github.com/apache/skywalking-nodejs/pull/65#discussion_r757300150



##########
File path: src/agent/protocol/grpc/clients/TraceReportClient.ts
##########
@@ -53,14 +52,14 @@ export default class TraceReportClient implements Client {
 
   start() {
     const reportFunction = () => {
-      emitter.emit('segments-sent');  // reset limiter in SpanContext
+      emitter.emit('segments-sent'); // reset limiter in SpanContext
 
       try {
         if (this.buffer.length === 0) {
           return;
         }
 
-        const stream = this.reporterClient.collect((error, _) => {
+        const stream = this.reporterClient.collect(AuthInterceptor(),(error, _) => {

Review comment:
       Please add a space after `,`

##########
File path: src/agent/protocol/grpc/AuthInterceptor.ts
##########
@@ -17,23 +17,14 @@
  *
  */
 
-import * as grpc from 'grpc';
-import { InterceptingCall, Listener, Metadata, Requester } from 'grpc';
+import * as grpc from '@grpc/grpc-js';
 import config from '../../../config/AgentConfig';
 
-type Options = { [key: string]: string | number };
 
-export default function AuthInterceptor(options: Options, nextCall: (options: Options) => InterceptingCall) {
-  return new grpc.InterceptingCall(
-    nextCall(options),
-    new (class implements Requester {
-      // tslint:disable-next-line:ban-types
-      start(metadata: Metadata, listener: Listener, next: Function) {
-        if (config.authorization) {
-          metadata.add('Authentication', config.authorization);
-        }
-        next(metadata, listener);
-      }
-    })(),
-  );
+export default function AuthInterceptor() { 
+  const mata = new grpc.Metadata()
+  if(config.authorization){

Review comment:
       Please add a space before `(`, after `)`




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org