Data purge functionality in pmm-admin. Replacement for pmm-admin purge command

Description

An equivalent of PMM 1.x [pmm-admin purge|https://www.percona.com/doc/percona-monitoring-and-management/pmm-admin.html#pmm-admin-purge] command does not exist in 2.x yet.

Instead,of doing additional command we can modify existed one

pmm-admin remove -mysql- MyMysql --purge.

  • Must remove Service from Inventory

  • Delete all historical data from data storage related to this Service Name . Service might not be currently in the system, but we still need to try to delete data by it's name  (old orphaned data will be deleted anyway)

 Acceptance criteria:

  • Remove service and the data related to the service in the same time.

  • After removing service with --purge flag all QAN data and Victoria metrics data related to [service-name] should be removed.

  • If user already removed the service and then ran `pmm-admin remove ... --purge` command it should remove all QAN data and Victoria metrics data related to [service-name] and don't return an error

  • While calling `pmm-admin purge` command show a message that user should use `pmm-admin remove [service-type] [service-name] --purge`

  • Update documentation.

User interaction:

  1. pmm-admin remove mysql --help 

usage: pmm-admin remove [<flags>] <service-type> [<service-name>]

Remove Service from monitoring

Flags:
*-- purge  All data for service X will completely removed. You can't undo this action.*
 -h, --help Show context-sensitive help (also try --help-long and --help-man)
 --version Show application version
 --server-url=SERVER-URL PMM Server URL in `[https://username:password@pmm-server-host/]` format
 --server-insecure-tls Skip PMM Server TLS certificate validation
 -..........

  1. pmm-admin remove mysql m2 --purge

Service removed.
Historical data associated with service m2 removed  ("Some explain that some date maybe still visible for  some time")
 

  1.  pmm-admin purge
    Invalid option. Did you mean 'pmm-admin remove mysql  --purge'?

Out of scope:

  • remove and --purge  works with Service and all related agents, no need to do separate purge/remove for  different  agents

  • make all data to be deleted async 

 

ASYNC: Can cause problem, when you trying add service with same name as deleting one.

SYNC: Can cause timeout, takes very long time in some cases.

 We still need make decision if it is better do that in async/sync.

Proposed solution: 

  1. Add flag purge to pmm-admin remove mysql command.

  2. Add command purge to pmm-admin to show help that "purge is flag, not command".

  3. Extend PMM API remove call with purge attribute.

  4. Extend method for remove in PMM-Managed to purge data.

  5. If service is exists

    1. Send PMM-agent SetStateRequest and wait for the response.

  6. Otherwise if flag `purge` is provided

    1. Don't return error

  7. Request for VM API for purge data from history

    1. Remove data by service_name and wait for the response. 

  8. Request for QAN API to purge data from PMM-Manged.

    1. Remove data from clickhouse by service_name and wait for the response.

  9. Dont let user add service with same name until it will be completly deleted.

With sync solution we should be aware of timeouts. 

Notes:

  • Do not add new metrics for current service while removing data.

  • Should we wait until clickhouse mutation finished?

  • TODO --purge flag should also be added to commands (and APIs) that remove Agents and Nodes. It should be possible to remove a single Agent with all data, and a whole Node with all data.

How to test

None

How to document

None

AFFECTED CS IDs

275343, CS0051296

Activity

Show:

C W 
January 11, 2021 at 2:28 PM

As we are touching on purging data, including I presume any query examples from QAN, how does PMM plan to support PII removal?

Could there be a partial purge instead of a full one? It shouldn't be necessary to remove the service to do that, but it could be something that needs to be done server-side vs via the client.

Alexey Palazhchenko 
September 1, 2020 at 10:40 AM

--purge flag should also be added to commands (and APIs) that remove Agents and Nodes. It should be possible to remove a single Agent with all data, and a whole Node with all data.

Alexander Blinkov 
August 3, 2020 at 2:21 PM

Pausing work on this ticket until VM integration end

Details

Assignee

Reporter

Priority

Components

Needs QA

Needs Doc

Created July 9, 2019 at 10:29 PM
Updated December 4, 2024 at 12:59 PM