Commit Graph

60 Commits

Author SHA1 Message Date
GitLab Bot bf53a3fd78 Add latest changes from gitlab-org/gitlab@master 2023-09-19 03:09:45 +00:00
GitLab Bot 27f5b61b11 Add latest changes from gitlab-org/gitlab@master 2021-10-18 21:12:56 +00:00
GitLab Bot a8476fe0cd Add latest changes from gitlab-org/gitlab@master 2021-06-15 18:09:57 +00:00
GitLab Bot 28f1931ae8 Add latest changes from gitlab-org/gitlab@master 2020-11-27 18:09:52 +00:00
GitLab Bot ea937d0916 Add latest changes from gitlab-org/gitlab@master 2020-07-31 15:10:14 +00:00
GitLab Bot ed00b1a6a3 Add latest changes from gitlab-org/gitlab@master 2020-07-28 12:09:49 +00:00
GitLab Bot c417764f00 Add latest changes from gitlab-org/gitlab@master 2020-07-07 09:08:57 +00:00
GitLab Bot ad7ce32986 Add latest changes from gitlab-org/gitlab@master 2020-06-25 18:08:50 +00:00
GitLab Bot 6ff3eb60e3 Add latest changes from gitlab-org/gitlab@master 2020-06-09 15:08:05 +00:00
GitLab Bot e2d4a6dedb Add latest changes from gitlab-org/gitlab@master 2020-05-14 00:07:47 +00:00
GitLab Bot 0e65189f85 Add latest changes from gitlab-org/gitlab@master 2020-05-13 09:08:37 +00:00
GitLab Bot c2b98d3dbd Add latest changes from gitlab-org/gitlab@master 2019-12-17 15:08:15 +00:00
GitLab Bot 3546e1bb09 Add latest changes from gitlab-org/gitlab@master 2019-10-16 06:07:06 +00:00
Jacopo f599862e6c
Remove feature flags starting with `prometheus_transaction_`
Those feature flags were always enabled so we can remove them safely.
2019-09-05 11:01:02 +02:00
dineshpanda e908e11776 Avoid calling freeze on already frozen strings in lib/gitlab 2019-09-04 09:52:02 +05:30
Ryan Cobb 5543d897d0 Filters branch and path labels for metrics 2019-04-04 10:56:12 +00:00
Sarah Yasonik e6fcdd7aca Update Metrics references to Object path
On reload, references to Metrics within classes in the Gitlab::Metrics
module fail. Update all references to ::Gitlab::Metrics so that
constant lookup finds the right module in development. This fix should
not impact production.
2019-02-14 18:05:35 +00:00
gfyoung 7ec8af5017 Enable even more frozen string for lib/gitlab
Enables frozen string for the following:

* lib/gitlab/hook_data/**/*.rb
* lib/gitlab/i18n/**/*.rb
* lib/gitlab/import/**/*.rb
* lib/gitlab/import_export/**/*.rb
* lib/gitlab/kubernetes/**/*.rb
* lib/gitlab/legacy_github_import/**/*.rb
* lib/gitlab/manifest_import/**/*.rb
* lib/gitlab/metrics/**/*.rb
* lib/gitlab/middleware/**/*.rb

Partially addresses gitlab-org/gitlab-ce#47424.
2018-11-16 17:41:14 -08:00
Yorick Peterse 61ae9c4c5b
Adjust SQL and transaction Prometheus buckets
This allows us to better calculate Apdex scores, instead of having to
use the 0.1 and 1.0 buckets.
2018-06-11 19:18:02 +02:00
Pawel Chojnacki 50c9ba43f8 Only use features for events 2018-02-20 14:06:12 +01:00
Pawel Chojnacki 93c0a168ab Put all event metrics exposed to prometheus behind a feature flag 2018-02-20 13:29:05 +01:00
Pawel Chojnacki d4c768ce09 Rename Concern -> Methods 2018-01-29 15:13:05 +01:00
Pawel Chojnacki a760445f9b fix typo in the buckets 2018-01-29 15:13:05 +01:00
Pawel Chojnacki 938d9ffe40 Refactor metrics to use metrics dsl notation 2018-01-29 15:13:04 +01:00
Pawel Chojnacki 087c9a5e8f Fix rubocop warnings 2018-01-29 15:13:03 +01:00
Pawel Chojnacki 62ef34cb40 Put View instrumentation and transaction memory use behind feature 2018-01-29 15:13:03 +01:00
Pawel Chojnacki 66c1acba0b Fix code after refactoring 2018-01-29 15:13:03 +01:00
Pawel Chojnacki e56b3d180d Refactor transaction metrics 2018-01-29 15:13:03 +01:00
Pawel Chojnacki ed715b7926 use in_milliseconds rails helper 2017-12-20 17:49:43 +01:00
Pawel Chojnacki a8ebed6016 Make `System.monotonic_time` retun seconds represented by float with microsecond precision 2017-12-12 18:12:49 +01:00
Pawel Chojnacki a300787fa9 Use Mutex to guard metrics creation in transaction. Switch action view to threadsafe instance variables 2017-11-02 18:18:16 +01:00
Pawel Chojnacki 30a4bb6628 Fix sidekiq middleware tests 2017-11-02 18:16:58 +01:00
Pawel Chojnacki 534f6b1125 Tests for Web transaction and remove simple transacton 2017-11-02 18:11:44 +01:00
Pawel Chojnacki f64085e693 Move labels tests from Metrics rack spec to Transaction spec 2017-11-02 18:11:44 +01:00
Pawel Chojnacki 39ac6acbcc Fix Active record and transaction specs 2017-11-02 18:11:43 +01:00
Pawel Chojnacki 815b8db1b9 Split call name to module and method name 2017-11-02 18:11:43 +01:00
Pawel Chojnacki cc7997d8d0 More parsable labels in method performance measurements 2017-11-02 18:11:43 +01:00
Pawel Chojnacki 43a9777e5e Make transaction labels more readable 2017-11-02 18:11:43 +01:00
Pawel Chojnacki a8a5c337c1 Transaction needs to be able to describe controller action by itself 2017-11-02 18:11:43 +01:00
Pawel Chojnacki 29a1ad1646 Tune bucket sizes an action labels 2017-11-02 18:11:43 +01:00
Pawel Chojnacki aa25586afe Add action tag to more metrics 2017-11-02 18:11:43 +01:00
Pawel Chojnacki 6db3151fa1 Introduce missing Action concept 2017-11-02 18:11:43 +01:00
Pawel Chojnacki c97dc61a9e Cleanup transaction metrics 2017-11-02 18:11:43 +01:00
Pawel Chojnacki 3cc28601f3 Cleanup sampling code and fix bug with samplers running without sleep 2017-11-02 18:10:57 +01:00
Pawel Chojnacki f464adaaf6 Remove transaction tags and map transaction metrics to prometheus
+ clean transaction metrics

+ Gemfile.lock file update
2017-11-02 18:10:57 +01:00
Pawel Chojnacki 3b1464803b Transaction and method instrumentation 2017-11-02 18:10:42 +01:00
Douwe Maan b7d8df503c Enable Style/MutableConstant 2017-02-23 09:31:56 -06:00
Yorick Peterse d345591fc8
Tracking of custom events
GitLab Performance Monitoring is now able to track custom events not
directly related to application performance. These events include the
number of tags pushed, repositories created, builds registered, etc.

The use of these events is to get a better overview of how a GitLab
instance is used and how that may affect performance. For example, a
large number of Git pushes may have a negative impact on the underlying
storage engine.

Events are stored in the "events" measurement and are not prefixed with
"rails_" or "sidekiq_", this makes it easier to query events with the
same name triggered from different parts of the application. All events
being stored in the same measurement also makes it easier to downsample
data.

Currently the following events are tracked:

* Creating repositories
* Removing repositories
* Changing the default branch of a repository
* Pushing a new tag
* Removing an existing tag
* Pushing a commit (along with the branch being pushed to)
* Pushing a new branch
* Removing an existing branch
* Importing a repository (along with the URL we're importing)
* Forking a repository (along with the source/target path)
* CI builds registered (and when no build could be found)
* CI builds being updated
* Rails and Sidekiq exceptions

Fixes gitlab-org/gitlab-ce#13720
2016-08-17 10:04:04 +02:00
Yorick Peterse 905f8d763a
Reduce instrumentation overhead
This reduces the overhead of the method instrumentation code primarily
by reducing the number of method calls. There are also some other small
optimisations such as not casting timing values to Floats (there's no
particular need for this), using Symbols for method call metric names,
and reducing the number of Hash lookups for instrumented methods.

The exact impact depends on the code being executed. For example, for a
method that's only called once the difference won't be very noticeable.
However, for methods that are called many times the difference can be
more significant.

For example, the loading time of a large commit
(nrclark/dummy_project@81ebdea5df)
was reduced from around 19 seconds to around 15 seconds using these
changes.
2016-07-28 16:56:17 +02:00
Yorick Peterse d7b4f36a3c
Use clock_gettime for all performance timestamps
Process.clock_gettime allows getting the real time in nanoseconds as
well as allowing one to get a monotonic timestamp. This offers greater
accuracy without the overhead of having to allocate a Time instance. In
general using Time.now/Time.new is about 2x slower than using
Process.clock_gettime(). For example:

    require 'benchmark/ips'

    Benchmark.ips do |bench|
      bench.report 'Time.now' do
        Time.now.to_f
      end

      bench.report 'clock_gettime' do
        Process.clock_gettime(Process::CLOCK_MONOTONIC, :millisecond)
      end

      bench.compare!
    end

Running this benchmark gives:

    Calculating -------------------------------------
                Time.now   108.052k i/100ms
           clock_gettime   125.984k i/100ms
    -------------------------------------------------
                Time.now      2.343M (± 7.1%) i/s -     11.670M
           clock_gettime      4.979M (± 0.8%) i/s -     24.945M

    Comparison:
           clock_gettime:  4979393.8 i/s
                Time.now:  2342986.8 i/s - 2.13x slower

Another benefit of using Process.clock_gettime() is that we can simplify
the code a bit since it can give timestamps in nanoseconds out of the
box.
2016-06-28 17:51:25 +02:00