build: move to new protobuf library (#10019)

This commit is contained in:
Dane Strandboge 2021-11-09 08:51:14 -06:00 committed by GitHub
parent e73ffe56c4
commit ddeb6ec890
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
24 changed files with 2183 additions and 1041 deletions

10
go.mod
View File

@ -113,12 +113,10 @@ require (
github.com/goburrow/serial v0.1.0 // indirect github.com/goburrow/serial v0.1.0 // indirect
github.com/gobwas/glob v0.2.3 github.com/gobwas/glob v0.2.3
github.com/gofrs/uuid v3.3.0+incompatible github.com/gofrs/uuid v3.3.0+incompatible
github.com/gogo/protobuf v1.3.2
github.com/golang-jwt/jwt/v4 v4.1.0 github.com/golang-jwt/jwt/v4 v4.1.0
github.com/golang-sql/civil v0.0.0-20190719163853-cb61b32ac6fe // indirect github.com/golang-sql/civil v0.0.0-20190719163853-cb61b32ac6fe // indirect
github.com/golang/geo v0.0.0-20190916061304-5b978397cfec github.com/golang/geo v0.0.0-20190916061304-5b978397cfec
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/protobuf v1.5.2
github.com/golang/snappy v0.0.4 github.com/golang/snappy v0.0.4
github.com/google/flatbuffers v2.0.0+incompatible // indirect github.com/google/flatbuffers v2.0.0+incompatible // indirect
github.com/google/go-cmp v0.5.6 github.com/google/go-cmp v0.5.6
@ -338,6 +336,8 @@ require (
github.com/aws/aws-sdk-go-v2/service/dynamodbstreams v1.4.0 // indirect github.com/aws/aws-sdk-go-v2/service/dynamodbstreams v1.4.0 // indirect
github.com/awslabs/kinesis-aggregation/go v0.0.0-20210630091500-54e17340d32f // indirect github.com/awslabs/kinesis-aggregation/go v0.0.0-20210630091500-54e17340d32f // indirect
github.com/cenkalti/backoff/v4 v4.1.1 // indirect github.com/cenkalti/backoff/v4 v4.1.1 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/jcmturner/aescts/v2 v2.0.0 // indirect github.com/jcmturner/aescts/v2 v2.0.0 // indirect
github.com/jcmturner/dnsutils/v2 v2.0.0 // indirect github.com/jcmturner/dnsutils/v2 v2.0.0 // indirect
github.com/jcmturner/gokrb5/v8 v8.4.2 // indirect github.com/jcmturner/gokrb5/v8 v8.4.2 // indirect
@ -365,3 +365,9 @@ replace github.com/mdlayher/apcupsd => github.com/influxdata/apcupsd v0.0.0-2021
//https://github.com/WireGuard/wgctrl-go/blob/e35592f146e40ce8057113d14aafcc3da231fbac/go.mod#L12 ) was not working when using GOPROXY=direct. //https://github.com/WireGuard/wgctrl-go/blob/e35592f146e40ce8057113d14aafcc3da231fbac/go.mod#L12 ) was not working when using GOPROXY=direct.
//Replacing with the pseudo-version works around this. //Replacing with the pseudo-version works around this.
replace golang.zx2c4.com/wireguard v0.0.20200121 => golang.zx2c4.com/wireguard v0.0.0-20200121152719-05b03c675090 replace golang.zx2c4.com/wireguard v0.0.20200121 => golang.zx2c4.com/wireguard v0.0.0-20200121152719-05b03c675090
// replaced due to open PR updating protobuf https://github.com/cisco-ie/nx-telemetry-proto/pull/1
replace github.com/cisco-ie/nx-telemetry-proto => github.com/sbezverk/nx-telemetry-proto v0.0.0-20210629125746-3c19a51b1abc
// replaced due to open PR updating protobuf https://github.com/riemann/riemann-go-client/pull/27
replace github.com/riemann/riemann-go-client => github.com/dstrand1/riemann-go-client v0.5.1-0.20211028194734-b5eb11fb5754

9
go.sum
View File

@ -478,8 +478,6 @@ github.com/cilium/ebpf v0.4.0/go.mod h1:4tRaxcgiL706VnOzHOdBlY8IEAIdxINsQBcU4xJJ
github.com/cilium/ebpf v0.6.2/go.mod h1:4tRaxcgiL706VnOzHOdBlY8IEAIdxINsQBcU4xJJXRs= github.com/cilium/ebpf v0.6.2/go.mod h1:4tRaxcgiL706VnOzHOdBlY8IEAIdxINsQBcU4xJJXRs=
github.com/circonus-labs/circonus-gometrics v2.3.1+incompatible/go.mod h1:nmEj6Dob7S7YxXgwXpfOuvO54S+tGdZdw9fuRZt25Ag= github.com/circonus-labs/circonus-gometrics v2.3.1+incompatible/go.mod h1:nmEj6Dob7S7YxXgwXpfOuvO54S+tGdZdw9fuRZt25Ag=
github.com/circonus-labs/circonusllhist v0.1.3/go.mod h1:kMXHVDlOchFAehlya5ePtbp5jckzBHf4XRpQvBOLI+I= github.com/circonus-labs/circonusllhist v0.1.3/go.mod h1:kMXHVDlOchFAehlya5ePtbp5jckzBHf4XRpQvBOLI+I=
github.com/cisco-ie/nx-telemetry-proto v0.0.0-20190531143454-82441e232cf6 h1:57RI0wFkG/smvVTcz7F43+R0k+Hvci3jAVQF9lyMoOo=
github.com/cisco-ie/nx-telemetry-proto v0.0.0-20190531143454-82441e232cf6/go.mod h1:ugEfq4B8T8ciw/h5mCkgdiDRFS4CkqqhH2dymDB4knc=
github.com/clbanning/x2j v0.0.0-20191024224557-825249438eec/go.mod h1:jMjuTZXRI4dUb/I5gc9Hdhagfvm9+RyrPryS/auMzxE= github.com/clbanning/x2j v0.0.0-20191024224557-825249438eec/go.mod h1:jMjuTZXRI4dUb/I5gc9Hdhagfvm9+RyrPryS/auMzxE=
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc=
@ -691,6 +689,8 @@ github.com/doclambda/protobufquery v0.0.0-20210317203640-88ffabe06a60/go.mod h1:
github.com/docopt/docopt-go v0.0.0-20180111231733-ee0de3bc6815/go.mod h1:WwZ+bS3ebgob9U8Nd0kOddGdZWjyMGR8Wziv+TBNwSE= github.com/docopt/docopt-go v0.0.0-20180111231733-ee0de3bc6815/go.mod h1:WwZ+bS3ebgob9U8Nd0kOddGdZWjyMGR8Wziv+TBNwSE=
github.com/dropbox/godropbox v0.0.0-20180512210157-31879d3884b9 h1:NAvZb7gqQfLSNBPzVsvI7eZMosXtg2g2kxXrei90CtU= github.com/dropbox/godropbox v0.0.0-20180512210157-31879d3884b9 h1:NAvZb7gqQfLSNBPzVsvI7eZMosXtg2g2kxXrei90CtU=
github.com/dropbox/godropbox v0.0.0-20180512210157-31879d3884b9/go.mod h1:glr97hP/JuXb+WMYCizc4PIFuzw1lCR97mwbe1VVXhQ= github.com/dropbox/godropbox v0.0.0-20180512210157-31879d3884b9/go.mod h1:glr97hP/JuXb+WMYCizc4PIFuzw1lCR97mwbe1VVXhQ=
github.com/dstrand1/riemann-go-client v0.5.1-0.20211028194734-b5eb11fb5754 h1:aDtw0/++yjOoiXB9sldaFYW61mK3m6ia/wYWxPLrwYY=
github.com/dstrand1/riemann-go-client v0.5.1-0.20211028194734-b5eb11fb5754/go.mod h1:4rS0vfmzOMwfFPhi6Zve4k/59TsBepqd6WESNULE0ho=
github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk=
github.com/dustin/go-humanize v1.0.0 h1:VSnTsYCnlFHaM2/igO1h6X3HA71jcobQuxemgkq4zYo= github.com/dustin/go-humanize v1.0.0 h1:VSnTsYCnlFHaM2/igO1h6X3HA71jcobQuxemgkq4zYo=
github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk=
@ -993,7 +993,6 @@ github.com/golang/mock v1.4.3/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt
github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4= github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4=
github.com/golang/mock v1.5.0/go.mod h1:CWnOUgYIOo4TcNZ0wHX3YZCqsaM1I1Jvs6v3mP3KVu8= github.com/golang/mock v1.5.0/go.mod h1:CWnOUgYIOo4TcNZ0wHX3YZCqsaM1I1Jvs6v3mP3KVu8=
github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs= github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs=
github.com/golang/protobuf v0.0.0-20170307001533-c9c7427a2a70/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
@ -1836,8 +1835,6 @@ github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475/go.mod h1:bCqn
github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0 h1:OdAsTTz6OkFY5QxjkYwrChwuRruF69c169dPK26NUlk= github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0 h1:OdAsTTz6OkFY5QxjkYwrChwuRruF69c169dPK26NUlk=
github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo= github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo=
github.com/retailnext/hllpp v1.0.1-0.20180308014038-101a6d2f8b52/go.mod h1:RDpi1RftBQPUCDRw6SmxeaREsAaRKnOclghuzp/WRzc= github.com/retailnext/hllpp v1.0.1-0.20180308014038-101a6d2f8b52/go.mod h1:RDpi1RftBQPUCDRw6SmxeaREsAaRKnOclghuzp/WRzc=
github.com/riemann/riemann-go-client v0.5.0 h1:yPP7tz1vSYJkSZvZFCsMiDsHHXX57x8/fEX3qyEXuAA=
github.com/riemann/riemann-go-client v0.5.0/go.mod h1:FMiaOL8dgBnRfgwENzV0xlYJ2eCbV1o7yqVwOBLbShQ=
github.com/rivo/tview v0.0.0-20200219210816-cd38d7432498/go.mod h1:6lkG1x+13OShEf0EaOCaTQYyB7d5nSbb181KtjlS+84= github.com/rivo/tview v0.0.0-20200219210816-cd38d7432498/go.mod h1:6lkG1x+13OShEf0EaOCaTQYyB7d5nSbb181KtjlS+84=
github.com/rivo/uniseg v0.1.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= github.com/rivo/uniseg v0.1.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
github.com/robertkrimen/otto v0.0.0-20191219234010-c382bd3c16ff h1:+6NUiITWwE5q1KO6SAfUX918c+Tab0+tGAM/mtdlUyA= github.com/robertkrimen/otto v0.0.0-20191219234010-c382bd3c16ff h1:+6NUiITWwE5q1KO6SAfUX918c+Tab0+tGAM/mtdlUyA=
@ -1873,6 +1870,8 @@ github.com/samuel/go-zookeeper v0.0.0-20200724154423-2164a8ac840e h1:CGjiMQ0wMH4
github.com/samuel/go-zookeeper v0.0.0-20200724154423-2164a8ac840e/go.mod h1:gi+0XIa01GRL2eRQVjQkKGqKF3SF9vZR/HnPullcV2E= github.com/samuel/go-zookeeper v0.0.0-20200724154423-2164a8ac840e/go.mod h1:gi+0XIa01GRL2eRQVjQkKGqKF3SF9vZR/HnPullcV2E=
github.com/sanity-io/litter v1.2.0/go.mod h1:JF6pZUFgu2Q0sBZ+HSV35P8TVPI1TTzEwyu9FXAw2W4= github.com/sanity-io/litter v1.2.0/go.mod h1:JF6pZUFgu2Q0sBZ+HSV35P8TVPI1TTzEwyu9FXAw2W4=
github.com/sanposhiho/wastedassign v0.1.3/go.mod h1:LGpq5Hsv74QaqM47WtIsRSF/ik9kqk07kchgv66tLVE= github.com/sanposhiho/wastedassign v0.1.3/go.mod h1:LGpq5Hsv74QaqM47WtIsRSF/ik9kqk07kchgv66tLVE=
github.com/sbezverk/nx-telemetry-proto v0.0.0-20210629125746-3c19a51b1abc h1:9RAsqOFf0U5CuwXR/Jff3nXTv6tAQNN7U4A/2cBRXFc=
github.com/sbezverk/nx-telemetry-proto v0.0.0-20210629125746-3c19a51b1abc/go.mod h1:rJDd05J5hqWVU9MjJ+5jw1CuLn/jRhvU0xtFEzzqjwM=
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.7.0.20210223165440-c65ae3540d44/go.mod h1:CJJ5VAbozOl0yEw7nHB9+7BXTJbIn6h7W+f6Gau5IP8= github.com/scaleway/scaleway-sdk-go v1.0.0-beta.7.0.20210223165440-c65ae3540d44/go.mod h1:CJJ5VAbozOl0yEw7nHB9+7BXTJbIn6h7W+f6Gau5IP8=
github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529 h1:nn5Wsu0esKSJiIVhscUtVbo7ada43DJhG55ua/hjS5I= github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529 h1:nn5Wsu0esKSJiIVhscUtVbo7ada43DJhG55ua/hjS5I=
github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc=

View File

@ -15,11 +15,11 @@ import (
dialout "github.com/cisco-ie/nx-telemetry-proto/mdt_dialout" dialout "github.com/cisco-ie/nx-telemetry-proto/mdt_dialout"
telemetry "github.com/cisco-ie/nx-telemetry-proto/telemetry_bis" telemetry "github.com/cisco-ie/nx-telemetry-proto/telemetry_bis"
"github.com/golang/protobuf/proto" //nolint:staticcheck // Cannot switch to "google.golang.org/protobuf/proto", "github.com/golang/protobuf/proto" is used by "github.com/cisco-ie/nx-telemetry-proto/telemetry_bis"
"google.golang.org/grpc" "google.golang.org/grpc"
"google.golang.org/grpc/credentials" "google.golang.org/grpc/credentials"
_ "google.golang.org/grpc/encoding/gzip" // Register GRPC gzip decoder to support compressed telemetry _ "google.golang.org/grpc/encoding/gzip" // Register GRPC gzip decoder to support compressed telemetry
"google.golang.org/grpc/peer" "google.golang.org/grpc/peer"
"google.golang.org/protobuf/proto"
"github.com/influxdata/telegraf" "github.com/influxdata/telegraf"
"github.com/influxdata/telegraf/metric" "github.com/influxdata/telegraf/metric"
@ -61,6 +61,9 @@ type CiscoTelemetryMDT struct {
mutex sync.Mutex mutex sync.Mutex
acc telegraf.Accumulator acc telegraf.Accumulator
wg sync.WaitGroup wg sync.WaitGroup
// Though unused in the code, required by protoc-gen-go-grpc to maintain compatibility
dialout.UnimplementedGRPCMdtDialoutServer
} }
type NxPayloadXfromStructure struct { type NxPayloadXfromStructure struct {

View File

@ -10,9 +10,9 @@ import (
dialout "github.com/cisco-ie/nx-telemetry-proto/mdt_dialout" dialout "github.com/cisco-ie/nx-telemetry-proto/mdt_dialout"
telemetryBis "github.com/cisco-ie/nx-telemetry-proto/telemetry_bis" telemetryBis "github.com/cisco-ie/nx-telemetry-proto/telemetry_bis"
"github.com/golang/protobuf/proto" //nolint:staticcheck // Cannot switch to "google.golang.org/protobuf/proto", "github.com/golang/protobuf/proto" is used by "github.com/cisco-ie/nx-telemetry-proto/telemetry_bis"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
"google.golang.org/grpc" "google.golang.org/grpc"
"google.golang.org/protobuf/proto"
"github.com/influxdata/telegraf/testutil" "github.com/influxdata/telegraf/testutil"
) )

View File

@ -1,9 +1,10 @@
package cisco_telemetry_mdt package cisco_telemetry_mdt
import ( import (
telemetry "github.com/cisco-ie/nx-telemetry-proto/telemetry_bis"
"strconv" "strconv"
"strings" "strings"
telemetry "github.com/cisco-ie/nx-telemetry-proto/telemetry_bis"
) )
//xform Field to string //xform Field to string

View File

@ -1,182 +1,238 @@
// Code generated by protoc-gen-go. DO NOT EDIT. // Code generated by protoc-gen-go. DO NOT EDIT.
// source: authentication_service.proto // versions:
// protoc-gen-go v1.27.1
// protoc v3.17.3
// source: auth/authentication_service.proto
/*
Package authentication is a generated protocol buffer package.
It is generated from these files:
authentication_service.proto
It has these top-level messages:
LoginRequest
LoginReply
*/
package authentication package authentication
import proto "github.com/golang/protobuf/proto"
import fmt "fmt"
import math "math"
import ( import (
context "golang.org/x/net/context" protoreflect "google.golang.org/protobuf/reflect/protoreflect"
grpc "google.golang.org/grpc" protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
) )
// Reference imports to suppress errors if they are not otherwise used. const (
var _ = proto.Marshal // Verify that this generated code is sufficiently up-to-date.
var _ = fmt.Errorf _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
var _ = math.Inf // Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
// This is a compile-time assertion to ensure that this generated file )
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package
// The request message containing the user's name, password and client id // The request message containing the user's name, password and client id
type LoginRequest struct { type LoginRequest struct {
UserName string `protobuf:"bytes,1,opt,name=user_name,json=userName" json:"user_name,omitempty"` state protoimpl.MessageState
Password string `protobuf:"bytes,2,opt,name=password" json:"password,omitempty"` sizeCache protoimpl.SizeCache
ClientId string `protobuf:"bytes,3,opt,name=client_id,json=clientId" json:"client_id,omitempty"` unknownFields protoimpl.UnknownFields
UserName string `protobuf:"bytes,1,opt,name=user_name,json=userName,proto3" json:"user_name,omitempty"`
Password string `protobuf:"bytes,2,opt,name=password,proto3" json:"password,omitempty"`
ClientId string `protobuf:"bytes,3,opt,name=client_id,json=clientId,proto3" json:"client_id,omitempty"`
}
func (x *LoginRequest) Reset() {
*x = LoginRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_auth_authentication_service_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *LoginRequest) String() string {
return protoimpl.X.MessageStringOf(x)
} }
func (m *LoginRequest) Reset() { *m = LoginRequest{} }
func (m *LoginRequest) String() string { return proto.CompactTextString(m) }
func (*LoginRequest) ProtoMessage() {} func (*LoginRequest) ProtoMessage() {}
func (*LoginRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }
func (m *LoginRequest) GetUserName() string { func (x *LoginRequest) ProtoReflect() protoreflect.Message {
if m != nil { mi := &file_auth_authentication_service_proto_msgTypes[0]
return m.UserName if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use LoginRequest.ProtoReflect.Descriptor instead.
func (*LoginRequest) Descriptor() ([]byte, []int) {
return file_auth_authentication_service_proto_rawDescGZIP(), []int{0}
}
func (x *LoginRequest) GetUserName() string {
if x != nil {
return x.UserName
} }
return "" return ""
} }
func (m *LoginRequest) GetPassword() string { func (x *LoginRequest) GetPassword() string {
if m != nil { if x != nil {
return m.Password return x.Password
} }
return "" return ""
} }
func (m *LoginRequest) GetClientId() string { func (x *LoginRequest) GetClientId() string {
if m != nil { if x != nil {
return m.ClientId return x.ClientId
} }
return "" return ""
} }
//
// The response message containing the result of login attempt. // The response message containing the result of login attempt.
// result value of true indicates success and false indicates // result value of true indicates success and false indicates
// failure // failure
type LoginReply struct { type LoginReply struct {
Result bool `protobuf:"varint,1,opt,name=result" json:"result,omitempty"` state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Result bool `protobuf:"varint,1,opt,name=result,proto3" json:"result,omitempty"`
} }
func (m *LoginReply) Reset() { *m = LoginReply{} } func (x *LoginReply) Reset() {
func (m *LoginReply) String() string { return proto.CompactTextString(m) } *x = LoginReply{}
func (*LoginReply) ProtoMessage() {} if protoimpl.UnsafeEnabled {
func (*LoginReply) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} } mi := &file_auth_authentication_service_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (m *LoginReply) GetResult() bool { func (x *LoginReply) String() string {
if m != nil { return protoimpl.X.MessageStringOf(x)
return m.Result }
func (*LoginReply) ProtoMessage() {}
func (x *LoginReply) ProtoReflect() protoreflect.Message {
mi := &file_auth_authentication_service_proto_msgTypes[1]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use LoginReply.ProtoReflect.Descriptor instead.
func (*LoginReply) Descriptor() ([]byte, []int) {
return file_auth_authentication_service_proto_rawDescGZIP(), []int{1}
}
func (x *LoginReply) GetResult() bool {
if x != nil {
return x.Result
} }
return false return false
} }
func init() { var File_auth_authentication_service_proto protoreflect.FileDescriptor
proto.RegisterType((*LoginRequest)(nil), "authentication.LoginRequest")
proto.RegisterType((*LoginReply)(nil), "authentication.LoginReply") var file_auth_authentication_service_proto_rawDesc = []byte{
0x0a, 0x21, 0x61, 0x75, 0x74, 0x68, 0x2f, 0x61, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63,
0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x70, 0x72,
0x6f, 0x74, 0x6f, 0x12, 0x0e, 0x61, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74,
0x69, 0x6f, 0x6e, 0x22, 0x64, 0x0a, 0x0c, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x71, 0x75,
0x65, 0x73, 0x74, 0x12, 0x1b, 0x0a, 0x09, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x6e, 0x61, 0x6d, 0x65,
0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x75, 0x73, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65,
0x12, 0x1a, 0x0a, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x18, 0x02, 0x20, 0x01,
0x28, 0x09, 0x52, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x12, 0x1b, 0x0a, 0x09,
0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52,
0x08, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x22, 0x24, 0x0a, 0x0a, 0x4c, 0x6f, 0x67,
0x69, 0x6e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x16, 0x0a, 0x06, 0x72, 0x65, 0x73, 0x75, 0x6c,
0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x32,
0x51, 0x0a, 0x05, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x12, 0x48, 0x0a, 0x0a, 0x4c, 0x6f, 0x67, 0x69,
0x6e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x12, 0x1c, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74,
0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x71,
0x75, 0x65, 0x73, 0x74, 0x1a, 0x1a, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63,
0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x70, 0x6c, 0x79,
0x22, 0x00, 0x42, 0x12, 0x5a, 0x10, 0x2e, 0x3b, 0x61, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69,
0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
} }
// Reference imports to suppress errors if they are not otherwise used. var (
var _ context.Context file_auth_authentication_service_proto_rawDescOnce sync.Once
var _ grpc.ClientConn file_auth_authentication_service_proto_rawDescData = file_auth_authentication_service_proto_rawDesc
)
// This is a compile-time assertion to ensure that this generated file func file_auth_authentication_service_proto_rawDescGZIP() []byte {
// is compatible with the grpc package it is being compiled against. file_auth_authentication_service_proto_rawDescOnce.Do(func() {
const _ = grpc.SupportPackageIsVersion4 file_auth_authentication_service_proto_rawDescData = protoimpl.X.CompressGZIP(file_auth_authentication_service_proto_rawDescData)
})
// Client API for Login service return file_auth_authentication_service_proto_rawDescData
type LoginClient interface {
LoginCheck(ctx context.Context, in *LoginRequest, opts ...grpc.CallOption) (*LoginReply, error)
} }
type loginClient struct { var file_auth_authentication_service_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
cc *grpc.ClientConn var file_auth_authentication_service_proto_goTypes = []interface{}{
(*LoginRequest)(nil), // 0: authentication.LoginRequest
(*LoginReply)(nil), // 1: authentication.LoginReply
}
var file_auth_authentication_service_proto_depIdxs = []int32{
0, // 0: authentication.Login.LoginCheck:input_type -> authentication.LoginRequest
1, // 1: authentication.Login.LoginCheck:output_type -> authentication.LoginReply
1, // [1:2] is the sub-list for method output_type
0, // [0:1] is the sub-list for method input_type
0, // [0:0] is the sub-list for extension type_name
0, // [0:0] is the sub-list for extension extendee
0, // [0:0] is the sub-list for field type_name
} }
func NewLoginClient(cc *grpc.ClientConn) LoginClient { func init() { file_auth_authentication_service_proto_init() }
return &loginClient{cc} func file_auth_authentication_service_proto_init() {
} if File_auth_authentication_service_proto != nil {
return
func (c *loginClient) LoginCheck(ctx context.Context, in *LoginRequest, opts ...grpc.CallOption) (*LoginReply, error) {
out := new(LoginReply)
err := grpc.Invoke(ctx, "/authentication.Login/LoginCheck", in, out, c.cc, opts...)
if err != nil {
return nil, err
} }
return out, nil if !protoimpl.UnsafeEnabled {
} file_auth_authentication_service_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*LoginRequest); i {
// Server API for Login service case 0:
return &v.state
type LoginServer interface { case 1:
LoginCheck(context.Context, *LoginRequest) (*LoginReply, error) return &v.sizeCache
} case 2:
return &v.unknownFields
func RegisterLoginServer(s *grpc.Server, srv LoginServer) { default:
s.RegisterService(&_Login_serviceDesc, srv) return nil
}
func _Login_LoginCheck_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(LoginRequest)
if err := dec(in); err != nil {
return nil, err
} }
if interceptor == nil {
return srv.(LoginServer).LoginCheck(ctx, in)
} }
info := &grpc.UnaryServerInfo{ file_auth_authentication_service_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
Server: srv, switch v := v.(*LoginReply); i {
FullMethod: "/authentication.Login/LoginCheck", case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
} }
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(LoginServer).LoginCheck(ctx, req.(*LoginRequest))
} }
return interceptor(ctx, in, info, handler) }
} type x struct{}
out := protoimpl.TypeBuilder{
var _Login_serviceDesc = grpc.ServiceDesc{ File: protoimpl.DescBuilder{
ServiceName: "authentication.Login", GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
HandlerType: (*LoginServer)(nil), RawDescriptor: file_auth_authentication_service_proto_rawDesc,
Methods: []grpc.MethodDesc{ NumEnums: 0,
{ NumMessages: 2,
MethodName: "LoginCheck", NumExtensions: 0,
Handler: _Login_LoginCheck_Handler, NumServices: 1,
}, },
}, GoTypes: file_auth_authentication_service_proto_goTypes,
Streams: []grpc.StreamDesc{}, DependencyIndexes: file_auth_authentication_service_proto_depIdxs,
Metadata: "authentication_service.proto", MessageInfos: file_auth_authentication_service_proto_msgTypes,
} }.Build()
File_auth_authentication_service_proto = out.File
func init() { proto.RegisterFile("authentication_service.proto", fileDescriptor0) } file_auth_authentication_service_proto_rawDesc = nil
file_auth_authentication_service_proto_goTypes = nil
var fileDescriptor0 = []byte{ file_auth_authentication_service_proto_depIdxs = nil
// 200 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x49, 0x2c, 0x2d, 0xc9,
0x48, 0xcd, 0x2b, 0xc9, 0x4c, 0x4e, 0x2c, 0xc9, 0xcc, 0xcf, 0x8b, 0x2f, 0x4e, 0x2d, 0x2a, 0xcb,
0x4c, 0x4e, 0xd5, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x43, 0x95, 0x55, 0x4a, 0xe1, 0xe2,
0xf1, 0xc9, 0x4f, 0xcf, 0xcc, 0x0b, 0x4a, 0x2d, 0x2c, 0x4d, 0x2d, 0x2e, 0x11, 0x92, 0xe6, 0xe2,
0x2c, 0x2d, 0x4e, 0x2d, 0x8a, 0xcf, 0x4b, 0xcc, 0x4d, 0x95, 0x60, 0x54, 0x60, 0xd4, 0xe0, 0x0c,
0xe2, 0x00, 0x09, 0xf8, 0x25, 0xe6, 0xa6, 0x0a, 0x49, 0x71, 0x71, 0x14, 0x24, 0x16, 0x17, 0x97,
0xe7, 0x17, 0xa5, 0x48, 0x30, 0x41, 0xe4, 0x60, 0x7c, 0x90, 0xc6, 0xe4, 0x9c, 0xcc, 0xd4, 0xbc,
0x92, 0xf8, 0xcc, 0x14, 0x09, 0x66, 0x88, 0x24, 0x44, 0xc0, 0x33, 0x45, 0x49, 0x85, 0x8b, 0x0b,
0x6a, 0x4b, 0x41, 0x4e, 0xa5, 0x90, 0x18, 0x17, 0x5b, 0x51, 0x6a, 0x71, 0x69, 0x4e, 0x09, 0xd8,
0x02, 0x8e, 0x20, 0x28, 0xcf, 0x28, 0x90, 0x8b, 0x15, 0xac, 0x4a, 0xc8, 0x03, 0xaa, 0xdc, 0x39,
0x23, 0x35, 0x39, 0x5b, 0x48, 0x46, 0x0f, 0xd5, 0xcd, 0x7a, 0xc8, 0x0e, 0x96, 0x92, 0xc2, 0x21,
0x5b, 0x90, 0x53, 0xa9, 0xc4, 0x90, 0xc4, 0x06, 0xf6, 0xb5, 0x31, 0x20, 0x00, 0x00, 0xff, 0xff,
0x11, 0x57, 0x52, 0xd2, 0x15, 0x01, 0x00, 0x00,
} }

View File

@ -25,6 +25,7 @@
syntax = "proto3"; syntax = "proto3";
package authentication; package authentication;
option go_package = ".;authentication";
// The Login service definition. // The Login service definition.
service Login { service Login {

View File

@ -0,0 +1,101 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
package authentication
import (
context "context"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
)
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
// Requires gRPC-Go v1.32.0 or later.
const _ = grpc.SupportPackageIsVersion7
// LoginClient is the client API for Login service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
type LoginClient interface {
LoginCheck(ctx context.Context, in *LoginRequest, opts ...grpc.CallOption) (*LoginReply, error)
}
type loginClient struct {
cc grpc.ClientConnInterface
}
func NewLoginClient(cc grpc.ClientConnInterface) LoginClient {
return &loginClient{cc}
}
func (c *loginClient) LoginCheck(ctx context.Context, in *LoginRequest, opts ...grpc.CallOption) (*LoginReply, error) {
out := new(LoginReply)
err := c.cc.Invoke(ctx, "/authentication.Login/LoginCheck", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// LoginServer is the server API for Login service.
// All implementations must embed UnimplementedLoginServer
// for forward compatibility
type LoginServer interface {
LoginCheck(context.Context, *LoginRequest) (*LoginReply, error)
mustEmbedUnimplementedLoginServer()
}
// UnimplementedLoginServer must be embedded to have forward compatible implementations.
type UnimplementedLoginServer struct {
}
func (UnimplementedLoginServer) LoginCheck(context.Context, *LoginRequest) (*LoginReply, error) {
return nil, status.Errorf(codes.Unimplemented, "method LoginCheck not implemented")
}
func (UnimplementedLoginServer) mustEmbedUnimplementedLoginServer() {}
// UnsafeLoginServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to LoginServer will
// result in compilation errors.
type UnsafeLoginServer interface {
mustEmbedUnimplementedLoginServer()
}
func RegisterLoginServer(s grpc.ServiceRegistrar, srv LoginServer) {
s.RegisterService(&Login_ServiceDesc, srv)
}
func _Login_LoginCheck_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(LoginRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(LoginServer).LoginCheck(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/authentication.Login/LoginCheck",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(LoginServer).LoginCheck(ctx, req.(*LoginRequest))
}
return interceptor(ctx, in, info, handler)
}
// Login_ServiceDesc is the grpc.ServiceDesc for Login service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var Login_ServiceDesc = grpc.ServiceDesc{
ServiceName: "authentication.Login",
HandlerType: (*LoginServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "LoginCheck",
Handler: _Login_LoginCheck_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "auth/authentication_service.proto",
}

View File

@ -0,0 +1,11 @@
package jti_openconfig_telemetry
// To run these commands, make sure that protoc-gen-go and protoc-gen-go-grpc are installed
// > go install google.golang.org/protobuf/cmd/protoc-gen-go
// > go install google.golang.org/grpc/cmd/protoc-gen-go-grpc
//
// Generated files were last generated with:
// - protoc-gen-go: v1.27.1
// - protoc-gen-go-grpc: v1.1.0
//go:generate protoc --go_out=auth/ --go-grpc_out=auth/ auth/authentication_service.proto
//go:generate protoc --go_out=oc/ --go-grpc_out=oc/ oc/oc.proto

File diff suppressed because it is too large Load Diff

View File

@ -36,6 +36,7 @@
syntax = "proto3"; syntax = "proto3";
package telemetry; package telemetry;
option go_package = ".;telemetry";
// Interface exported by Agent // Interface exported by Agent
service OpenConfigTelemetry { service OpenConfigTelemetry {

View File

@ -0,0 +1,293 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
package telemetry
import (
context "context"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
)
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
// Requires gRPC-Go v1.32.0 or later.
const _ = grpc.SupportPackageIsVersion7
// OpenConfigTelemetryClient is the client API for OpenConfigTelemetry service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
type OpenConfigTelemetryClient interface {
// Request an inline subscription for data at the specified path.
// The device should send telemetry data back on the same
// connection as the subscription request.
TelemetrySubscribe(ctx context.Context, in *SubscriptionRequest, opts ...grpc.CallOption) (OpenConfigTelemetry_TelemetrySubscribeClient, error)
// Terminates and removes an existing telemetry subscription
CancelTelemetrySubscription(ctx context.Context, in *CancelSubscriptionRequest, opts ...grpc.CallOption) (*CancelSubscriptionReply, error)
// Get the list of current telemetry subscriptions from the
// target. This command returns a list of existing subscriptions
// not including those that are established via configuration.
GetTelemetrySubscriptions(ctx context.Context, in *GetSubscriptionsRequest, opts ...grpc.CallOption) (*GetSubscriptionsReply, error)
// Get Telemetry Agent Operational States
GetTelemetryOperationalState(ctx context.Context, in *GetOperationalStateRequest, opts ...grpc.CallOption) (*GetOperationalStateReply, error)
// Return the set of data encodings supported by the device for
// telemetry data
GetDataEncodings(ctx context.Context, in *DataEncodingRequest, opts ...grpc.CallOption) (*DataEncodingReply, error)
}
type openConfigTelemetryClient struct {
cc grpc.ClientConnInterface
}
func NewOpenConfigTelemetryClient(cc grpc.ClientConnInterface) OpenConfigTelemetryClient {
return &openConfigTelemetryClient{cc}
}
func (c *openConfigTelemetryClient) TelemetrySubscribe(ctx context.Context, in *SubscriptionRequest, opts ...grpc.CallOption) (OpenConfigTelemetry_TelemetrySubscribeClient, error) {
stream, err := c.cc.NewStream(ctx, &OpenConfigTelemetry_ServiceDesc.Streams[0], "/telemetry.OpenConfigTelemetry/telemetrySubscribe", opts...)
if err != nil {
return nil, err
}
x := &openConfigTelemetryTelemetrySubscribeClient{stream}
if err := x.ClientStream.SendMsg(in); err != nil {
return nil, err
}
if err := x.ClientStream.CloseSend(); err != nil {
return nil, err
}
return x, nil
}
type OpenConfigTelemetry_TelemetrySubscribeClient interface {
Recv() (*OpenConfigData, error)
grpc.ClientStream
}
type openConfigTelemetryTelemetrySubscribeClient struct {
grpc.ClientStream
}
func (x *openConfigTelemetryTelemetrySubscribeClient) Recv() (*OpenConfigData, error) {
m := new(OpenConfigData)
if err := x.ClientStream.RecvMsg(m); err != nil {
return nil, err
}
return m, nil
}
func (c *openConfigTelemetryClient) CancelTelemetrySubscription(ctx context.Context, in *CancelSubscriptionRequest, opts ...grpc.CallOption) (*CancelSubscriptionReply, error) {
out := new(CancelSubscriptionReply)
err := c.cc.Invoke(ctx, "/telemetry.OpenConfigTelemetry/cancelTelemetrySubscription", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *openConfigTelemetryClient) GetTelemetrySubscriptions(ctx context.Context, in *GetSubscriptionsRequest, opts ...grpc.CallOption) (*GetSubscriptionsReply, error) {
out := new(GetSubscriptionsReply)
err := c.cc.Invoke(ctx, "/telemetry.OpenConfigTelemetry/getTelemetrySubscriptions", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *openConfigTelemetryClient) GetTelemetryOperationalState(ctx context.Context, in *GetOperationalStateRequest, opts ...grpc.CallOption) (*GetOperationalStateReply, error) {
out := new(GetOperationalStateReply)
err := c.cc.Invoke(ctx, "/telemetry.OpenConfigTelemetry/getTelemetryOperationalState", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *openConfigTelemetryClient) GetDataEncodings(ctx context.Context, in *DataEncodingRequest, opts ...grpc.CallOption) (*DataEncodingReply, error) {
out := new(DataEncodingReply)
err := c.cc.Invoke(ctx, "/telemetry.OpenConfigTelemetry/getDataEncodings", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// OpenConfigTelemetryServer is the server API for OpenConfigTelemetry service.
// All implementations must embed UnimplementedOpenConfigTelemetryServer
// for forward compatibility
type OpenConfigTelemetryServer interface {
// Request an inline subscription for data at the specified path.
// The device should send telemetry data back on the same
// connection as the subscription request.
TelemetrySubscribe(*SubscriptionRequest, OpenConfigTelemetry_TelemetrySubscribeServer) error
// Terminates and removes an existing telemetry subscription
CancelTelemetrySubscription(context.Context, *CancelSubscriptionRequest) (*CancelSubscriptionReply, error)
// Get the list of current telemetry subscriptions from the
// target. This command returns a list of existing subscriptions
// not including those that are established via configuration.
GetTelemetrySubscriptions(context.Context, *GetSubscriptionsRequest) (*GetSubscriptionsReply, error)
// Get Telemetry Agent Operational States
GetTelemetryOperationalState(context.Context, *GetOperationalStateRequest) (*GetOperationalStateReply, error)
// Return the set of data encodings supported by the device for
// telemetry data
GetDataEncodings(context.Context, *DataEncodingRequest) (*DataEncodingReply, error)
mustEmbedUnimplementedOpenConfigTelemetryServer()
}
// UnimplementedOpenConfigTelemetryServer must be embedded to have forward compatible implementations.
type UnimplementedOpenConfigTelemetryServer struct {
}
func (UnimplementedOpenConfigTelemetryServer) TelemetrySubscribe(*SubscriptionRequest, OpenConfigTelemetry_TelemetrySubscribeServer) error {
return status.Errorf(codes.Unimplemented, "method TelemetrySubscribe not implemented")
}
func (UnimplementedOpenConfigTelemetryServer) CancelTelemetrySubscription(context.Context, *CancelSubscriptionRequest) (*CancelSubscriptionReply, error) {
return nil, status.Errorf(codes.Unimplemented, "method CancelTelemetrySubscription not implemented")
}
func (UnimplementedOpenConfigTelemetryServer) GetTelemetrySubscriptions(context.Context, *GetSubscriptionsRequest) (*GetSubscriptionsReply, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetTelemetrySubscriptions not implemented")
}
func (UnimplementedOpenConfigTelemetryServer) GetTelemetryOperationalState(context.Context, *GetOperationalStateRequest) (*GetOperationalStateReply, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetTelemetryOperationalState not implemented")
}
func (UnimplementedOpenConfigTelemetryServer) GetDataEncodings(context.Context, *DataEncodingRequest) (*DataEncodingReply, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetDataEncodings not implemented")
}
func (UnimplementedOpenConfigTelemetryServer) mustEmbedUnimplementedOpenConfigTelemetryServer() {}
// UnsafeOpenConfigTelemetryServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to OpenConfigTelemetryServer will
// result in compilation errors.
type UnsafeOpenConfigTelemetryServer interface {
mustEmbedUnimplementedOpenConfigTelemetryServer()
}
func RegisterOpenConfigTelemetryServer(s grpc.ServiceRegistrar, srv OpenConfigTelemetryServer) {
s.RegisterService(&OpenConfigTelemetry_ServiceDesc, srv)
}
func _OpenConfigTelemetry_TelemetrySubscribe_Handler(srv interface{}, stream grpc.ServerStream) error {
m := new(SubscriptionRequest)
if err := stream.RecvMsg(m); err != nil {
return err
}
return srv.(OpenConfigTelemetryServer).TelemetrySubscribe(m, &openConfigTelemetryTelemetrySubscribeServer{stream})
}
type OpenConfigTelemetry_TelemetrySubscribeServer interface {
Send(*OpenConfigData) error
grpc.ServerStream
}
type openConfigTelemetryTelemetrySubscribeServer struct {
grpc.ServerStream
}
func (x *openConfigTelemetryTelemetrySubscribeServer) Send(m *OpenConfigData) error {
return x.ServerStream.SendMsg(m)
}
func _OpenConfigTelemetry_CancelTelemetrySubscription_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(CancelSubscriptionRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(OpenConfigTelemetryServer).CancelTelemetrySubscription(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/telemetry.OpenConfigTelemetry/cancelTelemetrySubscription",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(OpenConfigTelemetryServer).CancelTelemetrySubscription(ctx, req.(*CancelSubscriptionRequest))
}
return interceptor(ctx, in, info, handler)
}
func _OpenConfigTelemetry_GetTelemetrySubscriptions_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GetSubscriptionsRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(OpenConfigTelemetryServer).GetTelemetrySubscriptions(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/telemetry.OpenConfigTelemetry/getTelemetrySubscriptions",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(OpenConfigTelemetryServer).GetTelemetrySubscriptions(ctx, req.(*GetSubscriptionsRequest))
}
return interceptor(ctx, in, info, handler)
}
func _OpenConfigTelemetry_GetTelemetryOperationalState_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GetOperationalStateRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(OpenConfigTelemetryServer).GetTelemetryOperationalState(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/telemetry.OpenConfigTelemetry/getTelemetryOperationalState",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(OpenConfigTelemetryServer).GetTelemetryOperationalState(ctx, req.(*GetOperationalStateRequest))
}
return interceptor(ctx, in, info, handler)
}
func _OpenConfigTelemetry_GetDataEncodings_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(DataEncodingRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(OpenConfigTelemetryServer).GetDataEncodings(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/telemetry.OpenConfigTelemetry/getDataEncodings",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(OpenConfigTelemetryServer).GetDataEncodings(ctx, req.(*DataEncodingRequest))
}
return interceptor(ctx, in, info, handler)
}
// OpenConfigTelemetry_ServiceDesc is the grpc.ServiceDesc for OpenConfigTelemetry service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var OpenConfigTelemetry_ServiceDesc = grpc.ServiceDesc{
ServiceName: "telemetry.OpenConfigTelemetry",
HandlerType: (*OpenConfigTelemetryServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "cancelTelemetrySubscription",
Handler: _OpenConfigTelemetry_CancelTelemetrySubscription_Handler,
},
{
MethodName: "getTelemetrySubscriptions",
Handler: _OpenConfigTelemetry_GetTelemetrySubscriptions_Handler,
},
{
MethodName: "getTelemetryOperationalState",
Handler: _OpenConfigTelemetry_GetTelemetryOperationalState_Handler,
},
{
MethodName: "getDataEncodings",
Handler: _OpenConfigTelemetry_GetDataEncodings_Handler,
},
},
Streams: []grpc.StreamDesc{
{
StreamName: "telemetrySubscribe",
Handler: _OpenConfigTelemetry_TelemetrySubscribe_Handler,
ServerStreams: true,
},
},
Metadata: "oc/oc.proto",
}

View File

@ -47,6 +47,7 @@ var dataWithStringValues = &telemetry.OpenConfigData{
} }
type openConfigTelemetryServer struct { type openConfigTelemetryServer struct {
telemetry.UnimplementedOpenConfigTelemetryServer
} }
func (s *openConfigTelemetryServer) TelemetrySubscribe(req *telemetry.SubscriptionRequest, stream telemetry.OpenConfigTelemetry_TelemetrySubscribeServer) error { func (s *openConfigTelemetryServer) TelemetrySubscribe(req *telemetry.SubscriptionRequest, stream telemetry.OpenConfigTelemetry_TelemetrySubscribeServer) error {

View File

@ -15,15 +15,15 @@ import (
"sync" "sync"
"time" "time"
"github.com/influxdata/telegraf/metric"
"github.com/gogo/protobuf/proto"
"github.com/influxdata/telegraf"
"github.com/influxdata/telegraf/config"
tlsint "github.com/influxdata/telegraf/plugins/common/tls"
"github.com/influxdata/telegraf/plugins/inputs"
riemanngo "github.com/riemann/riemann-go-client" riemanngo "github.com/riemann/riemann-go-client"
riemangoProto "github.com/riemann/riemann-go-client/proto" riemangoProto "github.com/riemann/riemann-go-client/proto"
"google.golang.org/protobuf/proto"
"github.com/influxdata/telegraf"
"github.com/influxdata/telegraf/config"
"github.com/influxdata/telegraf/metric"
tlsint "github.com/influxdata/telegraf/plugins/common/tls"
"github.com/influxdata/telegraf/plugins/inputs"
) )
type RiemannSocketListener struct { type RiemannSocketListener struct {

View File

@ -5,11 +5,12 @@ import (
"testing" "testing"
"time" "time"
"github.com/influxdata/telegraf/config"
"github.com/influxdata/telegraf/testutil"
riemanngo "github.com/riemann/riemann-go-client" riemanngo "github.com/riemann/riemann-go-client"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
"gotest.tools/assert" "gotest.tools/assert"
"github.com/influxdata/telegraf/config"
"github.com/influxdata/telegraf/testutil"
) )
func TestSocketListener_tcp(t *testing.T) { func TestSocketListener_tcp(t *testing.T) {

View File

@ -10,8 +10,6 @@ import (
"time" "time"
monitoring "cloud.google.com/go/monitoring/apiv3/v2" monitoring "cloud.google.com/go/monitoring/apiv3/v2"
googlepbduration "github.com/golang/protobuf/ptypes/duration"
googlepbts "github.com/golang/protobuf/ptypes/timestamp"
"github.com/influxdata/telegraf" "github.com/influxdata/telegraf"
"github.com/influxdata/telegraf/config" "github.com/influxdata/telegraf/config"
"github.com/influxdata/telegraf/internal/limiter" "github.com/influxdata/telegraf/internal/limiter"
@ -22,6 +20,8 @@ import (
distributionpb "google.golang.org/genproto/googleapis/api/distribution" distributionpb "google.golang.org/genproto/googleapis/api/distribution"
metricpb "google.golang.org/genproto/googleapis/api/metric" metricpb "google.golang.org/genproto/googleapis/api/metric"
monitoringpb "google.golang.org/genproto/googleapis/monitoring/v3" monitoringpb "google.golang.org/genproto/googleapis/monitoring/v3"
"google.golang.org/protobuf/types/known/durationpb"
"google.golang.org/protobuf/types/known/timestamppb"
) )
const ( const (
@ -393,8 +393,8 @@ func (s *Stackdriver) newTimeSeriesConf(
) *timeSeriesConf { ) *timeSeriesConf {
filter := s.newListTimeSeriesFilter(metricType) filter := s.newListTimeSeriesFilter(metricType)
interval := &monitoringpb.TimeInterval{ interval := &monitoringpb.TimeInterval{
EndTime: &googlepbts.Timestamp{Seconds: endTime.Unix()}, EndTime: &timestamppb.Timestamp{Seconds: endTime.Unix()},
StartTime: &googlepbts.Timestamp{Seconds: startTime.Unix()}, StartTime: &timestamppb.Timestamp{Seconds: startTime.Unix()},
} }
tsReq := &monitoringpb.ListTimeSeriesRequest{ tsReq := &monitoringpb.ListTimeSeriesRequest{
Name: fmt.Sprintf("projects/%s", s.Project), Name: fmt.Sprintf("projects/%s", s.Project),
@ -432,7 +432,7 @@ func (t *timeSeriesConf) initForAggregate(alignerStr string) {
} }
aligner := monitoringpb.Aggregation_Aligner(alignerInt) aligner := monitoringpb.Aggregation_Aligner(alignerInt)
agg := &monitoringpb.Aggregation{ agg := &monitoringpb.Aggregation{
AlignmentPeriod: &googlepbduration.Duration{Seconds: 60}, AlignmentPeriod: &durationpb.Duration{Seconds: 60},
PerSeriesAligner: aligner, PerSeriesAligner: aligner,
} }
t.fieldKey = t.fieldKey + "_" + strings.ToLower(alignerStr) t.fieldKey = t.fieldKey + "_" + strings.ToLower(alignerStr)
@ -522,8 +522,8 @@ func (s *Stackdriver) generatetimeSeriesConfs(
if s.timeSeriesConfCache != nil && s.timeSeriesConfCache.IsValid() { if s.timeSeriesConfCache != nil && s.timeSeriesConfCache.IsValid() {
// Update interval for timeseries requests in timeseries cache // Update interval for timeseries requests in timeseries cache
interval := &monitoringpb.TimeInterval{ interval := &monitoringpb.TimeInterval{
EndTime: &googlepbts.Timestamp{Seconds: endTime.Unix()}, EndTime: &timestamppb.Timestamp{Seconds: endTime.Unix()},
StartTime: &googlepbts.Timestamp{Seconds: startTime.Unix()}, StartTime: &timestamppb.Timestamp{Seconds: startTime.Unix()},
} }
for _, timeSeriesConf := range s.timeSeriesConfCache.TimeSeriesConfs { for _, timeSeriesConf := range s.timeSeriesConfCache.TimeSeriesConfs {
timeSeriesConf.listTimeSeriesRequest.Interval = interval timeSeriesConf.listTimeSeriesRequest.Interval = interval

View File

@ -6,7 +6,6 @@ import (
"testing" "testing"
"time" "time"
"github.com/golang/protobuf/ptypes/timestamp"
"github.com/influxdata/telegraf" "github.com/influxdata/telegraf"
"github.com/influxdata/telegraf/plugins/inputs" "github.com/influxdata/telegraf/plugins/inputs"
"github.com/influxdata/telegraf/testutil" "github.com/influxdata/telegraf/testutil"
@ -15,6 +14,7 @@ import (
metricpb "google.golang.org/genproto/googleapis/api/metric" metricpb "google.golang.org/genproto/googleapis/api/metric"
"google.golang.org/genproto/googleapis/api/monitoredres" "google.golang.org/genproto/googleapis/api/monitoredres"
monitoringpb "google.golang.org/genproto/googleapis/monitoring/v3" monitoringpb "google.golang.org/genproto/googleapis/monitoring/v3"
"google.golang.org/protobuf/types/known/timestamppb"
) )
type Call struct { type Call struct {
@ -105,7 +105,7 @@ func TestGather(t *testing.T) {
timeseries: createTimeSeries( timeseries: createTimeSeries(
&monitoringpb.Point{ &monitoringpb.Point{
Interval: &monitoringpb.TimeInterval{ Interval: &monitoringpb.TimeInterval{
EndTime: &timestamp.Timestamp{ EndTime: &timestamppb.Timestamp{
Seconds: now.Unix(), Seconds: now.Unix(),
}, },
}, },
@ -138,7 +138,7 @@ func TestGather(t *testing.T) {
timeseries: createTimeSeries( timeseries: createTimeSeries(
&monitoringpb.Point{ &monitoringpb.Point{
Interval: &monitoringpb.TimeInterval{ Interval: &monitoringpb.TimeInterval{
EndTime: &timestamp.Timestamp{ EndTime: &timestamppb.Timestamp{
Seconds: now.Unix(), Seconds: now.Unix(),
}, },
}, },
@ -171,7 +171,7 @@ func TestGather(t *testing.T) {
timeseries: createTimeSeries( timeseries: createTimeSeries(
&monitoringpb.Point{ &monitoringpb.Point{
Interval: &monitoringpb.TimeInterval{ Interval: &monitoringpb.TimeInterval{
EndTime: &timestamp.Timestamp{ EndTime: &timestamppb.Timestamp{
Seconds: now.Unix(), Seconds: now.Unix(),
}, },
}, },
@ -204,7 +204,7 @@ func TestGather(t *testing.T) {
timeseries: createTimeSeries( timeseries: createTimeSeries(
&monitoringpb.Point{ &monitoringpb.Point{
Interval: &monitoringpb.TimeInterval{ Interval: &monitoringpb.TimeInterval{
EndTime: &timestamp.Timestamp{ EndTime: &timestamppb.Timestamp{
Seconds: now.Unix(), Seconds: now.Unix(),
}, },
}, },
@ -249,7 +249,7 @@ func TestGather(t *testing.T) {
Points: []*monitoringpb.Point{ Points: []*monitoringpb.Point{
{ {
Interval: &monitoringpb.TimeInterval{ Interval: &monitoringpb.TimeInterval{
EndTime: &timestamp.Timestamp{ EndTime: &timestamppb.Timestamp{
Seconds: now.Unix(), Seconds: now.Unix(),
}, },
}, },
@ -283,7 +283,7 @@ func TestGather(t *testing.T) {
timeseries: createTimeSeries( timeseries: createTimeSeries(
&monitoringpb.Point{ &monitoringpb.Point{
Interval: &monitoringpb.TimeInterval{ Interval: &monitoringpb.TimeInterval{
EndTime: &timestamp.Timestamp{ EndTime: &timestamppb.Timestamp{
Seconds: now.Unix(), Seconds: now.Unix(),
}, },
}, },
@ -378,7 +378,7 @@ func TestGather(t *testing.T) {
timeseries: createTimeSeries( timeseries: createTimeSeries(
&monitoringpb.Point{ &monitoringpb.Point{
Interval: &monitoringpb.TimeInterval{ Interval: &monitoringpb.TimeInterval{
EndTime: &timestamp.Timestamp{ EndTime: &timestamppb.Timestamp{
Seconds: now.Unix(), Seconds: now.Unix(),
}, },
}, },
@ -473,7 +473,7 @@ func TestGather(t *testing.T) {
timeseries: createTimeSeries( timeseries: createTimeSeries(
&monitoringpb.Point{ &monitoringpb.Point{
Interval: &monitoringpb.TimeInterval{ Interval: &monitoringpb.TimeInterval{
EndTime: &timestamp.Timestamp{ EndTime: &timestamppb.Timestamp{
Seconds: now.Unix(), Seconds: now.Unix(),
}, },
}, },
@ -556,7 +556,7 @@ func TestGather(t *testing.T) {
timeseries: createTimeSeries( timeseries: createTimeSeries(
&monitoringpb.Point{ &monitoringpb.Point{
Interval: &monitoringpb.TimeInterval{ Interval: &monitoringpb.TimeInterval{
EndTime: &timestamp.Timestamp{ EndTime: &timestamppb.Timestamp{
Seconds: now.Unix(), Seconds: now.Unix(),
}, },
}, },
@ -702,7 +702,7 @@ func TestGatherAlign(t *testing.T) {
createTimeSeries( createTimeSeries(
&monitoringpb.Point{ &monitoringpb.Point{
Interval: &monitoringpb.TimeInterval{ Interval: &monitoringpb.TimeInterval{
EndTime: &timestamp.Timestamp{ EndTime: &timestamppb.Timestamp{
Seconds: now.Unix(), Seconds: now.Unix(),
}, },
}, },
@ -717,7 +717,7 @@ func TestGatherAlign(t *testing.T) {
createTimeSeries( createTimeSeries(
&monitoringpb.Point{ &monitoringpb.Point{
Interval: &monitoringpb.TimeInterval{ Interval: &monitoringpb.TimeInterval{
EndTime: &timestamp.Timestamp{ EndTime: &timestamppb.Timestamp{
Seconds: now.Unix(), Seconds: now.Unix(),
}, },
}, },
@ -732,7 +732,7 @@ func TestGatherAlign(t *testing.T) {
createTimeSeries( createTimeSeries(
&monitoringpb.Point{ &monitoringpb.Point{
Interval: &monitoringpb.TimeInterval{ Interval: &monitoringpb.TimeInterval{
EndTime: &timestamp.Timestamp{ EndTime: &timestamppb.Timestamp{
Seconds: now.Unix(), Seconds: now.Unix(),
}, },
}, },
@ -1081,7 +1081,7 @@ func TestListMetricDescriptorFilter(t *testing.T) {
ch <- createTimeSeries( ch <- createTimeSeries(
&monitoringpb.Point{ &monitoringpb.Point{
Interval: &monitoringpb.TimeInterval{ Interval: &monitoringpb.TimeInterval{
EndTime: &timestamp.Timestamp{ EndTime: &timestamppb.Timestamp{
Seconds: now.Unix(), Seconds: now.Unix(),
}, },
}, },

View File

@ -10,7 +10,6 @@ import (
"strings" "strings"
monitoring "cloud.google.com/go/monitoring/apiv3/v2" // Imports the Stackdriver Monitoring client package. monitoring "cloud.google.com/go/monitoring/apiv3/v2" // Imports the Stackdriver Monitoring client package.
googlepb "github.com/golang/protobuf/ptypes/timestamp"
"github.com/influxdata/telegraf" "github.com/influxdata/telegraf"
"github.com/influxdata/telegraf/internal" "github.com/influxdata/telegraf/internal"
"github.com/influxdata/telegraf/plugins/outputs" "github.com/influxdata/telegraf/plugins/outputs"
@ -18,6 +17,7 @@ import (
metricpb "google.golang.org/genproto/googleapis/api/metric" metricpb "google.golang.org/genproto/googleapis/api/metric"
monitoredrespb "google.golang.org/genproto/googleapis/api/monitoredres" monitoredrespb "google.golang.org/genproto/googleapis/api/monitoredres"
monitoringpb "google.golang.org/genproto/googleapis/monitoring/v3" monitoringpb "google.golang.org/genproto/googleapis/monitoring/v3"
"google.golang.org/protobuf/types/known/timestamppb"
) )
// Stackdriver is the Google Stackdriver config info. // Stackdriver is the Google Stackdriver config info.
@ -247,16 +247,16 @@ func getStackdriverTimeInterval(
switch m { switch m {
case metricpb.MetricDescriptor_GAUGE: case metricpb.MetricDescriptor_GAUGE:
return &monitoringpb.TimeInterval{ return &monitoringpb.TimeInterval{
EndTime: &googlepb.Timestamp{ EndTime: &timestamppb.Timestamp{
Seconds: end, Seconds: end,
}, },
}, nil }, nil
case metricpb.MetricDescriptor_CUMULATIVE: case metricpb.MetricDescriptor_CUMULATIVE:
return &monitoringpb.TimeInterval{ return &monitoringpb.TimeInterval{
StartTime: &googlepb.Timestamp{ StartTime: &timestamppb.Timestamp{
Seconds: start, Seconds: start,
}, },
EndTime: &googlepb.Timestamp{ EndTime: &timestamppb.Timestamp{
Seconds: end, Seconds: end,
}, },
}, nil }, nil

View File

@ -12,9 +12,6 @@ import (
"time" "time"
monitoring "cloud.google.com/go/monitoring/apiv3/v2" monitoring "cloud.google.com/go/monitoring/apiv3/v2"
"github.com/golang/protobuf/proto"
emptypb "github.com/golang/protobuf/ptypes/empty"
googlepb "github.com/golang/protobuf/ptypes/timestamp"
"github.com/influxdata/telegraf" "github.com/influxdata/telegraf"
"github.com/influxdata/telegraf/testutil" "github.com/influxdata/telegraf/testutil"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
@ -22,6 +19,9 @@ import (
monitoringpb "google.golang.org/genproto/googleapis/monitoring/v3" monitoringpb "google.golang.org/genproto/googleapis/monitoring/v3"
"google.golang.org/grpc" "google.golang.org/grpc"
"google.golang.org/grpc/metadata" "google.golang.org/grpc/metadata"
"google.golang.org/protobuf/proto"
"google.golang.org/protobuf/types/known/emptypb"
"google.golang.org/protobuf/types/known/timestamppb"
) )
// clientOpt is the option tests should use to connect to the test server. // clientOpt is the option tests should use to connect to the test server.
@ -181,7 +181,7 @@ func TestWriteAscendingTime(t *testing.T) {
ts := request.TimeSeries[0] ts := request.TimeSeries[0]
require.Len(t, ts.Points, 1) require.Len(t, ts.Points, 1)
require.Equal(t, ts.Points[0].Interval, &monitoringpb.TimeInterval{ require.Equal(t, ts.Points[0].Interval, &monitoringpb.TimeInterval{
EndTime: &googlepb.Timestamp{ EndTime: &timestamppb.Timestamp{
Seconds: 1, Seconds: 1,
}, },
}) })
@ -196,7 +196,7 @@ func TestWriteAscendingTime(t *testing.T) {
ts = request.TimeSeries[0] ts = request.TimeSeries[0]
require.Len(t, ts.Points, 1) require.Len(t, ts.Points, 1)
require.Equal(t, ts.Points[0].Interval, &monitoringpb.TimeInterval{ require.Equal(t, ts.Points[0].Interval, &monitoringpb.TimeInterval{
EndTime: &googlepb.Timestamp{ EndTime: &timestamppb.Timestamp{
Seconds: 2, Seconds: 2,
}, },
}) })
@ -311,7 +311,7 @@ func TestWriteBatchable(t *testing.T) {
ts := request.TimeSeries[0] ts := request.TimeSeries[0]
require.Len(t, ts.Points, 1) require.Len(t, ts.Points, 1)
require.Equal(t, ts.Points[0].Interval, &monitoringpb.TimeInterval{ require.Equal(t, ts.Points[0].Interval, &monitoringpb.TimeInterval{
EndTime: &googlepb.Timestamp{ EndTime: &timestamppb.Timestamp{
Seconds: 3, Seconds: 3,
}, },
}) })
@ -324,7 +324,7 @@ func TestWriteBatchable(t *testing.T) {
ts = request.TimeSeries[1] ts = request.TimeSeries[1]
require.Len(t, ts.Points, 1) require.Len(t, ts.Points, 1)
require.Equal(t, ts.Points[0].Interval, &monitoringpb.TimeInterval{ require.Equal(t, ts.Points[0].Interval, &monitoringpb.TimeInterval{
EndTime: &googlepb.Timestamp{ EndTime: &timestamppb.Timestamp{
Seconds: 1, Seconds: 1,
}, },
}) })
@ -337,7 +337,7 @@ func TestWriteBatchable(t *testing.T) {
ts = request.TimeSeries[2] ts = request.TimeSeries[2]
require.Len(t, ts.Points, 1) require.Len(t, ts.Points, 1)
require.Equal(t, ts.Points[0].Interval, &monitoringpb.TimeInterval{ require.Equal(t, ts.Points[0].Interval, &monitoringpb.TimeInterval{
EndTime: &googlepb.Timestamp{ EndTime: &timestamppb.Timestamp{
Seconds: 3, Seconds: 3,
}, },
}) })
@ -350,7 +350,7 @@ func TestWriteBatchable(t *testing.T) {
ts = request.TimeSeries[4] ts = request.TimeSeries[4]
require.Len(t, ts.Points, 1) require.Len(t, ts.Points, 1)
require.Equal(t, ts.Points[0].Interval, &monitoringpb.TimeInterval{ require.Equal(t, ts.Points[0].Interval, &monitoringpb.TimeInterval{
EndTime: &googlepb.Timestamp{ EndTime: &timestamppb.Timestamp{
Seconds: 5, Seconds: 5,
}, },
}) })

View File

@ -8,7 +8,6 @@ import (
"github.com/influxdata/telegraf" "github.com/influxdata/telegraf"
"github.com/influxdata/telegraf/metric" "github.com/influxdata/telegraf/metric"
"github.com/gogo/protobuf/proto"
"github.com/prometheus/common/model" "github.com/prometheus/common/model"
"github.com/prometheus/prometheus/prompb" "github.com/prometheus/prometheus/prompb"
) )
@ -22,7 +21,7 @@ func (p *Parser) Parse(buf []byte) ([]telegraf.Metric, error) {
var metrics []telegraf.Metric var metrics []telegraf.Metric
var req prompb.WriteRequest var req prompb.WriteRequest
if err := proto.Unmarshal(buf, &req); err != nil { if err := req.Unmarshal(buf); err != nil {
return nil, fmt.Errorf("unable to unmarshal request body: %s", err) return nil, fmt.Errorf("unable to unmarshal request body: %s", err)
} }

View File

@ -7,9 +7,9 @@ import (
"strings" "strings"
"time" "time"
"github.com/gogo/protobuf/proto"
"github.com/influxdata/telegraf" "github.com/influxdata/telegraf"
dto "github.com/prometheus/client_model/go" dto "github.com/prometheus/client_model/go"
"google.golang.org/protobuf/proto"
) )
const helpString = "Telegraf collected metric" const helpString = "Telegraf collected metric"

View File

@ -5,11 +5,11 @@ import (
"testing" "testing"
"time" "time"
"github.com/gogo/protobuf/proto"
"github.com/influxdata/telegraf" "github.com/influxdata/telegraf"
"github.com/influxdata/telegraf/testutil" "github.com/influxdata/telegraf/testutil"
dto "github.com/prometheus/client_model/go" dto "github.com/prometheus/client_model/go"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
"google.golang.org/protobuf/proto"
) )
type Input struct { type Input struct {

View File

@ -9,7 +9,6 @@ import (
"strings" "strings"
"time" "time"
"github.com/gogo/protobuf/proto"
"github.com/golang/snappy" "github.com/golang/snappy"
"github.com/influxdata/telegraf/plugins/serializers/prometheus" "github.com/influxdata/telegraf/plugins/serializers/prometheus"
@ -236,7 +235,8 @@ func (s *Serializer) SerializeBatch(metrics []telegraf.Metric) ([]byte, error) {
return false return false
}) })
} }
data, err := proto.Marshal(&prompb.WriteRequest{Timeseries: promTS}) pb := &prompb.WriteRequest{Timeseries: promTS}
data, err := pb.Marshal()
if err != nil { if err != nil {
return nil, fmt.Errorf("unable to marshal protobuf: %v", err) return nil, fmt.Errorf("unable to marshal protobuf: %v", err)
} }

View File

@ -7,7 +7,6 @@ import (
"testing" "testing"
"time" "time"
"github.com/gogo/protobuf/proto"
"github.com/golang/snappy" "github.com/golang/snappy"
"github.com/prometheus/common/model" "github.com/prometheus/common/model"
"github.com/prometheus/prometheus/prompb" "github.com/prometheus/prometheus/prompb"
@ -664,7 +663,7 @@ func prompbToText(data []byte) ([]byte, error) {
return nil, err return nil, err
} }
var req prompb.WriteRequest var req prompb.WriteRequest
err = proto.Unmarshal(protobuff, &req) err = req.Unmarshal(protobuff)
if err != nil { if err != nil {
return nil, err return nil, err
} }