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 +4 -4
- data/Gemfile.lock +4 -4
- data/funktor-testapp/funktor_config/boot.rb +2 -1
- data/lib/funktor/activity_tracker.rb +4 -0
- data/lib/funktor/middleware/new_relic.rb +9 -2
- data/lib/funktor/version.rb +1 -1
- data/lib/funktor.rb +10 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8d203ecf9e2339ebe66302ae0224fb17a6529f0cf3e22eb71b95b7025527f9b1
|
4
|
+
data.tar.gz: 28b8a6774c12241aa583c3268b925aed85f72692eea0f96655567e7fc539a2b9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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.
|
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.
|
26
|
-
aws-sdk-core (3.131.
|
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.
|
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 '
|
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
|
data/lib/funktor/version.rb
CHANGED
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.
|
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-
|
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
|