Sha256: d6ee8eb6a862fdfeaf5426b73d20408b47778540410ec8fcdb3bedddf4f76bc0

Contents?: true

Size: 1.56 KB

Versions: 6

Compression:

Stored size: 1.56 KB

Contents

# Copyright 2017 OpenCensus Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

require "opencensus/common/config"

module OpenCensus
  # The OpenCensus overall configuration.
  @config = Common::Config.new

  class << self
    ##
    # Configure OpenCensus. Most configuration parameters are part of
    # subconfigurations that live under this main configuration.
    #
    # If the OpenCensus Railtie is installed in a Rails application, the
    # toplevel configuration object is also exposed as `config.opencensus`.
    #
    # Generally, you should configure this once at process initialization,
    # but it can be modified at any time.
    #
    # Example:
    #
    #     OpenCensus.configure do |config|
    #       config.trace.default_sampler =
    #         OpenCensus::Trace::Samplers::AlwaysSample.new
    #       config.trace.default_max_attributes = 16
    #     end
    #
    def configure
      if block_given?
        yield @config
      else
        @config
      end
    end

    ##
    # Get the current configuration.
    # @private
    #
    attr_reader :config
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
opencensus-0.3.1 lib/opencensus/config.rb
opencensus-0.3.0 lib/opencensus/config.rb
opencensus-0.2.2 lib/opencensus/config.rb
opencensus-0.2.1 lib/opencensus/config.rb
opencensus-0.2.0 lib/opencensus/config.rb
opencensus-0.1.0 lib/opencensus/config.rb