Skip to content

Commit

Permalink
Partial scrape test passing
Browse files Browse the repository at this point in the history
  • Loading branch information
naman47vyas committed Apr 4, 2024
1 parent 4d558ea commit bd50874
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions receiver/mysqlreceiver/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,7 @@ func (c *mySQLClient) getInnodbStatus() (int64, error) {
query := "SHOW ENGINE INNODB STATUS;"
row := c.client.QueryRow(query)
err := row.Scan(&typeVar, &name, &status)
// TODO: Suggest better value if there's an error for the metric.
if err != nil {
return -1, err
}
Expand Down
1 change: 1 addition & 0 deletions receiver/mysqlreceiver/scraper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ func TestScrape(t *testing.T) {

expectedFile := filepath.Join("testdata", "scraper", "expected_partial.yaml")
expectedMetrics, err := golden.ReadMetrics(expectedFile)

require.NoError(t, err)
assert.NoError(t, pmetrictest.CompareMetrics(actualMetrics, expectedMetrics,
pmetrictest.IgnoreMetricDataPointsOrder(), pmetrictest.IgnoreStartTimestamp(),
Expand Down
9 changes: 9 additions & 0 deletions receiver/mysqlreceiver/testdata/scraper/expected_partial.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,15 @@ resourceMetrics:
startTimeUnixNano: "1000000"
timeUnixNano: "2000000"
unit: "1"
- description: Total memory used by InnoDB, as shown in the BUFFER POOL AND MEMORY section of SHOW ENGINE INNODB STATUS.
name: mysql.innodb.mem_total
gauge:
dataPoints:
- asInt: "-1"
startTimeUnixNano: "1000000"
timeUnixNano: "2000000"
unit: By
scope:
name: otelcol/mysqlreceiver
version: latest

0 comments on commit bd50874

Please sign in to comment.