How to use the grpc.primary_user_agent function in grpc

To help you get started, we’ve selected a few grpc examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github maierj / fastlane-action / .github / actions / statistics-chart-action / node_modules / @grpc / grpc-js / build / src / subchannel.js View on Github external
this.keepaliveTimeMs = KEEPALIVE_MAX_TIME_MS;
        /**
         * The amount of time to wait for an acknowledgement after sending a ping
         */
        this.keepaliveTimeoutMs = KEEPALIVE_TIMEOUT_MS;
        /**
         * Tracks calls with references to this subchannel
         */
        this.callRefcount = 0;
        /**
         * Tracks channels and subchannel pools with references to this subchannel
         */
        this.refcount = 0;
        // Build user-agent string.
        this.userAgent = [
            options['grpc.primary_user_agent'],
            `grpc-node-js/${clientVersion}`,
            options['grpc.secondary_user_agent'],
        ]
            .filter(e => e)
            .join(' '); // remove falsey values first
        if ('grpc.keepalive_time_ms' in options) {
            this.keepaliveTimeMs = options['grpc.keepalive_time_ms'];
        }
        if ('grpc.keepalive_timeout_ms' in options) {
            this.keepaliveTimeoutMs = options['grpc.keepalive_timeout_ms'];
        }
        this.keepaliveIntervalId = setTimeout(() => { }, 0);
        clearTimeout(this.keepaliveIntervalId);
        this.keepaliveTimeoutId = setTimeout(() => { }, 0);
        clearTimeout(this.keepaliveTimeoutId);
        const backoffOptions = {
github grpc / grpc-node / packages / grpc-js / src / channel.ts View on Github external
this.defaultAuthority = this.target.host;
    }
    this.filterStackFactory = new FilterStackFactory([
      new CallCredentialsFilterFactory(this),
      new DeadlineFilterFactory(this),
      new MetadataStatusFilterFactory(this),
      new CompressionFilterFactory(this),
    ]);
    this.currentBackoffDeadline = new Date();
    /* The only purpose of these lines is to ensure that this.backoffTimerId has
     * a value of type NodeJS.Timer. */
    this.backoffTimerId = setTimeout(() => {}, 0);

    // Build user-agent string.
    this.userAgent = [
      options['grpc.primary_user_agent'],
      `grpc-node-js/${clientVersion}`,
      options['grpc.secondary_user_agent'],
    ]
      .filter(e => e)
      .join(' '); // remove falsey values first
  }
github grpc / grpc-node / src / client.js View on Github external
function Client(address, credentials, options, updateMetadata) {
    if (!updateMetadata) {
      updateMetadata = function(uri, metadata, callback) {
        callback(null, metadata);
      };
    }
    if (!options) {
      options = {};
    }
    options['grpc.primary_user_agent'] = 'grpc-node/' + version;
    this.$channel = new grpc.Channel(address, credentials, options);
    // Remove the optional DNS scheme, trailing port, and trailing backslash
    address = address.replace(/^(dns:\/{3})?([^:\/]+)(:\d+)?\/?$/, '$2');
    this.$server_address = address;
    this.$auth_uri = 'https://' + this.server_address + '/' + serviceName;
    this.$updateMetadata = updateMetadata;
  }
github grpc / grpc / src / node / src / client.js View on Github external
function Client(address, credentials, options) {
    if (!options) {
      options = {};
    }
    /* Append the grpc-node user agent string after the application user agent
     * string, and put the combination at the beginning of the user agent string
     */
    if (options['grpc.primary_user_agent']) {
      options['grpc.primary_user_agent'] += ' ';
    } else {
      options['grpc.primary_user_agent'] = '';
    }
    options['grpc.primary_user_agent'] += 'grpc-node/' + version;
    /* Private fields use $ as a prefix instead of _ because it is an invalid
     * prefix of a method name */
    this.$channel = new grpc.Channel(address, credentials, options);
  }
github grpc / grpc / src / node / src / client.js View on Github external
function Client(address, credentials, options) {
    if (!options) {
      options = {};
    }
    /* Append the grpc-node user agent string after the application user agent
     * string, and put the combination at the beginning of the user agent string
     */
    if (options['grpc.primary_user_agent']) {
      options['grpc.primary_user_agent'] += ' ';
    } else {
      options['grpc.primary_user_agent'] = '';
    }
    options['grpc.primary_user_agent'] += 'grpc-node/' + version;
    /* Private fields use $ as a prefix instead of _ because it is an invalid
     * prefix of a method name */
    this.$channel = new grpc.Channel(address, credentials, options);
  }
github maierj / fastlane-action / .github / actions / statistics-chart-action / node_modules / @grpc / grpc-js / src / subchannel.ts View on Github external
constructor(
    private channelTarget: string,
    private subchannelAddress: string,
    private options: ChannelOptions,
    private credentials: ChannelCredentials
  ) {
    // Build user-agent string.
    this.userAgent = [
      options['grpc.primary_user_agent'],
      `grpc-node-js/${clientVersion}`,
      options['grpc.secondary_user_agent'],
    ]
      .filter(e => e)
      .join(' '); // remove falsey values first

    if ('grpc.keepalive_time_ms' in options) {
      this.keepaliveTimeMs = options['grpc.keepalive_time_ms']!;
    }
    if ('grpc.keepalive_timeout_ms' in options) {
      this.keepaliveTimeoutMs = options['grpc.keepalive_timeout_ms']!;
    }
    this.keepaliveIntervalId = setTimeout(() => {}, 0);
    clearTimeout(this.keepaliveIntervalId);
    this.keepaliveTimeoutId = setTimeout(() => {}, 0);
    clearTimeout(this.keepaliveTimeoutId);
github grpc / grpc-node / packages / grpc-js-core / src / channel.ts View on Github external
} else {
      this.defaultAuthority = this.target.host;
    }
    this.filterStackFactory = new FilterStackFactory([
      new CallCredentialsFilterFactory(this), new DeadlineFilterFactory(this),
      new MetadataStatusFilterFactory(this), new CompressionFilterFactory(this)
    ]);
    this.currentBackoffDeadline = new Date();
    /* The only purpose of these lines is to ensure that this.backoffTimerId has
     * a value of type NodeJS.Timer. */
    this.backoffTimerId = setTimeout(() => {}, 0);
    clearTimeout(this.backoffTimerId);

    // Build user-agent string.
    this.userAgent = [
      options['grpc.primary_user_agent'], `grpc-node-js/${clientVersion}`,
      options['grpc.secondary_user_agent']
    ].filter(e => e).join(' ');  // remove falsey values first
  }