summaryrefslogtreecommitdiff
path: root/lib
Commit message (Collapse)AuthorAgeFilesLines
* Added host option for InfluxDBinfluxdbYorick Peterse2015-12-281-1/+2
|
* Use String#delete for removing double quotesYorick Peterse2015-12-281-1/+1
|
* Track object counts using the "allocations" GemYorick Peterse2015-12-172-3/+26
| | | | | This allows us to track the counts of actual classes instead of "T_XXX" nodes. This is only enabled on CRuby as it uses CRuby specific APIs.
* Support for instrumenting class hierarchiesYorick Peterse2015-12-171-0/+23
| | | | This will be used to (for example) instrument all ActiveRecord models.
* Only track method calls above a certain thresholdYorick Peterse2015-12-172-3/+9
| | | | | | | This ensures we don't end up wasting resources by tracking method calls that only take a few microseconds. By default the threshold is 10 milliseconds but this can be changed using the gitlab.yml configuration file.
* Allow filtering of what methods to instrumentYorick Peterse2015-12-171-2/+17
| | | | | This makes it possible to determine if a method should be instrumented or not using a block.
* Track location information as tagsYorick Peterse2015-12-172-12/+22
| | | | | | This allows the information to be displayed when using certain functions (e.g. top()) as well as making it easier to aggregate on a per file basis.
* Replace double quotes when obfuscating SQLYorick Peterse2015-12-171-1/+9
| | | | | | | InfluxDB escapes double quotes upon output which makes it a pain to deal with. This ensures that if we're using PostgreSQL we don't store any queries containing double quotes in InfluxDB, solving the escaping problem.
* Track object count types as tagsYorick Peterse2015-12-171-1/+3
|
* Only instrument methods defined directlyYorick Peterse2015-12-171-3/+7
| | | | | | | | | | When using instrument_methods/instrument_instance_methods we only want to instrument methods defined directly in a class, not those included via mixins (e.g. whatever RSpec throws in during development). In case an externally included method _has_ to be instrumented we can still use the regular instrument_method/instrument_instance_method methods.
* Added Instrumentation.configureYorick Peterse2015-12-171-0/+4
| | | | | This makes it easier to instrument multiple modules without having to type the full namespace over and over again.
* Methods for instrumenting multiple methodsYorick Peterse2015-12-171-0/+23
| | | | | | The methods Instrumentation.instrument_methods and Instrumentation.instrument_instance_methods can be used to instrument all methods of a module at once.
* Proper method instrumentation for special symbolsYorick Peterse2015-12-171-4/+5
| | | | | This ensures that methods such as "==" can be instrumented without producing syntax errors.
* Use custom code for instrumenting method callsYorick Peterse2015-12-172-48/+31
| | | | | | | | | | | | | | | | | | | The use of ActiveSupport would slow down instrumented method calls by about 180x due to: 1. ActiveSupport itself not being the fastest thing on the planet 2. caller_locations() having quite some overhead The use of caller_locations() has been removed because it's not _that_ useful since we already know the full namespace of receivers and the names of the called methods. The use of ActiveSupport has been replaced with some custom code that's generated using eval() (which can be quite a bit faster than using define_method). This new setup results in instrumented methods only being about 35-40x slower (compared to non instrumented methods).
* Use string evaluation for method instrumentationYorick Peterse2015-12-172-9/+11
| | | | | This is faster than using define_method since we don't have to keep block bindings around.
* Improved last_relative_application_frame timingsYorick Peterse2015-12-171-5/+8
| | | | | | | The previous setup wasn't exactly fast, resulting in instrumented method calls taking about 600 times longer than non instrumented calls (including any ActiveSupport code involved). With this commit this slowdown has been reduced to around 185 times.
* Storing of application metrics in InfluxDBYorick Peterse2015-12-1713-0/+594
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Merge branch 'api-support-starred-projects' into 'master' Dmitriy Zaporozhets2015-12-161-0/+11
|\ | | | | | | | | | | | | | | | | Api support for requesting starred projects for user Closes #4112 Note: probably targets the wrong release in the `CHANGELOG`, though 8.4 was not there yet See merge request !2127
| * Api support for requesting starred projects for userZeger-Jan van de Weg2015-12-161-0/+11
| | | | | | | | Fixes #4112
* | Merge branch 'fix_rubocop' into 'master' Robert Speicher2015-12-161-1/+1
|\ \ | |/ |/| | | | | Fix Rubocop complain. See merge request !2125
| * Fix Rubocop complain.fix_rubocopRubén Dávila2015-12-161-1/+1
| |
* | Merge branch 'disable-markdown-cache' into 'master' Douwe Maan2015-12-161-1/+3
|\ \ | |/ |/| | | | | | | | | Temporarily disable Markdown caching See merge request !2120
| * Temporarily disable Markdown cachingDouwe Maan2015-12-161-1/+3
| |
* | Merge branch 'master' of gitlab.com:gitlab-org/gitlab-ceDmitriy Zaporozhets2015-12-164-292/+6
|\ \ | |/
| * Merge branch 'workhorse-passthrough' into 'master' Kamil Trzciński2015-12-164-292/+6
| |\ | | | | | | | | | | | | | | | | | | Pass all requests from NGINX to gitlab-workhorse See merge request !2073
| | * Merge branch 'master' of gitlab.com:gitlab-org/gitlab-ce into ↵Jacob Vosmaer2015-12-1523-352/+162
| | |\ | | | | | | | | | | | | workhorse-passthrough
| | * | Update init script options for gitlab-workhorseJacob Vosmaer2015-12-152-2/+3
| | | |
| | * | Pass all requests from NGINX to gitlab-workhorseJacob Vosmaer2015-12-112-290/+3
| | | |
* | | | Merge branch 'add-open-issues-count-to-api' of ↵Dmitriy Zaporozhets2015-12-161-0/+1
|\ \ \ \ | |/ / / |/| | | | | | | | | | | | | | | https://gitlab.com/stanhu/gitlab-ce Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
| * | | Add open_issues_count to project APIStan Hu2015-12-111-0/+1
| | | | | | | | | | | | | | | | This is needed to support Huboard and a generally useful value.
* | | | Merge remote-tracking branch 'origin/feature/update-rubocop'Dmitriy Zaporozhets2015-12-1613-16/+21
|\ \ \ \
| * | | | Fixed Rubocop offensesGabriel Mazetto2015-12-1513-16/+21
| | |_|/ | |/| |
* | | | Merge branch 'lazy-reference-extractor' into 'master' Robert Speicher2015-12-1554-421/+471
|\ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Move Markdown/reference logic from `Gitlab::Markdown` to `Banzai` - Moves from `Gitlab::Markdown` to `Banzai` - Moves filters and pipelines into their own namespace: `Banzai::Filter` and `Banzai::Pipeline` - No more `autoload`! - Split up `Gitlab::ReferenceExtractor` into `Banzai::ReferenceExtractor` and `Gitlab::ReferenceExtractor` - Replace `something(load_lazy_references: true)` by `Gitlab::ReferenceExtractor.lazily { something }` Goes from: ```ruby def referenced_merge_requests references = [self, *notes].flat_map do |note| note.all_references(load_lazy_references: false).merge_requests end.uniq! Gitlab::Markdown::ReferenceFilter::LazyReference.load(references).uniq.sort_by(&:iid) end ``` to ```ruby def referenced_merge_requests Gitlab::ReferenceExtractor.lazily do [self, *notes].flat_map do |note| note.all_references.merge_requests end end.sort_by(&:iid) end ``` See merge request !2027
| * | | | Use lazy reference extractor to get issue's MRslazy-reference-extractorDouwe Maan2015-12-151-1/+1
| | | | |
| * | | | Move Markdown/reference logic from Gitlab::Markdown to BanzaiDouwe Maan2015-12-1554-421/+471
| |/ / /
* | | | Merge branch 'add_user_repo_integrity_rake_task' into 'master' Robert Speicher2015-12-151-4/+52
|\ \ \ \ | |/ / / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add user repository integrity check rake task Corrupt repositories and stuck lock files can cause weird issues in GitLab. Often we know which user is having these problems and then we have to go hunt down which repository is causing it. Several times recently that involved me running queries in the rails console to get an array of projects and then writing a quick Ruby script to loop through and run `git fsck`. This last time I also had to check for the existence of `config.lock` and ref lock files. This rake task will eliminate all of those steps and allow an admin to simply specify a username. I also added the lock file checks to the existing `gitlab:repo:check` task which goes through all projects. See merge request !2080
| * | | [ci skip] Add user repository integrity check rake taskDrew Blessing2015-12-141-4/+52
| | |/ | |/|
* | | Merge branch 'master' into ci/persist-registration-tokenGrzegorz Bizon2015-12-1426-376/+368
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * master: (66 commits) Fix runners admin view Fix migrations Rename mention of gitlab-git-http-server to gitlab-workhorse Bump Redis requirement to 2.8 for Sidekiq 4 requirements Fix wording on runner setup page add details on how to change saml button label Fix tests Move awards back to gray panel and few improvements to sidebar Few UI improvements to new sidebar implementation Fix tests for new issuable sidebar Update changelog Implement new sidebar for merge request page Make edit link on issuable sidebar works Redesign issue page for new sidebar Move awards css to separate file Implement issuable sidebar partial Update CHANGELOG Clarify cache behavior Run builds from projects with enabled CI Use Gitlab::Git instead of Ci::Git ... Conflicts: db/schema.rb
| * \ \ Merge branch 'ci-project-migrate' into 'master' Kamil Trzciński2015-12-1420-310/+69
| |\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Ci Project migrate - This doesn't migrate: allow_git_fetch, coverage_regex, timeout. Since this are project configuration settings I would propose to migrate them to `.gitlab-ci.yml`. - This requires offline migrations. - It simplifies database models making all CI objects to be attached to: Project. - It removes Ci::Project, but makes /ci/projects working by adding method: Project.find_by_ci_id for backward compatibility (badges, triggers). - We should add default `timeout` to Application Settings. - It misses specs. - It is based on ci-services-migrate for now. - It removes CI events. - It removes administrator CI projects overview. - It removes CI application settings. In 8.4 or 8.5 we can remove redundant tables and columns. See merge request !1987
| | * | | Use Gitlab::Git instead of Ci::GitKamil Trzcinski2015-12-111-5/+0
| | | | |
| | * | | Fix specsKamil Trzcinski2015-12-111-1/+1
| | | | |
| | * | | Fix after column renameKamil Trzcinski2015-12-111-9/+0
| | | | |
| | * | | Fix triggers testsKamil Trzcinski2015-12-111-1/+1
| | | | |
| | * | | Reimplement Trigger APIKamil Trzcinski2015-12-113-0/+53
| | | | |
| | * | | Remove ci_ prefix from all ci related thingsKamil Trzcinski2015-12-112-3/+3
| | | | |
| | * | | Add runners tokenKamil Trzcinski2015-12-114-7/+3
| | | | |
| | * | | Migrate CI::Project to ProjectKamil Trzcinski2015-12-1115-295/+19
| | | | |
| * | | | Merge branch 'ci-services-migrate' into 'master' Kamil Trzciński2015-12-145-40/+87
| |\ \ \ \ | | |/ / / | | | | | | | | | | | | | | | | | | | | | | | | | Ci Services migrate See merge request !1985
| | * | | Migrate CI WebHooks and Emails to new tablesKamil Trzcinski2015-12-101-0/+18
| | | | |
| | * | | Migrate CI::Services and CI::WebHooks to Services and WebHooksKamil Trzcinski2015-12-104-40/+69
| | | | |