Commit Graph
149 Commits
Author SHA1 Message Date
Zeger-Jan van de Weg 1e7116b34d Exclude projects pending deletion from all results 2016-03-31 20:20:18 +02:00
Stan Hu 720ef51bd9 Check if repo exists before attempting to update cache info
Closes #14361
2016-03-27 06:17:49 -07:00
Yorick Peterse 68a4c98f50 Cache output of Repository#exists?
This caches the output of Repository#exists? in Redis while making sure
it's flushed properly when creating new repositories, deleting them,
etc.

For the ProjectWiki tests to work I had to make ProjectWiki#create_repo!
public as testing private methods in RSpec is a bit of a pain.
2016-03-19 21:54:08 +01:00
Robert Speicher c790107854 Merge branch 'no-gc-retry' into 'master'
Do not retry "git gc"

To prevent 'git gc' timing out on a large repo and then bouncing
around in the retry queue.

See merge request !3266
2016-03-18 20:26:40 +00:00
Jacob Vosmaer 2057bc02a3 Do not retry "git gc" 2016-03-17 11:02:11 +01:00
Gabriel Mazetto f54bf00309 Back-porting PostReceive refactor made for EE 🍺 2016-03-17 00:24:12 -03:00
Zeger-Jan van de Weg b221d11a25 Add ability to delete a user with force 2016-03-15 21:09:25 +01:00
Zeger-Jan van de Weg 4bcc097750 A worker deletes a user, so the request doesn't time out
Fixes #13261
2016-03-15 21:09:25 +01:00
Jacob Vosmaer 1764e1b7cb Use Gitlab::Git::DiffCollections 2016-03-03 18:38:44 +01:00
Yorick Peterse ff28a7cc36 Moved cache expiration code to Repository hooks
This keeps all the cache expiration code in a single file/class instead
of spreading it all across the codebase.
2016-02-23 12:02:59 +01:00
Douwe Maan 52a8d1f3c6 Merge branch 'fix/gitpushservice-complexity-issue' into 'master'
Reduce code complexity on GitPushService#execute

Code complexity for gitlab-ce after this has been refactored:
```
  27.3: GitPushService#execute
```
This still needs to be merged into `gitlab-ee` presumably with conflicts... Perhaps we should create another issue for doing that?

I left the code sort of similar to what it was... If I could, I would have refactored most of the code into separate classes, etc. as it breaks probably all SOLID principles.

Fixes https://gitlab.com/gitlab-org/gitlab-ce/issues/13327


See merge request !2784
2016-02-18 09:33:21 +00:00
Yorick Peterse a9e0301c23 Expire caches after forking/importing a repository
This ensures the caches for Repository#empty? and
Repository#has_visible_content? are flushed after a repository has been
imported or forked.

Fixes gitlab-org/gitlab-ce#13505
2016-02-17 11:38:18 +01:00
James Lopez 5255a54df9 refactored some stuff based on MR feedback 2016-02-17 10:42:59 +01:00
James Lopez 20e79f714a refactored GitPushService and updated spec 2016-02-15 15:51:00 +01:00
James Lopez 77d2aeabec attempt to reduce code complexity on GitPushService#execute 2016-02-11 12:50:27 +01:00
Josh Frye 91b9cbff8d First pass at deleting projects in the background. 2016-01-29 09:14:16 -05:00
Josh Frye f9218898ec [WIP] Background process note logic for #3948 2016-01-28 13:04:42 -05:00
Douglas Barbosa Alexandre 6dd88e090e Extract Projects::ImportService service from RepositoryImportWorker 2016-01-25 22:58:30 -02: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 d67e2045a0 Drop empty tag values from metrics
InfluxDB throws an error when trying to store a list of tags where one
or more have an empty value.
2015-12-17 17:25:48 +01:00
Yorick Peterse 5142c61707 Cast values to strings before escaping them
This ensures that e.g. line numbers used in tags are first casted to
strings.
2015-12-17 17:25:48 +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
Kamil Trzcinski d5c91bb9a6 Migrate CI WebHooks and Emails to new tables 2015-12-10 16:04:08 +01:00
Kamil Trzcinski 2988e1fbf5 Migrate CI::Services and CI::WebHooks to Services and WebHooks 2015-12-10 16:04:08 +01:00
Douwe Maan 75486f09c4 Merge branch 'master' into zj/gitlab-ce-merge-if-green 2015-12-08 13:43:45 +01:00
Zeger-Jan van de Weg 0e96d6eb10 Merge branch 'master' into merge-if-green 2015-12-07 10:06:07 +01:00
Gabriel Mazetto 496870ddec Migrate from Sidetiq to Sidekiq-cron
Updated Sidekiq to 3.5.x
2015-12-04 11:29:45 -02:00
Valery Sizov e92ceb7b57 fix specs 2015-11-30 16:12:31 +02:00
Valery SizovandValery Sizov 7f214cee74 Migrate mailers to ActiveJob 2015-11-26 17:03:43 +02:00
Valery Sizov 40ff1318d2 Rails update to 4.2.4 2015-11-25 18:18:44 +02:00
Kamil Trzcinski 57e974c03b Fix 500 when using CI
- Fix for Ci::Build state machine, allowing to process builds without the project
- Forcefully update builds that didn't want to update with state machine
- Fix saving GitLabCiService as Admin Template
2015-11-23 13:51:41 +01:00
Rubén Dávila 2ed48df79a Remove accidentally added line. #3598
It should exist in EE only.
2015-11-20 16:50:48 -05:00
Douwe Maan 5e8ddd3c2d Remove unused variable in repository import 2015-11-18 12:02:09 +01:00
Douwe Maan 841a7c6897 Store and show reason why import failed. 2015-11-18 12:00:56 +01:00
Zeger-Jan van de Weg 53b285c9a8 Merge branch 'master' into merge-if-green 2015-11-18 11:58:01 +01:00
Zeger-Jan van de Weg 2f048df4a4 API support, incorporated feedback 2015-11-18 11:17:41 +01:00
Kamil Trzcinski 8d2758e02d Cleanup stuck CI builds daily 2015-11-03 13:12:16 +01:00
Jacob Vosmaer a321404fde Remove unused sidekiq worker 2015-10-20 17:11:31 +02:00
Jacob Vosmaer e1fff018d7 Clear archive cache asynchronously 2015-10-20 16:53:37 +02:00
Douwe Maan ee028d9d60 Rename reply_by_email to incoming_email to prepare for the future. 2015-09-21 10:35:37 +02:00
Valery SizovandKamil Trzcinski a0c1a12dee remove API calls from CE to CI 2015-09-18 18:02:11 +02:00
Kamil Trzcinski e21deaee8e Merge remote-tracking branch 'origin/master' into ci-and-ce-sitting-in-a-tree-k-i-s-s-i-n-g
# Conflicts:
#	Gemfile.lock
2015-09-15 22:40:35 +02:00
Stan Hu 9995f0806b Import forked repositories asynchronously to prevent large repositories from timing out
Use import_status to track async import status and give feedback to the user

Closes #2388
Closes #2400
2015-09-11 00:34:04 -07:00
Dmitriy Zaporozhets 0b5d627cd4 Merge branch 'master' into ci-and-ce-sitting-in-a-tree-k-i-s-s-i-n-g 2015-09-09 14:56:02 +02:00
Jared Szechy e156f42079 FogBugz project import 2015-09-08 20:23:01 -04:00
Dmitriy Zaporozhets 39ee52f1b1 Expire cache when merge request source branch was removed
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2015-08-28 10:23:56 +02:00
Douwe Maan 843694f902 Merge branch 'master' into ci-and-ce-sitting-in-a-tree-k-i-s-s-i-n-g 2015-08-26 17:53:31 -07:00
Douwe Maan 046b283127 Groundwork for merging CI into CE 2015-08-25 18:42:46 -07:00
Dmitriy Zaporozhets c1b490d6ef Merge branch 'handle-smtp-input-errors' into 'master'
Gracefully handle SMTP user input errors (e.g. incorrect email addresses) to prevent Sidekiq retries

### What does this MR do?

This MR gracefully handles SMTP input errors (e.g. incorrect or invalid e-mail addresses) to prevent these types of exceptions from causing Sidekiq to retry the task. If these specific exceptions occur, they will be logged, and the e-mail will be dropped from the queue.

### Why was this MR needed?

If you include an author that has a misspelled e-mail address, Sidekiq will keep sending e-mail to all the recipients even if they have already received the e-mail. The only way to recover is to clear the Sidekiq queue.

Note that other exceptions can still be thrown (e.g. `IOError`, `Net::SMTPAuthenticationError`, `Net::SMTPServerBusy`, `Net::SMTPUnknownError`, and `TimeoutError`). If the worker encounters these, Sidekiq should retry the task.

### What are the relevant issue numbers?

Closes https://github.com/gitlabhq/gitlabhq/issues/9560

See merge request !1163
2015-08-25 09:23:43 +00:00
Douwe Maan 2088880383 Ignore empty incoming messages. 2015-08-24 10:57:35 -07:00