Skip to content

Commit

Permalink
chore: updates per request
Browse files Browse the repository at this point in the history
  • Loading branch information
jcountsNR committed Sep 5, 2023
1 parent e137f3d commit 380b044
Show file tree
Hide file tree
Showing 5 changed files with 84 additions and 50 deletions.
36 changes: 32 additions & 4 deletions receiver/kafkametricsreceiver/broker_scraper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,38 @@ func TestBrokerScraper_scrape(t *testing.T) {
require.NoError(t, bs.start(context.Background(), componenttest.NewNopHost()))
md, err := bs.scrape(context.Background())
assert.NoError(t, err)
expectedDp := int64(len(testBrokers))
receivedMetrics := md.ResourceMetrics().At(0).ScopeMetrics().At(0).Metrics().At(0)
receivedDp := receivedMetrics.Gauge().DataPoints().At(0).IntValue()
assert.Equal(t, expectedDp, receivedDp)
require.Equal(t, 1, md.ResourceMetrics().Len())
require.Equal(t, 1, md.ResourceMetrics().At(0).ScopeMetrics().Len())
ms := md.ResourceMetrics().At(0).ScopeMetrics().At(0).Metrics()
for i := 0; i < ms.Len(); i++ {
m := ms.At(i)
switch m.Name() {
case "kafka.brokers":
assert.Equal(t, m.Sum().DataPoints().At(0).IntValue(), int64(len(testBrokers)))
case "kafka.broker.count":
assert.Equal(t, m.Sum().DataPoints().At(0).IntValue(), int64(len(testBrokers)))
case "kafka.broker.consumer_fetch_rate":
assert.Equal(t, m.Gauge().DataPoints().At(0).DoubleValue(), int64(len(testBrokers)))
case "kafka.broker.incoming_byte_rate":
assert.Equal(t, m.Gauge().DataPoints().At(0).DoubleValue(), int64(len(testBrokers)))
case "kafka.broker.outgoing_byte_rate":
assert.Equal(t, m.Gauge().DataPoints().At(0).DoubleValue(), int64(len(testBrokers)))
case "kafka.broker.request_latency":
assert.Equal(t, m.Gauge().DataPoints().At(0).DoubleValue(), int64(len(testBrokers)))
case "kafka.broker.response_rate":
assert.Equal(t, m.Gauge().DataPoints().At(0).DoubleValue(), int64(len(testBrokers)))
case "kafka.broker.response_size":
assert.Equal(t, m.Gauge().DataPoints().At(0).DoubleValue(), int64(len(testBrokers)))
case "kafka.broker.request_rate":
assert.Equal(t, m.Gauge().DataPoints().At(0).DoubleValue(), int64(len(testBrokers)))
case "kafka.broker.request_size":
assert.Equal(t, m.Gauge().DataPoints().At(0).DoubleValue(), int64(len(testBrokers)))
case "kafka.broker.requests_in_flight":
assert.Equal(t, m.Sum().DataPoints().At(0).IntValue(), int64(len(testBrokers)))
case "kafka.broker.consumer_fetch_count":
assert.Equal(t, m.Sum().DataPoints().At(0).IntValue(), int64(len(testBrokers)))
}
}
}

func TestBrokersScraper_createBrokerScraper(t *testing.T) {
Expand Down
20 changes: 10 additions & 10 deletions receiver/kafkametricsreceiver/documentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ metrics:
### kafka.brokers
[DEPRECATED] Number of brokers in the cluster.
[depracated] Number of brokers in the cluster.
| Unit | Metric Type | Value Type |
| ---- | ----------- | ---------- |
| {brokers} | Gauge | Int |
| Unit | Metric Type | Value Type | Aggregation Temporality | Monotonic |
| ---- | ----------- | ---------- | ----------------------- | --------- |
| {broker} | Sum | Int | Cumulative | false |
### kafka.consumer_group.lag
Expand Down Expand Up @@ -186,7 +186,7 @@ Count of consumer fetches
| Unit | Metric Type | Value Type | Aggregation Temporality | Monotonic |
| ---- | ----------- | ---------- | ----------------------- | --------- |
| {fetches} | Sum | Double | Cumulative | false |
| {fetches} | Sum | Int | Cumulative | false |
#### Attributes
Expand Down Expand Up @@ -214,15 +214,15 @@ Number of brokers in the cluster.
| Unit | Metric Type | Value Type | Aggregation Temporality | Monotonic |
| ---- | ----------- | ---------- | ----------------------- | --------- |
| {brokers} | Sum | Int | Cumulative | false |
| {broker} | Sum | Int | Cumulative | false |
### messaging.kafka.broker.incoming_byte_rate
Average tncoming Byte Rate in bytes/second
Average incoming Byte Rate in bytes/second
| Unit | Metric Type | Value Type |
| ---- | ----------- | ---------- |
| 1 | Gauge | Double |
| By/s | Gauge | Double |
#### Attributes
Expand All @@ -246,11 +246,11 @@ Average outgoing Byte Rate in bytes/second.
### messaging.kafka.broker.request_latency
Average request latency in ms
Average request latency in seconds
| Unit | Metric Type | Value Type |
| ---- | ----------- | ---------- |
| ms | Gauge | Double |
| s | Gauge | Double |
#### Attributes
Expand Down

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

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

20 changes: 11 additions & 9 deletions receiver/kafkametricsreceiver/metadata.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,19 @@ metrics:
# brokers scraper
kafka.brokers:
enabled: true
description: "[DEPRECATED] Number of brokers in the cluster."
unit: "{brokers}"
gauge:
description: '[depracated] Number of brokers in the cluster.'
unit: "{broker}"
sum:
monotonic: false
value_type: int
aggregation_temporality: cumulative
warnings:
if_enabled: The metric is deprecated and will be removed. Use `messaging.kafka.broker.count`

messaging.kafka.broker.count:
enabled: false
description: Number of brokers in the cluster.
unit: "{brokers}"
unit: "{broker}"
sum:
monotonic: false
value_type: int
Expand All @@ -55,8 +57,8 @@ metrics:
if_enabled_not_set: This metric will be enabled by default in the next versions.
messaging.kafka.broker.incoming_byte_rate:
enabled: false
description: Average tncoming Byte Rate in bytes/second
unit: 1
description: Average incoming Byte Rate in bytes/second
unit: By/s
gauge:
value_type: double
attributes: [broker]
Expand All @@ -73,8 +75,8 @@ metrics:
if_enabled_not_set: This metric will be enabled by default in the next versions.
messaging.kafka.broker.request_latency:
enabled: false
description: Average request latency in ms
unit: "ms"
description: Average request latency in seconds
unit: "s"
gauge:
value_type: double
attributes: [broker]
Expand Down Expand Up @@ -130,7 +132,7 @@ metrics:
description: Count of consumer fetches
unit: "{fetches}"
sum:
value_type: double
value_type: int
aggregation_temporality: cumulative
attributes: [broker]
warnings:
Expand Down

0 comments on commit 380b044

Please sign in to comment.