funktor 0.7.27 → 0.7.30

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ef7feda36c3d7a6609b907b94632602d744b98a2f685853eb4686f77aa62330b
4
- data.tar.gz: 6ceaf132ea54f0e97760a05660208e262d7ed9c1d0473522100b5bf5c3d39161
3
+ metadata.gz: 8d203ecf9e2339ebe66302ae0224fb17a6529f0cf3e22eb71b95b7025527f9b1
4
+ data.tar.gz: 28b8a6774c12241aa583c3268b925aed85f72692eea0f96655567e7fc539a2b9
5
5
  SHA512:
6
- metadata.gz: 5ee21aa7210894ad2a05554d73eaa0958100ac87956e8e70e85146e0e04e419e402afc905f9eb20ba488537be053882739deb8595842cb50953594617e5f2dfc
7
- data.tar.gz: 9dbbed69db716f99cf8bd16db47938a45036b16d88bd5c576f862c3b2dd9457a589b15697829f95ed669d801d5e58bac856a4406c980d94157fd8a627bd88c2e
6
+ metadata.gz: 2309beb1a659c3bd5fcfa7b4f3092de4381e84d26195fbd8fc52f0c32b47bf490bb91ec2dadacd026624c31fc80906e303e40c13e55bc74942f0ffdd504c9d9d
7
+ data.tar.gz: d9a3386b7d8e6cf320450ed7ff5d3b4a4c21de88bd1976bbf7f28bcabb67964236bbe770a3b2c5e11543cfa63e2743ccc14da4f0d79b8efe1edccc714919e840
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- funktor (0.7.27)
4
+ funktor (0.7.30)
5
5
  activesupport
6
6
  aws-sdk-dynamodb (~> 1.62)
7
7
  aws-sdk-sqs (~> 1.37)
@@ -22,13 +22,13 @@ GEM
22
22
  addressable (2.8.0)
23
23
  public_suffix (>= 2.0.2, < 5.0)
24
24
  aws-eventstream (1.2.0)
25
- aws-partitions (1.597.0)
26
- aws-sdk-core (3.131.1)
25
+ aws-partitions (1.604.0)
26
+ aws-sdk-core (3.131.2)
27
27
  aws-eventstream (~> 1, >= 1.0.2)
28
28
  aws-partitions (~> 1, >= 1.525.0)
29
29
  aws-sigv4 (~> 1.1)
30
30
  jmespath (~> 1, >= 1.6.1)
31
- aws-sdk-dynamodb (1.74.0)
31
+ aws-sdk-dynamodb (1.75.0)
32
32
  aws-sdk-core (~> 3, >= 3.127.0)
33
33
  aws-sigv4 (~> 1.1)
34
34
  aws-sdk-sqs (1.51.1)
@@ -6,7 +6,7 @@ require "rubygems"
6
6
  require 'bundler/setup'
7
7
 
8
8
  # load bootsnap for faster cold starts
9
- require 'bootsnap/setup'
9
+ #require 'bootsnap/setup'
10
10
 
11
11
  # Set up gems listed in the Gemfile.
12
12
  Bundler.require(:default, :production)
@@ -17,6 +17,7 @@ require 'funktor'
17
17
 
18
18
 
19
19
  Funktor.enable_work_queue_visibility = false
20
+ Funktor.enable_activity_tracking = false
20
21
 
21
22
  # Load all ruby files in the app directory
22
23
  require_rel File.join('..', 'app')
@@ -40,6 +40,10 @@ module Funktor
40
40
  }
41
41
 
42
42
  def track(activity, job)
43
+ unless Funktor.enable_activity_tracking
44
+ Funktor.logger.debug "activity tracking is disabled"
45
+ return
46
+ end
43
47
  Funktor.logger.debug "starting track activity for #{activity}"
44
48
  incrKey = nil || INCR_KEYS[activity.to_sym]
45
49
  decrKey = nil || DECR_KEYS[activity.to_sym]
@@ -1,10 +1,16 @@
1
- require 'newrelic_rpm'
1
+ require 'new_relic/agent'
2
+ # This is kind of a brute force approach that's not very performant. It's based on this documentaion:
3
+ # https://docs.newrelic.com/docs/apm/agents/ruby-agent/background-jobs/monitor-ruby-background-processes
4
+ #
5
+ # It might be better if we could use the NewRelic Lambda Layer, but currently it doesn't seem to support Ruby.
6
+ # https://docs.newrelic.com/docs/serverless-function-monitoring/aws-lambda-monitoring/get-started/monitoring-aws-lambda-serverless-monitoring
2
7
  module Funktor
3
8
  module Middleware
4
9
  class NewRelic
5
10
  include ::NewRelic::Agent::Instrumentation::ControllerInstrumentation
6
11
 
7
12
  def call(job)
13
+ ::NewRelic::Agent.manual_start(:sync_startup => true)
8
14
  trace_args = {
9
15
  :name => 'perform',
10
16
  :class_name => job.worker_class_name_for_metrics,
@@ -16,11 +22,12 @@ module Funktor
16
22
  ::NewRelic::Agent::AttributeFilter::DST_NONE)
17
23
  yield
18
24
  end
25
+ ::NewRelic::Agent.shutdown
19
26
  end
20
27
  end
21
28
  end
22
29
 
23
- def new_relic!
30
+ def self.new_relic!
24
31
  Funktor.configure_work_queue_handler do |config|
25
32
  config.work_queue_handler_middleware do |chain|
26
33
  chain.add Funktor::Middleware::NewRelic
@@ -1,3 +1,3 @@
1
1
  module Funktor
2
- VERSION = "0.7.27"
2
+ VERSION = "0.7.30"
3
3
  end
data/lib/funktor.rb CHANGED
@@ -21,7 +21,8 @@ module Funktor
21
21
  DEFAULT_OPTIONS = {
22
22
  error_handlers: [],
23
23
  log_level: Logger::DEBUG, # Set a high log level during early, active development
24
- enable_work_queue_visibility: true # Enable this by default during early, active development
24
+ enable_work_queue_visibility: true, # Enable this by default during early, active development
25
+ enable_activity_tracking: true, # Enable this by default during early, active development
25
26
  }
26
27
 
27
28
  def self.configure_job_pusher
@@ -121,6 +122,14 @@ module Funktor
121
122
  options[:enable_work_queue_visibility] = enabled
122
123
  end
123
124
 
125
+ def self.enable_activity_tracking
126
+ options[:enable_activity_tracking]
127
+ end
128
+
129
+ def self.enable_activity_tracking= enabled
130
+ options[:enable_activity_tracking] = enabled
131
+ end
132
+
124
133
  # We have a raw_logger that doesn't add timestamps and what not. This is used to publish
125
134
  # CloudWatch metrics that can be used in dashboards.
126
135
  def self.raw_logger
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: funktor
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.27
4
+ version: 0.7.30
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeremy Green
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-06-07 00:00:00.000000000 Z
11
+ date: 2022-07-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk-sqs