fluent-plugin-sentry-ruby 0.2.0 → 0.3.2

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: 3e0ef4f3d924384893aa2981c125f9feae2b7a1948ad5381ce17305b818a13d7
4
- data.tar.gz: bddee414a0b307de71af2fa1a9c051e28d45ccd7ae74721ea0c11a64d2109a36
3
+ metadata.gz: 4418b05058672d2766e69e17dbd9bc40149e05d19428fced8c2b31b5a0b330d5
4
+ data.tar.gz: 6e3cb4a26b182a9dbe567b0213deba689c2c997480243efa5d03111310a1c9ae
5
5
  SHA512:
6
- metadata.gz: 5c7ce3468c3c7a47f4bcc3d80bd2e1ea159dfe33d82088e5f8f077921889aed18d81373907756d1c84b23212a19e76934f9fb4c20806db2bd6ece0b7f85c2be7
7
- data.tar.gz: ff94f27723a8c9df77dd1bf7f861f305496dc44063019d90907a65eca3d0da02e8751c1c7b2b653e119291cdd3001eb490268ee0e2d06c4810d871d37157487b
6
+ metadata.gz: cdfe6dbe81b35df5b648c9c00730ecaad0b180c28d8e496e88b9cd7abacd87c388ea23cc041e7391fec7d0c7b7cd57073fe54ffea8ac59c9fcde7dfceb7e9cab
7
+ data.tar.gz: c8fce2612bb83622fef2b652811665064bab56b6e5fabf79ff088aa8162035f9d6b98d54ee654edc69d0dedc845f05a4450c42269ace1da9898a08ca024d94d0
@@ -0,0 +1,17 @@
1
+ # [Choice] Ruby version (use -bullseye variants on local arm64/Apple Silicon): 3, 3.0, 2, 2.7, 2.6, 3-bullseye, 3.0-bullseye, 2-bullseye, 2.7-bullseye, 2.6-bullseye, 3-buster, 3.0-buster, 2-buster, 2.7-buster, 2.6-buster
2
+ ARG VARIANT=2-bullseye
3
+ FROM mcr.microsoft.com/vscode/devcontainers/ruby:0-${VARIANT}
4
+
5
+ # [Choice] Node.js version: none, lts/*, 16, 14, 12, 10
6
+ ARG NODE_VERSION="none"
7
+ RUN if [ "${NODE_VERSION}" != "none" ]; then su vscode -c "umask 0002 && . /usr/local/share/nvm/nvm.sh && nvm install ${NODE_VERSION} 2>&1"; fi
8
+
9
+ # [Optional] Uncomment this section to install additional OS packages.
10
+ # RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
11
+ # && apt-get -y install --no-install-recommends <your-package-list-here>
12
+
13
+ # [Optional] Uncomment this line to install additional gems.
14
+ # RUN gem install <your-gem-names-here>
15
+
16
+ # [Optional] Uncomment this line to install global node packages.
17
+ # RUN su vscode -c "source /usr/local/share/nvm/nvm.sh && npm install -g <your-package-here>" 2>&1
@@ -0,0 +1,43 @@
1
+ # [Choice] Ruby version (use -bullseye variants on local arm64/Apple Silicon): 3, 3.0, 2, 2.7, 2.6, 3-bullseye, 3.0-bullseye, 2-bullseye, 2.7-bullseye, 2.6-bullseye, 3-buster, 3.0-buster, 2-buster, 2.7-buster, 2.6-buster
2
+ ARG VARIANT=2-bullseye
3
+ FROM ruby:${VARIANT}
4
+
5
+ # Copy library scripts to execute
6
+ COPY library-scripts/*.sh library-scripts/*.env /tmp/library-scripts/
7
+
8
+ # [Option] Install zsh
9
+ ARG INSTALL_ZSH="true"
10
+ # [Option] Upgrade OS packages to their latest versions
11
+ ARG UPGRADE_PACKAGES="true"
12
+ # Install needed packages and setup non-root user. Use a separate RUN statement to add your own dependencies.
13
+ ARG USERNAME=vscode
14
+ ARG USER_UID=1000
15
+ ARG USER_GID=$USER_UID
16
+ RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
17
+ # Remove imagemagick due to https://security-tracker.debian.org/tracker/CVE-2019-10131
18
+ && apt-get purge -y imagemagick imagemagick-6-common \
19
+ # Install common packages, non-root user, rvm, core build tools
20
+ && bash /tmp/library-scripts/common-debian.sh "${INSTALL_ZSH}" "${USERNAME}" "${USER_UID}" "${USER_GID}" "${UPGRADE_PACKAGES}" "true" "true" \
21
+ && bash /tmp/library-scripts/ruby-debian.sh "none" "${USERNAME}" "true" "true" \
22
+ && apt-get autoremove -y && apt-get clean -y && rm -rf /var/lib/apt/lists/*
23
+
24
+ # [Choice] Node.js version: none, lts/*, 16, 14, 12, 10
25
+ ARG NODE_VERSION="none"
26
+ ENV NVM_DIR=/usr/local/share/nvm
27
+ ENV NVM_SYMLINK_CURRENT=true \
28
+ PATH=${NVM_DIR}/current/bin:${PATH}
29
+ RUN bash /tmp/library-scripts/node-debian.sh "${NVM_DIR}" "${NODE_VERSION}" "${USERNAME}" \
30
+ && apt-get clean -y && rm -rf /var/lib/apt/lists/*
31
+
32
+ # Remove library scripts for final image
33
+ RUN rm -rf /tmp/library-scripts
34
+
35
+ # [Optional] Uncomment this section to install additional OS packages.
36
+ # RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
37
+ # && apt-get -y install --no-install-recommends <your-package-list-here>
38
+
39
+ # [Optional] Uncomment this line to install additional gems.
40
+ # RUN gem install <your-gem-names-here>
41
+
42
+ # [Optional] Uncomment this line to install global node packages.
43
+ # RUN su vscode -c "source /usr/local/share/nvm/nvm.sh && npm install -g <your-package-here>" 2>&1
@@ -0,0 +1,34 @@
1
+ // For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
2
+ // https://github.com/microsoft/vscode-dev-containers/tree/v0.209.6/containers/ruby
3
+ {
4
+ "name": "Ruby",
5
+ "build": {
6
+ "dockerfile": "Dockerfile",
7
+ "args": {
8
+ // Update 'VARIANT' to pick a Ruby version: 3, 3.0, 2, 2.7, 2.6
9
+ // Append -bullseye or -buster to pin to an OS version.
10
+ // Use -bullseye variants on local on arm64/Apple Silicon.
11
+ "VARIANT": "3-bullseye",
12
+ // Options
13
+ "NODE_VERSION": "lts/*"
14
+ }
15
+ },
16
+
17
+ // Set *default* container specific settings.json values on container create.
18
+ "settings": {},
19
+
20
+ // Add the IDs of extensions you want installed when the container is created.
21
+ "extensions": [
22
+ "rebornix.Ruby"
23
+ ],
24
+
25
+ // Use 'forwardPorts' to make a list of ports inside the container available locally.
26
+ // "forwardPorts": [],
27
+
28
+ // Use 'postCreateCommand' to run commands after the container is created.
29
+ // "postCreateCommand": "ruby --version",
30
+
31
+ // Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
32
+ "remoteUser": "vscode"
33
+
34
+ }
data/.gitignore ADDED
@@ -0,0 +1,4 @@
1
+ log
2
+ pkg
3
+ tmp
4
+ fluent.conf
@@ -3,7 +3,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
3
 
4
4
  Gem::Specification.new do |spec|
5
5
  spec.name = "fluent-plugin-sentry-ruby"
6
- spec.version = "0.2.0"
6
+ spec.version = "0.3.2"
7
7
  spec.authors = ["buffalo"]
8
8
  spec.email = ["buffalobigboy@gmail.com"]
9
9
 
@@ -10,13 +10,17 @@ module Fluent
10
10
  config_param :title, :string, :default => 'test'
11
11
  config_param :level, :enum, list: [:fatal, :error, :warning, :info, :debug], :default => 'info'
12
12
  config_param :environment, :string, :default => 'local'
13
- config_param :type, :enum, list: [ :event, :exception], :default => :event
13
+ config_param :type, :enum, list: [:event, :exception], :default => :event
14
14
  # for event
15
15
  config_param :user_keys, :array, :default => [], value_type: :string
16
16
  config_param :tag_keys, :array, :default => [], value_type: :string
17
- config_param :keys, :array, :default => [], value_type: :string
17
+ config_param :data_keys, :array, :default => [], value_type: :string
18
18
  # for exception
19
- config_param :lang, :string, :default => 'php'
19
+ config_param :e_message, :string, :default => 'message'
20
+ config_param :e_describe, :string, :default => 'describe'
21
+ config_param :e_filename, :string, :default => 'filename'
22
+ config_param :e_stack, :string, :default => 'stack'
23
+ config_param :e_line, :string, :default => 'line'
20
24
 
21
25
 
22
26
  def initialize
@@ -41,28 +45,31 @@ module Fluent
41
45
  begin
42
46
  event = Sentry::Event.new(configuration: @client.configuration)
43
47
 
44
- event.message = record['message'] || @title
45
48
  event.level = (record['level'] || @level).downcase
46
49
  event.environment = record['env'] || @environment
47
50
 
48
51
  if @type === :event
52
+ event.message = record['message'] || @title
49
53
  event.user = record.select{ |key| @user_keys.include?(key) }
50
54
  event.extra = @keys.length() > 0 ? record.select{ |key| @keys.include?(key) } : record
51
55
  event.contexts = {'data' => { origin_data: record }}
52
- event.tags = event.tags.merge({ :platform => tag })
56
+ event.tags = event.tags.merge({ :log_tag => tag })
53
57
  .merge({ :timestamp => Time.at(time).strftime('%Y-%m-%d %H:%M:%S') })
54
58
  .merge(record.select{ |key| (@tag_keys + @user_keys).include?(key) })
55
59
  elsif @type === :exception
56
60
  event = event.to_hash
57
61
  event['exception'] = Sentry::CustomExceptionInterface.new(
58
- type: 'FatalThrowableError',
59
- message: record['message'],
62
+ type: record['message'] || @title,
63
+ message: (record[@e_describe] + (record[@e_line] ? (' on line:' + record[@e_line]) : '')) || '',
60
64
  stacktrace: Sentry::StacktraceInterface.new(frames: [Sentry::CustomStacktraceFrame.new(
61
- filename: 'index' + '.' + @lang,
62
- context_line: record['message'],
63
- post_context: record['stack']
65
+ filename: record[@e_filename] || '',
66
+ context_line: (record[@e_describe] + (record[@e_line] ? (' on line:' + record[@e_line]) : '')) || '',
67
+ post_context: record[@e_stack] || (record[@e_describe] || ''),
64
68
  )])
65
69
  ).to_hash
70
+ event['tags'] = { :log_tag => tag }
71
+ .merge({ :timestamp => Time.at(time).strftime('%d-%b-%Y %H:%M:%S %Z') })
72
+ .merge(record.select{ |key| (@tag_keys + @user_keys).include?(key) })
66
73
  end
67
74
 
68
75
  @client.send_event(event)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-sentry-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - buffalo
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-12-17 00:00:00.000000000 Z
11
+ date: 2022-01-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -93,6 +93,10 @@ executables: []
93
93
  extensions: []
94
94
  extra_rdoc_files: []
95
95
  files:
96
+ - ".devcontainer/Dockerfile"
97
+ - ".devcontainer/base.Dockerfile"
98
+ - ".devcontainer/devcontainer.json"
99
+ - ".gitignore"
96
100
  - Gemfile
97
101
  - LICENSE
98
102
  - README.md