mirror of
https://github.com/prometheus/prometheus.git
synced 2024-12-28 15:09:39 -08:00
d83879210c
My aim is to support the new grpc generic write path in Frankenstein. On the surface this seems easy - however I've hit a number of problems that make me think it might be better to not use grpc just yet. The explanation of the problems requires a little background. At weave, traffic to frankenstein need to go through a couple of services first, for SSL and to be authenticated. So traffic goes: internet -> frontend -> authfe -> frankenstein - The frontend is Nginx, and adds/removes SSL. Its done this way for legacy reasons, so the certs can be managed in one place, although eventually we imagine we'll merge it with authfe. All traffic from frontend is sent to authfe. - Authfe checks the auth tokens / cookie etc and then picks the service to forward the RPC to. - Frankenstein accepts the reads and does the right thing with them. First problem I hit was Nginx won't proxy http2 requests - it can accept them, but all calls downstream are http1 (see https://trac.nginx.org/nginx/ticket/923). This wasn't such a big deal, so it now looks like: internet --(grpc/http2)--> frontend --(grpc/http1)--> authfe --(grpc/http1)--> frankenstein Next problem was golang grpc server won't accept http1 requests (see https://groups.google.com/forum/#!topic/grpc-io/JnjCYGPMUms). It is possible to link a grpc server in with a normal go http mux, as long as the mux server is serving over SSL, as the golang http client & server won't do http2 over anything other than an SSL connection. This would require making all our service to service comms SSL. So I had a go a writing a grpc http1 server, and got pretty far. But is was a bit of a mess. So finally I thought I'd make a separate grpc frontend for this, running in parallel with the frontend/authfe combo on a different port - and first up I'd need a grpc reverse proxy. Ideally we'd have some nice, generic reverse proxy that only knew about a map from service names -> downstream service, and didn't need to decode & re-encode every request as it went through. It seems like this can't be done with golang's grpc library - see https://github.com/mwitkow/grpc-proxy/issues/1. And then I was surprised to find you can't do grpc from browsers! See http://www.grpc.io/faq/ - not important to us, but I'm starting to question why we decided to use grpc in the first place? It would seem we could have most of the benefits of grpc with protos over HTTP, and this wouldn't preclude moving to grpc when its a bit more mature? In fact, the grcp FAQ even admits as much: > Why is gRPC better than any binary blob over HTTP/2? > This is largely what gRPC is on the wire.
133 lines
5.2 KiB
Go
133 lines
5.2 KiB
Go
// Code generated by protoc-gen-go.
|
|
// source: remote.proto
|
|
// DO NOT EDIT!
|
|
|
|
/*
|
|
Package remote is a generated protocol buffer package.
|
|
|
|
It is generated from these files:
|
|
remote.proto
|
|
|
|
It has these top-level messages:
|
|
Sample
|
|
LabelPair
|
|
TimeSeries
|
|
WriteRequest
|
|
WriteResponse
|
|
*/
|
|
package remote
|
|
|
|
import proto "github.com/golang/protobuf/proto"
|
|
import fmt "fmt"
|
|
import math "math"
|
|
|
|
// Reference imports to suppress errors if they are not otherwise used.
|
|
var _ = proto.Marshal
|
|
var _ = fmt.Errorf
|
|
var _ = math.Inf
|
|
|
|
// 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
|
|
|
|
type Sample struct {
|
|
Value float64 `protobuf:"fixed64,1,opt,name=value" json:"value,omitempty"`
|
|
TimestampMs int64 `protobuf:"varint,2,opt,name=timestamp_ms,json=timestampMs" json:"timestamp_ms,omitempty"`
|
|
}
|
|
|
|
func (m *Sample) Reset() { *m = Sample{} }
|
|
func (m *Sample) String() string { return proto.CompactTextString(m) }
|
|
func (*Sample) ProtoMessage() {}
|
|
func (*Sample) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }
|
|
|
|
type LabelPair struct {
|
|
Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"`
|
|
Value string `protobuf:"bytes,2,opt,name=value" json:"value,omitempty"`
|
|
}
|
|
|
|
func (m *LabelPair) Reset() { *m = LabelPair{} }
|
|
func (m *LabelPair) String() string { return proto.CompactTextString(m) }
|
|
func (*LabelPair) ProtoMessage() {}
|
|
func (*LabelPair) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} }
|
|
|
|
type TimeSeries struct {
|
|
Labels []*LabelPair `protobuf:"bytes,1,rep,name=labels" json:"labels,omitempty"`
|
|
// Sorted by time, oldest sample first.
|
|
Samples []*Sample `protobuf:"bytes,2,rep,name=samples" json:"samples,omitempty"`
|
|
}
|
|
|
|
func (m *TimeSeries) Reset() { *m = TimeSeries{} }
|
|
func (m *TimeSeries) String() string { return proto.CompactTextString(m) }
|
|
func (*TimeSeries) ProtoMessage() {}
|
|
func (*TimeSeries) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2} }
|
|
|
|
func (m *TimeSeries) GetLabels() []*LabelPair {
|
|
if m != nil {
|
|
return m.Labels
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (m *TimeSeries) GetSamples() []*Sample {
|
|
if m != nil {
|
|
return m.Samples
|
|
}
|
|
return nil
|
|
}
|
|
|
|
type WriteRequest struct {
|
|
Timeseries []*TimeSeries `protobuf:"bytes,1,rep,name=timeseries" json:"timeseries,omitempty"`
|
|
}
|
|
|
|
func (m *WriteRequest) Reset() { *m = WriteRequest{} }
|
|
func (m *WriteRequest) String() string { return proto.CompactTextString(m) }
|
|
func (*WriteRequest) ProtoMessage() {}
|
|
func (*WriteRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{3} }
|
|
|
|
func (m *WriteRequest) GetTimeseries() []*TimeSeries {
|
|
if m != nil {
|
|
return m.Timeseries
|
|
}
|
|
return nil
|
|
}
|
|
|
|
type WriteResponse struct {
|
|
}
|
|
|
|
func (m *WriteResponse) Reset() { *m = WriteResponse{} }
|
|
func (m *WriteResponse) String() string { return proto.CompactTextString(m) }
|
|
func (*WriteResponse) ProtoMessage() {}
|
|
func (*WriteResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{4} }
|
|
|
|
func init() {
|
|
proto.RegisterType((*Sample)(nil), "remote.Sample")
|
|
proto.RegisterType((*LabelPair)(nil), "remote.LabelPair")
|
|
proto.RegisterType((*TimeSeries)(nil), "remote.TimeSeries")
|
|
proto.RegisterType((*WriteRequest)(nil), "remote.WriteRequest")
|
|
proto.RegisterType((*WriteResponse)(nil), "remote.WriteResponse")
|
|
}
|
|
|
|
func init() { proto.RegisterFile("remote.proto", fileDescriptor0) }
|
|
|
|
var fileDescriptor0 = []byte{
|
|
// 250 bytes of a gzipped FileDescriptorProto
|
|
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x5c, 0x91, 0x4f, 0x4b, 0x03, 0x31,
|
|
0x10, 0xc5, 0xdd, 0xd6, 0xae, 0x74, 0xba, 0x2a, 0x0e, 0x15, 0x8a, 0x27, 0xcd, 0x69, 0xbd, 0xf4,
|
|
0xb0, 0xa2, 0x57, 0xd1, 0xb3, 0x82, 0xa4, 0x82, 0x47, 0x49, 0x61, 0x0e, 0x0b, 0x9b, 0x66, 0xcd,
|
|
0xa4, 0x7e, 0x7e, 0xb3, 0xf9, 0xd3, 0x2e, 0xde, 0x66, 0xde, 0xbc, 0xf9, 0xcd, 0x0b, 0x81, 0xca,
|
|
0x92, 0x36, 0x8e, 0xd6, 0xbd, 0x35, 0xce, 0x60, 0x19, 0x3b, 0xf1, 0x02, 0xe5, 0x46, 0xe9, 0xbe,
|
|
0x23, 0x5c, 0xc2, 0xec, 0x57, 0x75, 0x7b, 0x5a, 0x15, 0xb7, 0x45, 0x5d, 0xc8, 0xd8, 0xe0, 0x1d,
|
|
0x54, 0xae, 0xd5, 0xc4, 0xce, 0x9b, 0xbe, 0x35, 0xaf, 0x26, 0x7e, 0x38, 0x95, 0x8b, 0x83, 0xf6,
|
|
0xce, 0xe2, 0x11, 0xe6, 0x6f, 0x6a, 0x4b, 0xdd, 0x87, 0x6a, 0x2d, 0x22, 0x9c, 0xee, 0x94, 0x8e,
|
|
0x90, 0xb9, 0x0c, 0xf5, 0x91, 0x3c, 0x09, 0x62, 0x6c, 0x84, 0x02, 0xf8, 0xf4, 0x94, 0x0d, 0xd9,
|
|
0x96, 0x18, 0xef, 0xa1, 0xec, 0x06, 0x08, 0xfb, 0xcd, 0x69, 0xbd, 0x68, 0xae, 0xd6, 0x29, 0xee,
|
|
0x01, 0x2d, 0x93, 0x01, 0x6b, 0x38, 0xe3, 0x10, 0x79, 0x48,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