Data purge functionality in pmm-admin. Replacement for pmm-admin purge command
General
Escalation
General
Escalation
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`
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 -..........
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")
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:
Add flag purge to pmm-admin remove mysql command.
Add command purge to pmm-admin to show help that "purge is flag, not command".
Extend PMM API remove call with purge attribute.
Extend method for remove in PMM-Managed to purge data.
If service is exists
Send PMM-agent SetStateRequest and wait for the response.
Otherwise if flag `purge` is provided
Don't return error
Request for VM API for purge data from history
Remove data by service_name and wait for the response.
Request for QAN API to purge data from PMM-Manged.
Remove data from clickhouse by service_name and wait for the response.
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.
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
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:
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
-..........
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")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:
Add flag purge to pmm-admin remove mysql command.
Add command purge to pmm-admin to show help that "purge is flag, not command".
Extend PMM API remove call with purge attribute.
Extend method for remove in PMM-Managed to purge data.
If service is exists
Send PMM-agent SetStateRequest and wait for the response.
Otherwise if flag `purge` is provided
Don't return error
Request for VM API for purge data from history
Remove data by service_name and wait for the response.
Request for QAN API to purge data from PMM-Manged.
Remove data from clickhouse by service_name and wait for the response.
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.