ach-fluent-plugin-sentry 0.0.9 → 0.0.10

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 661455e9330dddbb450ec3e75e4aa72b1e7dca2edc2ec330591d733c7f0c30b5
4
- data.tar.gz: 5095f0b2d7569edb21aebff9687ecd46bc217c2b2bbf8b2bcb84383b4bffac0c
3
+ metadata.gz: f8bb08c165c3eba39393003f51c783877243141f5fa13d4b6b744918040a3877
4
+ data.tar.gz: b73ace7c66bda11e60daa9012d49565a2e04dbb37fdf2d0a619ce544a439bd8b
5
5
  SHA512:
6
- metadata.gz: 2b5ed4100830489bddfa4bdde3156e03e66ec209288fd8da88c74fbfaee09ea2de1aae9400e5a7904423ea11d45bb1be3f3608cde2183a8ebe6af4d310f6af33
7
- data.tar.gz: 5c7799c0885c9b0e4967d8870cc31d265c3ba1482ea079ba36e8995c76f09ea904e0631d398ef1f2a0095ada5a04a19ba959f27ab752c2fb8055e27f1bbb07bb
6
+ metadata.gz: b32075bd2d0baab63f739a9dd6d3ada943b8544e622d74911f89d413a547d8f8e554949a5b06b9840f7371a307ca0802ef133f8c490c602ea24484183d2b2324
7
+ data.tar.gz: '087e035270078ea98ad94d53bb58eeedabb1058fa09520270866e3fea31013899e0947e986daaa2b51018f6a46d3b5c4fe2264a47354795819857edc11501317'
@@ -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.9"
7
+ spec.version = "0.0.10"
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,17 +65,18 @@ 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
71
  :message => record['message']
69
72
  )
70
73
  event.timestamp = record['timestamp'] || Time.at(time).utc.strftime('%Y-%m-%dT%H:%M:%S')
71
- #event.level = record['level'] || @default_level
74
+ event.level = record['level'] || @default_level
72
75
  #event.logger = record['logger'] || @default_logger
73
76
  #event.culprit = record['culprit'] || nil
74
77
  #event.server_name = record['server_name'] || @hostname
75
78
  #event.release = record['release'] if record['release']
76
- #event.tags = event.tags.merge({ :tag => tag }.merge(record['tags'] || {}))
79
+ event.tags = event.tags.merge({ :tag => tag }.merge(record['tags'] || {}))
77
80
  #event.extra = record.reject{ |key| EVENT_KEYS.include?(key) }
78
81
  @client.send_event(event)
79
82
  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.9
4
+ version: 0.0.10
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