Skip to content

Commit

Permalink
Fix sqs queue name (elastic#28512)
Browse files Browse the repository at this point in the history
  • Loading branch information
kaiyan-sheng authored and wiwen committed Nov 1, 2021
1 parent 6987cc8 commit 264a289
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 37 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func AddMetadata(endpoint string, regionName string, awsConfig awssdk.Config, ev
if _, ok := events[queueName]; !ok {
continue
}
events[queueName].RootFields.Put(metadataPrefix+"name", queueName)
events[queueName].RootFields.Put(metadataPrefix+".name", queueName)
}
return events
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,26 +10,11 @@ package s3_daily_storage
import (
"testing"

"github.com/stretchr/testify/assert"

_ "github.com/elastic/beats/v7/libbeat/processors/actions"
mbtest "github.com/elastic/beats/v7/metricbeat/mb/testing"
"github.com/elastic/beats/v7/x-pack/metricbeat/module/aws/mtest"
)

func TestFetch(t *testing.T) {
config := mtest.GetConfigForTest(t, "s3_daily_storage", "86400s")

metricSet := mbtest.NewReportingMetricSetV2Error(t, config)
events, errs := mbtest.ReportingFetchV2Error(metricSet)
if len(errs) > 0 {
t.Fatalf("Expected 0 error, had %d. %v\n", len(errs), errs)
}

assert.NotEmpty(t, events)
mbtest.TestMetricsetFieldsDocumented(t, metricSet, events)
}

func TestData(t *testing.T) {
config := mtest.GetConfigForTest(t, "s3_daily_storage", "86400s")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,26 +10,11 @@ package s3_request
import (
"testing"

"github.com/stretchr/testify/assert"

_ "github.com/elastic/beats/v7/libbeat/processors/actions"
mbtest "github.com/elastic/beats/v7/metricbeat/mb/testing"
"github.com/elastic/beats/v7/x-pack/metricbeat/module/aws/mtest"
)

func TestFetch(t *testing.T) {
config := mtest.GetConfigForTest(t, "s3_request", "60s")

metricSet := mbtest.NewReportingMetricSetV2Error(t, config)
events, errs := mbtest.ReportingFetchV2Error(metricSet)
if len(errs) > 0 {
t.Fatalf("Expected 0 error, had %d. %v\n", len(errs), errs)
}

assert.NotEmpty(t, events)
mbtest.TestMetricsetFieldsDocumented(t, metricSet, events)
}

func TestData(t *testing.T) {
config := mtest.GetConfigForTest(t, "s3_request", "60s")

Expand Down
11 changes: 5 additions & 6 deletions x-pack/metricbeat/module/aws/sqs/_meta/data.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,14 @@
"deleted": 0,
"not_visible": 0,
"received": 0,
"sent": 0.2857142857142857,
"visible": 827.8
"sent": 0,
"visible": 1577.8
},
"oldest_message_age": {
"sec": 345606.4
"sec": 345603.2
},
"queuename": "filebeat-aws-elb-test",
"sent_message_size": {
"bytes": 1006.5
"queue": {
"name": "filebeat-aws-elb-test"
}
},
"tags": {
Expand Down

0 comments on commit 264a289

Please sign in to comment.