Skip to content

Commit

Permalink
Replace EOL modules: github.com/golang/protobuf by google.golang.org/…
Browse files Browse the repository at this point in the history
…protobuf (elastic#37212)
  • Loading branch information
AndersonQ authored Dec 20, 2023
1 parent 50aac80 commit b59a8f4
Show file tree
Hide file tree
Showing 10 changed files with 76 additions and 75 deletions.
76 changes: 38 additions & 38 deletions NOTICE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17323,44 +17323,6 @@ Contents of probable licence file $GOMODCACHE/github.com/golang/[email protected]/LICE
limitations under the License.


--------------------------------------------------------------------------------
Dependency : github.com/golang/protobuf
Version: v1.5.3
Licence type (autodetected): BSD-3-Clause
--------------------------------------------------------------------------------

Contents of probable licence file $GOMODCACHE/github.com/golang/[email protected]/LICENSE:

Copyright 2010 The Go Authors. All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:

* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following disclaimer
in the documentation and/or other materials provided with the
distribution.
* Neither the name of Google Inc. nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.



--------------------------------------------------------------------------------
Dependency : github.com/golang/snappy
Version: v0.0.4
Expand Down Expand Up @@ -37758,6 +37720,44 @@ third-party archives.
limitations under the License.


--------------------------------------------------------------------------------
Dependency : github.com/golang/protobuf
Version: v1.5.3
Licence type (autodetected): BSD-3-Clause
--------------------------------------------------------------------------------

Contents of probable licence file $GOMODCACHE/github.com/golang/[email protected]/LICENSE:

Copyright 2010 The Go Authors. All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:

* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following disclaimer
in the documentation and/or other materials provided with the
distribution.
* Neither the name of Google Inc. nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.



--------------------------------------------------------------------------------
Dependency : github.com/google/gofuzz
Version: v1.2.0
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,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
Expand Down Expand Up @@ -291,6 +290,7 @@ require (
github.com/golang-sql/civil v0.0.0-20190719163853-cb61b32ac6fe // indirect
github.com/golang-sql/sqlexp v0.1.0 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/protobuf v1.5.3 // 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
Expand Down
7 changes: 4 additions & 3 deletions x-pack/functionbeat/provider/aws/aws/kinesis_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@ import (
"github.com/aws/aws-lambda-go/events"
"github.com/awslabs/kinesis-aggregation/go/v2/deaggregator"
aggRecProto "github.com/awslabs/kinesis-aggregation/go/v2/records"
"github.com/golang/protobuf/proto" //nolint:staticcheck // SA1019 dependency uses deprecated package
"github.com/stretchr/testify/assert"
"google.golang.org/protobuf/proto"
"google.golang.org/protobuf/runtime/protoimpl"

"github.com/elastic/beats/v7/x-pack/functionbeat/function/provider"
conf "github.com/elastic/elastic-agent-libs/config"
Expand Down Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,13 @@ import (
"time"

"github.com/aws/aws-sdk-go-v2/service/kinesis/types"
"google.golang.org/protobuf/runtime/protoimpl"

"github.com/aws/aws-lambda-go/events"
"github.com/awslabs/kinesis-aggregation/go/v2/deaggregator"
aggRecProto "github.com/awslabs/kinesis-aggregation/go/v2/records"
"github.com/golang/protobuf/proto" //nolint:staticcheck // SA1019 dependency uses deprecated package
"github.com/stretchr/testify/assert"
"google.golang.org/protobuf/proto"

"github.com/elastic/beats/v7/libbeat/beat"
"github.com/elastic/elastic-agent-libs/mapstr"
Expand All @@ -33,7 +34,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",
Expand Down Expand Up @@ -393,7 +394,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[:]...)
Expand Down
10 changes: 5 additions & 5 deletions x-pack/metricbeat/module/gcp/metrics/cloudsql/metadata_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import (
"testing"

monitoring "cloud.google.com/go/monitoring/apiv3/v2/monitoringpb"
"github.com/golang/protobuf/ptypes/timestamp"
"google.golang.org/genproto/googleapis/api/metric"
"google.golang.org/genproto/googleapis/api/monitoredres"
"google.golang.org/protobuf/types/known/timestamppb"
"gotest.tools/assert"

"github.com/elastic/elastic-agent-libs/mapstr"
Expand Down Expand Up @@ -43,10 +43,10 @@ var fake = &monitoring.TimeSeries{
Value: &monitoring.TypedValue_DoubleValue{DoubleValue: 0.0041224284852319215},
},
Interval: &monitoring.TimeInterval{
StartTime: &timestamp.Timestamp{
StartTime: &timestamppb.Timestamp{
Seconds: 1569932700,
},
EndTime: &timestamp.Timestamp{
EndTime: &timestamppb.Timestamp{
Seconds: 1569932700,
},
},
Expand All @@ -55,10 +55,10 @@ var fake = &monitoring.TimeSeries{
Value: &monitoring.TypedValue_DoubleValue{DoubleValue: 0.004205757571772513},
},
Interval: &monitoring.TimeInterval{
StartTime: &timestamp.Timestamp{
StartTime: &timestamppb.Timestamp{
Seconds: 1569932640,
},
EndTime: &timestamp.Timestamp{
EndTime: &timestamppb.Timestamp{
Seconds: 1569932640,
},
},
Expand Down
10 changes: 5 additions & 5 deletions x-pack/metricbeat/module/gcp/metrics/compute/metadata_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ import (
"testing"

monitoring "cloud.google.com/go/monitoring/apiv3/v2/monitoringpb"
"github.com/golang/protobuf/ptypes/timestamp"
"github.com/stretchr/testify/assert"
"google.golang.org/genproto/googleapis/api/metric"
"google.golang.org/genproto/googleapis/api/monitoredres"
"google.golang.org/protobuf/types/known/timestamppb"
)

var fake = &monitoring.TimeSeries{
Expand Down Expand Up @@ -41,10 +41,10 @@ var fake = &monitoring.TimeSeries{
Value: &monitoring.TypedValue_DoubleValue{DoubleValue: 0.0041224284852319215},
},
Interval: &monitoring.TimeInterval{
StartTime: &timestamp.Timestamp{
StartTime: &timestamppb.Timestamp{
Seconds: 1569932700,
},
EndTime: &timestamp.Timestamp{
EndTime: &timestamppb.Timestamp{
Seconds: 1569932700,
},
},
Expand All @@ -53,10 +53,10 @@ var fake = &monitoring.TimeSeries{
Value: &monitoring.TypedValue_DoubleValue{DoubleValue: 0.004205757571772513},
},
Interval: &monitoring.TimeInterval{
StartTime: &timestamp.Timestamp{
StartTime: &timestamppb.Timestamp{
Seconds: 1569932640,
},
EndTime: &timestamp.Timestamp{
EndTime: &timestamppb.Timestamp{
Seconds: 1569932640,
},
},
Expand Down
11 changes: 5 additions & 6 deletions x-pack/metricbeat/module/gcp/metrics/metrics_requester.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,11 @@ import (
"sync"
"time"

"github.com/golang/protobuf/ptypes/duration"

monitoring "cloud.google.com/go/monitoring/apiv3/v2"
"cloud.google.com/go/monitoring/apiv3/v2/monitoringpb"
"github.com/golang/protobuf/ptypes/timestamp"
"google.golang.org/api/iterator"
"google.golang.org/protobuf/types/known/durationpb"
"google.golang.org/protobuf/types/known/timestamppb"

"github.com/elastic/beats/v7/x-pack/metricbeat/module/gcp"
"github.com/elastic/elastic-agent-libs/logp"
Expand Down Expand Up @@ -256,7 +255,7 @@ func (r *metricsRequester) getFilterForMetric(serviceName, m string) 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()
Expand All @@ -280,10 +279,10 @@ func getTimeIntervalAligner(ingestDelay time.Duration, samplePeriod time.Duratio
}

interval := &monitoringpb.TimeInterval{
StartTime: &timestamp.Timestamp{
StartTime: &timestamppb.Timestamp{
Seconds: startTime.Unix(),
},
EndTime: &timestamp.Timestamp{
EndTime: &timestamppb.Timestamp{
Seconds: endTime.Unix(),
},
}
Expand Down
12 changes: 6 additions & 6 deletions x-pack/metricbeat/module/gcp/metrics/metrics_requester_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import (
"testing"
"time"

"github.com/golang/protobuf/ptypes/duration"
"github.com/stretchr/testify/assert"
"go.uber.org/zap/zapcore"
"google.golang.org/protobuf/types/known/durationpb"

"github.com/elastic/beats/v7/x-pack/metricbeat/module/gcp"
"github.com/elastic/elastic-agent-libs/logp"
Expand All @@ -21,15 +21,15 @@ func TestGetTimeIntervalAligner(t *testing.T) {
title string
ingestDelay time.Duration
samplePeriod time.Duration
collectionPeriod *duration.Duration
collectionPeriod *durationpb.Duration
inputAligner string
expectedAligner string
}{
{
"test collectionPeriod equals to samplePeriod",
time.Duration(240) * time.Second,
time.Duration(60) * time.Second,
&duration.Duration{
&durationpb.Duration{
Seconds: int64(60),
},
"",
Expand All @@ -39,7 +39,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",
Expand All @@ -49,7 +49,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",
Expand All @@ -59,7 +59,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",
Expand Down
6 changes: 3 additions & 3 deletions x-pack/metricbeat/module/gcp/metrics/metricset.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ import (

monitoring "cloud.google.com/go/monitoring/apiv3/v2"
"cloud.google.com/go/monitoring/apiv3/v2/monitoringpb"
"github.com/golang/protobuf/ptypes/duration"
"google.golang.org/api/iterator"
"google.golang.org/api/option"
"google.golang.org/genproto/googleapis/api/metric"
"google.golang.org/protobuf/types/known/durationpb"

"github.com/elastic/beats/v7/metricbeat/mb"
"github.com/elastic/beats/v7/x-pack/metricbeat/module/gcp"
Expand Down Expand Up @@ -107,7 +107,7 @@ type config struct {
CredentialsJSON string `config:"credentials_json"`

opt []option.ClientOption
period *duration.Duration
period *durationpb.Duration
}

// New creates a new instance of the MetricSet. New is responsible for unpacking
Expand Down Expand Up @@ -139,7 +139,7 @@ func New(base mb.BaseMetricSet) (mb.MetricSet, error) {
return m, fmt.Errorf("no credentials_file_path or credentials_json specified")
}

m.config.period = &duration.Duration{
m.config.period = &durationpb.Duration{
Seconds: int64(m.Module().Config().Period.Seconds()),
}

Expand Down
Loading

0 comments on commit b59a8f4

Please sign in to comment.