Add DataDog APM module

This commit is contained in:
Oleksii Kriuchykhin 2024-06-10 10:51:16 +02:00
parent 5cea3cc81e
commit 5e36ddf894
7 changed files with 36 additions and 11 deletions

View file

@ -2,7 +2,7 @@
source 'http://rubygems.org'
ruby '3.2.4'
ruby '~> 3.2.2'
gem 'activerecord-session_store'
gem 'bootsnap', require: false
@ -97,6 +97,7 @@ gem 'jsbundling-rails'
gem 'tailwindcss-rails', '~> 2.4'
gem 'base62' # Used for smart annotations
gem 'datadog'
gem 'newrelic_rpm'
# Permission helper Gem
@ -120,6 +121,7 @@ group :development, :test do
gem 'rubocop', require: false
gem 'rubocop-performance'
gem 'rubocop-rails'
gem 'ruby-lsp'
gem 'timecop'
end

View file

@ -285,7 +285,13 @@ GEM
activerecord (>= 5.a)
database_cleaner-core (~> 2.0.0)
database_cleaner-core (2.0.1)
datadog (2.0.0)
debase-ruby_core_source (= 3.3.1)
libdatadog (~> 9.0.0.1.0)
libddwaf (~> 1.14.0.0.0)
msgpack
date (3.3.4)
debase-ruby_core_source (3.3.1)
debug_inspector (1.1.0)
deface (1.9.0)
actionview (>= 5.2)
@ -409,6 +415,14 @@ GEM
activerecord
kaminari-core (= 1.2.2)
kaminari-core (1.2.2)
libdatadog (9.0.0.1.0)
libdatadog (9.0.0.1.0-x86_64-linux)
libddwaf (1.14.0.0.0)
ffi (~> 1.0)
libddwaf (1.14.0.0.0-arm64-darwin)
ffi (~> 1.0)
libddwaf (1.14.0.0.0-x86_64-linux)
ffi (~> 1.0)
listen (3.8.0)
rb-fsevent (~> 0.10, >= 0.10.3)
rb-inotify (~> 0.9, >= 0.9.10)
@ -890,4 +904,4 @@ RUBY VERSION
ruby 3.2.4p170
BUNDLED WITH
2.4.19
2.5.11

View file

@ -0,0 +1,9 @@
# frozen_string_literal: true
if ENV['DD_TRACE_ENABLED'] == 'true'
require 'datadog/auto_instrument'
Datadog.configure do |config|
config.tracing.enabled = ENV['DD_TRACE_ENABLED'] == 'true'
end
end

View file

@ -6,9 +6,8 @@ Rails.application.configure do
Silencer::Logger,
config.log_tags,
silence: [
# Silence WickedPDF rendering in logs
%r{/projects/[0-9]*/reports/generate.pdf},
'/api/health'
'/api/health',
'/health'
]
)
end

View file

@ -9,6 +9,8 @@
# https://docs.newrelic.com/docs/agents/ruby-agent/installation-configuration/ruby-agent-configuration
common: &default_settings
agent_enabled: <%= ENV["NEW_RELIC_AGENT_ENABLED"] == 'true' %>
# Required license key associated with your New Relic account.
license_key: <%= ENV["NEW_RELIC_LICENSE_KEY"] %>

View file

@ -5,6 +5,8 @@ Rails.application.routes.draw do
post 'access_tokens/revoke', to: 'doorkeeper/access_tokens#revoke'
get 'health', to: 'api/api#health'
# Addons
constraints UserSubdomain do

View file

@ -21,12 +21,9 @@ module ActiveStorage
Rails.logger.info "Starting preparing document preview for file #{blob.filename.sanitized}..."
begin
success = system(libreoffice_path,
'--headless', '--invisible',
'-env:UserInstallation=file:///tmp/scinote-libreoffice',
'--convert-to', 'png',
'--outdir', work_dir,
input.path)
success = system(
libreoffice_path, '--headless', '--invisible', '--convert-to', 'png', '--outdir', work_dir, input.path
)
unless success && File.file?(preview_file)
raise StandardError, "There was an error generating document preview, blob id: #{blob.id}"