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

Maxim Muzafarov commented on CASSANDRA-14572:
---------------------------------------------

I'd like to share some intermediate results, as I've been working on this issue 
for a while and have managed to implement a robust solution. All metrics are 
exported from MetricsRegistry by metric type and by metric group, the latter is 
set accordingly in all the classes in the `org.apache.cassandra.metrics` 
package. Need some time to write a good test coverage.

The outcome looks pretty nice, see the tables below.
{code:bash}
cqlsh> select * from system_views.metrics_all_group_names;

 group_name        | comment                                            | 
virtual_table
-------------------+----------------------------------------------------+-----------------------------
             Batch |               Metrics specific to batch statements |       
        metrics_batch
        BufferPool |              Metrics for buffer pool "chunk-cache" |       
  metrics_buffer_pool
    CIDRAuthorizer | CIDR authorizer metrics specific to CIDR filtering |     
metrics_cidr_authorizer
               CQL |                            Metrics for CQL queries |       
          metrics_cql
             Cache |                                      Cache metrics |       
        metrics_cache
            Client |                        Metrics for client requests |       
       metrics_client
 ClientMessageSize |              Metrics group for "ClientMessageSize" | 
metrics_client_message_size
     ClientRequest |                        Metrics for "ClientRequest" |      
metrics_client_request
 ClientRequestSize |              Metrics group for "ClientRequestSize" | 
metrics_client_request_size
      ColumnFamily |                               ColumnFamily metrics |       
metrics_column_family
         CommitLog |                                  CommitLog metrics |       
   metrics_commit_log
        Compaction |                                 Compaction metrics |       
   metrics_compaction
    DroppedMessage |                 Metrics group for "DroppedMessage" |     
metrics_dropped_message
      HintsService |                              Hints service metrics |       
metrics_hints_service
             Index |                              RowIndexEntry metrics |       
        metrics_index
          Keyspace |                               Metrics of keyspaces |       
     metrics_keyspace
      MemtablePool |                               MemtablePool metrics |       
metrics_memtable_pool
         Messaging |                               Messaging statistics |       
    metrics_messaging
             Paxos |                                      Paxos metrics |       
        metrics_paxos
        ReadRepair |                                Read repair metrics |       
  metrics_read_repair
            Repair |                         Metrics group for "Repair" |       
       metrics_repair
           Storage |             Metrics for Storage related statistics |       
      metrics_storage
      StorageProxy |                     Metrics for partition denylist |       
metrics_storage_proxy
               TCM |                                        TCM metrics |       
          metrics_tcm
             Table |                                      Table metrics |       
        metrics_table
       ThreadPools |                            Metrics of thread pools |       
 metrics_thread_pools
{code}

{code:bash}
cqlsh> select * from system_views.metrics_commit_log;

 name                                                              | scope     
| type  | value
-------------------------------------------------------------------+-----------+-------+----------
             org.apache.cassandra.metrics.CommitLog.CompletedTasks | Undefined 
| gauge |      129
         org.apache.cassandra.metrics.CommitLog.OverSizedMutations | Undefined 
| meter |        0
               org.apache.cassandra.metrics.CommitLog.PendingTasks | Undefined 
| gauge |        0
         org.apache.cassandra.metrics.CommitLog.TotalCommitLogSize | Undefined 
| gauge | 67108864
            org.apache.cassandra.metrics.CommitLog.WaitingOnCommit | Undefined 
| timer |        0
             org.apache.cassandra.metrics.CommitLog.WaitingOnFlush | Undefined 
| timer |        4
 org.apache.cassandra.metrics.CommitLog.WaitingOnSegmentAllocation | Undefined 
| timer |        1
{code}

Autocompletion for the metrics tables works as well:
{code:bash}
cqlsh> select * from system_views.metrics_
metrics_all_group_names      metrics_column_family        metrics_index         
       metrics_storage              metrics_type_gauge
metrics_batch                metrics_commit_log           metrics_keyspace      
       metrics_storage_proxy        metrics_type_histogram
metrics_buffer_pool          metrics_compaction           metrics_memtable_pool 
       metrics_table                metrics_type_meter
metrics_cache                metrics_cql                  metrics_messaging     
       metrics_tcm                  metrics_type_timer
metrics_client_request       metrics_dropped_message      metrics_read_repair   
       metrics_thread_pools         
metrics_client_request_size  metrics_hints_service        metrics_repair        
       metrics_type_counter         
{code}

> Expose all table metrics in virtual table
> -----------------------------------------
>
>                 Key: CASSANDRA-14572
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-14572
>             Project: Cassandra
>          Issue Type: New Feature
>          Components: Legacy/Observability, Observability/Metrics
>            Reporter: Chris Lohfink
>            Assignee: Maxim Muzafarov
>            Priority: Low
>              Labels: virtual-tables
>             Fix For: 5.x
>
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> While we want a number of virtual tables to display data in a way thats great 
> and intuitive like in nodetool. There is also much for being able to expose 
> the metrics we have for tooling via CQL instead of JMX. This is more for the 
> tooling and adhoc advanced users who know exactly what they are looking for.
> *Schema:*
> Initial idea is to expose data via {{((keyspace, table), metric)}} with a 
> column for each metric value. Could also use a Map or UDT instead of the 
> column based that can be a bit more specific to each metric type. To that end 
> there can be a {{metric_type}} column and then a UDT for each metric type 
> filled in, or a single value with more of a Map<Text, Text> style. I am 
> purposing the column type though as with {{ALLOW FILTERING}} it does allow 
> more extensive query capabilities.
> *Implementations:*
> * Use reflection to grab all the metrics from TableMetrics (see: 
> CASSANDRA-7622 impl). This is easiest and least abrasive towards new metric 
> implementors... but its reflection and a kinda a bad idea.
> * Add a hook in TableMetrics to register with this virtual table when 
> registering
> * Pull from the CassandraMetrics registery (either reporter or iterate 
> through metrics query on read of virtual table)



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

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org

Reply via email to