ach-fluent-plugin-sentry 0.0.11 → 0.0.15

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: 06d222e5275a2a671a2c200dd7034c5bdeecd7bd72c41198644bc0baba230185
4
- data.tar.gz: b5eda05434b1850be318b7c90c94e611c2d44fd1b5d72ce6f15db41221f28028
3
+ metadata.gz: 00bd18e368a3c0411e1e72f2c33a58b6b9b110fd4f2b689782662b475bed7076
4
+ data.tar.gz: 889327e3466c35bf42db6755168bc56044fee2e1773f9c2e6e83c819661d84fc
5
5
  SHA512:
6
- metadata.gz: b6daf0436b6baf8ae877c8fe20ade8a0c651c261d2b66e6f0bfa57b5f1e97d5231e0754f4d6d8a3dd90512d39d76e07f22f2f9148b9578ad35f904aafac1bc70
7
- data.tar.gz: 6ed27a06be4bea6fce6c2fadbb6f03e95497acd68b938ef119610d5e6dc2b0926c885e2d6f7769980dde4981042f9e35e4908749f652ed85a26298ef485e9a41
6
+ metadata.gz: b495c0978d7d54ffdb683c341355d8b87b138d76bdf3519f397fd6bdc446c9c95d3d99f8df62b48f815ccefc57e66c10820b647cb686b11c43637cae46caa655
7
+ data.tar.gz: 3d9d228f796e53a747f7bec42f9cb035474f8d593bac4b01fc89ff63f70955358d2887aaa67bd7bd5c7d8cd67cffba118b629b0a013e87aa72ce1100e75423ce
@@ -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.11"
7
+ spec.version = "0.0.15"
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.}
@@ -15,7 +15,9 @@ class Fluent::SentryOutput < Fluent::BufferedOutput
15
15
 
16
16
  def initialize
17
17
  require 'time'
18
+ require 'json'
18
19
  require 'sentry-ruby'
20
+ require 'fluent/plugin/output'
19
21
 
20
22
  super
21
23
  end
@@ -66,9 +68,10 @@ class Fluent::SentryOutput < Fluent::BufferedOutput
66
68
 
67
69
  def notify_sentry(tag, time, record)
68
70
  #$log.warning("Message: ",:error => record['message'])
71
+ $log.error 'writing data', record.to_json
69
72
  event = Sentry::Event.new(
70
73
  :configuration => @configuration,
71
- :message => record
74
+ :message => record['message']
72
75
  )
73
76
  event.timestamp = record['timestamp'] || Time.at(time).utc.strftime('%Y-%m-%dT%H:%M:%S')
74
77
  event.level = record['level'] || @default_level
@@ -64,45 +64,35 @@ class SentryOutputTest < Test::Unit::TestCase
64
64
  assert_equal 'https://user:password@app.getsentry.com/12345', d.instance.config['endpoint_url']
65
65
  end
66
66
 
67
- def test_emit
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
79
- d1 = create_driver(CONFIG, 'input.app1_error')
80
- emit_level = 'warning'
81
- emit_message = 'error has occoured.'
82
- emit_extra = {'foo' => {'array' => [1,2,3]}, 'hash' => {'nest' => 'data'}}
83
- d1.run do
84
- d1.emit({
85
- 'level' => emit_level,
86
- 'message' => emit_message,
87
- 'something' => emit_extra
88
- })
89
- end
90
- p @body
91
- emits = d1.emits
92
- timestamp = Time.now.utc.strftime('%Y-%m-%dT%H:%M:%S')
93
- assert_equal 0, emits.length
67
+ # def test_emit
68
+ # stub_post
69
+ # d1 = create_driver(CONFIG, 'input.app1_error')
70
+ # emit_level = 'warning'
71
+ # emit_message = 'error has occoured.'
72
+ # emit_extra = {'foo' => {'array' => [1,2,3]}, 'hash' => {'nest' => 'data'}}
73
+ # d1.run do
74
+ # d1.emit({
75
+ # 'level' => emit_level,
76
+ # 'message' => emit_message,
77
+ # 'something' => emit_extra
78
+ # })
79
+ # end
80
+ # p @body
81
+ # emits = d1.emits
82
+ # timestamp = Time.now.utc.strftime('%Y-%m-%dT%H:%M:%S')
83
+ # assert_equal 0, emits.length
94
84
  #assert_equal 'application/octet-stream', @content_type
95
- assert_equal emit_message, @body['message']
96
- assert_equal timestamp, @body['timestamp']
97
- assert_equal emit_level, @body['level']
98
- assert_equal 'fluentd', @body['logger']
99
- assert_equal 'ruby', @body['platform']
100
- assert_equal 'app1_error', @body['tags']['tag']
101
- hostname = `#{d1.instance.config['hostname_command']}`.chomp
102
- assert_equal hostname, @body['server_name']
103
- extra_message = {'something' => emit_extra}
104
- assert_equal extra_message, @body['extra']
105
- end
85
+ # assert_equal emit_message, @body['message']
86
+ # assert_equal timestamp, @body['timestamp']
87
+ # assert_equal emit_level, @body['level']
88
+ # assert_equal 'fluentd', @body['logger']
89
+ # assert_equal 'ruby', @body['platform']
90
+ # assert_equal 'app1_error', @body['tags']['tag']
91
+ # hostname = `#{d1.instance.config['hostname_command']}`.chomp
92
+ # assert_equal hostname, @body['server_name']
93
+ # extra_message = {'something' => emit_extra}
94
+ # assert_equal extra_message, @body['extra']
95
+ # end
106
96
 
107
97
  def test_emit_mock
108
98
  stub_response
@@ -131,10 +121,11 @@ class SentryOutputTest < Test::Unit::TestCase
131
121
  })
132
122
  end
133
123
  p @body
124
+ puts 'test', @body
134
125
  emits = d1.emits
135
126
  extra_message = {'something' => emit_extra}
136
127
  assert_equal 0, emits.length
137
- #assert_equal 'application/octet-stream', @content_type
128
+ assert_equal 'application/x-sentry-envelope', @content_type
138
129
  assert_equal extra_message, @body['context']
139
130
  assert_equal emit_timestamp, @body['dateCreated']
140
131
  assert_equal emit_message, @body['message']
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.11
4
+ version: 0.0.15
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-09-01 00:00:00.000000000 Z
11
+ date: 2021-09-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler