Skip to content

Conversation

@shishkovilja
Copy link
Contributor

@shishkovilja shishkovilja commented Dec 26, 2021

Thank you for submitting the pull request to the Apache Ignite.

In order to streamline the review of the contribution
we ask you to ensure the following steps have been taken:

The Contribution Checklist

  • There is a single JIRA ticket related to the pull request.
  • The web-link to the pull request is attached to the JIRA ticket.
  • The JIRA ticket has the Patch Available state.
  • The pull request body describes changes that have been made.
    The description explains WHAT and WHY was made instead of HOW.
  • The pull request title is treated as the final commit message.
    The following pattern must be used: IGNITE-XXXX Change summary where XXXX - number of JIRA issue.
  • A reviewer has been mentioned through the JIRA comments
    (see the Maintainers list)
  • The pull request has been checked by the Teamcity Bot and
    the green visa attached to the JIRA ticket (see TC.Bot: Check PR)

Notes

If you need any help, please email dev@ignite.apache.org or ask anу advice on http://asf.slack.com #ignite channel.

Implementation

Main classes

Internal task VisorCacheMetricsTask is implemented for enabling or disabling metrics collection.
Logic of Control Script is implemented in CacheMetrics class.

Command syntax

--cache metrics enable|disable|status --caches cache1[,...,cacheN]|--all-caches

Output format

Status

Command [CACHE] started
Arguments: --cache metrics status --all-caches 
--------------------------------------------------------------------------------
Cache Name    Metrics Status
cache-1       enabled              
cache-2       disabled             
cache-3       disabled             
Command [CACHE] finished with code: 0

Enable/disable

Command [CACHE] started
Arguments: --cache metrics enable --caches cache-2,cache-1,cache-3
--------------------------------------------------------------------------------
Cache Name    Metrics Status
cache-1       enabled              
cache-2       enabled             
cache-3       enabled    
Command [CACHE] finished with code: 0

Execution errors

If one of a specified caches was not found, then exception will be thrown:
For status operation:

Command [CACHE] started
Arguments: --cache metrics status --caches cache-1,cache-2,non-existent-cache 
--------------------------------------------------------------------------------
Cache does not exist: non-existent-cache
Command [CACHE] finished with code: 4
Error stack trace:
class org.apache.ignite.IgniteException: Cache does not exist: non-existent-cache
	at org.apache.ignite.internal.visor.cache.metrics.VisorCacheMetricsManageTask$VisorCacheMetricsManageJob.cacheMetricsStatus(VisorCacheMetricsManageTask.java:103)
	at org.apache.ignite.internal.visor.cache.metrics.VisorCacheMetricsManageTask$VisorCacheMetricsManageJob.run(VisorCacheMetricsManageTask.java:79)
	at org.apache.ignite.internal.visor.cache.metrics.VisorCacheMetricsManageTask$VisorCacheMetricsManageJob.run(VisorCacheMetricsManageTask.java:50)
	at org.apache.ignite.internal.visor.VisorJob.execute(VisorJob.java:69)
...

For enable/disable operations:

Command [CACHE] started
Arguments: --cache metrics disable --caches cache-1,cache-2,non-existent-cache 
--------------------------------------------------------------------------------
One or more cache descriptors not found [caches=[cache-1, cache-2, non-existent-cache]]
Command [CACHE] finished with code: 4
Error stack trace:
class org.apache.ignite.IgniteException: One or more cache descriptors not found [caches=[cache-1, cache-2, non-existent-cache]]
	at org.apache.ignite.internal.util.IgniteUtils.convertException(IgniteUtils.java:1110)
	at org.apache.ignite.internal.cluster.IgniteClusterImpl.enableStatistics(IgniteClusterImpl.java:599)
	at org.apache.ignite.internal.visor.cache.metrics.VisorCacheMetricsManageTask$VisorCacheMetricsManageJob.run(VisorCacheMetricsManageTask.java:75)
	at org.apache.ignite.internal.visor.cache.metrics.VisorCacheMetricsManageTask$VisorCacheMetricsManageJob.run(VisorCacheMetricsManageTask.java:50)
	at org.apache.ignite.internal.visor.VisorJob.execute(VisorJob.java:69)
...

@shishkovilja shishkovilja marked this pull request as draft March 8, 2022 19:56
@shishkovilja shishkovilja marked this pull request as ready for review April 5, 2022 07:07
@shishkovilja shishkovilja changed the title IGNITE-14913 Introduced CacheMetrics command for Control Script IGNITE-14913 Introduced CacheMetricsManage command for Control Script Apr 8, 2022
@shishkovilja shishkovilja changed the title IGNITE-14913 Introduced CacheMetricsManage command for Control Script IGNITE-14913 Introduced CacheMetric command for Control Script May 12, 2022
@shishkovilja shishkovilja changed the title IGNITE-14913 Introduced CacheMetric command for Control Script IGNITE-14913 CacheMetrics command for Control Script May 30, 2022
@NSAmelchev NSAmelchev merged commit 9003d09 into apache:master Jun 1, 2022
@shishkovilja shishkovilja deleted the ignite-14913 branch June 1, 2022 14:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants