blipit 0.3.0 → 0.3.1

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: '08dd6a2a074cf2d5363dc7a1640afb6e95605dcc8cf142319d788aabaf46c877'
4
- data.tar.gz: f07cb8341c0c1c9a2d6f2c3946dbcb25cbead6fded1f24b0a9e0dd7bc494ca38
3
+ metadata.gz: 8f4ec865735afcdbd98349eb7d2148acc8b1ff40e2384de3ed3440f184f1d1b2
4
+ data.tar.gz: '05877dd952a76408ac91f2584dbd928b468a81778c07bcbed1f11dff2338691a'
5
5
  SHA512:
6
- metadata.gz: 6f2a8803675ecfbf37e1eabe6949c182bd37e68ad9b9cd6650f3dae0af080c99cbeaf97d2e1a6ca8997f7d49f712e041c687fa52a7837b6bd06c3c2d8a7df10b
7
- data.tar.gz: 39bcdf4469045c253649823b9db645e7161ef0c77ad82f97f8601fda97f14c9209af4e86bd4fe8bbeebd5032ee9a29da716880f3a50496cccee8f32113380d47
6
+ metadata.gz: 6f9b14cccbf62cb78c2fe5f031e0b11af71214add1be19091c23eb4394b3da1b6a24a4b434706609c182ba81fc9155bfdf21a63e8a72afb7de1788e21f30d3fe
7
+ data.tar.gz: 314ebfa21e8a5a77735b0518cca8771f9545a8497200ec9b541729bad1ae7b5672dcd78d646e534c38aea16c5bea5bbb9b6f44d817a446bf84eb3e3f96a0acd9
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 0.3.1
2
+
3
+ - Platform mismatch: when Blipit refuses data because the key belongs to a project for another platform (HTTP 409 platform_mismatch), the SDK logs one clear error and stops sending for the rest of the run.
4
+
1
5
  ## 0.3.0
2
6
 
3
7
  - Runs on Blipit's own core, blipit-nuggets, with no third-party monitoring gem and no runtime dependencies. Events go to `POST /api/v1/events` in Blipit's event format with the `X-Blipit-Key` header; spans go to `/v1/traces`.
@@ -18,6 +18,7 @@ module Blipit
18
18
  SECURITY_FIELDS = { actor_id: 128, ip: 45, user_agent: 512, database: 64, outcome: 64, target: 256 }.freeze
19
19
  HEADER_ALLOW = %w[user-agent referer content-type accept-language].freeze
20
20
  MAX_EVENTS = 100
21
+ REFUSED_KEYS = {}
21
22
  MAX_SPANS = 10_000
22
23
  SPAN_BATCH = 1000
23
24
  SPAN_FLUSH = 5.0
@@ -459,6 +460,17 @@ module Blipit
459
460
  end
460
461
 
461
462
  def post(path, body)
463
+ return [409, {}, nil] if REFUSED_KEYS[@key]
464
+
465
+ status, headers, payload = send_request(path, body)
466
+ if status == 409 && payload.is_a?(Hash) && payload["reason"] == "platform_mismatch" && !REFUSED_KEYS[@key]
467
+ REFUSED_KEYS[@key] = true
468
+ warn("[blipit] #{payload["error"] || "This key belongs to a project for another platform."} Blipit stopped sending with this key until the process restarts.")
469
+ end
470
+ [status, headers, payload]
471
+ end
472
+
473
+ def send_request(path, body)
462
474
  uri = URI.parse(@base + path)
463
475
  http = Net::HTTP.new(uri.host, uri.port)
464
476
  http.use_ssl = uri.scheme == "https"
@@ -1,3 +1,3 @@
1
1
  module Blipit
2
- VERSION = "0.3.0"
2
+ VERSION = "0.3.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: blipit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Louward Labs