Skip to content

Commit 08863a4

Browse files
authored
Add event.module attribute to all remapped metrics (#18)
1 parent 2863c42 commit 08863a4

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

remappers/common/const.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,8 @@ package common
2020
const (
2121
// DatastreamDatasetLabel defines a dataset label for attributes.
2222
DatastreamDatasetLabel = "data_stream.dataset"
23+
24+
// RemapperEventModule defines the value of the ECS attribute
25+
// `event.module` that will be added to all the remapped metrics.
26+
RemapperEventModule = "elastic/opentelemetry-lib"
2327
)

remappers/hostmetrics/hostmetrics_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ func doTestRemap(t *testing.T, id string, remapOpts ...Option) {
5353

5454
systemIntegration := newConfig(remapOpts...).SystemIntegrationDataset
5555
outAttr := func(scraper string) map[string]any {
56-
m := map[string]any{"event.provider": "hostmetrics"}
56+
m := map[string]any{"event.module": "elastic/opentelemetry-lib"}
5757
if systemIntegration {
5858
m[common.DatastreamDatasetLabel] = scraperToElasticDataset[scraper]
5959
}

remappers/internal/metric.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ func AddMetrics(
6868
dp.SetStartTimestamp(metric.StartTimestamp)
6969
}
7070

71-
dp.Attributes().PutStr("event.provider", "hostmetrics")
71+
dp.Attributes().PutStr("event.module", common.RemapperEventModule)
7272
if dataset != "" {
7373
dp.Attributes().PutStr(common.DatastreamDatasetLabel, dataset)
7474
}

0 commit comments

Comments
 (0)