Commit Graph

244 Commits

Author SHA1 Message Date
syasonik ecdc50b198 Switch errors to inherit from a base class
Error classes associated with individual stages of
dashboard processing tend to have very long names.
As dashboard post-processing includes more steps,
we will likely need to handle more error cases.
Refactoring to have all errors inherit from a specific
base class will help accommodate this and keep the code
more readable.
2019-06-06 23:05:19 +01:00
syasonik cd94500a42 Address rubocop errors 2019-06-06 11:43:50 +01:00
syasonik 54dd44030b Expose prometheus endpoint per metric in dashboard
Adds a new stage to dashboard processesing step for the
EnvironmentsController::metrics_dashboard endpoint.

Allows the front end to avoid generating the endpoint
unitutive string mutations.
2019-06-06 11:43:50 +01:00
Bob Van Landuyt 327cae1da7 Merge branch '61964-unicorn-instrumentation' into 'master'
Adds ruby and unicorn instrumentation

Closes #61964

See merge request gitlab-org/gitlab-ce!28499
2019-06-04 17:59:04 +00:00
Ryan Cobb 4c6b1fc23c Add comment to clarify system proc stat field 2019-06-04 10:04:36 -06:00
Jan Provaznik d4a83ce5a3 Ignore Puma empty worker stats
In some cases (during worker start) it's possible that
Puma.stats returns an empty hash for worker's last status. In
that case we just skip sampling of the worker until these
stats are available.
2019-06-04 09:11:55 +00:00
Ryan Cobb e9ae881c9a Remove unnecessary super call in unicorn sampler 2019-06-03 11:18:54 -06:00
Ryan Cobb 0393c5059d Merge branch 'master' into 61964-unicorn-instrumentation 2019-05-29 10:56:38 -06:00
Jan Provaznik a5adc6a024 Add Puma sampler
This sampler gathers Puma-specific metrics which can be used by
Prometheus then.
2019-05-29 12:27:44 +00:00
Ryan Cobb 4fae62b9ef Fix typo in system.rb 2019-05-20 14:26:30 -06:00
Ryan Cobb 9eeedfccbc Adds ruby and unicorn instrumentation
This adds ruby and unicorn instrumentation. This was originally
intended in 11.11 but due to performance concerns it was reverted. This
new commit foregoes the sys-proctable gem was causing performance issues
previously.
2019-05-20 13:36:59 -06:00
Ryan Cobb 2334b07726 Revert "Merge branch '56850-add-new-unicorn-metrics' into 'master'"
This reverts merge request !27474
2019-05-20 14:34:00 +00:00
Ash McKenzie c5a9bc17a1 Merge branch '56850-add-new-unicorn-metrics' into 'master'
Resolve "Add new Unicorn metrics"

Closes #56850

See merge request gitlab-org/gitlab-ce!27474
2019-05-07 16:21:40 +00:00
Stan Hu f93b2e02a5 Run rubocop -a on CE files 2019-05-05 03:24:28 -07:00
Sarah Yasonik 552a3d2fd9 Update metrics dashboard API to load yml from repo
Updates the EnvironmentController#metrics_dashboard endpoint
to support a "dashboard" param, which can be used to specify
the filepath of a dashboard configuration from a project
repository. Dashboard configurations are expected to be
stored in .gitlab/dashboards/.

Updates dashboard post-processing steps to exclude custom
metrics, which should only display on the system dashboard.
2019-05-01 10:16:03 +00:00
Ryan Cobb 17986d91a5 Add back ruby_memory_bytes metric, limit duplication, clean up
This adds back ruby_memory_bytes for backwards compatibility, limits
code duplication, cleans up unused methods, and limits the unicorn
worker sampling scope.
2019-04-29 12:13:02 -06:00
Ryan Cobb 2f6a1e77bc Cleanup syntax in System max_open_file_descriptors 2019-04-26 10:16:53 -06:00
syasonik 0e093940e1 Move dashboard param to initialize method 2019-04-25 14:13:43 +08:00
syasonik 8926b37d5b Prefer safe_load and deep_symbolize_keys 2019-04-25 14:00:51 +08:00
syasonik 4a5c48c47c Move MetricsDashboard to Metrics::Dashboard 2019-04-25 13:35:05 +08:00
Ryan Cobb bb27bf4a1c Update docs and calculate process start time via proc table
This updates monitor docs to reflect the new ruby and unicorn metrics as
well as making it so we fetch process start time via the proc table
instead of via CLOCK_BOOTTIME
2019-04-24 17:05:09 -06:00
Ryan Cobb 174a03dfc2 Move process specific metrics to ruby sampler
These metrics are not unicorn specific and can be used across ruby
processes
2019-04-24 13:01:51 -06:00
Ryan Cobb 4c248c05cb Adds new metrics for unicorn monitoring
This adds new metrics for monitoring unicorn. These metrics include
process_cpu_seconds_total, process_start_time_seconds, process_max_fds,
and unicorn_workers.
2019-04-18 13:46:56 -06:00
Ryan Cobb 5543d897d0 Filters branch and path labels for metrics 2019-04-04 10:56:12 +00:00
Nick Thomas 9f05e97aad
Run rubocop -a 2019-03-13 13:42:43 +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
Ben Kochie 54438ad04b
Clean up unicorn sampler metric labels
Change `type` and `address` labels to be less generic to avoid conflicts
with other systems.
2019-02-06 14:19:51 +01:00
Lin Jen-Shin 965f40d9ac Port this style change from EE 2019-01-30 01:16:43 +08: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
William George 1b153d497b Make getting a user by the username case insensitive 2018-10-18 09:06:44 +00:00
Mark Chao bec7f06097 Ignore irrelevant sql commands in metrics
Fix #51005
2018-09-05 09:10:19 +08:00
Yorick Peterse 81d8ddf8ca
Add a 10 ms bucket for SQL timings
This allows us to calculate quantiles of SQL timings more accurately,
instead of a lot of timings being assigned to the 50 ms bucket.
2018-07-10 15:59:30 +02:00
Lin Jen-Shin 9286f5b934 Use stable gitlab-styles and eliminate offenses 2018-07-09 21:13:08 +08:00
Lin Jen-Shin 4ee08b77bc Updates from `rubocop -a` 2018-07-09 21:13:08 +08:00
Ben Kochie 78a9991543
Cleanup ruby sampler metrics
* Use a simple counter for sampler duration instead of a histogram.
* Use a counter to collect GC time.
* Remove unused objects metric.
* Cleanup metric names to match Prometheus conventions.
* Prefix generic GC stats with `gc_stat`.
* Include worker label on memory and file descriptor metrics.
2018-06-22 14:12:22 +02:00
Stan Hu 88ceef87e3 Merge branch 'limit-metrics-content-type' into 'master'
Limit the action suffixes in transaction metrics

See merge request gitlab-org/gitlab-ce!20032
2018-06-20 16:34:42 +00:00
Yorick Peterse d527b46802
Remove remaining traces of the Allocations Gem
In MR https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/15834 we
removed use of the data produced by the Allocations Gem. However, we
never removed the code that just enables tracking of allocations. In
this commit we remove all remaining traces of this Gem.
2018-06-20 15:11:10 +02:00
Yorick Peterse d73e68deb5
Limit the action suffixes in transaction metrics
There seem to be a lot of cases where the suffix of an action (e.g.
".html") is set to bogus data, such as "*/*" or entire URLs. This can
increase cardinality of our metrics, and isn't very useful for
monitoring and filtering. To work around this, we enforce a whitelist
containing a few suffixes we actually care about. Suffixes not supported
will be grouped under the action without a suffix. This means that a
request to "FooController#bar.jpeg" will be assigned to
"FooController#bar".
2018-06-20 14:35:04 +02: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
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