Skip to content

Commit

Permalink
updated generate code
Browse files Browse the repository at this point in the history
  • Loading branch information
armstrmi committed Mar 28, 2022
1 parent d769b1c commit 82558e9
Show file tree
Hide file tree
Showing 4 changed files with 70 additions and 33 deletions.
9 changes: 7 additions & 2 deletions receiver/riakreceiver/documentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,15 @@ metrics:
enabled: <true|false>
```
## Attributes
## Resource attributes
| Name | Description | Type |
| ---- | ----------- | ---- |
| riak.node.name | The name this node uses to identify itself. | String |
## Metric attributes
| Name | Description |
| ---- | ----------- |
| operation | The operation type for index operations. |
| request | The request operation type. |
| riak.node.name | The name this node uses to identify itself. |
82 changes: 58 additions & 24 deletions receiver/riakreceiver/internal/metadata/generated_metrics_v2.go

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

5 changes: 4 additions & 1 deletion receiver/riakreceiver/metadata.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
name: riakreceiver

attributes:
resource_attributes:
riak.node.name:
description: The name this node uses to identify itself.
type: string

attributes:
request:
description: The request operation type.
enum:
Expand Down
7 changes: 1 addition & 6 deletions receiver/riakreceiver/scraper.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,6 @@ func (r *riakScraper) scrape(ctx context.Context) (pdata.Metrics, error) {
// collectStats collects metrics
func (r *riakScraper) collectStats(stat *model.Stats) (pdata.Metrics, error) {
now := pdata.NewTimestampFromTime(time.Now())
md := r.mb.NewMetricData()

md.ResourceMetrics().At(0).Resource().Attributes().UpsertString(metadata.A.RiakNodeName, stat.Node)

var errors scrapererror.ScrapeErrors
//scrape node.operation.count metric
r.mb.RecordRiakNodeOperationCountDataPoint(now, stat.NodeGets, metadata.AttributeRequest.Get)
Expand All @@ -102,6 +98,5 @@ func (r *riakScraper) collectStats(stat *model.Stats) (pdata.Metrics, error) {
r.mb.RecordRiakVnodeIndexOperationCountDataPoint(now, stat.VnodeIndexWrites, metadata.AttributeOperation.Write)
r.mb.RecordRiakVnodeIndexOperationCountDataPoint(now, stat.VnodeIndexDeletes, metadata.AttributeOperation.Delete)

r.mb.Emit(md.ResourceMetrics().At(0).InstrumentationLibraryMetrics().At(0).Metrics())
return md, errors.Combine()
return r.mb.Emit(metadata.WithRiakNodeName(stat.Node)), errors.Combine()
}

0 comments on commit 82558e9

Please sign in to comment.