ach-fluent-plugin-sentry 0.0.7 → 0.0.11

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: b1ff3484b47fa18586d83e051959494c35e343c506c0dd83620887530ac09f96
4
- data.tar.gz: 4f3b6c75ba0bca9d07b4867f44d261c74fb515c48199ffa9cc244909118dbcf3
3
+ metadata.gz: 06d222e5275a2a671a2c200dd7034c5bdeecd7bd72c41198644bc0baba230185
4
+ data.tar.gz: b5eda05434b1850be318b7c90c94e611c2d44fd1b5d72ce6f15db41221f28028
5
5
  SHA512:
6
- metadata.gz: 3e698c6a34e1653dff9d6d5574ebc417853c3657cc375a0a93b64cd95f12355dd308786b1da8110c09ee9f2bcc018c37ebeebfb1c4dea6ac2231a501918f53a2
7
- data.tar.gz: 9f4b1669bcfafae3f7c8c150f7d33a456f5adf2d5391542023cec718cd02e0c3aa3e186751cd8670e591ebb9afccb876df853a9d43a88fb3a58cbd6509793cd6
6
+ metadata.gz: b6daf0436b6baf8ae877c8fe20ade8a0c651c261d2b66e6f0bfa57b5f1e97d5231e0754f4d6d8a3dd90512d39d76e07f22f2f9148b9578ad35f904aafac1bc70
7
+ data.tar.gz: 6ed27a06be4bea6fce6c2fadbb6f03e95497acd68b938ef119610d5e6dc2b0926c885e2d6f7769980dde4981042f9e35e4908749f652ed85a26298ef485e9a41
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = "ach-fluent-plugin-sentry"
7
- spec.version = "0.0.7"
7
+ spec.version = "0.0.11"
8
8
  spec.authors = ["Kentaro Yoshida"]
9
9
  spec.email = ["y.ken.studio@gmail.com"]
10
10
  spec.summary = %q{Fluentd output plugin that sends aggregated errors/exception events to Sentry. Sentry is a event logging and aggregation platform.}
@@ -35,6 +35,8 @@ class Fluent::SentryOutput < Fluent::BufferedOutput
35
35
  @hostname = `#{hostname_command}`.chomp
36
36
 
37
37
  @configuration = Sentry::Configuration.new
38
+ @configuration.send_modules = false
39
+ @configuration.debug = true
38
40
  @configuration.dsn = @endpoint_url
39
41
  @configuration.server_name = @hostname
40
42
  @client = Sentry::Client.new(@configuration)
@@ -63,19 +65,19 @@ class Fluent::SentryOutput < Fluent::BufferedOutput
63
65
  end
64
66
 
65
67
  def notify_sentry(tag, time, record)
68
+ #$log.warning("Message: ",:error => record['message'])
66
69
  event = Sentry::Event.new(
67
70
  :configuration => @configuration,
68
- :message => record['message']
71
+ :message => record
69
72
  )
70
73
  event.timestamp = record['timestamp'] || Time.at(time).utc.strftime('%Y-%m-%dT%H:%M:%S')
71
- event.time_spent = record['time_spent'] || nil
72
74
  event.level = record['level'] || @default_level
73
- event.logger = record['logger'] || @default_logger
74
- event.culprit = record['culprit'] || nil
75
- event.server_name = record['server_name'] || @hostname
76
- event.release = record['release'] if record['release']
75
+ #event.logger = record['logger'] || @default_logger
76
+ #event.culprit = record['culprit'] || nil
77
+ #event.server_name = record['server_name'] || @hostname
78
+ #event.release = record['release'] if record['release']
77
79
  event.tags = event.tags.merge({ :tag => tag }.merge(record['tags'] || {}))
78
- event.extra = record.reject{ |key| EVENT_KEYS.include?(key) }
80
+ #event.extra = record.reject{ |key| EVENT_KEYS.include?(key) }
79
81
  @client.send_event(event)
80
82
  end
81
83
  end
@@ -25,6 +25,20 @@ class SentryOutputTest < Test::Unit::TestCase
25
25
  end
26
26
  end
27
27
 
28
+ def stub_1(url="https://app.getsentry.com/api/12345/envelope/")
29
+ stub_request(:post, "https://app.getsentry.com/api/12345/envelope/").
30
+ with(
31
+ body: "{\"event_id\":\"2aa1f0210fc04c89a8febda09d3e4a5f\",\"dsn\":\"https://user:password@app.getsentry.com/12345\",\"sdk\":{\"name\":\"sentry.ruby\",\"version\":\"4.6.5\"},\"sent_at\":\"2021-09-01T12:00:23Z\"}\n{\"type\":\"event\",\"content_type\":\"application/json\"}\n{\"event_id\":\"2aa1f0210fc04c89a8febda09d3e4a5f\",\"level\":\"warning\",\"timestamp\":\"2021-09-01T12:00:23\",\"environment\":\"default\",\"server_name\":\"reisei-workspace\",\"modules\":{\"rake\":\"13.0.6\",\"bundler\":\"2.2.26\",\"cool.io\":\"1.7.1\",\"http_parser.rb\":\"0.7.0\",\"msgpack\":\"1.4.2\",\"sigdump\":\"0.2.4\",\"serverengine\":\"2.2.4\",\"strptime\":\"0.2.5\",\"concurrent-ruby\":\"1.1.9\",\"tzinfo\":\"2.0.4\",\"tzinfo-data\":\"1.2021.1\",\"webrick\":\"1.7.0\",\"yajl-ruby\":\"1.4.1\",\"fluentd\":\"1.14.0\",\"faraday-em_http\":\"1.0.0\",\"faraday-em_synchrony\":\"1.0.0\",\"faraday-excon\":\"1.1.0\",\"faraday-httpclient\":\"1.0.1\",\"faraday-net_http\":\"1.0.1\",\"faraday-net_http_persistent\":\"1.2.0\",\"faraday-patron\":\"1.0.0\",\"faraday-rack\":\"1.0.0\",\"multipart-post\":\"2.1.1\",\"ruby2_keywords\":\"0.0.5\",\"faraday\":\"1.7.0\",\"sentry-ruby-core\":\"4.6.5\",\"sentry-ruby\":\"4.6.5\",\"ach-fluent-plugin-sentry\":\"0.0.9\",\"public_suffix\":\"4.0.6\",\"addressable\":\"2.8.0\",\"thor\":\"1.1.0\",\"appraisal\":\"2.4.1\",\"rexml\":\"3.2.5\",\"crack\":\"0.4.5\",\"hashdiff\":\"1.0.1\",\"power_assert\":\"2.0.1\",\"test-unit\":\"3.4.4\",\"webmock\":\"3.14.0\"},\"message\":\"error has occoured.\",\"user\":{},\"tags\":{\"tag\":\"app1_error\"},\"contexts\":{},\"extra\":{},\"fingerprint\":[],\"platform\":\"ruby\",\"sdk\":{\"name\":\"sentry.ruby\",\"version\":\"4.6.5\"}}\n",
32
+ headers: {
33
+ 'Accept'=>'*/*',
34
+ 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3',
35
+ 'Content-Encoding'=>'',
36
+ 'Content-Type'=>'application/x-sentry-envelope',
37
+ 'User-Agent'=>'sentry-ruby/4.6.5',
38
+ 'X-Sentry-Auth'=>'Sentry sentry_version=7, sentry_client=sentry-ruby/4.6.5, sentry_timestamp=1630497623, sentry_key=user, sentry_secret=password'
39
+ }).to_return(status: 200, body: "", headers: {})
40
+ end
41
+
28
42
  def stub_post(url="https://app.getsentry.com/api/12345/store/")
29
43
  parser = Yajl::Parser.new
30
44
  stub_request(:post, url).with do |req|
@@ -34,7 +48,7 @@ class SentryOutputTest < Test::Unit::TestCase
34
48
  end
35
49
  end
36
50
 
37
- def stub_response(url="https://app.getsentry.com/api/12345/store/")
51
+ def stub_response(url="https://app.getsentry.com/api/12345/envelope/")
38
52
  stub_request(:post, url).with do |req|
39
53
  @content_type = req.headers["Content-Type"]
40
54
  message = Zlib::Inflate.inflate(Base64.decode64(req.body))
@@ -51,7 +65,17 @@ class SentryOutputTest < Test::Unit::TestCase
51
65
  end
52
66
 
53
67
  def test_emit
54
- stub_post
68
+ stub_request(:post, "https://app.getsentry.com/api/12345/envelope/").
69
+ with(
70
+ body: "{\"event_id\":\"2aa1f0210fc04c89a8febda09d3e4a5f\",\"dsn\":\"https://user:password@app.getsentry.com/12345\",\"sdk\":{\"name\":\"sentry.ruby\",\"version\":\"4.6.5\"},\"sent_at\":\"2021-09-01T12:00:23Z\"}\n{\"type\":\"event\",\"content_type\":\"application/json\"}\n{\"event_id\":\"2aa1f0210fc04c89a8febda09d3e4a5f\",\"level\":\"warning\",\"timestamp\":\"2021-09-01T12:00:23\",\"environment\":\"default\",\"server_name\":\"reisei-workspace\",\"modules\":{\"rake\":\"13.0.6\",\"bundler\":\"2.2.26\",\"cool.io\":\"1.7.1\",\"http_parser.rb\":\"0.7.0\",\"msgpack\":\"1.4.2\",\"sigdump\":\"0.2.4\",\"serverengine\":\"2.2.4\",\"strptime\":\"0.2.5\",\"concurrent-ruby\":\"1.1.9\",\"tzinfo\":\"2.0.4\",\"tzinfo-data\":\"1.2021.1\",\"webrick\":\"1.7.0\",\"yajl-ruby\":\"1.4.1\",\"fluentd\":\"1.14.0\",\"faraday-em_http\":\"1.0.0\",\"faraday-em_synchrony\":\"1.0.0\",\"faraday-excon\":\"1.1.0\",\"faraday-httpclient\":\"1.0.1\",\"faraday-net_http\":\"1.0.1\",\"faraday-net_http_persistent\":\"1.2.0\",\"faraday-patron\":\"1.0.0\",\"faraday-rack\":\"1.0.0\",\"multipart-post\":\"2.1.1\",\"ruby2_keywords\":\"0.0.5\",\"faraday\":\"1.7.0\",\"sentry-ruby-core\":\"4.6.5\",\"sentry-ruby\":\"4.6.5\",\"ach-fluent-plugin-sentry\":\"0.0.9\",\"public_suffix\":\"4.0.6\",\"addressable\":\"2.8.0\",\"thor\":\"1.1.0\",\"appraisal\":\"2.4.1\",\"rexml\":\"3.2.5\",\"crack\":\"0.4.5\",\"hashdiff\":\"1.0.1\",\"power_assert\":\"2.0.1\",\"test-unit\":\"3.4.4\",\"webmock\":\"3.14.0\"},\"message\":\"error has occoured.\",\"user\":{},\"tags\":{\"tag\":\"app1_error\"},\"contexts\":{},\"extra\":{},\"fingerprint\":[],\"platform\":\"ruby\",\"sdk\":{\"name\":\"sentry.ruby\",\"version\":\"4.6.5\"}}\n",
71
+ headers: {
72
+ 'Accept'=>'*/*',
73
+ 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3',
74
+ 'Content-Encoding'=>'',
75
+ 'Content-Type'=>'application/x-sentry-envelope',
76
+ 'User-Agent'=>'sentry-ruby/4.6.5',
77
+ 'X-Sentry-Auth'=>'Sentry sentry_version=7, sentry_client=sentry-ruby/4.6.5, sentry_timestamp=1630497623, sentry_key=user, sentry_secret=password'}).to_return(status: 200, body: "", headers: {})
78
+ #stub_post
55
79
  d1 = create_driver(CONFIG, 'input.app1_error')
56
80
  emit_level = 'warning'
57
81
  emit_message = 'error has occoured.'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ach-fluent-plugin-sentry
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kentaro Yoshida
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-08-31 00:00:00.000000000 Z
11
+ date: 2021-09-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler