[ 
https://issues.apache.org/jira/browse/CASSSIDECAR-329?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18014017#comment-18014017
 ] 

Sudipta Laha commented on CASSSIDECAR-329:
------------------------------------------

 
h2. API Specification

*Access method:* *{{GET}}*
*URI:* *{{/api/v1/cassandra/stats/compaction}}*
**
h3. Output fields
|No|Field|Type|Description|Source|
|1|concurrentCompactors|Long|Number of concurrent compaction 
threads|StorageServiceMBean ->
getConcurrentCompactors|
|2|pendingTasks|Object \{map of string(keyspace) -> string(table) → 
integer(count)}|Number of compaction tasks currently pending (queued but not 
started) grouped by table and keyspace.|
JmxGaugeMBean ->
PendingTasksByTableName metric|
|3|totalPendingTasks|Long|Total number of compaction tasks currently pending 
(queued but not started).|
JmxGaugeMBean ->
PendingTasksByTableName metric|
|4|completedCompactions|Long|Total number of completed compactions since server
[re]start.|JmxMeterMBean -> TotalCompactionsCompleted metric|
|5|dataCompacted|Long|Total number of bytes compacted since server
[re]start.|JmxCounterMBean -> BytesCompacted metric|
|6|abortedCompactions|Long|Number of aborted compactions since server
[re]start.|JmxCounterMBean → CompactionsAborted metric|
|7|reducedCompactions|Long|Number of reduced compactions due to limited disk 
space.|JmxCounterMBean → CompactionsReduced metric|
|8|sstablesDroppedFromCompaction|Long|SSTable files dropped during compactio 
due to limited disk space.|JmxCounterMBean → SSTablesDroppedFromCompaction 
metric|
|9|completedCompactionsRate|Object| | |
|9.1|→ meanRate|Double|Compactions completed per hour|JmxMeterMBean -> 
TotalCompactionsCompleted metric|
|9.2|→ fifteenMinuteRate|Double|Compactions completed per minute for the last 
15 minutes|JmxMeterMBean -> TotalCompactionsCompleted metric|
|10|compactionThroughput|Object| | |
|10.1|→ configured|String|Configured throughput limit in MiB/s.|
StorageServiceMBean → 
getCompactionThroughtputMibPerSecAsDouble|
|10.2|→ oneMinute|String|Compaction throughput for the last 1 minutes in MiB/s.|
StorageServiceMBean → getCurrentCompactionThroughputMebibytesPerSec|
|10.3|→ fiveMinute|String|Compaction throughput for the last 5 minutes in 
MiB/s.|
StorageServiceMBean → getCurrentCompactionThroughputMebibytesPerSec|
|10.4|→ fifteenMinute|String|Compaction throughput for the last 15 minutes in 
MiB/s.|
StorageServiceMBean → getCurrentCompactionThroughputMebibytesPerSec|
|11|activeCompactions|Array of Objects|Array of active compactions in progress.|
CompactionManagerMBean → 
getCompactions|
|11.1|→ id|String|Id of the compaction.|
COMPACTION_ID _in the compactions_|
|11.2|→ keyspace|String|Keyspace name|KEYSPACE __ _in the compactions_|
|11.3|→ columnFamily|String|Table name|COLUMNFAMILY _in the compactions_|
|11.4|→ taskType|String|Type of compaction task.|TASK_TYPE in the compactions|
|11.5|→ completedBytes|Long|Completed compactions in bytes.|
COMPLETED in the compactions|
|11.6|→ totalBytes|Long|Total compactions in bytes.|
TOTAL in the compactions|
|11.7|→ percentCompleted|Double|Percentage of completed compactions.|(COMPLETED 
/ TOTAL) X 100|
|11.8|→ ssTables|Array of String|A list of the SS tables being compacted.|
SSTABLES in the compactions|
|11.9|→ targetDirectory|String|Target directory of the 
compaction.|TARGET_DIRECTORY in the compactions|
|12|activeCompactionsCount|Long|Number of active compactions in 
progress|Count(activeCompactions)|
|13|activeCompactionsRemainingTime|String|Remaining bytes/ compaction 
throughput in 
seconds.| |
h3. Sample output

{
"concurrentCompactors": 4,
"pendingTasks": {
"keyspace1": {
"tableA": 3,
"tableB": 1
},
"keyspace2": {
"tableX": 2
}
},
"totalPendingTasks": 6,
"completedCompactions": 15234,
"dataCompacted": 987654321012,
"abortedCompactions": 12,
"reducedCompactions": 4,
"sstablesDroppedFromCompaction": 7,
"completedCompactionsRate": {
"meanRate": 24.7,
"fifteenMinuteRate": 0.42
},
"compactionThroughput": {
"configured": 64.0,
"oneMinute": 58.3,
"fiveMinute": 60.1,
"fifteenMinute": 59.7
},
"activeCompactions": [
{
"id": "b31f6a8a-12ab-4f11-9f3e-d30c2f59a6b9",
"keyspace": "keyspace1",
"columnFamily": "tableA",
"taskType": "Compaction",
"completedBytes": 157286400,
"totalBytes": 314572800,
"percentCompleted": 50.0,
"ssTables": [
"na-1-big-Data.db",
"na-2-big-Data.db"
],
"targetDirectory": "/var/lib/cassandra/data/keyspace1/tableA-123abc",
"remainingTimeSeconds": 42
},
{
"id": "8f5a04e5-89fb-4b1a-b3f0-3db21b912df1",
"keyspace": "keyspace2",
"columnFamily": "tableX",
"taskType": "Validation",
"completedBytes": 10485760,
"totalBytes": 20971520,
"percentCompleted": 50.0,
"ssTables": [
"na-3-big-Data.db"
],
"targetDirectory": "/var/lib/cassandra/data/keyspace2/tableX-456def",
"remainingTimeSeconds": 15
}
],
"activeCompactionsCount": 2,
"activeCompactionsRemainingTime": 57
}

 

> Sidecar endpoint for vending statistics related to compaction
> -------------------------------------------------------------
>
>                 Key: CASSSIDECAR-329
>                 URL: https://issues.apache.org/jira/browse/CASSSIDECAR-329
>             Project: Sidecar for Apache Cassandra
>          Issue Type: Improvement
>          Components: Rest API
>            Reporter: Sudipta Laha
>            Assignee: Sudipta Laha
>            Priority: Major
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> This proposal is part of an effort to introduce bespoke Sidecar APIs to 
> support key operational functionality currently managed through nodetool 
> commands. Introducing these APIs offers several benefits:
>  
>  * Strong Contract Definition: APIs provide a well-defined contract for both 
> request and response structures, reducing errors in operational tooling by 
> eliminating the need to parse command results.
>  * Error Handling: A clear response contract allows for meaningful error 
> messages to be communicated to clients, without exposing internal 
> implementation details.
>  * Input Validation: APIs can incorporate input validation to enhance 
> security by protecting against command injection attacks.
>  * Version Compatibility: By exposing a standardized interface, APIs ensure 
> compatibility across different Cassandra versions, through the sidecar’s 
> abstraction.
>  * Access Control: APIs enable fine-grained access control, leveraging 
> permissions and roles associated with client identities for precise 
> authorization.
> This specific task introduces an endpoint that vends statistics related to 
> compaction, equivalent to the "nodetool compactionstats" API functionality.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to