fluent-plugin-sentry-ruby 0.2.1 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.devcontainer/Dockerfile +17 -0
- data/.devcontainer/base.Dockerfile +43 -0
- data/.devcontainer/devcontainer.json +34 -0
- data/.gitignore +4 -0
- data/fluent-plugin-sentry.gemspec +1 -1
- data/lib/fluent/plugin/out_sentry.rb +15 -9
- metadata +6 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 204e60b022ba9c4103a3960941f917f3c2f6bb6d3dd2cc5bbc5351384f395612
|
4
|
+
data.tar.gz: ea604c23453f76c502c17c3e5a7749c591ebf4a52618221053edf375989e658e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 271dc81cd18564dfbd72cfab382e94255b356b7faf17d8fafcb1160900f144ab723535c66a69126a6f3429ac68b7583b7e310c7f0fc00fea08893a7cbf24788d
|
7
|
+
data.tar.gz: 1f0d10204414fa185a76726ace2e5efcb5363a9708efbe46aaf0950b03afd145c1c8e986a3f3f08d951d6f00081a131481456cef55bf034a1dbc0a6cb1b97133
|
@@ -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
@@ -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: [
|
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
17
|
config_param :keys, :array, :default => [], value_type: :string
|
18
18
|
# for exception
|
19
|
-
config_param :
|
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,11 +45,11 @@ 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 }}
|
@@ -55,15 +59,17 @@ module Fluent
|
|
55
59
|
elsif @type === :exception
|
56
60
|
event = event.to_hash
|
57
61
|
event['exception'] = Sentry::CustomExceptionInterface.new(
|
58
|
-
type: @title,
|
59
|
-
message: record['
|
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:
|
62
|
-
context_line: record['
|
63
|
-
post_context: record['
|
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
|
66
|
-
event['tags'] = { :
|
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) })
|
67
73
|
end
|
68
74
|
|
69
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.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- buffalo
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-01-
|
11
|
+
date: 2022-01-23 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
|