Sha256: aff14bb702df765019336fe36ddcae7f411b0bbc8966fc24d59a3d79ca517f3e

Contents?: true

Size: 822 Bytes

Versions: 1

Compression:

Stored size: 822 Bytes

Contents

# frozen_string_literal: true

module GitlabQuality
  module TestTooling
    module Concerns
      module InfluxdbTools
        # InfluxDb client
        #
        # @return [InfluxDB2::Client]
        def influx_client(url:, token:, bucket:)
          @influx_client ||= InfluxDB2::Client.new(
            url || raise('Missing influxdb_url'),
            token || raise('Missing influxdb_token'),
            bucket: bucket || raise('Missing influxdb_bucket'),
            org: "gitlab-qa",
            precision: InfluxDB2::WritePrecision::NANOSECOND
          )
        end

        # Write client
        #
        # @return [WriteApi]
        def write_api(url:, token:, bucket:)
          @write_api ||= influx_client(url: url, token: token, bucket: bucket).create_write_api
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
gitlab_quality-test_tooling-1.24.0 lib/gitlab_quality/test_tooling/concerns/influxdb_tools.rb