Skip to content
Snippets Groups Projects

Add Metrics Dashboard annnotations API to FF

Merged Sarah Yasonik requested to merge sy-flag-metrics-annotations into master

What does this MR do and why?

This MR gates the metrics dashboard annotations API behind the remove_monitor_metrics feature flag. Frontend is done, but we also want to deprecate/remove any API access.

Related issue: Metrics: Delete API entrypoints & helpers (#397138 - closed) (one of many MRs)

Context for removal:

All related backend MRs to flag all metrics dashboard endpoints

How to set up and validate locally

Pre-req: Project with environments

  1. Use graphiql to test the query -> http://gdk.test:3000/-/graphql-explorer
  2. We can verify the flag without annotations actually set up, because the response attribute will switch from [] to null or error
Query Response before Response after
query annotations {
  project(fullPath: "gitlab-org/monitor/monitor-sandbox") {
    environments {
      nodes {
        metricsDashboard(path: "config/prometheus/common_metrics.yml") {
          annotations(from: "2023-05-09 11:57:31 -0400", to: "2023-05-10 11:57:31 -0400") {
            nodes {
              id
              panelId
              description
            }
          }
        }
      }
    }
  }
}
{
  "data": {
    "project": {
      "environments": {
        "nodes": [
          {
            "metricsDashboard": {
              "annotations": {
                "nodes": []
              }
            }
          }
        ]
      }
    }
  }
}
{
  "data": {
    "project": {
      "environments": {
        "nodes": [
          {
            "metricsDashboard": {
              "annotations": null
            }
          }
        ]
      }
    }
  }
}
mutation otherannotations {
  createAnnotation(
    input: { 
      environmentId: "gid://gitlab/Environment/1",  
      dashboardPath: "config/prometheus/common_metrics.yml", 
      startingAt: "2023-05-09 11:57:31 -0400", 
      description: "Something happened!"
    }
  ) {
    annotation {
      id
      description
    }
  }
}
{
  "data": {
    "createAnnotation": {
      "annotation": {
        "id": "gid://gitlab/Metrics::Dashboard::Annotation/1",
        "description": "Something happened!"
      }
    }
  }
}
{
  "data": {
    "createAnnotation": null
  },
  "errors": [
    {
      "message": "The resource that you are attempting to access does not exist or you don't have permission to perform this action",
      "locations": [
        {
          "line": 21,
          "column": 3
        }
      ],
      "path": [
        "createAnnotation"
      ]
    }
  ]
}
mutation deleteannotations {
  deleteAnnotation(input: { id: "gid://gitlab/Metrics::Dashboard::Annotation/2" }) {
    errors
  }
}
{
  "data": {
    "deleteAnnotation": {
      "errors": []
    }
  }
}
{
  "data": {
    "deleteAnnotation": null
  },
  "errors": [
    {
      "message": "The resource that you are attempting to access does not exist or you don't have permission to perform this action",
      "locations": [
        {
          "line": 37,
          "column": 3
        }
      ],
      "path": [
        "deleteAnnotation"
      ]
    }
  ]
}

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Peter Leitzen

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • Sarah Yasonik added 1 commit

    added 1 commit

    • 8b70fefb - Add Metrics Dashboard annnotations API to FF

    Compare with previous version

  • Sarah Yasonik resolved all threads

    resolved all threads

  • A deleted user added documentation label

    added documentation label

  • Sarah Yasonik added 1 commit

    added 1 commit

    • 811bee98 - Add Metrics Dashboard annnotations API to FF

    Compare with previous version

  • Sarah Yasonik changed the description

    changed the description

  • Sarah Yasonik mentioned in merge request !120288 (merged)

    mentioned in merge request !120288 (merged)

  • Sarah Yasonik mentioned in merge request !120289 (merged)

    mentioned in merge request !120289 (merged)

  • Sarah Yasonik mentioned in merge request !120299 (merged)

    mentioned in merge request !120299 (merged)

  • Sarah Yasonik mentioned in merge request !120305 (merged)

    mentioned in merge request !120305 (merged)

  • Sarah Yasonik mentioned in merge request !120307 (merged)

    mentioned in merge request !120307 (merged)

  • Sarah Yasonik mentioned in merge request !120309 (closed)

    mentioned in merge request !120309 (closed)

  • Sarah Yasonik mentioned in merge request !120310 (merged)

    mentioned in merge request !120310 (merged)

  • Sarah Yasonik mentioned in merge request !120313 (merged)

    mentioned in merge request !120313 (merged)

  • Sarah Yasonik mentioned in merge request !120316 (merged)

    mentioned in merge request !120316 (merged)

  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Please register or sign in to reply
    Loading