injest-client 0.1.3 → 0.1.5

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: 8b596088bca86e19140c5a6896579a1157c93e6f7892ec690697a1cee3e9d731
4
- data.tar.gz: bccef6f66027afa03d3ce6d241b0e548a83bd1a2402ba36a1a66b5f8c04099d1
3
+ metadata.gz: 993d376f31a687775d97c75154c909570579864c600a4d304ceb23a1bbaf6549
4
+ data.tar.gz: e65f194830ea42e1b43a1c939a421c8a663f3256328741cfb6612a0ae59aadf0
5
5
  SHA512:
6
- metadata.gz: f490690c6e154ce55a3d166729c5683a449750824a33aa873dff73f7a152af9c383731ec585c43516fa9884212f53a0ba9a7f42cf72fe0108eb037196b2f0752
7
- data.tar.gz: 78ba835c11aff60fcab737943b8e74b8fd51dbd77f58b50c624fa77b91b38a4bf27bbace1d1d2aacda4f2c8a9465324d3a60de737117bb8726121171c8972007
6
+ metadata.gz: 232df2b57f81d5b6c6d931a07fce60226ec45448a1e7b3a2584116994a02af0bfa323a00321886b853b788d0a25dd7466ceb9a1677f3df3fe36a5c67e9e1faa5
7
+ data.tar.gz: 6de732e492c9a68a2568d76b1f018fc3973ae9f0efefc520da0e0f6272b5cb0cb09aaaf32c735fe2b93b5bd30ac33221170755a6c6017847a1737f149d7dd79a
data/lib/README.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # Injest Client
2
2
 
3
+ ## Changelog
4
+
5
+ ### 0.1.5
6
+
7
+ - remove consumer
8
+
9
+ ### 0.1.4
10
+
11
+ - add raw_search to Injest::HttpClient
12
+
3
13
  ENV vars
4
14
 
5
15
  - `INJEST_STRATEGY`: stdout by default
@@ -5,6 +5,7 @@ class Injest::HttpClient
5
5
  attr_reader :root_url,
6
6
  :push_url,
7
7
  :search_url,
8
+ :raw_search_url,
8
9
  :jwt,
9
10
  :client_code
10
11
  def initialize(configuration)
@@ -16,6 +17,7 @@ class Injest::HttpClient
16
17
  @push_url = [root_url, 'api/v1/logs', client_code].join('/')
17
18
  end
18
19
  @search_url = [root_url, 'api/v1/logs/search'].join('/')
20
+ @raw_search_url = [root_url, 'api/v1/logs/raw_search'].join('/')
19
21
  @jwt = configuration.injest_token
20
22
  end
21
23
 
@@ -37,6 +39,13 @@ class Injest::HttpClient
37
39
  post_http_request search_url, payload
38
40
  end
39
41
 
42
+ def raw_search(body:, index_postfix: nil)
43
+ payload = { body: body }
44
+ payload[:index_postfix] = index_postfix unless index_postfix.nil?
45
+
46
+ post_http_request raw_search_url, payload
47
+ end
48
+
40
49
  # Push a log
41
50
  def push(data)
42
51
  data = data_as_hash(data)
@@ -2,7 +2,7 @@ class Injest::Middleware
2
2
  HEADERS_BLACKLIST = %w[HTTP_COOKIE].freeze
3
3
 
4
4
  attr_reader :configuration
5
- attr_reader :request_type, :env, :consumer, :subject
5
+ attr_reader :request_type, :env, :subject
6
6
 
7
7
  def initialize(app, processor: nil)
8
8
  @app = app
@@ -10,7 +10,6 @@ class Injest::Middleware
10
10
 
11
11
  @processor = processor
12
12
 
13
- @consumer = nil
14
13
  @subject = nil
15
14
  end
16
15
 
@@ -28,7 +27,6 @@ class Injest::Middleware
28
27
  @request_ended_on = Time.now
29
28
 
30
29
  set_subject
31
- set_consumer
32
30
 
33
31
  data = build_data
34
32
  data = @processor.call(env, data) unless @processor.nil?
@@ -96,7 +94,6 @@ class Injest::Middleware
96
94
  action: data['action'],
97
95
  params: params,
98
96
  version: Gem.loaded_specs["injest-client"].version.to_s,
99
- consumer: consumer
100
97
  }
101
98
  end
102
99
 
@@ -135,14 +132,6 @@ class Injest::Middleware
135
132
  end
136
133
  end
137
134
 
138
- def set_consumer
139
- if !subject.nil?
140
- @consumer = [subject[:type].downcase, subject[:id]].join(':')
141
- elsif env.key?("action_dispatch.request.parameters")
142
- @consumer = env["action_dispatch.request.parameters"].fetch('_consumer', 'unknown')
143
- end
144
- end
145
-
146
135
  def set_request_type
147
136
  # TODO: maybe we should check some header instead
148
137
  if env['PATH_INFO'].match?(/.*\.(?:png|css|jpeg|ico|gif)/)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: injest-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stefano Lampis
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-01-09 00:00:00.000000000 Z
11
+ date: 2023-05-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sidekiq