oboe-heroku 0.8.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,111 @@
1
+ # Copyright (c) 2013 AppNeta
2
+ # All rights reserved.
3
+
4
+ module Oboe_metal
5
+ class Event
6
+ def self.metadataString(evt)
7
+ evt.metadataString()
8
+ end
9
+ end
10
+
11
+ class Context
12
+ class << self
13
+ attr_accessor :layer_op
14
+
15
+ def log(layer, label, options = {}, with_backtrace = true)
16
+ Oboe.logger.debug "HerokuMetal log: layer: #{layer}, label: #{label}, options: #{options}, with_backtrace: #{with_backtrace.to_s}"
17
+
18
+ evt = Oboe::Context.createEvent()
19
+ evt.addInfo("Layer", layer.to_s)
20
+ evt.addInfo("Label", label.to_s)
21
+
22
+ options.each_pair do |k, v|
23
+ evt.addInfo(k.to_s, v.to_s)
24
+ end
25
+
26
+ evt.addInfo("Backtrace", Oboe::API.backtrace) if with_backtrace
27
+ Oboe.reporter.sendReport(evt)
28
+ end
29
+
30
+ def tracing_layer_op?(operation)
31
+ if operation.is_a?(Array)
32
+ return operation.include?(@layer_op)
33
+ else
34
+ return @layer_op == operation
35
+ end
36
+ end
37
+ end
38
+ end
39
+
40
+ class Reporter
41
+ def self.sendReport(evt)
42
+ Oboe.reporter.sendReport(evt)
43
+ end
44
+ end
45
+ end
46
+
47
+ module Oboe
48
+ include Oboe_metal
49
+
50
+ class << self
51
+ attr_accessor :reporter
52
+
53
+ def always?
54
+ Oboe::Config[:tracing_mode].to_s == "always"
55
+ end
56
+
57
+ def continue?
58
+ Oboe::Context.isValid and not Oboe.never?
59
+ end
60
+
61
+ def never?
62
+ Oboe::Config[:tracing_mode].to_s == "never"
63
+ end
64
+
65
+ def now?
66
+ Oboe::Context.isValid and not Oboe.never?
67
+ end
68
+
69
+ def passthrough?
70
+ ["always", "through"].include?(Oboe::Config[:tracing_mode])
71
+ end
72
+
73
+ def sample?
74
+ Oboe::Context.sampleRequest('', '', '')
75
+ end
76
+
77
+ def start?
78
+ not Oboe::Context.isValid and Oboe.always?
79
+ end
80
+
81
+ def through?
82
+ Oboe::Config[:tracing_mode] == "through"
83
+ end
84
+
85
+ def tracing?
86
+ Oboe::Context.isValid and not Oboe.never?
87
+ end
88
+
89
+ # Disconnect/Reconnect wrappers used for forking webservers
90
+ # such as Unicorn or Passenger
91
+ #
92
+ def disconnect!
93
+ ::Oboe::Context.disconnect(::Oboe.reporter)
94
+ end
95
+
96
+ def reconnect!
97
+ ::Oboe::Context.reconnect(::Oboe.reporter)
98
+ end
99
+ end
100
+ end
101
+
102
+ begin
103
+ Oboe_metal::Context.init()
104
+
105
+ # The Oboe Reporter is configured via Heroku config variables.
106
+ Oboe.reporter = Oboe::Reporter.new(nil, nil)
107
+ rescue Exception => e
108
+ $stderr.puts e.message
109
+ raise
110
+ end
111
+
@@ -0,0 +1,29 @@
1
+ module Oboe
2
+ module Loading
3
+
4
+ def self.initialize_heroku
5
+ # OBOE_TRACE_NEVER 0
6
+ # OBOE_TRACE_ALWAYS 1
7
+ # OBOE_TRACE_THROUGH 2
8
+
9
+ if defined?(Oboe::Config)
10
+
11
+ case Oboe::Config[:tracing_mode].to_s.downcase.to_sym
12
+ when :never
13
+ # OBOE_TRACE_NEVER
14
+ Oboe::Context.setTracingMode(0)
15
+ when :always
16
+ # OBOE_TRACE_ALWAYS
17
+ Oboe::Context.setTracingMode(1)
18
+ else
19
+ # OBOE_TRACE_ALWAYS
20
+ Oboe::Context.setTracingMode(1)
21
+ end
22
+ else
23
+ # OBOE_TRACE_ALWAYS
24
+ Oboe::Context.setTracingMode(1)
25
+ end
26
+ end # self.initialize_heroku
27
+
28
+ end
29
+ end
@@ -0,0 +1,10 @@
1
+ class OboeHeroku
2
+ module Version
3
+ MAJOR = 0
4
+ MINOR = 8
5
+ PATCH = 0
6
+ BUILD = 1
7
+
8
+ STRING = [MAJOR, MINOR, PATCH, BUILD].compact.join('.')
9
+ end
10
+ end
@@ -0,0 +1,20 @@
1
+ # Copyright (c) 2013 by Tracelytics, Inc.
2
+ # All rights reserved.
3
+
4
+ begin
5
+ require 'oboe_metal.so'
6
+ require 'heroku_metal'
7
+ require 'oboe-heroku/loading'
8
+
9
+ # Require the core oboe gem
10
+ require 'oboe'
11
+
12
+ Oboe::Loading.initialize_heroku
13
+
14
+ rescue LoadError
15
+ if ENV.has_key?('TRACEVIEW_DEBUG_LEVEL') and (ENV['TRACEVIEW_DEBUG_LEVEL'].to_i > 1)
16
+ $stderr.puts "[oboe-heroku/error] Could not load oboe-heroku dependencies."
17
+ end
18
+ rescue Exception => e
19
+ $stderr.puts "[oboe-heroku/error] Problem loading: #{e.inspect}"
20
+ end
@@ -0,0 +1,21 @@
1
+ $:.push File.expand_path("../lib", __FILE__)
2
+ require "oboe-heroku/version"
3
+
4
+ Gem::Specification.new do |s|
5
+ s.name = %q{oboe-heroku}
6
+ s.version = OboeHeroku::Version::STRING
7
+ s.date = Time.now.strftime('%Y-%m-%d')
8
+
9
+ s.authors = ["Peter Giacomo Lombardo", "Guy Lancaster"]
10
+ s.email = %q{traceviewsupport@appneta.com}
11
+ s.homepage = %q{http://www.appneta.com/application-performance-management}
12
+ s.summary = %q{AppNeta TraceView performance instrumentation gem for the Heroku platform}
13
+ s.description = %q{The oboe-heroku gem provides TraceView instrumentation for Ruby and Ruby frameworks on Heroku.}
14
+
15
+ s.extra_rdoc_files = ["LICENSE"]
16
+ s.files = `git ls-files`.split("\n")
17
+
18
+ s.extensions = ['ext/oboe_metal/extconf.rb']
19
+
20
+ s.add_dependency(%q<oboe>, [">= 2.1.1"])
21
+ end
data/tasks/.keep ADDED
File without changes
metadata ADDED
@@ -0,0 +1,97 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: oboe-heroku
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.8.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Peter Giacomo Lombardo
9
+ - Guy Lancaster
10
+ autorequire:
11
+ bindir: bin
12
+ cert_chain: []
13
+ date: 2013-07-24 00:00:00.000000000 Z
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: oboe
17
+ requirement: !ruby/object:Gem::Requirement
18
+ none: false
19
+ requirements:
20
+ - - ! '>='
21
+ - !ruby/object:Gem::Version
22
+ version: 2.1.1
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ none: false
27
+ requirements:
28
+ - - ! '>='
29
+ - !ruby/object:Gem::Version
30
+ version: 2.1.1
31
+ description: The oboe-heroku gem provides TraceView instrumentation for Ruby and Ruby
32
+ frameworks on Heroku.
33
+ email: traceviewsupport@appneta.com
34
+ executables: []
35
+ extensions:
36
+ - ext/oboe_metal/extconf.rb
37
+ extra_rdoc_files:
38
+ - LICENSE
39
+ files:
40
+ - .gitignore
41
+ - LICENSE
42
+ - README.md
43
+ - Rakefile
44
+ - ext/oboe_metal/extconf.rb
45
+ - ext/oboe_metal/src/bson/bson.h
46
+ - ext/oboe_metal/src/bson/platform_hacks.h
47
+ - ext/oboe_metal/src/libs/.keep
48
+ - ext/oboe_metal/src/libs/README
49
+ - ext/oboe_metal/src/libs/libboost_date_time.so.1.53.0
50
+ - ext/oboe_metal/src/libs/libboost_system.so.1.53.0
51
+ - ext/oboe_metal/src/libs/libboost_thread.so.1.53.0
52
+ - ext/oboe_metal/src/libs/libevent-2.0.so.5.1.9
53
+ - ext/oboe_metal/src/libs/libfb303.so
54
+ - ext/oboe_metal/src/libs/liboboe-1.0.so.1.3.1
55
+ - ext/oboe_metal/src/libs/liboboe.a
56
+ - ext/oboe_metal/src/libs/liboboe.la
57
+ - ext/oboe_metal/src/libs/libthrift-0.9.0.so
58
+ - ext/oboe_metal/src/libs/libthrift.la
59
+ - ext/oboe_metal/src/libs/libthriftnb-0.9.0.so
60
+ - ext/oboe_metal/src/libs/libthriftnb.la
61
+ - ext/oboe_metal/src/libs/libthriftz-0.9.0.so
62
+ - ext/oboe_metal/src/libs/libthriftz.la
63
+ - ext/oboe_metal/src/oboe.h
64
+ - ext/oboe_metal/src/oboe.hpp
65
+ - ext/oboe_metal/src/oboe_debug.h
66
+ - ext/oboe_metal/src/oboe_wrap.cxx
67
+ - lib/heroku_metal.rb
68
+ - lib/oboe-heroku.rb
69
+ - lib/oboe-heroku/loading.rb
70
+ - lib/oboe-heroku/version.rb
71
+ - oboe-heroku.gemspec
72
+ - tasks/.keep
73
+ homepage: http://www.appneta.com/application-performance-management
74
+ licenses: []
75
+ post_install_message:
76
+ rdoc_options: []
77
+ require_paths:
78
+ - lib
79
+ required_ruby_version: !ruby/object:Gem::Requirement
80
+ none: false
81
+ requirements:
82
+ - - ! '>='
83
+ - !ruby/object:Gem::Version
84
+ version: '0'
85
+ required_rubygems_version: !ruby/object:Gem::Requirement
86
+ none: false
87
+ requirements:
88
+ - - ! '>='
89
+ - !ruby/object:Gem::Version
90
+ version: '0'
91
+ requirements: []
92
+ rubyforge_project:
93
+ rubygems_version: 1.8.24
94
+ signing_key:
95
+ specification_version: 3
96
+ summary: AppNeta TraceView performance instrumentation gem for the Heroku platform
97
+ test_files: []