Skip to content

Commit

Permalink
Update opentelemetry lib version and use event.module identifier
Browse files Browse the repository at this point in the history
  • Loading branch information
lahsivjar committed Jun 4, 2024
1 parent c5bbbcb commit b40e2af
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/elastic/apm-data
go 1.21.1

require (
github.com/elastic/opentelemetry-lib v0.0.0-20240520143123-3234f90c8fca
github.com/elastic/opentelemetry-lib v0.0.0-20240604140721-08863a456d6c
github.com/google/go-cmp v0.6.0
github.com/jaegertracing/jaeger v1.56.0
github.com/json-iterator/go v1.1.12
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ github.com/elastic/go-windows v1.0.1 h1:AlYZOldA+UJ0/2nBuqWdo90GFCgG9xuyw9SYzGUt
github.com/elastic/go-windows v1.0.1/go.mod h1:FoVvqWSun28vaDQPbj2Elfc0JahhPB7WQEGa3c814Ss=
github.com/elastic/opentelemetry-lib v0.0.0-20240520143123-3234f90c8fca h1:LM2sFnvnkQP9txkkdMr7kVQiKGtWNJl+yZECsEGacCA=
github.com/elastic/opentelemetry-lib v0.0.0-20240520143123-3234f90c8fca/go.mod h1:/kKvHbJLVo/NcKMPHI8/RZKL64fushmnRUzn+arQpjg=
github.com/elastic/opentelemetry-lib v0.0.0-20240604140721-08863a456d6c h1:gRCjiqyIH1RxEYAJr1z9Y3KdJITip45iPprj7DbL9Mk=
github.com/elastic/opentelemetry-lib v0.0.0-20240604140721-08863a456d6c/go.mod h1:/kKvHbJLVo/NcKMPHI8/RZKL64fushmnRUzn+arQpjg=
github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
github.com/go-logr/logr v1.4.1 h1:pKouT5E8xu9zeFC39JXRDukb6JFQPXM5p5I91188VAQ=
github.com/go-logr/logr v1.4.1/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
Expand Down
3 changes: 2 additions & 1 deletion input/otlp/metrics_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ import (

"github.com/elastic/apm-data/input/otlp"
"github.com/elastic/apm-data/model/modelpb"
"github.com/elastic/opentelemetry-lib/remappers/common"
)

func TestConsumer_ConsumeMetrics_Interface(t *testing.T) {
Expand Down Expand Up @@ -919,7 +920,7 @@ func TestConsumeMetricsWithOTelRemapper(t *testing.T) {
},
},
Labels: map[string]*modelpb.LabelValue{
"event.provider": &modelpb.LabelValue{Value: "hostmetrics"},
"event.module": &modelpb.LabelValue{Value: common.RemapperEventModule},
},
},
}
Expand Down
5 changes: 3 additions & 2 deletions model/modelprocessor/datastream.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
"strings"

"github.com/elastic/apm-data/model/modelpb"
"github.com/elastic/opentelemetry-lib/remappers/common"
)

const (
Expand Down Expand Up @@ -143,8 +144,8 @@ func metricsetDataset(event *modelpb.APMEvent) string {
internal := true

// set internal to false for metrics translated using OTel remappers.
if label, ok := event.Labels["event.provider"]; ok && label != nil {
internal = !(label.Value == "hostmetrics")
if label, ok := event.Labels["event.module"]; ok && label != nil {
internal = !(label.Value == common.RemapperEventModule)
}

if internal {
Expand Down
3 changes: 2 additions & 1 deletion model/modelprocessor/datastream_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import (

"github.com/elastic/apm-data/model/modelpb"
"github.com/elastic/apm-data/model/modelprocessor"
"github.com/elastic/opentelemetry-lib/remappers/common"
)

func TestSetDataStream(t *testing.T) {
Expand Down Expand Up @@ -206,7 +207,7 @@ func TestSetDataStream(t *testing.T) {
},
},
Labels: map[string]*modelpb.LabelValue{
"event.provider": &modelpb.LabelValue{Value: "hostmetrics"}, // otel translated hostmetrics
"event.module": &modelpb.LabelValue{Value: common.RemapperEventModule}, // otel translated hostmetrics
},
},
output: &modelpb.DataStream{Type: "metrics", Dataset: "apm.app.service_name", Namespace: "custom"},
Expand Down

0 comments on commit b40e2af

Please sign in to comment.