diff --git a/NOTICE.txt b/NOTICE.txt index a3253a7a9b2d..a726092f934b 100644 --- a/NOTICE.txt +++ b/NOTICE.txt @@ -29306,11 +29306,11 @@ Contents of probable licence file $GOMODCACHE/github.com/google/gofuzz@v1.1.0/LI -------------------------------------------------------------------------------- Dependency : github.com/google/licenseclassifier -Version: v0.0.0-20200402202327-879cb1424de0 +Version: v0.0.0-20221004142553-c1ed8fcf4bab Licence type (autodetected): Apache-2.0 -------------------------------------------------------------------------------- -Contents of probable licence file $GOMODCACHE/github.com/google/licenseclassifier@v0.0.0-20200402202327-879cb1424de0/LICENSE: +Contents of probable licence file $GOMODCACHE/github.com/google/licenseclassifier@v0.0.0-20221004142553-c1ed8fcf4bab/LICENSE: Apache License diff --git a/go.mod b/go.mod index 3698416fcad0..40570bd517d7 100644 --- a/go.mod +++ b/go.mod @@ -91,7 +91,6 @@ require ( github.com/gofrs/uuid v4.4.0+incompatible github.com/gogo/protobuf v1.3.2 github.com/golang/mock v1.6.0 - github.com/golang/protobuf v1.5.3 github.com/golang/snappy v0.0.4 github.com/gomodule/redigo v1.8.3 github.com/google/flatbuffers v23.3.3+incompatible @@ -199,6 +198,7 @@ require ( require ( github.com/elastic/elastic-agent-libs v0.6.2 github.com/elastic/elastic-agent-system-metrics v0.4.4 + github.com/golang/protobuf v1.5.3 google.golang.org/genproto/googleapis/api v0.0.0-20230711160842-782d3b101e98 ) @@ -242,7 +242,7 @@ require ( github.com/golang/glog v1.1.0 // indirect github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect github.com/google/gofuzz v1.1.0 // indirect - github.com/google/licenseclassifier v0.0.0-20200402202327-879cb1424de0 // indirect + github.com/google/licenseclassifier v0.0.0-20221004142553-c1ed8fcf4bab // indirect github.com/google/s2a-go v0.1.4 // indirect github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect github.com/googleapis/enterprise-certificate-proxy v0.2.3 // indirect diff --git a/go.sum b/go.sum index 76bf6aa3ec99..514b0d43cfd2 100644 --- a/go.sum +++ b/go.sum @@ -474,8 +474,10 @@ github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeN github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/gofuzz v1.1.0 h1:Hsa8mG0dQ46ij8Sl2AYJDUv1oA9/d6Vk+3LG99Oe02g= github.com/google/gofuzz v1.1.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= -github.com/google/licenseclassifier v0.0.0-20200402202327-879cb1424de0 h1:OggOMmdI0JLwg1FkOKH9S7fVHF0oEm8PX6S8kAdpOps= github.com/google/licenseclassifier v0.0.0-20200402202327-879cb1424de0/go.mod h1:qsqn2hxC+vURpyBRygGUuinTO42MFRLcsmQ/P8v94+M= +github.com/google/licenseclassifier v0.0.0-20221004142553-c1ed8fcf4bab h1:okY7fFoWybMbxiHkaqStN4mxSrPfYmTZl5Zh32Z5FjY= +github.com/google/licenseclassifier v0.0.0-20221004142553-c1ed8fcf4bab/go.mod h1:jkYIPv59uiw+1MxTWlqQEKebsUDV1DCXQtBBn5lVzf4= +github.com/google/licenseclassifier/v2 v2.0.0-alpha.1/go.mod h1:YAgBGGTeNDMU+WfIgaFvjZe4rudym4f6nIn8ZH5X+VM= github.com/google/martian v2.1.0+incompatible h1:/CP5g8u/VJHijgedC/Legn3BAbAaWPgecwXBIDzw5no= github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= github.com/google/martian/v3 v3.3.2 h1:IqNFLAmvJOgVlpdEBiQbDc2EwKW77amAycfTuWKdfvw= diff --git a/x-pack/filebeat/input/httpjson/input_test.go b/x-pack/filebeat/input/httpjson/input_test.go index 9630d0c81fb8..10829d52c081 100644 --- a/x-pack/filebeat/input/httpjson/input_test.go +++ b/x-pack/filebeat/input/httpjson/input_test.go @@ -240,7 +240,7 @@ func TestStatelessHTTPJSONInput(t *testing.T) { var g errgroup.Group g.Go(func() error { return input.Run(ctx, chanClient) }) - timeout := time.NewTimer(5 * time.Second) + timeout := time.NewTimer(10 * time.Second) t.Cleanup(func() { _ = timeout.Stop() }) var receivedCount int diff --git a/x-pack/functionbeat/provider/aws/aws/kinesis_test.go b/x-pack/functionbeat/provider/aws/aws/kinesis_test.go index d99e3640071d..28f17dd60ed1 100644 --- a/x-pack/functionbeat/provider/aws/aws/kinesis_test.go +++ b/x-pack/functionbeat/provider/aws/aws/kinesis_test.go @@ -14,8 +14,9 @@ import ( "github.com/aws/aws-lambda-go/events" "github.com/awslabs/kinesis-aggregation/go/deaggregator" aggRecProto "github.com/awslabs/kinesis-aggregation/go/records" - "github.com/golang/protobuf/proto" "github.com/stretchr/testify/assert" + "google.golang.org/protobuf/proto" + "google.golang.org/protobuf/runtime/protoimpl" "github.com/elastic/beats/v7/libbeat/common" "github.com/elastic/beats/v7/x-pack/functionbeat/function/provider" @@ -133,14 +134,14 @@ func generateAggregatedKinesisEvent(validRec bool) events.KinesisEvent { partKeyTable = append(partKeyTable, "0") aggRec.PartitionKeyTable = partKeyTable - data, _ := proto.Marshal(aggRec) + data, _ := proto.Marshal(protoimpl.X.ProtoMessageV2Of(aggRec)) md5Hash := md5.Sum(data) aggRecBytes = append(aggRecBytes, data...) aggRecBytes = append(aggRecBytes, md5Hash[:]...) return events.KinesisEvent{ Records: []events.KinesisEventRecord{ - events.KinesisEventRecord{ + { AwsRegion: "east-1", EventID: "1234", EventName: "connect", diff --git a/x-pack/functionbeat/provider/aws/aws/transformer/transformer_test.go b/x-pack/functionbeat/provider/aws/aws/transformer/transformer_test.go index a1b5afb93c90..86b93de1de94 100644 --- a/x-pack/functionbeat/provider/aws/aws/transformer/transformer_test.go +++ b/x-pack/functionbeat/provider/aws/aws/transformer/transformer_test.go @@ -13,11 +13,13 @@ import ( "testing" "time" + "google.golang.org/protobuf/runtime/protoimpl" + "github.com/aws/aws-lambda-go/events" "github.com/awslabs/kinesis-aggregation/go/deaggregator" aggRecProto "github.com/awslabs/kinesis-aggregation/go/records" - "github.com/golang/protobuf/proto" "github.com/stretchr/testify/assert" + "google.golang.org/protobuf/proto" "github.com/elastic/beats/v7/libbeat/beat" "github.com/elastic/beats/v7/libbeat/common" @@ -31,7 +33,7 @@ func TestCloudwatch(t *testing.T) { SubscriptionFilters: []string{"MyFilter"}, MessageType: "DATA_MESSAGE", LogEvents: []events.CloudwatchLogsLogEvent{ - events.CloudwatchLogsLogEvent{ + { ID: "1234567890123456789", Timestamp: 1566908691193, Message: "my interesting message", @@ -391,7 +393,7 @@ func generateKinesisAggregateRecord(numRecords int, valid bool) []byte { } aggRec.PartitionKeyTable = partKeyTable - data, _ := proto.Marshal(aggRec) + data, _ := proto.Marshal(protoimpl.X.ProtoMessageV2Of(aggRec)) md5Hash := md5.Sum(data) aggRecBytes = append(aggRecBytes, data...) aggRecBytes = append(aggRecBytes, md5Hash[:]...) diff --git a/x-pack/metricbeat/module/gcp/metrics/compute/metadata_test.go b/x-pack/metricbeat/module/gcp/metrics/compute/metadata_test.go index cee4484f615b..17213b8e1b89 100644 --- a/x-pack/metricbeat/module/gcp/metrics/compute/metadata_test.go +++ b/x-pack/metricbeat/module/gcp/metrics/compute/metadata_test.go @@ -7,11 +7,11 @@ package compute import ( "testing" - "github.com/golang/protobuf/ptypes/timestamp" + monitoring "cloud.google.com/go/monitoring/apiv3/v2/monitoringpb" "github.com/stretchr/testify/assert" "google.golang.org/genproto/googleapis/api/metric" "google.golang.org/genproto/googleapis/api/monitoredres" - monitoring "google.golang.org/genproto/googleapis/monitoring/v3" + "google.golang.org/protobuf/types/known/timestamppb" ) var fake = &monitoring.TimeSeries{ @@ -41,10 +41,10 @@ var fake = &monitoring.TimeSeries{ Value: &monitoring.TypedValue_DoubleValue{DoubleValue: 0.0041224284852319215}, }, Interval: &monitoring.TimeInterval{ - StartTime: ×tamp.Timestamp{ + StartTime: ×tamppb.Timestamp{ Seconds: 1569932700, }, - EndTime: ×tamp.Timestamp{ + EndTime: ×tamppb.Timestamp{ Seconds: 1569932700, }, }, @@ -53,10 +53,10 @@ var fake = &monitoring.TimeSeries{ Value: &monitoring.TypedValue_DoubleValue{DoubleValue: 0.004205757571772513}, }, Interval: &monitoring.TimeInterval{ - StartTime: ×tamp.Timestamp{ + StartTime: ×tamppb.Timestamp{ Seconds: 1569932640, }, - EndTime: ×tamp.Timestamp{ + EndTime: ×tamppb.Timestamp{ Seconds: 1569932640, }, }, diff --git a/x-pack/metricbeat/module/gcp/metrics/metrics_requester.go b/x-pack/metricbeat/module/gcp/metrics/metrics_requester.go index d518acc0014a..7cd929d84735 100644 --- a/x-pack/metricbeat/module/gcp/metrics/metrics_requester.go +++ b/x-pack/metricbeat/module/gcp/metrics/metrics_requester.go @@ -11,12 +11,11 @@ import ( "sync" "time" - "github.com/golang/protobuf/ptypes/duration" - - monitoring "cloud.google.com/go/monitoring/apiv3" - "github.com/golang/protobuf/ptypes/timestamp" + monitoring "cloud.google.com/go/monitoring/apiv3/v2" + "cloud.google.com/go/monitoring/apiv3/v2/monitoringpb" "google.golang.org/api/iterator" - monitoringpb "google.golang.org/genproto/googleapis/monitoring/v3" + "google.golang.org/protobuf/types/known/durationpb" + "google.golang.org/protobuf/types/known/timestamppb" "github.com/elastic/beats/v7/libbeat/logp" "github.com/elastic/beats/v7/x-pack/metricbeat/module/gcp" @@ -156,7 +155,7 @@ func (r *metricsRequester) getFilterForMetric(serviceName, m string) (f string) } // Returns a GCP TimeInterval based on the ingestDelay and samplePeriod from ListMetricDescriptor -func getTimeIntervalAligner(ingestDelay time.Duration, samplePeriod time.Duration, collectionPeriod *duration.Duration, inputAligner string) (*monitoringpb.TimeInterval, string) { +func getTimeIntervalAligner(ingestDelay time.Duration, samplePeriod time.Duration, collectionPeriod *durationpb.Duration, inputAligner string) (*monitoringpb.TimeInterval, string) { var startTime, endTime, currentTime time.Time var needsAggregation bool currentTime = time.Now().UTC() @@ -180,10 +179,10 @@ func getTimeIntervalAligner(ingestDelay time.Duration, samplePeriod time.Duratio } interval := &monitoringpb.TimeInterval{ - StartTime: ×tamp.Timestamp{ + StartTime: ×tamppb.Timestamp{ Seconds: startTime.Unix(), }, - EndTime: ×tamp.Timestamp{ + EndTime: ×tamppb.Timestamp{ Seconds: endTime.Unix(), }, } diff --git a/x-pack/metricbeat/module/gcp/metrics/metrics_requester_test.go b/x-pack/metricbeat/module/gcp/metrics/metrics_requester_test.go index 2181ebfdac0d..a92af95470de 100644 --- a/x-pack/metricbeat/module/gcp/metrics/metrics_requester_test.go +++ b/x-pack/metricbeat/module/gcp/metrics/metrics_requester_test.go @@ -8,8 +8,8 @@ import ( "testing" "time" - "github.com/golang/protobuf/ptypes/duration" "github.com/stretchr/testify/assert" + "google.golang.org/protobuf/types/known/durationpb" "github.com/elastic/beats/v7/libbeat/logp" ) @@ -122,7 +122,7 @@ func TestGetTimeIntervalAligner(t *testing.T) { title string ingestDelay time.Duration samplePeriod time.Duration - collectionPeriod *duration.Duration + collectionPeriod *durationpb.Duration inputAligner string expectedAligner string }{ @@ -130,7 +130,7 @@ func TestGetTimeIntervalAligner(t *testing.T) { "test collectionPeriod equals to samplePeriod", time.Duration(240) * time.Second, time.Duration(60) * time.Second, - &duration.Duration{ + &durationpb.Duration{ Seconds: int64(60), }, "", @@ -140,7 +140,7 @@ func TestGetTimeIntervalAligner(t *testing.T) { "test collectionPeriod larger than samplePeriod", time.Duration(240) * time.Second, time.Duration(60) * time.Second, - &duration.Duration{ + &durationpb.Duration{ Seconds: int64(300), }, "ALIGN_MEAN", @@ -150,7 +150,7 @@ func TestGetTimeIntervalAligner(t *testing.T) { "test collectionPeriod smaller than samplePeriod", time.Duration(240) * time.Second, time.Duration(60) * time.Second, - &duration.Duration{ + &durationpb.Duration{ Seconds: int64(30), }, "ALIGN_MAX", @@ -160,7 +160,7 @@ func TestGetTimeIntervalAligner(t *testing.T) { "test collectionPeriod equals to samplePeriod with given aligner", time.Duration(240) * time.Second, time.Duration(60) * time.Second, - &duration.Duration{ + &durationpb.Duration{ Seconds: int64(60), }, "ALIGN_MEAN", diff --git a/x-pack/metricbeat/module/gcp/metrics/metricset.go b/x-pack/metricbeat/module/gcp/metrics/metricset.go index 8bdf8ca3e5f4..56eb71d33317 100644 --- a/x-pack/metricbeat/module/gcp/metrics/metricset.go +++ b/x-pack/metricbeat/module/gcp/metrics/metricset.go @@ -10,13 +10,13 @@ import ( "strings" "time" - monitoring "cloud.google.com/go/monitoring/apiv3" - "github.com/golang/protobuf/ptypes/duration" + monitoring "cloud.google.com/go/monitoring/apiv3/v2" + "cloud.google.com/go/monitoring/apiv3/v2/monitoringpb" "github.com/pkg/errors" "google.golang.org/api/iterator" "google.golang.org/api/option" "google.golang.org/genproto/googleapis/api/metric" - monitoringpb "google.golang.org/genproto/googleapis/monitoring/v3" + "google.golang.org/protobuf/types/known/durationpb" "github.com/elastic/beats/v7/libbeat/common" "github.com/elastic/beats/v7/libbeat/common/cfgwarn" @@ -106,7 +106,7 @@ type config struct { CredentialsFilePath string `config:"credentials_file_path"` opt []option.ClientOption - period *duration.Duration + period *durationpb.Duration } // New creates a new instance of the MetricSet. New is responsible for unpacking @@ -130,7 +130,7 @@ func New(base mb.BaseMetricSet) (mb.MetricSet, error) { m.MetricsConfig = metricsConfigs.Metrics m.config.opt = []option.ClientOption{option.WithCredentialsFile(m.config.CredentialsFilePath)} - m.config.period = &duration.Duration{ + m.config.period = &durationpb.Duration{ Seconds: int64(m.Module().Config().Period.Seconds()), } @@ -212,7 +212,7 @@ func (m *MetricSet) eventMapping(ctx context.Context, tss []timeSeriesWithAligne return nil, errors.Wrap(err, "error trying to group time series data") } - //Create single events for each group of data that matches some common patterns like labels and timestamp + // Create single events for each group of data that matches some common patterns like labels and timestamp events := make([]mb.Event, 0) for _, groupedEvents := range tsGrouped { event := mb.Event{