Sha256: cfae7fad60711fa55d36bb62764e6863ac124d9f43ce5140f0140dd390a78469

Contents?: true

Size: 1.12 KB

Versions: 25

Compression:

Stored size: 1.12 KB

Contents

# (c) Copyright IBM Corp. 2021
# (c) Copyright Instana Inc. 2021

require 'test_helper'

class MongoTest < Minitest::Test
  def setup
    clear_all!
  end

  def test_mongo
    Instana.tracer.start_or_continue_trace(:'mongo-test') do
      client = Mongo::Client.new('mongodb://127.0.0.1:27017/instana')
      client[:people].delete_many({ name: /$S*/ })
      client[:people].insert_many([{ _id: 1, name: "Stan" }])
    end

    spans = ::Instana.processor.queued_spans
    delete_span, insert_span, = spans

    delete_data = delete_span[:data][:mongo]
    insert_data = insert_span[:data][:mongo]

    assert_equal delete_span[:n], :mongo
    assert_equal insert_span[:n], :mongo

    assert_equal delete_data[:namespace], "instana"
    assert_equal delete_data[:command], "delete"
    assert_equal delete_data[:peer], {hostname: "127.0.0.1", port: 27017}
    assert delete_data[:json].include?("delete")

    assert_equal insert_data[:namespace], "instana"
    assert_equal insert_data[:command], "insert"
    assert_equal insert_data[:peer], {hostname: "127.0.0.1", port: 27017}
    assert insert_data[:json].include?("insert")
  end
end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
instana-1.214.4 test/instrumentation/mongo_test.rb
instana-1.214.3 test/instrumentation/mongo_test.rb
instana-1.214.2 test/instrumentation/mongo_test.rb
instana-1.214.1 test/instrumentation/mongo_test.rb
instana-1.214.0 test/instrumentation/mongo_test.rb
instana-1.213.3 test/instrumentation/mongo_test.rb
instana-1.213.2 test/instrumentation/mongo_test.rb
instana-1.213.1 test/instrumentation/mongo_test.rb
instana-1.213.0 test/instrumentation/mongo_test.rb
instana-1.212.0 test/instrumentation/mongo_test.rb
instana-1.211.0 test/instrumentation/mongo_test.rb
instana-1.210.1 test/instrumentation/mongo_test.rb
instana-1.210.0 test/instrumentation/mongo_test.rb
instana-1.209.8 test/instrumentation/mongo_test.rb
instana-1.209.7 test/instrumentation/mongo_test.rb
instana-1.209.6 test/instrumentation/mongo_test.rb
instana-1.209.5 test/instrumentation/mongo_test.rb
instana-1.209.4 test/instrumentation/mongo_test.rb
instana-1.209.3 test/instrumentation/mongo_test.rb
instana-1.209.2 test/instrumentation/mongo_test.rb