diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-01-18 19:00:14 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-01-18 19:00:14 +0000 |
commit | 05f0ebba3a2c8ddf39e436f412dc2ab5bf1353b2 (patch) | |
tree | 11d0f2a6ec31c7793c184106cedc2ded3d9a2cc5 /qa/qa/support/loglinking.rb | |
parent | ec73467c23693d0db63a797d10194da9e72a74af (diff) | |
download | gitlab-ce-05f0ebba3a2c8ddf39e436f412dc2ab5bf1353b2.tar.gz |
Add latest changes from gitlab-org/gitlab@15-8-stable-eev15.8.0-rc42
Diffstat (limited to 'qa/qa/support/loglinking.rb')
-rw-r--r-- | qa/qa/support/loglinking.rb | 68 |
1 files changed, 11 insertions, 57 deletions
diff --git a/qa/qa/support/loglinking.rb b/qa/qa/support/loglinking.rb index 5a1aad3c7eb..e9202af3965 100644 --- a/qa/qa/support/loglinking.rb +++ b/qa/qa/support/loglinking.rb @@ -1,7 +1,5 @@ # frozen_string_literal: true -require 'active_support/core_ext/integer/time' - module QA module Support module Loglinking @@ -10,22 +8,6 @@ module QA STAGING_REF_ADDRESS = 'https://staging-ref.gitlab.com' PRODUCTION_ADDRESS = 'https://gitlab.com' PRE_PROD_ADDRESS = 'https://pre.gitlab.com' - SENTRY_BASE_URLS = { - staging: 'https://sentry.gitlab.net/gitlab/staginggitlabcom/?environment=gstg', - staging_ref: 'https://sentry.gitlab.net/gitlab/staging-ref/?environment=all', - pre: 'https://sentry.gitlab.net/gitlab/pregitlabcom/?environment=all', - production: 'https://sentry.gitlab.net/gitlab/gitlabcom/?environment=gprd' - }.freeze - KIBANA_BASE_URLS = { - staging: 'https://nonprod-log.gitlab.net/', - production: 'https://log.gprd.gitlab.net/', - pre: 'https://nonprod-log.gitlab.net/' - }.freeze - KIBANA_INDICES = { - staging: 'ed942d00-5186-11ea-ad8a-f3610a492295', - production: '7092c4e2-4eb5-46f2-8305-a7da2edad090', - pre: 'pubsub-rails-inf-pre' - }.freeze class << self def failure_metadata(correlation_id) @@ -33,43 +15,23 @@ module QA errors = ["Correlation Id: #{correlation_id}"] - env = get_logging_environment + env = logging_environment - unless env.nil? - sentry_base_url = get_sentry_base_url(env) - kibana_base_url = get_kibana_base_url(env) - kibana_index = get_kibana_index(env) + sentry = QA::Support::SystemLogs::Sentry.new(env, correlation_id) + sentry_url = sentry.url - errors << "Sentry Url: #{get_sentry_url(sentry_base_url, correlation_id)}" if sentry_base_url - errors << "Kibana Url: #{get_kibana_url(kibana_base_url, kibana_index, correlation_id)}" if kibana_base_url - end + kibana = QA::Support::SystemLogs::Kibana.new(env, correlation_id) + kibana_discover_url = kibana.discover_url + kibana_dashboard_url = kibana.dashboard_url - errors.join("\n") - end + errors << "Sentry Url: #{sentry_url}" if sentry_url + errors << "Kibana - Discover Url: #{kibana_discover_url}" if kibana_discover_url + errors << "Kibana - Dashboard Url: #{kibana_dashboard_url}" if kibana_dashboard_url - def get_sentry_base_url(env) - SENTRY_BASE_URLS[env] - end - - def get_sentry_url(base_url, correlation_id) - "#{base_url}&query=correlation_id%3A%22#{correlation_id}%22" - end - - def get_kibana_base_url(env) - KIBANA_BASE_URLS[env] - end - - def get_kibana_index(env) - KIBANA_INDICES[env] - end - - def get_kibana_url(base_url, index, correlation_id) - "#{base_url}app/discover#/?_a=%28index:%27#{index}%27%2Cquery%3A%28language%3Akuery%2C" \ - "query%3A%27json.correlation_id%20%3A%20#{correlation_id}%27%29%29" \ - "&_g=%28time%3A%28from%3A%27#{start_time}%27%2Cto%3A%27#{end_time}%27%29%29" + errors.join("\n") end - def get_logging_environment + def logging_environment address = QA::Runtime::Scenario.attributes[:gitlab_address] return if address.nil? @@ -86,14 +48,6 @@ module QA nil end end - - def start_time - (Time.now.utc - 24.hours).iso8601(3) - end - - def end_time - Time.now.utc.iso8601(3) - end end end end |