Commit Graph

205 Commits

Author SHA1 Message Date
Yorick Peterse 33af33d7cb
Fix GPM content types for Doorkeeper
Certain controllers (e.g. Doorkeeper::TokensController) don't expose the
method "request_format". This commit changes
Gitlab::Metrics::WebTransaction so we don't rely on this method, instead
using the underlying code this method uses.

Fixes https://gitlab.com/gitlab-org/gitlab-ce/issues/46412
2018-05-16 12:53:54 +02:00
Yorick Peterse c003337729
Fix setting Gitlab metrics content types
The method "content_type" on a controller does not always return the
correct content type. On the other hand, the method "request_format"
does _and_ immediately returns a Symbol (e.g. :json) instead of a
mime-type name (e.g. application/json). With these changes metrics
should again report their action names correctly.

Fixes https://gitlab.com/gitlab-com/infrastructure/issues/3499
2018-05-15 17:38:39 +02:00
Stan Hu 204af2e101 Support resetting of Prometheus metrics between test runs
Adding the :prometheus tag to an rspec test will clear out
memory-mapped files and reset the registry.

Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/39968
2018-05-09 14:33:42 -07:00
Stan Hu 05e1cbc4ca Move Sidekiq exporter logs to log/sidekiq_exporter.log
The Sidekiq exporter logs were mixing with the normal Sidekiq logs. In order
to support structured logging in Sidekiq, we either need to split this data
out or convert the exporter to produce structured logs. Since Sidekiq job
processing is fundamentally different information from Web server traffic,
it seems cleaner to move the metrics traffic into a separate file, where they
can be parsed by a different filter if needed.

Relates to #20060
2018-04-02 08:58:17 -07:00
Stan Hu 02d2a789d2 Fix "A copy of Gitlab::Metrics::Methods" have been removed error
Closes #44365
2018-03-16 12:05:39 -07:00
Stan Hu 3b3615f0b7 Guard against nil Sidekiq metrics server
Closes #41351
2018-02-20 21:47:55 -08: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
Mario de la Ossa eaada9d706 use Gitlab::UserSettings directly as a singleton instead of including/extending it 2018-02-02 18:39:55 +00:00
Takuya Noguchi 2b6307f6ad Enable RuboCop Style/RegexpLiteral 2018-02-01 02:06:07 +09:00
Pawel Chojnacki d4c768ce09 Rename Concern -> Methods 2018-01-29 15:13:05 +01:00
Pawel Chojnacki 098cf7d257 add comment aabout hotspots 2018-01-29 15:13:05 +01:00
Pawel Chojnacki 75b49298f7 remove unused (?) variables 2018-01-29 15:13:05 +01:00
Pawel Chojnacki ffac08d290 Use class variables for metrics provider cache 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 b1ba8eb9a2 Do not use include Gitlab::CurrentSettings unnecessarily 2018-01-29 15:13:05 +01:00
Pawel Chojnacki 1ac96603e1 Let mutex be initialized only once 2018-01-29 15:13:05 +01:00
Pawel Chojnacki 05373c2490 Fix wrong histograam buckets 2018-01-29 15:13:05 +01:00
Pawel Chojnacki 1c403459ca Add missing feature gate for cpu metrics 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 7d716cc849 Convert InfluxDB to concern. Fix uninitialized metrics when metrics code is inherited. 2018-01-29 15:13:04 +01:00
Pawel Chojnacki ea6196d490 Move prometheus metrics to module. Use class instance variables for metrics and metrics cache in metrics concern 2018-01-29 15:13:04 +01:00
Pawel Chojnacki 27359dbf22 use class variable for Mutex instead of Const 2018-01-29 15:13:04 +01:00
Pawel Chojnacki 83ae172145 Cleanup rspec 2018-01-29 15:13:04 +01:00
Pawel Chojnacki f5383578d9 NullMetric as a singleton 2018-01-29 15:13:04 +01:00
Pawel Chojnacki 3e898be8aa Avoid cascading locking 2018-01-29 15:13:04 +01:00
Pawel Chojnacki 6ff9f028fd Migrate and reduce the buckets of Gitaly metrics
/cc @bjk-gitlab
/cc @zj
2018-01-29 15:13:04 +01:00
Pawel Chojnacki 67fcd0610c Test if feature is respected 2018-01-29 15:13:04 +01:00
Pawel Chojnacki e3fe65543b Add Tests for Metrics::Concern 2018-01-29 15:13:04 +01:00
Pawel Chojnacki d7edc4b46b Use Global Mutex, and class instance variables using
```
          metric = @_metrics_provider_cache&.[](name)
          return metric if metric
``
acccessor that only slightly slower (<20ns) than direct class variable access
2018-01-29 15:13:03 +01:00
Pawel Chojnacki 087c9a5e8f Fix rubocop warnings 2018-01-29 15:13:03 +01:00
Pawel Chojnacki 0325c23732 Fix tests 2018-01-29 15:13:03 +01:00
Pawel Chojnacki 91a991367e Convert active record 2018-01-29 15:13:03 +01:00
Pawel Chojnacki 66c2a3a83e Fix helper methods and document metric builder options 2018-01-29 15:13:03 +01:00
Pawel Chojnacki 5328584b1e Reduce cardinality and convert some metrics to new scheme 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 53f818fdac Refactor method concern to use hashes 2018-01-29 15:13:03 +01:00
Pawel Chojnacki e56b3d180d Refactor transaction metrics 2018-01-29 15:13:03 +01:00
Pawel Chojnacki d97548daa8 cleanup method call 2018-01-29 15:13:03 +01:00
Pawel Chojnacki e5d6141541 Actually make the new methods work 2018-01-29 15:13:03 +01:00
Pawel Chojnacki ef44fef15f Initiaal implementation of metrics concern 2018-01-29 15:13:03 +01:00
🙈 jacopo beschi 🙉 729f05f0e3 Adds Rubocop rule for line break around conditionals 2018-01-11 16:34:01 +00:00
Oswaldo Ferreira 64c6a8ae6e Use Concurrent::AtomicReference instead AtomicFixnum 2017-12-26 17:23:12 -02:00
Douwe Maan 92e15071c1 Merge branch 'pawel/reduce_cardinality_of_prometheus_metrics' into 'master'
Reduce cardinality of some of GitLab's Prometheus metrics and fix observed duration reporting.

Closes #41045

See merge request gitlab-org/gitlab-ce!15881
2017-12-21 15:56:45 +00:00
Pawel Chojnacki 040167f072 Use seconds where possible, and convert to milliseconds for Influxdb consumption 2017-12-21 00:39:52 +01:00
Pawel Chojnacki ed715b7926 use in_milliseconds rails helper 2017-12-20 17:49:43 +01:00
Pawel Chojnacki 3c545133e8 Fix tests and formatting 2017-12-19 17:45:25 +01:00
Lin Jen-Shin 59ac184fcf Merge remote-tracking branch 'upstream/master' into no-ivar-in-modules
* upstream/master: (671 commits)
  Make rubocop happy
  Use guard clause
  Improve language
  Prettify
  Use temp branch
  Pass info about who started the job and which job triggered it
  Docs: add indexes for monitoring and performance monitoring
  clearer-documentation-on-inline-diffs
  Add docs for commit diff discussion in merge requests
  sorting for tags api
  Clear BatchLoader after each spec to prevent holding onto records longer than necessary
  Include project in BatchLoader key to prevent returning blobs for the wrong project
  moved lfs_blob_ids method into ExtractsPath module
  Converted JS modules into exported modules
  spec fixes
  Bump gitlab-shell version to 5.10.3
  Clear caches before updating MR diffs
  Use new Ruby version 2.4 in GitLab QA images
  moved lfs blob fetch from extractspath file
  Update GitLab QA dependencies
  ...
2017-12-15 17:14:26 +08:00
Pawel Chojnacki 51668d3e1f Use class variable and add rubocop exception 2017-12-12 23:45:32 +01:00