elasticgraph-indexer_lambda 0.18.0.4 → 0.19.0.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/elastic_graph/indexer_lambda/sqs_processor.rb +13 -5
- metadata +22 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3bfc9565971f681207f41974cda4f44cf821992c8409b15cc5beac389ca1a434
|
4
|
+
data.tar.gz: 5039dcacf6cf702d4b889d6518a54932d9a45a52e6ec151d42db43bef912372a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9acd5b9b9fa5690f48d404ac02ce67514d063a701ab826b5b32986876f5adce7f8ed957edfa740134357e9da4630787ef584501727318670ba74c5c0ffeb9cb9
|
7
|
+
data.tar.gz: 77bf6c267ae7f27cccaa24e8bda41112a63548a7f396840cb0932669b3de63a26b9a820b48b1108738ad77f8131d446b53aa17a193798c3dbe1f094900ab5b16
|
@@ -6,7 +6,7 @@
|
|
6
6
|
#
|
7
7
|
# frozen_string_literal: true
|
8
8
|
|
9
|
-
require "elastic_graph/
|
9
|
+
require "elastic_graph/errors"
|
10
10
|
require "elastic_graph/indexer/indexing_failures_error"
|
11
11
|
require "json"
|
12
12
|
|
@@ -23,7 +23,7 @@ module ElasticGraph
|
|
23
23
|
@s3_client = s3_client
|
24
24
|
end
|
25
25
|
|
26
|
-
# Processes the ElasticGraph events in the given `lambda_event`, indexing the data in the
|
26
|
+
# Processes the ElasticGraph events in the given `lambda_event`, indexing the data in the datastore.
|
27
27
|
def process(lambda_event, refresh_indices: false)
|
28
28
|
events = events_from(lambda_event)
|
29
29
|
failures = @indexer_processor.process_returning_failures(events, refresh_indices: refresh_indices)
|
@@ -66,12 +66,20 @@ module ElasticGraph
|
|
66
66
|
# ...
|
67
67
|
# Note: "\n" at the end of each line is a single byte newline control character, instead of a string sequence
|
68
68
|
def events_from(lambda_event)
|
69
|
+
sqs_received_at_by_message_id = {} # : Hash[String, String]
|
69
70
|
lambda_event.fetch("Records").flat_map do |record|
|
70
71
|
sqs_metadata = extract_sqs_metadata(record)
|
71
|
-
|
72
|
+
if (message_id = sqs_metadata.fetch("message_id", nil))
|
73
|
+
sqs_received_at_by_message_id[message_id] = sqs_metadata.dig("latency_timestamps", "sqs_received_at")
|
74
|
+
end
|
72
75
|
parse_jsonl(record.fetch("body")).map do |event|
|
73
76
|
ElasticGraph::Support::HashUtil.deep_merge(event, sqs_metadata)
|
74
77
|
end
|
78
|
+
end.tap do
|
79
|
+
@logger.info({
|
80
|
+
"message_type" => "ReceivedSqsMessages",
|
81
|
+
"sqs_received_at_by_message_id" => sqs_received_at_by_message_id
|
82
|
+
})
|
75
83
|
end
|
76
84
|
end
|
77
85
|
|
@@ -110,7 +118,7 @@ module ElasticGraph
|
|
110
118
|
begin
|
111
119
|
s3_client.get_object(bucket: bucket_name, key: object_key).body.read
|
112
120
|
rescue Aws::S3::Errors::ServiceError => e
|
113
|
-
raise S3OperationFailedError, "Error reading large message from S3. bucket: `#{bucket_name}` key: `#{object_key}` message: `#{e.message}`"
|
121
|
+
raise Errors::S3OperationFailedError, "Error reading large message from S3. bucket: `#{bucket_name}` key: `#{object_key}` message: `#{e.message}`"
|
114
122
|
end
|
115
123
|
end
|
116
124
|
|
@@ -134,7 +142,7 @@ module ElasticGraph
|
|
134
142
|
if failure_ids.any? { |f| f.fetch("itemIdentifier").nil? }
|
135
143
|
# If we are not able to identify one or more failed events, then we must raise an exception instead of
|
136
144
|
# returning `batchItemFailures`. Otherwise, the unidentified failed events will not get retried.
|
137
|
-
raise MessageIdsMissingError, "Unexpected: some failures did not have a `message_id`, so we are raising an exception instead of returning `batchItemFailures`."
|
145
|
+
raise Errors::MessageIdsMissingError, "Unexpected: some failures did not have a `message_id`, so we are raising an exception instead of returning `batchItemFailures`."
|
138
146
|
end
|
139
147
|
|
140
148
|
{"batchItemFailures" => failure_ids}
|
metadata
CHANGED
@@ -1,14 +1,16 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: elasticgraph-indexer_lambda
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.19.0.0.rc1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Myron Marston
|
8
|
+
- Ben VandenBos
|
9
|
+
- Block Engineering
|
8
10
|
autorequire:
|
9
11
|
bindir: exe
|
10
12
|
cert_chain: []
|
11
|
-
date: 2024-
|
13
|
+
date: 2024-12-03 00:00:00.000000000 Z
|
12
14
|
dependencies:
|
13
15
|
- !ruby/object:Gem::Dependency
|
14
16
|
name: rubocop-factory_bot
|
@@ -44,42 +46,42 @@ dependencies:
|
|
44
46
|
requirements:
|
45
47
|
- - "~>"
|
46
48
|
- !ruby/object:Gem::Version
|
47
|
-
version: '3.
|
49
|
+
version: '3.1'
|
48
50
|
type: :development
|
49
51
|
prerelease: false
|
50
52
|
version_requirements: !ruby/object:Gem::Requirement
|
51
53
|
requirements:
|
52
54
|
- - "~>"
|
53
55
|
- !ruby/object:Gem::Version
|
54
|
-
version: '3.
|
56
|
+
version: '3.1'
|
55
57
|
- !ruby/object:Gem::Dependency
|
56
58
|
name: standard
|
57
59
|
requirement: !ruby/object:Gem::Requirement
|
58
60
|
requirements:
|
59
61
|
- - "~>"
|
60
62
|
- !ruby/object:Gem::Version
|
61
|
-
version: 1.
|
63
|
+
version: 1.41.0
|
62
64
|
type: :development
|
63
65
|
prerelease: false
|
64
66
|
version_requirements: !ruby/object:Gem::Requirement
|
65
67
|
requirements:
|
66
68
|
- - "~>"
|
67
69
|
- !ruby/object:Gem::Version
|
68
|
-
version: 1.
|
70
|
+
version: 1.41.0
|
69
71
|
- !ruby/object:Gem::Dependency
|
70
72
|
name: steep
|
71
73
|
requirement: !ruby/object:Gem::Requirement
|
72
74
|
requirements:
|
73
75
|
- - "~>"
|
74
76
|
- !ruby/object:Gem::Version
|
75
|
-
version: '1.
|
77
|
+
version: '1.8'
|
76
78
|
type: :development
|
77
79
|
prerelease: false
|
78
80
|
version_requirements: !ruby/object:Gem::Requirement
|
79
81
|
requirements:
|
80
82
|
- - "~>"
|
81
83
|
- !ruby/object:Gem::Version
|
82
|
-
version: '1.
|
84
|
+
version: '1.8'
|
83
85
|
- !ruby/object:Gem::Dependency
|
84
86
|
name: coderay
|
85
87
|
requirement: !ruby/object:Gem::Requirement
|
@@ -134,14 +136,14 @@ dependencies:
|
|
134
136
|
requirements:
|
135
137
|
- - "~>"
|
136
138
|
- !ruby/object:Gem::Version
|
137
|
-
version: '0.
|
139
|
+
version: '0.13'
|
138
140
|
type: :development
|
139
141
|
prerelease: false
|
140
142
|
version_requirements: !ruby/object:Gem::Requirement
|
141
143
|
requirements:
|
142
144
|
- - "~>"
|
143
145
|
- !ruby/object:Gem::Version
|
144
|
-
version: '0.
|
146
|
+
version: '0.13'
|
145
147
|
- !ruby/object:Gem::Dependency
|
146
148
|
name: simplecov
|
147
149
|
requirement: !ruby/object:Gem::Requirement
|
@@ -190,28 +192,28 @@ dependencies:
|
|
190
192
|
requirements:
|
191
193
|
- - '='
|
192
194
|
- !ruby/object:Gem::Version
|
193
|
-
version: 0.
|
195
|
+
version: 0.19.0.0.rc1
|
194
196
|
type: :runtime
|
195
197
|
prerelease: false
|
196
198
|
version_requirements: !ruby/object:Gem::Requirement
|
197
199
|
requirements:
|
198
200
|
- - '='
|
199
201
|
- !ruby/object:Gem::Version
|
200
|
-
version: 0.
|
202
|
+
version: 0.19.0.0.rc1
|
201
203
|
- !ruby/object:Gem::Dependency
|
202
204
|
name: elasticgraph-lambda_support
|
203
205
|
requirement: !ruby/object:Gem::Requirement
|
204
206
|
requirements:
|
205
207
|
- - '='
|
206
208
|
- !ruby/object:Gem::Version
|
207
|
-
version: 0.
|
209
|
+
version: 0.19.0.0.rc1
|
208
210
|
type: :runtime
|
209
211
|
prerelease: false
|
210
212
|
version_requirements: !ruby/object:Gem::Requirement
|
211
213
|
requirements:
|
212
214
|
- - '='
|
213
215
|
- !ruby/object:Gem::Version
|
214
|
-
version: 0.
|
216
|
+
version: 0.19.0.0.rc1
|
215
217
|
- !ruby/object:Gem::Dependency
|
216
218
|
name: aws-sdk-s3
|
217
219
|
requirement: !ruby/object:Gem::Requirement
|
@@ -267,10 +269,15 @@ files:
|
|
267
269
|
- lib/elastic_graph/indexer_lambda.rb
|
268
270
|
- lib/elastic_graph/indexer_lambda/lambda_function.rb
|
269
271
|
- lib/elastic_graph/indexer_lambda/sqs_processor.rb
|
270
|
-
homepage:
|
272
|
+
homepage: https://block.github.io/elasticgraph/
|
271
273
|
licenses:
|
272
274
|
- MIT
|
273
275
|
metadata:
|
276
|
+
bug_tracker_uri: https://github.com/block/elasticgraph/issues
|
277
|
+
changelog_uri: https://github.com/block/elasticgraph/releases/tag/v0.19.0.0.rc1
|
278
|
+
documentation_uri: https://block.github.io/elasticgraph/docs/main/
|
279
|
+
homepage_uri: https://block.github.io/elasticgraph/
|
280
|
+
source_code_uri: https://github.com/block/elasticgraph/tree/v0.19.0.0.rc1/elasticgraph-indexer_lambda
|
274
281
|
gem_category: lambda
|
275
282
|
post_install_message:
|
276
283
|
rdoc_options: []
|