To run this script, copy the files to a local directory and run:
bundle install
bundle exec ruby test_trace.rb
| # frozen_string_literal: true | |
| source "https://rubygems.org" | |
| gem "instana" |
| #! /usr/bin/env ruby | |
| ENV['INSTANA_GEM_DEV'] = true.to_s | |
| require 'bundler/setup' | |
| Bundler.require(:default, :development) | |
| require "instana" | |
| ::Instana.logger.warn "Hello Instana. Sleeping for a few seconds to allow instana agent to announce and initialize." | |
| sleep 3 | |
| if Instana.agent.ready? | |
| Instana.logger.warn "Instana agent is ready to go!" | |
| Instana.logger.warn "Instana: Sending 100 test traces to Instana." | |
| 100.times do Instana.tracer.start_or_continue_trace(:test) do sleep 1; end end | |
| Instana.logger.warn "Aaaaannddd they're gone..." | |
| else | |
| Instana.logger.warn "Instana agent is reporting not ready status :-(" | |
| end | |
| Instana.logger.warn "End of script" |