Commit graph

8 commits

Author SHA1 Message Date
Jamie Gaskins
c591ec811d
Arrange Datadog Redis integrations more usefully (#14185)
This commit solves two problems:

1. Redis cache usage is tracked under `redis-rpush` because they use the
   same Redis URL and `redis-rpush` overrides `redis`.
2. Sidekiq jobs can enqueue an unbounded number of other Sidekiq jobs.
   The instrumentation cost alone of enqueuing hundreds of thousands of
   other Sidekiq jobs can be prohibitive, similar to DEBUG-level
   logging. This commit wraps it in a conditional so it must be enabled
   explicitly and can be turned on and off at will without a code
   change.
2021-07-09 15:19:37 -04:00
rhymes
70e0e9b83a
[15 min fix] Fix some autoloading deprecation warnings (#13793)
* Fix autoloading for RateLimitChecker

* Fix autoloading for ForemStatsClient

* Fix autoloading for middlewares

* Move things to their proper place

* Move middleware usage to the proper place

* Re-add rest-client in datadog driver correctly

* Already required in config/initializers/middlewares.rb

* Bring that back

* Fix Honeybadger spec
2021-05-20 18:10:25 +02:00
Alex
393ba00221
Remove Elasticsearch ✂️ ✂️ ✂️ ✂️ ✂️ ✂️ ✂️ ✂️ ✂️ ✂️ ✂️ ✂️ ✂️ ✂️ (#13606)
* Attempt number 1

* Fix rack_attack specs

* Fix users_searches_users spec

* Fix display_users_search_spec

* Fix comment typo

* Remove search:destroy task from cypress

* Remove port 9300 from gitpod

* Stub response in attack_spec
2021-05-03 11:09:45 -04:00
Fernando Valverde
cf3bde4259
Add mobile push notifications to Forem (#12419)
* First commit with iOS PN working

* RPush cleanup worker + unique jobs config

* Remove rpush tables from schema.rb

* PR feedback

* Feature flag and test for route

* Tests and feature flag PushNotification ::Send

* Update app/controllers/devices_controller.rb

Co-authored-by: Michael Kohl <citizen428@dev.to>

* Update spec/routing/devices_routes_spec.rb

Co-authored-by: Michael Kohl <citizen428@dev.to>

* Update spec/services/push_notifications/send_spec.rb

Co-authored-by: Michael Kohl <citizen428@dev.to>

* PR feedback

* Set Rpush driver and url

* More PR feedback

* Apply suggestions from code review

Co-authored-by: Jamie Gaskins <jgaskins@gmail.com>

* PR feedback from Rhymes

* Don’t double render

* Sure

Co-authored-by: Josh Puetz <hi@joshpuetz.com>
Co-authored-by: Josh Puetz <josh@dev.to>
Co-authored-by: Michael Kohl <citizen428@dev.to>
Co-authored-by: Jamie Gaskins <jgaskins@gmail.com>
2021-03-12 14:08:18 -06:00
Jamie Gaskins
c15120b902
Fix ddtrace warnings at app start (#12941)
* Load HTTPClient before Datadog

The instrumentation needs it to be loaded before it can patch the
request methods.

* Don't split HTTPClient traces on domains yet

After the service explosion in Datadog APM last time, let's take a more
cautious approach.

* Turns out, we aren't even using the aws-sdk gems

This was added because we use Fog's AWS adapter, but Fog uses Excon
(which we're already instrumenting) instead of the AWS SDK directly.
2021-03-08 16:27:33 -05:00
Jamie Gaskins
bd2d90d849
Mitigate service explosion in Datadog (#12918)
Splitting by domain caused an explosion in "services" tracked in Datadog
because it was counting each podcast platform and each blog as being
another service. Noramlly this would be what we want, but that's a lot
to ask for such a broad range of user-supplied domains.

Since each of these requests is made via HTTParty, which uses Net::HTTP
by default, this commit stops splitting in that library.

We'll need to come up with a better way of tracking this.
2021-03-05 17:30:29 -05:00
Jamie Gaskins
125df50a87
Expand Datadog instrumentation (#12908)
Expand Datadog instrumentation

This commit adds extra telemetry in Datadog for:

- Redis
  - We make 3 different Redis connections available, so this change
    shows us _which_ Redis instance a given query goes to
- Split HTTP requests by domain using:
  - net/http - default for Ruby
  - faraday - used by:
    - buffer
    - elasticsearch
    - gibbon
    - oauth2
    - octokit
    - sawyer
    - twilio
  - excon - used by:
    - fog
- AWS
- RestClient
  - Cloudinary
  - Pusher
- concurrent-ruby
  - ActiveSupport
  - brpoplpush-redis_script
  - i18n
  - sidekiq-unique-jobs
  - sprockets (do we even use this?)
- httpclient
  - pusher
- http.rb
  - twitter (omniauth)
  - honeycomb
2021-03-05 10:44:52 -05:00
Kirk Haines
ed74f2f245
Abstract DatadogStatsClient to ForemStatsClient (#12304)
* This change abstracts the DatadogStatsClient into a ForemStatsClient.
The purpose of this abstraction is to set the foundation for a subsequent PR that will allow one to use New Relic for recording Forem stats, instead of Datadog, if there is a New Relic configuration found.
This specific change creates an abstraction layer that can be built upon, without changing any actual default behavior. All specs still pass.

* Use delegate instead of explicit methods.

* Delegate instead of explicit methods.

* Fix the error.

* Refactor according to the suggestions in the comments.

* Ooops.  Stats work better when all of the code is committed.

* Removing the alias of count to increment since that was done in error.
2021-01-27 11:25:44 -05:00