funktor 0.7.3 → 0.7.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 58967787594138d8c3e24feb2cb0cf5c742899d494099e972a505de9a49e8bc2
4
- data.tar.gz: bae55701018e66b63cacbd5d7911cdd5fa1f063969716f6726be423ffaee896b
3
+ metadata.gz: 6e7890531c38acfc5bc6f24550ee96f1df4ce78bea2f329300dcd70f4bb3e357
4
+ data.tar.gz: a46dbd83e9ab5521868053b737f2e5b047bef2a4012041a12072e1d5b19cf034
5
5
  SHA512:
6
- metadata.gz: 2251b6acccc727761a109cee8cf847000c4857726441cc01dc04cb6649f53b272eb0d0f335494d31a1089cfd335988073a872dd660295dc55e6e4c07e9bf813a
7
- data.tar.gz: b785cc6ba1db1c2e4e3af54b0a1c40045bb0f1d9cf2456edd82be1c1b370fa23edd71bc36edc5f8dfd9cf08990dcf490b5ec20ebd855d2da5610e48d7737e174
6
+ metadata.gz: 3f108fea2135fd1675f62f4b211baa330207ca7be525851e141fe069d2ef042d17afeb88b3cabd4708917cf39cb9178df0634b4b7e05d36ed21ea6198118839c
7
+ data.tar.gz: a077b5c7d2429cfeb5a8fe2ff27fac22afbf129c29ce9ea35db091da0992a914e2d5b381c59ab6dd5d7919a2875996d594f4063b721aa6811777df7227d26807
data/README.md CHANGED
@@ -40,8 +40,6 @@ cd my-funktor-app
40
40
  funktor init
41
41
  ```
42
42
 
43
- Then you sh
44
-
45
43
  This will create a `funktor` directory that is ready to deploy to AWS. If you've already configured
46
44
  your aws tools via `~/.aws/credentials` you should be ready to deploy.
47
45
 
@@ -21,13 +21,17 @@ class AuditWorker
21
21
  puts "So long from the #{self.class.name}, and thanks for all the fish!"
22
22
  end
23
23
 
24
+ def metric_namespace
25
+ [ENV['FUNKTOR_APP_NAME'], ENV['SERVERLESS_STAGE']].join('-')
26
+ end
27
+
24
28
  def metric_hash(time_diff)
25
29
  {
26
30
  "_aws": {
27
31
  "Timestamp": Time.now.strftime('%s%3N').to_i,
28
32
  "CloudWatchMetrics": [
29
33
  {
30
- "Namespace": ENV['FUNKTOR_APP_NAME'],
34
+ "Namespace": metric_namespace,
31
35
  "Dimensions": [["WorkerClassName"]],
32
36
  "Metrics": [ # CPU, Memory, Duration, etc...
33
37
  {
@@ -103,6 +103,7 @@ IncomingDeadJobQueueName: ${self:service}-${self:custom.stage}-incoming-dead
103
103
  IncomingJobHandlerName: ${self:service}-${self:custom.stage}-IncomingJobHandler
104
104
  IncomingJobQueueAccessPolicyName: ${self:service}-${self:custom.stage}-incoming-job-queue-access
105
105
  DashboardName: ${self:service}-${self:custom.stage}-dashboard
106
+ DashboardNamespace: ${self:service}-${self:custom.stage}
106
107
  DefaultQueueName: ${self:service}-${self:custom.stage}-default
107
108
  DefaultDeadJobQueueName: ${self:service}-${self:custom.stage}-default-dead
108
109
  DefaultQueueHandlerName: ${self:service}-${self:custom.stage}-DefaultQueueHandler
@@ -29,13 +29,13 @@ Resources:
29
29
  "type": "metric",
30
30
  "properties": {
31
31
  "metrics": [
32
- [ "funktor-testapp", "Duration", "WorkerClassName", "AuditWorker" ],
32
+ [ "${self:custom.funktor.DashboardNamespace}", "Duration", "WorkerClassName", "AuditWorker" ],
33
33
  [ "...", { "stat": "p99" } ],
34
- [ "funktor-testapp", "Duration", "WorkerClassName", "GreetingsWorker" ],
34
+ [ "${self:custom.funktor.DashboardNamespace}", "Duration", "WorkerClassName", "GreetingsWorker" ],
35
35
  [ "...", { "stat": "p99" } ],
36
- [ "funktor-testapp", "Duration", "WorkerClassName", "HelloWorker" ],
36
+ [ "${self:custom.funktor.DashboardNamespace}", "Duration", "WorkerClassName", "HelloWorker" ],
37
37
  [ "...", { "stat": "p99" } ],
38
- [ "funktor-testapp", "Duration", "WorkerClassName", "SingleThreadAuditWorker" ],
38
+ [ "${self:custom.funktor.DashboardNamespace}", "Duration", "WorkerClassName", "SingleThreadAuditWorker" ],
39
39
  [ "...", { "stat": "p99" } ]
40
40
  ],
41
41
  "view": "timeSeries",
@@ -55,13 +55,13 @@ Resources:
55
55
  "type": "metric",
56
56
  "properties": {
57
57
  "metrics": [
58
- [ "funktor-testapp", "processed", "WorkerClassName", "AuditWorker" ],
58
+ [ "${self:custom.funktor.DashboardNamespace}", "processed", "WorkerClassName", "AuditWorker" ],
59
59
  [ ".", "failed", ".", "." ],
60
- [ "funktor-testapp", "processed", "WorkerClassName", "GreetingsWorker" ],
60
+ [ "${self:custom.funktor.DashboardNamespace}", "processed", "WorkerClassName", "GreetingsWorker" ],
61
61
  [ ".", "failed", ".", "." ],
62
- [ "funktor-testapp", "processed", "WorkerClassName", "HelloWorker" ],
62
+ [ "${self:custom.funktor.DashboardNamespace}", "processed", "WorkerClassName", "HelloWorker" ],
63
63
  [ ".", "failed", ".", "." ],
64
- [ "funktor-testapp", "processed", "WorkerClassName", "SingleThreadAuditWorker" ],
64
+ [ "${self:custom.funktor.DashboardNamespace}", "processed", "WorkerClassName", "SingleThreadAuditWorker" ],
65
65
  [ ".", "failed", ".", "." ]
66
66
  ],
67
67
  "view": "timeSeries",
@@ -81,9 +81,9 @@ Resources:
81
81
  "type": "metric",
82
82
  "properties": {
83
83
  "metrics": [
84
- [ "funktor-testapp", "Duration", "Queue", "default" ],
84
+ [ "${self:custom.funktor.DashboardNamespace}", "Duration", "Queue", "default" ],
85
85
  [ "...", { "stat": "p99" } ],
86
- [ "funktor-testapp", "Duration", "Queue", "low_concurrency" ],
86
+ [ "${self:custom.funktor.DashboardNamespace}", "Duration", "Queue", "low_concurrency" ],
87
87
  [ "...", { "stat": "p99" } ]
88
88
  ],
89
89
  "view": "timeSeries",
@@ -102,9 +102,9 @@ Resources:
102
102
  "type": "metric",
103
103
  "properties": {
104
104
  "metrics": [
105
- [ "funktor-testapp", "processed", "Queue", "default" ],
105
+ [ "${self:custom.funktor.DashboardNamespace}", "processed", "Queue", "default" ],
106
106
  [ ".", "failed", ".", "." ],
107
- [ "funktor-testapp", "processed", "Queue", "low_concurrency" ],
107
+ [ "${self:custom.funktor.DashboardNamespace}", "processed", "Queue", "low_concurrency" ],
108
108
  [ ".", "failed", ".", "." ]
109
109
  ],
110
110
  "view": "timeSeries",
@@ -77,13 +77,17 @@ module Funktor
77
77
  @dynamodb_client ||= ::Aws::DynamoDB::Client.new
78
78
  end
79
79
 
80
+ def metric_namespace
81
+ [ENV['FUNKTOR_APP_NAME'], ENV['SERVERLESS_STAGE']].join('-')
82
+ end
83
+
80
84
  def put_metric_to_stdout(key, value)
81
85
  data = {
82
86
  "_aws": {
83
87
  "Timestamp": Time.now.strftime('%s%3N').to_i,
84
88
  "CloudWatchMetrics": [
85
89
  {
86
- "Namespace": "rails-lambda-experiment",
90
+ "Namespace": metric_namespace,
87
91
  "Dimensions": [["functionVersion"]],
88
92
  "Metrics": [ # CPU, Memory, Duration, etc...
89
93
  {
@@ -46,8 +46,10 @@ module Funktor
46
46
  say "serverless-ruby-layer is already installed in package.json"
47
47
  else
48
48
  if File.exist?("package-lock.json")
49
- run "npm install serverless-ruby-layer@1.4.0"
49
+ run "npm install serverless-ruby-layer@1.4.0 --save-dev"
50
50
  # TODO - Add handers for yarn and what not
51
+ elsif File.exist?("yarn.lock")
52
+ run "yarn add --dev serverless-ruby-layer@1.4.0"
51
53
  else
52
54
  say "You should install serverless-ruby-layer version 1.4.0 using yor package manager of choice."
53
55
  end
@@ -81,6 +81,7 @@ IncomingDeadJobQueueName: ${self:service}-${self:custom.stage}-incoming-dead
81
81
  IncomingJobHandlerName: ${self:service}-${self:custom.stage}-IncomingJobHandler
82
82
  IncomingJobQueueAccessPolicyName: ${self:service}-${self:custom.stage}-incoming-job-queue-access
83
83
  DashboardName: ${self:service}-${self:custom.stage}-dashboard
84
+ DashboardNamespace: ${self:service}-${self:custom.stage}
84
85
  <%- queue_names.each do |queue_name| -%>
85
86
  <%= queue_name.camelize %>QueueName: ${self:service}-${self:custom.stage}-<%= queue_name.underscore.dasherize %>
86
87
  <%= queue_name.camelize %>DeadJobQueueName: ${self:service}-${self:custom.stage}-<%= queue_name.underscore.dasherize %>-dead
@@ -30,7 +30,7 @@ Resources:
30
30
  "properties": {
31
31
  "metrics": [
32
32
  <%- app_worker_names.each do |worker_name| -%>
33
- [ "<%= app_name %>", "Duration", "WorkerClassName", "<%= worker_name %>" ],
33
+ [ "${self:custom.funktor.DashboardNamespace}", "Duration", "WorkerClassName", "<%= worker_name %>" ],
34
34
  [ "...", { "stat": "p99" } ]<%= worker_name == app_worker_names.last ? "" : "," %>
35
35
  <%- end -%>
36
36
  ],
@@ -52,7 +52,7 @@ Resources:
52
52
  "properties": {
53
53
  "metrics": [
54
54
  <%- app_worker_names.each do |worker_name| -%>
55
- [ "<%= app_name %>", "processed", "WorkerClassName", "<%= worker_name %>" ],
55
+ [ "${self:custom.funktor.DashboardNamespace}", "processed", "WorkerClassName", "<%= worker_name %>" ],
56
56
  [ ".", "failed", ".", "." ]<%= worker_name == app_worker_names.last ? "" : "," %>
57
57
  <%- end -%>
58
58
  ],
@@ -74,7 +74,7 @@ Resources:
74
74
  "properties": {
75
75
  "metrics": [
76
76
  <%- queue_names.each do |queue_name| -%>
77
- [ "<%= app_name %>", "Duration", "Queue", "<%= queue_name.underscore %>" ],
77
+ [ "${self:custom.funktor.DashboardNamespace}", "Duration", "Queue", "<%= queue_name.underscore %>" ],
78
78
  [ "...", { "stat": "p99" } ]<%= queue_name == queue_names.last ? "" : "," %>
79
79
  <%- end -%>
80
80
  ],
@@ -95,7 +95,7 @@ Resources:
95
95
  "properties": {
96
96
  "metrics": [
97
97
  <%- queue_names.each do |queue_name| -%>
98
- [ "<%= app_name %>", "processed", "Queue", "<%= queue_name.underscore %>" ],
98
+ [ "${self:custom.funktor.DashboardNamespace}", "processed", "Queue", "<%= queue_name.underscore %>" ],
99
99
  [ ".", "failed", ".", "." ]<%= queue_name == queue_names.last ? "" : "," %>
100
100
  <%- end -%>
101
101
  ],
@@ -17,13 +17,17 @@ module Funktor
17
17
  Funktor.raw_logger.unknown Funktor.dump_json(metric_hash(job))
18
18
  end
19
19
 
20
+ def metric_namespace
21
+ [ENV['FUNKTOR_APP_NAME'], ENV['SERVERLESS_STAGE']].join('-')
22
+ end
23
+
20
24
  def metric_hash(job)
21
25
  {
22
26
  "_aws": {
23
27
  "Timestamp": Time.now.strftime('%s%3N').to_i,
24
28
  "CloudWatchMetrics": [
25
29
  {
26
- "Namespace": ENV['FUNKTOR_APP_NAME'],
30
+ "Namespace": metric_namespace,
27
31
  "Dimensions": [["WorkerClassName"], ["Queue"]],
28
32
  "Metrics": [ # CPU, Memory, Duration, etc...
29
33
  {
@@ -18,13 +18,17 @@ module Funktor
18
18
  Funktor.raw_logger.unknown Funktor.dump_json(metric_hash(time_diff, job))
19
19
  end
20
20
 
21
+ def metric_namespace
22
+ [ENV['FUNKTOR_APP_NAME'], ENV['SERVERLESS_STAGE']].join('-')
23
+ end
24
+
21
25
  def metric_hash(time_diff_in_seconds, job)
22
26
  {
23
27
  "_aws": {
24
28
  "Timestamp": Time.now.strftime('%s%3N').to_i,
25
29
  "CloudWatchMetrics": [
26
30
  {
27
- "Namespace": ENV['FUNKTOR_APP_NAME'],
31
+ "Namespace": metric_namespace,
28
32
  "Dimensions": [["WorkerClassName"], ["Queue"]],
29
33
  "Metrics": [ # CPU, Memory, Duration, etc...
30
34
  {
@@ -1,3 +1,3 @@
1
1
  module Funktor
2
- VERSION = "0.7.3"
2
+ VERSION = "0.7.4"
3
3
  end
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.3
4
+ version: 0.7.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeremy Green
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-09-02 00:00:00.000000000 Z
11
+ date: 2022-05-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk-sqs