Skip to content

Move monitoring integrations to `Integrations::` [RUN ALL RSPEC] [RUN AS-IF-FOSS]

What does this MR do?

This MR namespaces the "monitoring" integrations to the Integrations:: namespace as part of #201855 (closed).

It builds on the groundwork in !60968 (merged) to safely rename STI models.

As the old PrometheusService model was used as a GraphQL GlobalID argument, it adds a new deprecation to allow backwards-compatibility with clients who still use the old GlobalID string (gid://gitlab/PrometheusService/<id>), or name (PrometheusServiceID), in arguments supplied to the mutations. Support of deprecated GlobalIDs was added in !62870 (merged).

QA

To test that this branch supports the old GraphQL mutations:

1. Create a Prometheus integration

Open a Rails console (replace "myproject" with a project full path):

project = Project.find_by_full_path("myproject")
integration = Integrations::Prometheus.create(project: project)

Note down the integration.id.

2. Call mutations using GraphiQL

Visit http://127.0.0.1:3000/-/graphql-explorer.

At the bottom, in the QUERY VARIABLES panel, paste (replacing <id> with the id of the prometheus integration you created earlier):

{
  "id": "gid://gitlab/PrometheusService/<id>",
  "active": true
}

(Screenshot example)

image

In the main query pane, paste and then run these (click the play button to run):

A mutation query with the input.id argument named as ID!:

mutation updatePrometheusIntegration($id: ID!, $active: Boolean!) {
  prometheusIntegrationUpdate(input: { id: $id, active: $active }) {
    errors
    integration {
      id
      active
    }
  }
}

A mutation query with the input.id argument named as PrometheusServiceID!:

mutation updatePrometheusIntegration($id: PrometheusServiceID!, $active: Boolean!) {
  prometheusIntegrationUpdate(input: { id: $id, active: $active }) {
    errors
    integration {
      id
      active
    }
  }
}

The above will also work on master so this is backwards-compatible


Additionally, this branch also accepts the newer query format (this is the format that is now documented in the GraphQL docs):

input.id named as IntegrationsPrometheusID!

mutation updatePrometheusIntegration($id: IntegrationsPrometheusID!, $active: Boolean!) {
  prometheusIntegrationUpdate(input: { id: $id, active: $active }) {
    errors
    integration {
      id
      active
    }
  }
}

And variables using the new-format GlobalID (this is the format this is now documented in the GraphQL docs, and expressed by the PrometheusType#id field):

{
  "id": "gid://gitlab/Integrations::Prometheus/98",
  "active": false
}

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Related to #201855 (closed)

Edited by Luke Duncalfe

Merge request reports

Loading