Commit Graph

129 Commits

Author SHA1 Message Date
GitLab Bot 3795b229ab Add latest changes from gitlab-org/gitlab@master 2020-05-01 00:09:59 +00:00
GitLab Bot 2e4d8b3449 Add latest changes from gitlab-org/gitlab@master 2020-04-28 03:09:53 +00:00
GitLab Bot e33f87ac0f Add latest changes from gitlab-org/gitlab@master 2020-04-21 15:21:10 +00:00
GitLab Bot 82fa8a3d1e Add latest changes from gitlab-org/gitlab@master 2020-03-10 09:08:10 +00:00
GitLab Bot d3c29eae5c Add latest changes from gitlab-org/gitlab@master 2020-03-05 21:08:13 +00:00
GitLab Bot 411cc77938 Add latest changes from gitlab-org/gitlab@master 2020-01-24 18:09:00 +00:00
GitLab Bot a5ab3467a7 Add latest changes from gitlab-org/gitlab@master 2020-01-13 15:07:53 +00:00
GitLab Bot fb73ca3398 Add latest changes from gitlab-org/gitlab@master 2019-12-27 15:08:16 +00:00
GitLab Bot 3ad11f24ca Add latest changes from gitlab-org/gitlab@master 2019-12-22 09:07:51 +00:00
GitLab Bot 9763c08170 Add latest changes from gitlab-org/gitlab@master 2019-12-17 03:07:45 +00:00
GitLab Bot d10a462fed Add latest changes from gitlab-org/gitlab@master 2019-12-16 12:07:43 +00:00
GitLab Bot 8cc5f27909 Add latest changes from gitlab-org/gitlab@master 2019-12-13 12:07:41 +00:00
GitLab Bot 175b4fa261 Add latest changes from gitlab-org/gitlab@master 2019-12-11 18:08:10 +00:00
GitLab Bot f7a13c56bf Add latest changes from gitlab-org/gitlab@master 2019-11-01 09:06:47 +00:00
GitLab Bot e95a97594a Add latest changes from gitlab-org/gitlab@master 2019-10-25 21:06:20 +00:00
GitLab Bot f155cc9034 Add latest changes from gitlab-org/gitlab@master 2019-10-16 03:06:12 +00:00
GitLab Bot 4f4dcd3c5d Add latest changes from gitlab-org/gitlab@master 2019-10-02 15:06:12 +00:00
GitLab Bot 81f7adf08b Add latest changes from gitlab-org/gitlab@master 2019-09-19 18:06:18 +00:00
Rémy Coutable b7398bc1fd Merge branch 'fix-peek-on-puma' into 'master'
Fix Peek on Puma

Closes #66528

See merge request gitlab-org/gitlab-ce!32213
2019-09-02 08:43:21 +00:00
Andrew Newdigate e369dee8a5 Rename Labkit::Tracing::GRPCInterceptor to GRPC::ClientInterceptor
The original name has been deprecated
2019-08-28 16:29:17 +00:00
Sean McGivern f9c456bd0c Make performance bar enabled checks consistent
Previously, we called the `peek_enabled?` method like so:

    prepend_before_action :set_peek_request_id, if: :peek_enabled?

Now we don't have a `set_peek_request_id` method, so we don't need that
line. However, the `peek_enabled?` part had a side-effect: it would also
populate the request store cache for whether the performance bar was
enabled for the current request or not.

This commit makes that side-effect explicit, and replaces all uses of
`peek_enabled?` with the more explicit
`Gitlab::PerformanceBar.enabled_for_request?`. There is one spec that
still sets `SafeRequestStore[:peek_enabled]` directly, because it is
contrasting behaviour with and without a request store enabled.

The upshot is:

1. We still set the value in one place. We make it more explicit that
   that's what we're doing.
2. Reading that value uses a consistent method so it's easier to find in
   future.
2019-08-28 17:25:02 +01:00
John Cai ebbd2aeb5f Handle when server info doesn't have the storage in question 2019-08-23 08:42:00 -07:00
Stan Hu a74396dcc5 Add Gitaly and Rugged call timing in Sidekiq logs
This will help identify Sidekiq jobs that invoke excessive number of
filesystem access.

The timing data is stored in `RequestStore`, but this is only active
within the middleware and is not directly accessible to the Sidekiq
logger. However, it is possible for the middleware to modify the job
hash to pass this data along to the logger.
2019-08-09 01:08:32 -07:00
Stan Hu 3b76d2982f Fix exception handling in Gitaly autodetection
In SELinux, the file cannot be written, and `Errno::EACCES`, not
`Errno::ACCESS` is thrown.

Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/65328
2019-07-30 07:03:45 -07:00
Stan Hu ec5ceae623 Fix Gitaly auto-detection caching
If `GitalyClient#can_use_disk?` returned `false`, it was never cached
properly and led to excessive number of Gitaly calls. Instead of using
`cached_value.present?`, we need to check `cached_value.nil?`.

Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/64802
2019-07-19 10:03:41 -07:00
Stan Hu ddf2dcf7fd Merge branch 'jc-wrap-rugged-calls-with-disk-access' into 'master'
Wrap rugged calls with access disk block

See merge request gitlab-org/gitlab-ce!30592
2019-07-17 22:23:20 +00:00
John Cai 8765d53737 Wrap rugged calls with access disk block
Whenever we use the rugged implementation, we are going straight to disk
so we want to bypass the disk access check.
2019-07-16 13:54:01 -07:00
John Cai c77d7837bb Remove catfile cache feature flag 2019-07-15 11:32:56 -07:00
Mayra Cabrera 0ab89d8e36 Add a rubocop for Rails.logger
Suggests to use a JSON structured log instead

Related to https://gitlab.com/gitlab-org/gitlab-ce/issues/54102
2019-07-10 19:26:47 +00:00
John Cai 5305d5267d Disabling can_use_disk? temporarily 2019-07-09 11:14:57 -07:00
Dmitriy Zaporozhets 7c7b8f32a7 Merge branch 'jc-detect-nfs-for-rugged' into 'master'
Use Rugged if we detect storage is NFS and we can access the disk

See merge request gitlab-org/gitlab-ce!29725
2019-07-08 13:35:43 +00:00
John Cai 8152e1aa4a Use Rugged if we detect storage is NFS and we can access the disk
Add a module we use as a singleton to determine whether or not rails is
able to access the disk
2019-07-05 10:31:47 -07:00
Zeger-Jan van de Weg 031e91beeb
Remove high cardinality Prometheus metric
The metric was used to correlate Gitaly requests to the Rails controller
and action combination. However, Kibana provides better observability in
this specific metric, and can handle hig cardinality much better.

There's no dashboard in Grafana that currently depends on this metric
being exposed.
2019-07-05 14:40:13 +02:00
Zeger-Jan van de Weg 4dfaaf40b9
Turn on Cat-File cache by default
The feature flag has been introduced an was turned off by default,
now the it will default to be turned on. That change would still allow
users to turn this feature off by leveraging the Rails console by
running:

`Feature.disable("gitaly_catfile-cache")`

Another option is to manage the number of items the LRU cache will
contain, by updating the `config.toml` for Gitaly. This would be the
`catfile_cache_size`:
0dcb5c579e/config.toml.example (L27)

Closes: https://gitlab.com/gitlab-org/gitaly/issues/1712
2019-06-18 13:33:43 +02:00
Zeger-Jan van de Weg 968674e417
Move Gitaly feature flag logic to Feature::Gitaly
The GitalyClient held a lot of logic which was all very tightly coupled.
In this instance the feature logic was extracted to make it do just a
little less and create a bit more focus in the GitalyClient's
responsibilies.
2019-06-18 13:18:18 +02:00
Zeger-Jan van de Weg b8372598e9 Remove delta island feature flag
Delta islands were implemented last released in:
https://gitlab.com/gitlab-org/gitaly/merge_requests/1110. It's been
enabled on production and works as expected.
2019-06-03 08:12:13 +00:00
Jacob Vosmaer 5dc68854f8 Register "gitaly_delta_islands" feature flag 2019-05-07 15:18:08 +00:00
Stan Hu f93b2e02a5 Run rubocop -a on CE files 2019-05-05 03:24:28 -07:00
John Cai fe31f63ce8 Add gitaly session id & catfile-cache feature flag 2019-04-29 07:21:36 +00:00
Andrew Newdigate 4f4de36cac Migrate correlation and tracing code to LabKit
This change is a fairly straightforward refactor to extract the tracing
and correlation-id code from the gitlab rails codebase into the new
LabKit-Ruby project.

The corresponding import into LabKit-Ruby was in
https://gitlab.com/gitlab-org/labkit-ruby/merge_requests/1

The code itself remains very similar for now.

Extracting it allows us to reuse it in other projects, such as
Gitaly-Ruby. This will give us the advantages of correlation-ids and
distributed tracing in that project too.
2019-04-18 09:57:16 +02:00
Stan Hu fbb3fd1397 Add backtrace to Gitaly performance bar
This adds the backtrace to a table to show exactly where the Gitaly call
was made to make it easier to understand where the call originated.

This change also collapses the details in the same row to improve the
usability when there is a backtrace.
2019-04-17 04:45:24 -07:00
Douglas Barbosa Alexandre 63cd518f66 Merge branch 'jc-remove-find-all-tags-ff' into 'master'
Remove find all tags feature flag

See merge request gitlab-org/gitlab-ce!26746
2019-04-01 18:00:23 +00:00
Kamil Trzciński a7cf61355a Merge branch 'sh-fix-gitaly-find-commit-caching' into 'master'
Allow ref name caching CommitService#find_commit

Closes #57083

See merge request gitlab-org/gitlab-ce!26248
2019-03-29 10:31:57 +00:00
John Cai daa807d5e2 Remove find all tags feature flag 2019-03-28 12:45:35 -07:00
Stan Hu 7a2325e43c Guard against nested allows with ref name caching
This avoids the case:

```
allow_ref_name_caching do
  allow_ref_name_caching do
    # using-feature
  end
end
```
2019-03-27 18:17:25 -05:00
Stan Hu db759c5d9c Allow ref name caching CommitService#find_commit
For a given merge request, it's quite common to see duplicate FindCommit
Gitaly requests because the Gitaly CommitService caches the request by
the commit SHA, not by the ref name. However, most of the duplicate
requests use the ref name, so the cache is never actually used in
practice. This leads to unnecessary requests that slow performance.

This commit allows certain callers to bypass the ref name to
OID conversion in the cache. We don't do this by default because it's
possible the tip of the branch changes during the commit, which
would cause the caller to get stale data.

This commit also forces the Ci::Pipeline to use the full ref name
so that caching can work for merge requests.

Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/57083
2019-03-27 14:46:39 -05:00
Stan Hu 74ff33a3fd Log Gitaly RPC duration to api_json.log and production_json.log
This makes it easier to debug Gitaly performance issues in the field.

This commit also makes the tracking of query time thread-safe via
RequestStore.
2019-03-27 06:01:21 -05:00
Nick Thomas 9f05e97aad
Run rubocop -a 2019-03-13 13:42:43 +00:00
Mark Lapierre b3f54b3d8e Add feature flag to enforce gitaly request limits
We typically don't want to enforce request limits in production
However, we have some production-like test environments, i.e., ones
where `Rails.env.production?` returns `true`. We do want to be able
to check if the limit is being exceeded while testing in those
environments.
2019-03-11 21:15:03 +00:00
Lin Jen-Shin 1557289ce3 Merge branch 'jc-feature-flag-find-all-tags' into 'master'
Add feature flag for FindAllTags

See merge request gitlab-org/gitlab-ce!25615
2019-03-07 07:39:34 +00:00