zero/connect: add telemetry request command (#5131)

* zero/connect: add telemetry request command

* rm relabeling
This commit is contained in:
Denis Mishin 2024-06-10 22:54:02 -04:00 committed by GitHub
parent 2b1dcf7355
commit e12532ba52
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 376 additions and 28 deletions

View file

@ -1,12 +1,17 @@
package mux package mux
import "context" import (
"context"
"github.com/pomerium/pomerium/pkg/zero/connect"
)
type config struct { type config struct {
onConnected func(ctx context.Context) onConnected func(ctx context.Context)
onDisconnected func(ctx context.Context) onDisconnected func(ctx context.Context)
onBundleUpdated func(ctx context.Context, key string) onBundleUpdated func(ctx context.Context, key string)
onBootstrapConfigUpdated func(ctx context.Context) onBootstrapConfigUpdated func(ctx context.Context)
onTelemetryRequested func(ctx context.Context, req *connect.TelemetryRequest)
} }
// WatchOption allows to specify callbacks for various events // WatchOption allows to specify callbacks for various events
@ -40,6 +45,12 @@ func WithOnBootstrapConfigUpdated(onBootstrapConfigUpdated func(context.Context)
} }
} }
func WithOnTelemetryRequested(onTelemetryRequested func(context.Context, *connect.TelemetryRequest)) WatchOption {
return func(cfg *config) {
cfg.onTelemetryRequested = onTelemetryRequested
}
}
func newConfig(opts ...WatchOption) *config { func newConfig(opts ...WatchOption) *config {
cfg := &config{} cfg := &config{}
for _, opt := range []WatchOption{ for _, opt := range []WatchOption{
@ -47,6 +58,7 @@ func newConfig(opts ...WatchOption) *config {
WithOnDisconnected(func(_ context.Context) {}), WithOnDisconnected(func(_ context.Context) {}),
WithOnBundleUpdated(func(_ context.Context, _ string) {}), WithOnBundleUpdated(func(_ context.Context, _ string) {}),
WithOnBootstrapConfigUpdated(func(_ context.Context) {}), WithOnBootstrapConfigUpdated(func(_ context.Context) {}),
WithOnTelemetryRequested(func(_ context.Context, _ *connect.TelemetryRequest) {}),
} { } {
opt(cfg) opt(cfg)
} }

View file

@ -48,6 +48,8 @@ func dispatch(ctx context.Context, cfg *config, msg message) error {
cfg.onBundleUpdated(ctx, "config") cfg.onBundleUpdated(ctx, "config")
case *connect.Message_BootstrapConfigUpdated: case *connect.Message_BootstrapConfigUpdated:
cfg.onBootstrapConfigUpdated(ctx) cfg.onBootstrapConfigUpdated(ctx)
case *connect.Message_TelemetryRequest:
cfg.onTelemetryRequested(ctx, msg.Message.GetTelemetryRequest())
default: default:
return fmt.Errorf("unknown message type") return fmt.Errorf("unknown message type")
} }

View file

@ -1,6 +1,6 @@
// Code generated by protoc-gen-go. DO NOT EDIT. // Code generated by protoc-gen-go. DO NOT EDIT.
// versions: // versions:
// protoc-gen-go v1.31.0 // protoc-gen-go v1.30.0
// protoc (unknown) // protoc (unknown)
// source: connect.proto // source: connect.proto
@ -74,6 +74,7 @@ type Message struct {
// //
// *Message_ConfigUpdated // *Message_ConfigUpdated
// *Message_BootstrapConfigUpdated // *Message_BootstrapConfigUpdated
// *Message_TelemetryRequest
Message isMessage_Message `protobuf_oneof:"message"` Message isMessage_Message `protobuf_oneof:"message"`
} }
@ -130,6 +131,13 @@ func (x *Message) GetBootstrapConfigUpdated() *BootstrapConfigUpdated {
return nil return nil
} }
func (x *Message) GetTelemetryRequest() *TelemetryRequest {
if x, ok := x.GetMessage().(*Message_TelemetryRequest); ok {
return x.TelemetryRequest
}
return nil
}
type isMessage_Message interface { type isMessage_Message interface {
isMessage_Message() isMessage_Message()
} }
@ -142,10 +150,16 @@ type Message_BootstrapConfigUpdated struct {
BootstrapConfigUpdated *BootstrapConfigUpdated `protobuf:"bytes,2,opt,name=bootstrap_config_updated,json=bootstrapConfigUpdated,proto3,oneof"` BootstrapConfigUpdated *BootstrapConfigUpdated `protobuf:"bytes,2,opt,name=bootstrap_config_updated,json=bootstrapConfigUpdated,proto3,oneof"`
} }
type Message_TelemetryRequest struct {
TelemetryRequest *TelemetryRequest `protobuf:"bytes,3,opt,name=telemetry_request,json=telemetryRequest,proto3,oneof"`
}
func (*Message_ConfigUpdated) isMessage_Message() {} func (*Message_ConfigUpdated) isMessage_Message() {}
func (*Message_BootstrapConfigUpdated) isMessage_Message() {} func (*Message_BootstrapConfigUpdated) isMessage_Message() {}
func (*Message_TelemetryRequest) isMessage_Message() {}
// ConfigUpdated is sent when the configuration has been updated // ConfigUpdated is sent when the configuration has been updated
// for the connected Pomerium Core deployment // for the connected Pomerium Core deployment
type ConfigUpdated struct { type ConfigUpdated struct {
@ -238,13 +252,216 @@ func (*BootstrapConfigUpdated) Descriptor() ([]byte, []int) {
return file_connect_proto_rawDescGZIP(), []int{3} return file_connect_proto_rawDescGZIP(), []int{3}
} }
// TelemetryRequest is sent to request current telemetry data from the Pomerium Core to be sent to the Zero Cloud.
type TelemetryRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
// include_session_analytics requests current MAU/DAU data
SessionAnalytics *SessionAnalyticsRequest `protobuf:"bytes,1,opt,name=session_analytics,json=sessionAnalytics,proto3,oneof" json:"session_analytics,omitempty"`
// envoy_metrics requests current envoy metrics
EnvoyMetrics *EnvoyMetricsRequest `protobuf:"bytes,2,opt,name=envoy_metrics,json=envoyMetrics,proto3,oneof" json:"envoy_metrics,omitempty"`
// pomerium_metrics requests current pomerium metrics
PomeriumMetrics *PomeriumMetricsRequest `protobuf:"bytes,3,opt,name=pomerium_metrics,json=pomeriumMetrics,proto3,oneof" json:"pomerium_metrics,omitempty"`
}
func (x *TelemetryRequest) Reset() {
*x = TelemetryRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_connect_proto_msgTypes[4]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *TelemetryRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*TelemetryRequest) ProtoMessage() {}
func (x *TelemetryRequest) ProtoReflect() protoreflect.Message {
mi := &file_connect_proto_msgTypes[4]
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 TelemetryRequest.ProtoReflect.Descriptor instead.
func (*TelemetryRequest) Descriptor() ([]byte, []int) {
return file_connect_proto_rawDescGZIP(), []int{4}
}
func (x *TelemetryRequest) GetSessionAnalytics() *SessionAnalyticsRequest {
if x != nil {
return x.SessionAnalytics
}
return nil
}
func (x *TelemetryRequest) GetEnvoyMetrics() *EnvoyMetricsRequest {
if x != nil {
return x.EnvoyMetrics
}
return nil
}
func (x *TelemetryRequest) GetPomeriumMetrics() *PomeriumMetricsRequest {
if x != nil {
return x.PomeriumMetrics
}
return nil
}
// SessionAnalyticsRequest is used to request current MAU/DAU data
type SessionAnalyticsRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
}
func (x *SessionAnalyticsRequest) Reset() {
*x = SessionAnalyticsRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_connect_proto_msgTypes[5]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *SessionAnalyticsRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*SessionAnalyticsRequest) ProtoMessage() {}
func (x *SessionAnalyticsRequest) ProtoReflect() protoreflect.Message {
mi := &file_connect_proto_msgTypes[5]
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 SessionAnalyticsRequest.ProtoReflect.Descriptor instead.
func (*SessionAnalyticsRequest) Descriptor() ([]byte, []int) {
return file_connect_proto_rawDescGZIP(), []int{5}
}
// EnvoyMetricsRequest is used to request current envoy metrics
type EnvoyMetricsRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
// only include metrics that match the provided labels, and relabel them with the provided labels
Metrics []string `protobuf:"bytes,1,rep,name=metrics,proto3" json:"metrics,omitempty"`
// only include labels that match the provided labels
Labels []string `protobuf:"bytes,2,rep,name=labels,proto3" json:"labels,omitempty"`
}
func (x *EnvoyMetricsRequest) Reset() {
*x = EnvoyMetricsRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_connect_proto_msgTypes[6]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *EnvoyMetricsRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*EnvoyMetricsRequest) ProtoMessage() {}
func (x *EnvoyMetricsRequest) ProtoReflect() protoreflect.Message {
mi := &file_connect_proto_msgTypes[6]
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 EnvoyMetricsRequest.ProtoReflect.Descriptor instead.
func (*EnvoyMetricsRequest) Descriptor() ([]byte, []int) {
return file_connect_proto_rawDescGZIP(), []int{6}
}
func (x *EnvoyMetricsRequest) GetMetrics() []string {
if x != nil {
return x.Metrics
}
return nil
}
func (x *EnvoyMetricsRequest) GetLabels() []string {
if x != nil {
return x.Labels
}
return nil
}
// PomeriumMetricsRequest is used to request current pomerium metrics
type PomeriumMetricsRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
}
func (x *PomeriumMetricsRequest) Reset() {
*x = PomeriumMetricsRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_connect_proto_msgTypes[7]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *PomeriumMetricsRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*PomeriumMetricsRequest) ProtoMessage() {}
func (x *PomeriumMetricsRequest) ProtoReflect() protoreflect.Message {
mi := &file_connect_proto_msgTypes[7]
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 PomeriumMetricsRequest.ProtoReflect.Descriptor instead.
func (*PomeriumMetricsRequest) Descriptor() ([]byte, []int) {
return file_connect_proto_rawDescGZIP(), []int{7}
}
var File_connect_proto protoreflect.FileDescriptor var File_connect_proto protoreflect.FileDescriptor
var file_connect_proto_rawDesc = []byte{ var file_connect_proto_rawDesc = []byte{
0x0a, 0x0d, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0a, 0x0d, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12,
0x0d, 0x70, 0x6f, 0x6d, 0x65, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x7a, 0x65, 0x72, 0x6f, 0x22, 0x12, 0x0d, 0x70, 0x6f, 0x6d, 0x65, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x7a, 0x65, 0x72, 0x6f, 0x22, 0x12,
0x0a, 0x10, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x0a, 0x10, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65,
0x73, 0x74, 0x22, 0xbe, 0x01, 0x0a, 0x07, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x45, 0x73, 0x74, 0x22, 0x8e, 0x02, 0x0a, 0x07, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x45,
0x0a, 0x0e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x5f, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x0a, 0x0e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x5f, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64,
0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x70, 0x6f, 0x6d, 0x65, 0x72, 0x69, 0x75, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x70, 0x6f, 0x6d, 0x65, 0x72, 0x69, 0x75,
0x6d, 0x2e, 0x7a, 0x65, 0x72, 0x6f, 0x2e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x55, 0x70, 0x64, 0x6d, 0x2e, 0x7a, 0x65, 0x72, 0x6f, 0x2e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x55, 0x70, 0x64,
@ -255,22 +472,56 @@ var file_connect_proto_rawDesc = []byte{
0x75, 0x6d, 0x2e, 0x7a, 0x65, 0x72, 0x6f, 0x2e, 0x42, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x75, 0x6d, 0x2e, 0x7a, 0x65, 0x72, 0x6f, 0x2e, 0x42, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61,
0x70, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x48, 0x00, 0x70, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x48, 0x00,
0x52, 0x16, 0x62, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x52, 0x16, 0x62, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x43, 0x6f, 0x6e, 0x66, 0x69,
0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x42, 0x09, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x12, 0x4e, 0x0a, 0x11, 0x74, 0x65, 0x6c, 0x65,
0x6d, 0x65, 0x74, 0x72, 0x79, 0x5f, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x18, 0x03, 0x20,
0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x70, 0x6f, 0x6d, 0x65, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x7a,
0x65, 0x72, 0x6f, 0x2e, 0x54, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x74, 0x72, 0x79, 0x52, 0x65, 0x71,
0x75, 0x65, 0x73, 0x74, 0x48, 0x00, 0x52, 0x10, 0x74, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x74, 0x72,
0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x42, 0x09, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73,
0x61, 0x67, 0x65, 0x22, 0x3c, 0x0a, 0x0d, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x55, 0x70, 0x64, 0x61, 0x67, 0x65, 0x22, 0x3c, 0x0a, 0x0d, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x55, 0x70, 0x64,
0x61, 0x74, 0x65, 0x64, 0x12, 0x2b, 0x0a, 0x11, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x73, 0x65, 0x61, 0x74, 0x65, 0x64, 0x12, 0x2b, 0x0a, 0x11, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x73, 0x65,
0x74, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x74, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52,
0x10, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x73, 0x65, 0x74, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x10, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x73, 0x65, 0x74, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f,
0x6e, 0x22, 0x18, 0x0a, 0x16, 0x42, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x43, 0x6f, 0x6e, 0x22, 0x18, 0x0a, 0x16, 0x42, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x43, 0x6f,
0x6e, 0x66, 0x69, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x32, 0x51, 0x0a, 0x07, 0x43, 0x6e, 0x66, 0x69, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x22, 0xce, 0x02, 0x0a, 0x10,
0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x12, 0x46, 0x0a, 0x09, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x54, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x74, 0x72, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
0x69, 0x62, 0x65, 0x12, 0x1f, 0x2e, 0x70, 0x6f, 0x6d, 0x65, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x7a, 0x12, 0x58, 0x0a, 0x11, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x61, 0x6e, 0x61, 0x6c,
0x65, 0x72, 0x6f, 0x2e, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x52, 0x65, 0x71, 0x79, 0x74, 0x69, 0x63, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x70, 0x6f,
0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x70, 0x6f, 0x6d, 0x65, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6d, 0x65, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x7a, 0x65, 0x72, 0x6f, 0x2e, 0x53, 0x65, 0x73, 0x73,
0x7a, 0x65, 0x72, 0x6f, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x30, 0x01, 0x42, 0x2f, 0x69, 0x6f, 0x6e, 0x41, 0x6e, 0x61, 0x6c, 0x79, 0x74, 0x69, 0x63, 0x73, 0x52, 0x65, 0x71, 0x75,
0x5a, 0x2d, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x70, 0x6f, 0x6d, 0x65, 0x73, 0x74, 0x48, 0x00, 0x52, 0x10, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x41, 0x6e,
0x65, 0x72, 0x69, 0x75, 0x6d, 0x2f, 0x70, 0x6f, 0x6d, 0x65, 0x72, 0x69, 0x75, 0x6d, 0x2f, 0x70, 0x61, 0x6c, 0x79, 0x74, 0x69, 0x63, 0x73, 0x88, 0x01, 0x01, 0x12, 0x4c, 0x0a, 0x0d, 0x65, 0x6e,
0x6b, 0x67, 0x2f, 0x7a, 0x65, 0x72, 0x6f, 0x2f, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x62, 0x76, 0x6f, 0x79, 0x5f, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28,
0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 0x0b, 0x32, 0x22, 0x2e, 0x70, 0x6f, 0x6d, 0x65, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x7a, 0x65, 0x72,
0x6f, 0x2e, 0x45, 0x6e, 0x76, 0x6f, 0x79, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x52, 0x65,
0x71, 0x75, 0x65, 0x73, 0x74, 0x48, 0x01, 0x52, 0x0c, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x4d, 0x65,
0x74, 0x72, 0x69, 0x63, 0x73, 0x88, 0x01, 0x01, 0x12, 0x55, 0x0a, 0x10, 0x70, 0x6f, 0x6d, 0x65,
0x72, 0x69, 0x75, 0x6d, 0x5f, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x18, 0x03, 0x20, 0x01,
0x28, 0x0b, 0x32, 0x25, 0x2e, 0x70, 0x6f, 0x6d, 0x65, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x7a, 0x65,
0x72, 0x6f, 0x2e, 0x50, 0x6f, 0x6d, 0x65, 0x72, 0x69, 0x75, 0x6d, 0x4d, 0x65, 0x74, 0x72, 0x69,
0x63, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x48, 0x02, 0x52, 0x0f, 0x70, 0x6f, 0x6d,
0x65, 0x72, 0x69, 0x75, 0x6d, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x88, 0x01, 0x01, 0x42,
0x14, 0x0a, 0x12, 0x5f, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x61, 0x6e, 0x61, 0x6c,
0x79, 0x74, 0x69, 0x63, 0x73, 0x42, 0x10, 0x0a, 0x0e, 0x5f, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x5f,
0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x42, 0x13, 0x0a, 0x11, 0x5f, 0x70, 0x6f, 0x6d, 0x65,
0x72, 0x69, 0x75, 0x6d, 0x5f, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x22, 0x19, 0x0a, 0x17,
0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x41, 0x6e, 0x61, 0x6c, 0x79, 0x74, 0x69, 0x63, 0x73,
0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x47, 0x0a, 0x13, 0x45, 0x6e, 0x76, 0x6f, 0x79,
0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x18,
0x0a, 0x07, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52,
0x07, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x6c, 0x61, 0x62, 0x65,
0x6c, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x06, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x73,
0x22, 0x18, 0x0a, 0x16, 0x50, 0x6f, 0x6d, 0x65, 0x72, 0x69, 0x75, 0x6d, 0x4d, 0x65, 0x74, 0x72,
0x69, 0x63, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x32, 0x51, 0x0a, 0x07, 0x43, 0x6f,
0x6e, 0x6e, 0x65, 0x63, 0x74, 0x12, 0x46, 0x0a, 0x09, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69,
0x62, 0x65, 0x12, 0x1f, 0x2e, 0x70, 0x6f, 0x6d, 0x65, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x7a, 0x65,
0x72, 0x6f, 0x2e, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x52, 0x65, 0x71, 0x75,
0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x70, 0x6f, 0x6d, 0x65, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x7a,
0x65, 0x72, 0x6f, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x30, 0x01, 0x42, 0x2f, 0x5a,
0x2d, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x70, 0x6f, 0x6d, 0x65,
0x72, 0x69, 0x75, 0x6d, 0x2f, 0x70, 0x6f, 0x6d, 0x65, 0x72, 0x69, 0x75, 0x6d, 0x2f, 0x70, 0x6b,
0x67, 0x2f, 0x7a, 0x65, 0x72, 0x6f, 0x2f, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x62, 0x06,
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
} }
var ( var (
@ -285,23 +536,31 @@ func file_connect_proto_rawDescGZIP() []byte {
return file_connect_proto_rawDescData return file_connect_proto_rawDescData
} }
var file_connect_proto_msgTypes = make([]protoimpl.MessageInfo, 4) var file_connect_proto_msgTypes = make([]protoimpl.MessageInfo, 8)
var file_connect_proto_goTypes = []interface{}{ var file_connect_proto_goTypes = []interface{}{
(*SubscribeRequest)(nil), // 0: pomerium.zero.SubscribeRequest (*SubscribeRequest)(nil), // 0: pomerium.zero.SubscribeRequest
(*Message)(nil), // 1: pomerium.zero.Message (*Message)(nil), // 1: pomerium.zero.Message
(*ConfigUpdated)(nil), // 2: pomerium.zero.ConfigUpdated (*ConfigUpdated)(nil), // 2: pomerium.zero.ConfigUpdated
(*BootstrapConfigUpdated)(nil), // 3: pomerium.zero.BootstrapConfigUpdated (*BootstrapConfigUpdated)(nil), // 3: pomerium.zero.BootstrapConfigUpdated
(*TelemetryRequest)(nil), // 4: pomerium.zero.TelemetryRequest
(*SessionAnalyticsRequest)(nil), // 5: pomerium.zero.SessionAnalyticsRequest
(*EnvoyMetricsRequest)(nil), // 6: pomerium.zero.EnvoyMetricsRequest
(*PomeriumMetricsRequest)(nil), // 7: pomerium.zero.PomeriumMetricsRequest
} }
var file_connect_proto_depIdxs = []int32{ var file_connect_proto_depIdxs = []int32{
2, // 0: pomerium.zero.Message.config_updated:type_name -> pomerium.zero.ConfigUpdated 2, // 0: pomerium.zero.Message.config_updated:type_name -> pomerium.zero.ConfigUpdated
3, // 1: pomerium.zero.Message.bootstrap_config_updated:type_name -> pomerium.zero.BootstrapConfigUpdated 3, // 1: pomerium.zero.Message.bootstrap_config_updated:type_name -> pomerium.zero.BootstrapConfigUpdated
0, // 2: pomerium.zero.Connect.Subscribe:input_type -> pomerium.zero.SubscribeRequest 4, // 2: pomerium.zero.Message.telemetry_request:type_name -> pomerium.zero.TelemetryRequest
1, // 3: pomerium.zero.Connect.Subscribe:output_type -> pomerium.zero.Message 5, // 3: pomerium.zero.TelemetryRequest.session_analytics:type_name -> pomerium.zero.SessionAnalyticsRequest
3, // [3:4] is the sub-list for method output_type 6, // 4: pomerium.zero.TelemetryRequest.envoy_metrics:type_name -> pomerium.zero.EnvoyMetricsRequest
2, // [2:3] is the sub-list for method input_type 7, // 5: pomerium.zero.TelemetryRequest.pomerium_metrics:type_name -> pomerium.zero.PomeriumMetricsRequest
2, // [2:2] is the sub-list for extension type_name 0, // 6: pomerium.zero.Connect.Subscribe:input_type -> pomerium.zero.SubscribeRequest
2, // [2:2] is the sub-list for extension extendee 1, // 7: pomerium.zero.Connect.Subscribe:output_type -> pomerium.zero.Message
0, // [0:2] is the sub-list for field type_name 7, // [7:8] is the sub-list for method output_type
6, // [6:7] is the sub-list for method input_type
6, // [6:6] is the sub-list for extension type_name
6, // [6:6] is the sub-list for extension extendee
0, // [0:6] is the sub-list for field type_name
} }
func init() { file_connect_proto_init() } func init() { file_connect_proto_init() }
@ -358,18 +617,68 @@ func file_connect_proto_init() {
return nil return nil
} }
} }
file_connect_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*TelemetryRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_connect_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*SessionAnalyticsRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_connect_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*EnvoyMetricsRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_connect_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*PomeriumMetricsRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
} }
file_connect_proto_msgTypes[1].OneofWrappers = []interface{}{ file_connect_proto_msgTypes[1].OneofWrappers = []interface{}{
(*Message_ConfigUpdated)(nil), (*Message_ConfigUpdated)(nil),
(*Message_BootstrapConfigUpdated)(nil), (*Message_BootstrapConfigUpdated)(nil),
(*Message_TelemetryRequest)(nil),
} }
file_connect_proto_msgTypes[4].OneofWrappers = []interface{}{}
type x struct{} type x struct{}
out := protoimpl.TypeBuilder{ out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{ File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(), GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_connect_proto_rawDesc, RawDescriptor: file_connect_proto_rawDesc,
NumEnums: 0, NumEnums: 0,
NumMessages: 4, NumMessages: 8,
NumExtensions: 0, NumExtensions: 0,
NumServices: 1, NumServices: 1,
}, },

View file

@ -16,6 +16,7 @@ message Message {
oneof message { oneof message {
ConfigUpdated config_updated = 1; ConfigUpdated config_updated = 1;
BootstrapConfigUpdated bootstrap_config_updated = 2; BootstrapConfigUpdated bootstrap_config_updated = 2;
TelemetryRequest telemetry_request = 3;
} }
} }
@ -32,6 +33,30 @@ message ConfigUpdated {
// config. // config.
message BootstrapConfigUpdated {} message BootstrapConfigUpdated {}
// TelemetryRequest is sent to request current telemetry data from the Pomerium Core to be sent to the Zero Cloud.
message TelemetryRequest {
// include_session_analytics requests current MAU/DAU data
optional SessionAnalyticsRequest session_analytics = 1;
// envoy_metrics requests current envoy metrics
optional EnvoyMetricsRequest envoy_metrics = 2;
// pomerium_metrics requests current pomerium metrics
optional PomeriumMetricsRequest pomerium_metrics = 3;
}
// SessionAnalyticsRequest is used to request current MAU/DAU data
message SessionAnalyticsRequest {}
// EnvoyMetricsRequest is used to request current envoy metrics
message EnvoyMetricsRequest {
// only include metrics that match the provided labels, and relabel them with the provided labels
repeated string metrics = 1;
// only include labels that match the provided labels
repeated string labels = 2;
}
// PomeriumMetricsRequest is used to request current pomerium metrics
message PomeriumMetricsRequest {}
// Connect service is used to maintain a persistent connection between the // Connect service is used to maintain a persistent connection between the
// Pomerium Core and Zero Cloud and receive messages from the cloud. // Pomerium Core and Zero Cloud and receive messages from the cloud.
service Connect { service Connect {

View file

@ -1,4 +1,4 @@
// Package connect provides the way to listen for updates from the cloud // Package connect provides the way to listen for updates from the cloud
package connect package connect
//go:generate go run github.com/bufbuild/buf/cmd/buf@v1.28.1 generate --path connect.proto --config buf.yaml //go:generate go run github.com/bufbuild/buf/cmd/buf@v1.32.2 generate --path connect.proto --config buf.yaml