Commit graph

29 commits

Author SHA1 Message Date
Jacob Vosmaer
3fa8d5d09a Remove duplication in Procfile 2016-01-14 15:08:22 +01:00
Yorick Peterse
620e7bb3d6 Write to InfluxDB directly via UDP
This removes the need for Sidekiq and any overhead/problems introduced
by TCP. There are a few things to take into account:

1. When writing data to InfluxDB you may still get an error if the
   server becomes unavailable during the write. Because of this we're
   catching all exceptions and just ignore them (for now).
2. Writing via UDP apparently requires the timestamp to be in
   nanoseconds. Without this data either isn't written properly.
3. Due to the restrictions on UDP buffer sizes we're writing metrics one
   by one, instead of writing all of them at once.
2015-12-29 14:53:45 +01:00
Yorick Peterse
141e946c3d Storing of application metrics in InfluxDB
This adds the ability to write application metrics (e.g. SQL timings) to
InfluxDB. These metrics can in turn be visualized using Grafana, or
really anything else that can read from InfluxDB. These metrics can be
used to track application performance over time, between different Ruby
versions, different GitLab versions, etc.

== Transaction Metrics

Currently the following is tracked on a per transaction basis (a
transaction is a Rails request or a single Sidekiq job):

* Timings per query along with the raw (obfuscated) SQL and information
  about what file the query originated from.
* Timings per view along with the path of the view and information about
  what file triggered the rendering process.
* The duration of a request itself along with the controller/worker
  class and method name.
* The duration of any instrumented method calls (more below).

== Sampled Metrics

Certain metrics can't be directly associated with a transaction. For
example, a process' total memory usage is unrelated to any running
transactions. While a transaction can result in the memory usage going
up there's no accurate way to determine what transaction is to blame,
this becomes especially problematic in multi-threaded environments.

To solve this problem there's a separate thread that takes samples at a
fixed interval. This thread (using the class Gitlab::Metrics::Sampler)
currently tracks the following:

* The process' total memory usage.
* The number of file descriptors opened by the process.
* The amount of Ruby objects (using ObjectSpace.count_objects).
* GC statistics such as timings, heap slots, etc.

The default/current interval is 15 seconds, any smaller interval might
put too much pressure on InfluxDB (especially when running dozens of
processes).

== Method Instrumentation

While currently not yet used methods can be instrumented to track how
long they take to run. Unlike the likes of New Relic this doesn't
require modifying the source code (e.g. including modules), it all
happens from the outside. For example, to track `User.by_login` we'd add
the following code somewhere in an initializer:

    Gitlab::Metrics::Instrumentation.
      instrument_method(User, :by_login)

to instead instrument an instance method:

    Gitlab::Metrics::Instrumentation.
      instrument_instance_method(User, :save)

Instrumentation for either all public model methods or a few crucial
ones will be added in the near future, I simply haven't gotten to doing
so just yet.

== Configuration

By default metrics are disabled. This means users don't have to bother
setting anything up if they don't want to. Metrics can be enabled by
editing one's gitlab.yml configuration file (see
config/gitlab.yml.example for example settings).

== Writing Data To InfluxDB

Because InfluxDB is still a fairly young product I expect the worse.
Data loss, unexpected reboots, the database not responding, you name it.
Because of this data is _not_ written to InfluxDB directly, instead it's
queued and processed by Sidekiq. This ensures that users won't notice
anything when InfluxDB is giving trouble.

The metrics worker can be started in a standalone manner as following:

    bundle exec sidekiq -q metrics

The corresponding class is called MetricsWorker.
2015-12-17 17:25:48 +01:00
Marin Jankovski
0c377a79d4 Merge branch 'fix_mailer_queue' into 'master'
Fix mailers queue

The `mailer` queue can be removed.

See merge request !1975
2015-12-04 11:48:32 +00:00
Valery Sizov
9ce8c867ee Fix mailer queue 2015-12-03 15:10:41 +02:00
Jacob Vosmaer
927a4576c6 The Procfile is for development only 2015-12-02 13:26:49 +01:00
Valery Sizov
7f214cee74 Migrate mailers to ActiveJob 2015-11-26 17:03:43 +02:00
Douwe Maan
046b283127 Groundwork for merging CI into CE 2015-08-25 18:42:46 -07:00
Douwe Maan
f3b57ce677 Update init scripts. 2015-08-19 13:58:07 -07:00
Douwe Maan
170aa3b43b Update mail_room. 2015-08-19 10:18:20 -07:00
Douwe Maan
f76eac56b9 Reply by email POC 2015-08-18 15:46:36 -07:00
Douwe Maan
2cfd0b59ae Archive repositories in background worker. 2015-03-31 12:52:20 +02:00
Dmitriy Zaporozhets
2ed9a42edc
Fix sidekiq for development
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2014-12-29 17:56:29 +02:00
Marin Jankovski
976eb7a955 Revert "Delete mailer queue" 2014-09-10 15:28:58 +02:00
ling.su
9c2b046454 Delete mailer queue because we don't use sidekiq_mailer gem and now the mailer queue doesn't exist any more. 2014-07-04 10:51:44 +08:00
Dmitriy Zaporozhets
24934c9b13
Fix procfile for developers
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2014-04-08 14:38:57 +03:00
Cyril Rohr
459e629591 Fix Procfile to be usable in production. 2014-04-07 15:45:52 +01:00
Dmitriy Zaporozhets
41e981740f Use 2 workers in development
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2014-03-20 10:16:17 +02:00
Dmitriy Zaporozhets
63e532eff0 Cache MR diffs result. Improve diff output 2013-07-08 20:12:35 +03:00
Dmitriy Zaporozhets
1fe61284af Replace unicorn with Puma 2013-04-04 23:19:24 +03:00
Dmitriy Zaporozhets
dd8d0a659d Fix procfile and attachment in event nore 2013-02-11 19:25:06 +02:00
Dmitriy Zaporozhets
1c5876eb7b Do gitolite calls async. Remove satellite with project remove 2013-01-28 17:22:45 +02:00
Ryan LaNeve
8a65229b35 Updates project to process web hooks async via sidekiq.
A new queue of "project_web_hook" is used to process web hooks asynchronously, allowing each to succeed/fail (and be retried) independently.

(Basically, project web hooks now process the same as system hooks.)
2013-01-25 10:42:57 -05:00
Dmitriy Zaporozhets
e98d478085 remove thin from production env. Use unicorn for foreman 2013-01-14 20:21:04 +02:00
Dmitriy Zaporozhets
9773ccc451 sidekiq with green tests 2013-01-09 09:14:05 +03:00
Dmitriy Zaporozhets
71bd956866 email via sidekiq. start and stop rake tasks 2013-01-09 08:44:05 +03:00
Dmitriy Zaporozhets
c7bb3a1f72 sidekiq 2013-01-09 08:14:05 +03:00
Dmitriy Zaporozhets
3c9d7b7077 Procfile production, resque script 2012-01-09 13:30:19 +02:00
Dmitriy Zaporozhets
57ac5fe99f Procfile added. use foreman start to run gitlabhq 2012-01-08 12:20:24 +02:00