Skip to content

Commit

Permalink
added count-stars metric (#60)
Browse files Browse the repository at this point in the history
  • Loading branch information
naman47vyas authored and bhogayatakb committed Dec 4, 2024
1 parent 4352aa2 commit 74a7e23
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 0 deletions.
27 changes: 27 additions & 0 deletions receiver/mysqlreceiver/internal/metadata/generated_metrics_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions receiver/mysqlreceiver/internal/metadata/testdata/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ all_set:
enabled: true
mysql.statement_event.count:
enabled: true
mysql.statement_event.count_stars:
enabled: true
mysql.statement_event.wait.time:
enabled: true
mysql.table.average_row_length:
Expand Down Expand Up @@ -162,6 +164,8 @@ none_set:
enabled: false
mysql.statement_event.count:
enabled: false
mysql.statement_event.count_stars:
enabled: false
mysql.statement_event.wait.time:
enabled: false
mysql.table.average_row_length:
Expand Down
9 changes: 9 additions & 0 deletions receiver/mysqlreceiver/metadata.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -554,6 +554,15 @@ metrics:
monotonic: false
aggregation_temporality: cumulative
attributes: [schema, digest, digest_text, event_state]
mysql.statement_event.count_stars:
enabled: true
description: The total count of executed queries per normalized query and schema.
unit: 1
sum:
value_type: int
monotonic: false
aggregation_temporality: cumulative
attributes: [schema, digest, digest_text]
mysql.statement_event.wait.time:
enabled: true
description: The total wait time of the summarized timed events.
Expand Down
1 change: 1 addition & 0 deletions receiver/mysqlreceiver/scraper.go
Original file line number Diff line number Diff line change
Expand Up @@ -518,6 +518,7 @@ func (m *mySQLScraper) scrapeStatementEventsStats(now pcommon.Timestamp, errs *s
m.mb.RecordMysqlStatementEventCountDataPoint(now, s.countSortRows, s.schema, s.digest, s.digestText, metadata.AttributeEventStateSortRows)
m.mb.RecordMysqlStatementEventCountDataPoint(now, s.countWarnings, s.schema, s.digest, s.digestText, metadata.AttributeEventStateWarnings)

m.mb.RecordMysqlStatementEventCountStarsDataPoint(now, s.countStar, s.schema, s.digest, s.digestText)
m.mb.RecordMysqlStatementEventWaitTimeDataPoint(now, s.sumTimerWait/picosecondsInNanoseconds, s.schema, s.digest, s.digestText)
}
}
Expand Down

0 comments on commit 74a7e23

Please sign in to comment.