Module: Gitlab::Observability

Extended by:
Observability
Included in:
Observability
Defined in:
lib/gitlab/observability.rb

Instance Method Summary collapse

Instance Method Details

#alerts_urlObject



27
28
29
# File 'lib/gitlab/observability.rb', line 27

def alerts_url
  "#{Gitlab::Observability.observability_url}/observability/v1/alerts"
end

#observability_ingest_urlObject



18
19
20
21
22
23
24
25
# File 'lib/gitlab/observability.rb', line 18

def observability_ingest_url
  return ENV['OVERRIDE_OBSERVABILITY_INGEST_URL'] if ENV['OVERRIDE_OBSERVABILITY_INGEST_URL']
  # TODO Make observability URL configurable https://gitlab.com/gitlab-org/opstrace/opstrace-ui/-/issues/80
  # Dev, test and staging instances can all point to `observe.staging.gitlab.com` by default
  return 'https://observe.staging.gitlab.com' if Gitlab.staging? || Gitlab.dev_or_test_env?

  'https://observe.gitlab.com'
end

#observability_urlObject

Returns the GitLab Observability URL



9
10
11
12
13
14
15
16
# File 'lib/gitlab/observability.rb', line 9

def observability_url
  return ENV['OVERRIDE_OBSERVABILITY_QUERY_URL'] if ENV['OVERRIDE_OBSERVABILITY_QUERY_URL']
  # TODO Make observability URL configurable https://gitlab.com/gitlab-org/opstrace/opstrace-ui/-/issues/80
  # Dev, test and staging instances can all point to `observe.staging.gitlab.com` by default
  return 'https://observe.staging.gitlab.com' if Gitlab.staging? || Gitlab.dev_or_test_env?

  'https://observe.gitlab.com'
end

#should_enable_observability_auth_scopes?(resource) ⇒ Boolean

Returns:

  • (Boolean)


31
32
33
34
35
36
37
38
# File 'lib/gitlab/observability.rb', line 31

def should_enable_observability_auth_scopes?(resource)
  # Enable the needed oauth scopes if tracing is enabled.
  if resource.is_a?(Group) || resource.is_a?(Project)
    return Feature.enabled?(:observability_features, resource.root_ancestor)
  end

  false
end