How to use the queue.max_bytes.number function in queue

To help you get started, we’ve selected a few queue 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 elastic / kibana / x-pack / legacy / plugins / logstash / public / components / pipeline_editor / pipeline_editor.js View on Github external
constructor(props) {
    super(props);

    const {
      pipeline: { id, description, pipeline, settings },
      username,
    } = this.props;

    const pipelineWorkersSet = typeof settings['pipeline.workers'] === 'number';
    const pipelineWorkers = pipelineWorkersSet ? settings['pipeline.workers'] : 1;
    this.state = {
      maxBytesNumber: settings['queue.max_bytes.number'],
      maxBytesUnit: settings['queue.max_bytes.units'],
      pipeline: {
        id,
        description,
        pipeline,
        settings: {
          'pipeline.batch.delay': settings['pipeline.batch.delay'],
          'pipeline.batch.size': settings['pipeline.batch.size'],
          'pipeline.workers': pipelineWorkers,
          'queue.checkpoint.writes': settings['queue.checkpoint.writes'],
          'queue.max_bytes': settings['queue.max_bytes.number'] + settings['queue.max_bytes.units'],
          'queue.type': settings['queue.type'],
        },
        username,
      },
      pipelineIdErrors: [],
github elastic / kibana / x-pack / legacy / plugins / logstash / public / models / pipeline / pipeline.js View on Github external
static fromUpstreamJSON(pipeline) {
    const settings = pipeline.settings;

    const maxBytesStr = get(settings, 'queue.max_bytes', '');
    const maxBytesParts = maxBytesStr.match(/(\d+)(\w+)/);
    if (Array.isArray(maxBytesParts) && maxBytesParts.length === 3) {
      const maxBytesNumber = maxBytesParts[1];
      const maxBytesUnits = maxBytesParts[2];

      if (maxBytesNumber && maxBytesUnits) {
        delete settings['queue.max_bytes'];
        settings['queue.max_bytes.number'] = parseInt(maxBytesNumber);
        settings['queue.max_bytes.units'] = maxBytesUnits;
      }
    }

    return new Pipeline({
      id: pipeline.id,
      description: pipeline.description,
      pipeline: pipeline.pipeline,
      username: pipeline.username,
      settings,
    });
  }
github elastic / kibana / x-pack / plugins / logstash / public / components / pipeline_editor / pipeline_editor.js View on Github external
constructor(props) {
    super(props);

    const {
      pipeline: { id, description, pipeline, settings },
      username,
    } = this.props;

    const pipelineWorkersSet = typeof settings['pipeline.workers'] === 'number';
    const pipelineWorkers = pipelineWorkersSet ? settings['pipeline.workers'] : 1;
    this.state = {
      maxBytesNumber: settings['queue.max_bytes.number'],
      maxBytesUnit: settings['queue.max_bytes.units'],
      pipeline: {
        id,
        description,
        pipeline,
        settings: {
          'pipeline.batch.delay': settings['pipeline.batch.delay'],
          'pipeline.batch.size': settings['pipeline.batch.size'],
          'pipeline.workers': pipelineWorkers,
          'queue.checkpoint.writes': settings['queue.checkpoint.writes'],
          'queue.max_bytes': settings['queue.max_bytes.number'] + settings['queue.max_bytes.units'],
          'queue.type': settings['queue.type'],
        },
        username,
      },
      pipelineIdErrors: [],
github elastic / kibana / x-pack / legacy / plugins / logstash / public / models / pipeline / pipeline.js View on Github external
get upstreamJSON() {
    const settings = this.settings;
    const maxBytesNumber = get(settings, 'queue.max_bytes.number');
    const maxBytesUnits = get(settings, 'queue.max_bytes.units');

    const upstreamSettings = { ...settings };

    if (maxBytesNumber && maxBytesUnits) {
      delete upstreamSettings['queue.max_bytes.number'];
      delete upstreamSettings['queue.max_bytes.units'];
      upstreamSettings['queue.max_bytes'] = `${maxBytesNumber}${maxBytesUnits}`;
    }

    return {
      description: this.description,
      pipeline: this.pipeline,
      username: this.username,
      settings: upstreamSettings,
    };
  }