Sha256: 25db5c5c2da501ca6cd8ed4360bd26061266a19507ef8e212596ef49430fac94

Contents?: true

Size: 605 Bytes

Versions: 29

Compression:

Stored size: 605 Bytes

Contents

module Datadog
  module Contrib
    module Elasticsearch
      # Quantize contains ES-specific resource quantization tools.
      module Quantize
        ID_REGEXP = %r{\/([0-9]+)([\/\?]|$)}
        ID_PLACEHOLDER = '/?\2'.freeze

        INDEX_REGEXP = /[0-9]{2,}/
        INDEX_PLACEHOLDER = '?'.freeze

        module_function

        # Very basic quantization, complex processing should be done in the agent
        def format_url(url)
          quantized_url = url.gsub(ID_REGEXP, ID_PLACEHOLDER)
          quantized_url.gsub(INDEX_REGEXP, INDEX_PLACEHOLDER)
        end
      end
    end
  end
end

Version data entries

29 entries across 29 versions & 2 rubygems

Version Path
fair-ddtrace-0.8.2.a lib/ddtrace/contrib/elasticsearch/quantize.rb
ddtrace-0.11.4 lib/ddtrace/contrib/elasticsearch/quantize.rb
ddtrace-0.11.3 lib/ddtrace/contrib/elasticsearch/quantize.rb
ddtrace-0.12.0.beta2 lib/ddtrace/contrib/elasticsearch/quantize.rb
ddtrace-0.12.0.beta1 lib/ddtrace/contrib/elasticsearch/quantize.rb
ddtrace-0.11.2 lib/ddtrace/contrib/elasticsearch/quantize.rb
ddtrace-0.11.1 lib/ddtrace/contrib/elasticsearch/quantize.rb
ddtrace-0.11.0 lib/ddtrace/contrib/elasticsearch/quantize.rb
ddtrace-0.11.0.beta2 lib/ddtrace/contrib/elasticsearch/quantize.rb
ddtrace-0.11.0.beta1 lib/ddtrace/contrib/elasticsearch/quantize.rb
ddtrace-0.10.0 lib/ddtrace/contrib/elasticsearch/quantize.rb
ddtrace-0.9.2 lib/ddtrace/contrib/elasticsearch/quantize.rb
ddtrace-0.9.1 lib/ddtrace/contrib/elasticsearch/quantize.rb
ddtrace-0.9.0 lib/ddtrace/contrib/elasticsearch/quantize.rb
ddtrace-0.8.2 lib/ddtrace/contrib/elasticsearch/quantize.rb
ddtrace-0.8.1 lib/ddtrace/contrib/elasticsearch/quantize.rb
ddtrace-0.8.0 lib/ddtrace/contrib/elasticsearch/quantize.rb
ddtrace-0.7.2 lib/ddtrace/contrib/elasticsearch/quantize.rb
ddtrace-0.7.1 lib/ddtrace/contrib/elasticsearch/quantize.rb
ddtrace-0.7.0 lib/ddtrace/contrib/elasticsearch/quantize.rb