From c64b2375cd400ffaf68b7f1cc6262d64c8f53014 Mon Sep 17 00:00:00 2001 From: mfboulos Date: Fri, 22 Nov 2019 18:08:14 -0800 Subject: [PATCH] Parse optional EventMetrics from HTTP response Config proto update EventMetrics per response body --- probes/http/http.go | 68 ++++++++++++------ probes/http/http_test.go | 41 +++++++++-- probes/http/proto/config.pb.go | 123 ++++++++++++++++++++------------- probes/http/proto/config.proto | 13 +++- 4 files changed, 169 insertions(+), 76 deletions(-) diff --git a/probes/http/http.go b/probes/http/http.go index d0e8116e..f452da88 100644 --- a/probes/http/http.go +++ b/probes/http/http.go @@ -30,6 +30,7 @@ import ( "github.com/google/cloudprober/logger" "github.com/google/cloudprober/metrics" + "github.com/google/cloudprober/metrics/payload" configpb "github.com/google/cloudprober/probes/http/proto" "github.com/google/cloudprober/probes/options" "github.com/google/cloudprober/targets/endpoint" @@ -56,6 +57,7 @@ type Probe struct { protocol string method string url string + dataChan chan *metrics.EventMetrics // Run counter, used to decide when to update targets or export // stats. @@ -70,6 +72,9 @@ type Probe struct { // statsExportInterval / p.opts.Interval. Metrics are exported when // (runCnt % statsExportFrequency) == 0 statsExportFrequency int64 + + // parser for reading metrics from response body + payloadParser *payload.Parser } type probeResult struct { @@ -78,6 +83,7 @@ type probeResult struct { respCodes *metrics.Map respBodies *metrics.Map validationFailure *metrics.Map + responseMetrics *metrics.EventMetrics } // Init initializes the probe with the given params. @@ -161,6 +167,13 @@ func (p *Probe) Init(name string, opts *options.Options) error { p.targetsUpdateFrequency = 1 } + defaultKind := metrics.CUMULATIVE + parser, err := payload.NewParser(p.c.GetOutputMetricsOptions(), "http", p.name, metrics.Kind(defaultKind), p.l) + if err != nil { + return fmt.Errorf("error initializing payload metrics: %v", err) + } + + p.payloadParser = parser return nil } @@ -222,11 +235,15 @@ func (p *Probe) doHTTPRequest(req *http.Request, result *probeResult, resultMu * result.success++ result.latency.AddFloat64(latency.Seconds() / p.opts.LatencyUnit.Seconds()) - if p.c.GetExportResponseAsMetrics() { + if p.c.GetExportResponseCountAsMetric() { if len(respBody) <= maxResponseSizeForMetrics { result.respBodies.IncKey(string(respBody)) } } + if p.c.GetExportResponseAsMetrics() { + // Parse response body as metrics + result.responseMetrics = p.payloadParser.PayloadMetrics(result.responseMetrics, string(respBody), req.Host) + } } func (p *Probe) updateTargets() { @@ -303,10 +320,12 @@ func (p *Probe) runProbe(ctx context.Context) { // Start starts and runs the probe indefinitely. func (p *Probe) Start(ctx context.Context, dataChan chan *metrics.EventMetrics) { + p.dataChan = dataChan + ticker := time.NewTicker(p.opts.Interval) defer ticker.Stop() - for ts := range ticker.C { + for range ticker.C { // Don't run another probe if context is canceled already. select { case <-ctx.Done(): @@ -325,28 +344,35 @@ func (p *Probe) Start(ctx context.Context, dataChan chan *metrics.EventMetrics) if (p.runCnt % p.statsExportFrequency) == 0 { for _, target := range p.targets { result := p.results[target.Name] - em := metrics.NewEventMetrics(ts). - AddMetric("total", metrics.NewInt(result.total)). - AddMetric("success", metrics.NewInt(result.success)). - AddMetric("latency", result.latency). - AddMetric("timeouts", metrics.NewInt(result.timeouts)). - AddMetric("resp-code", result.respCodes). - AddMetric("resp-body", result.respBodies). - AddLabel("ptype", "http"). - AddLabel("probe", p.name). - AddLabel("dst", target.Name) - - for _, al := range p.opts.AdditionalLabels { - em.AddLabel(al.KeyValueForTarget(target.Name)) - } - - if p.opts.Validators != nil { - em.AddMetric("validation_failure", result.validationFailure) - } + em := p.defaultMetrics(target.Name, result) p.opts.LogMetrics(em) - dataChan <- em + p.dataChan <- em + + if p.c.GetExportResponseAsMetrics() { + p.dataChan <- result.responseMetrics + } } } } } + +func (p *Probe) defaultMetrics(target string, result *probeResult) *metrics.EventMetrics { + em := metrics.NewEventMetrics(time.Now()). + AddMetric("success", metrics.NewInt(result.success)). + AddMetric("total", metrics.NewInt(result.total)). + AddMetric("latency", result.latency). + AddLabel("ptype", "external"). + AddLabel("probe", p.name). + AddLabel("dst", target) + + for _, al := range p.opts.AdditionalLabels { + em.AddLabel(al.KeyValueForTarget(target)) + } + + if p.opts.Validators != nil { + em.AddMetric("validation_failure", result.validationFailure) + } + + return em +} diff --git a/probes/http/http_test.go b/probes/http/http_test.go index 31d46f62..ea3e73bd 100644 --- a/probes/http/http_test.go +++ b/probes/http/http_test.go @@ -153,21 +153,30 @@ func TestProbeVariousMethods(t *testing.T) { } func TestProbeWithBody(t *testing.T) { - - testBody := "TestHTTPBody" + testBody := `TestHTTPBody "val123"` testTarget := "test.com" // Build the expected response code map expectedMap := metrics.NewMap("resp", metrics.NewInt(0)) expectedMap.IncKey(testBody) expected := expectedMap.String() + // Build the expected metrics + testBodyLines := strings.Split(testBody, "\n") + expectedMetrics := make(map[string]metrics.Value) + for _, line := range testBodyLines { + lineSplit := strings.Fields(line) + if len(lineSplit) == 2 { + expectedMetrics[lineSplit[0]], _ = metrics.ParseValueFromString(lineSplit[1]) + } + } p := &Probe{} err := p.Init("http_test", &options.Options{ Targets: targets.StaticTargets(testTarget), Interval: 2 * time.Second, ProbeConf: &configpb.ProbeConf{ - Body: &testBody, - ExportResponseAsMetrics: proto.Bool(true), + Body: &testBody, + ExportResponseCountAsMetric: proto.Bool(true), + ExportResponseAsMetrics: proto.Bool(true), }, }) @@ -182,8 +191,19 @@ func TestProbeWithBody(t *testing.T) { if got != expected { t.Errorf("response map: got=%s, expected=%s", got, expected) } + for key, val := range expectedMetrics { + metrics := p.results[testTarget].responseMetrics + if metrics != nil { + actualMetric := metrics.Metric(key) + if actualMetric != val { + t.Errorf("metric %s: got=%s, expected=%s", key, actualMetric, val) + } + } else { + t.Errorf("metric %s: not found, expected=%s", key, val) + } + } - // Probe 2nd run (we should get the same request body). + // Probe 2nd run (we should get the same request body) p.runProbe(context.Background()) expectedMap.IncKey(testBody) expected = expectedMap.String() @@ -191,6 +211,17 @@ func TestProbeWithBody(t *testing.T) { if got != expected { t.Errorf("response map: got=%s, expected=%s", got, expected) } + for key, val := range expectedMetrics { + metrics := p.results[testTarget].responseMetrics + if metrics != nil { + actualMetric := metrics.Metric(key) + if actualMetric != val { + t.Errorf("metric %s: got=%s, expected=%s", key, actualMetric, val) + } + } else { + t.Errorf("metric %s: not found, expected=%s", key, val) + } + } } func TestMultipleTargetsMultipleRequests(t *testing.T) { diff --git a/probes/http/proto/config.pb.go b/probes/http/proto/config.pb.go index e9a7eb40..d11313f2 100644 --- a/probes/http/proto/config.pb.go +++ b/probes/http/proto/config.pb.go @@ -1,11 +1,12 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // source: github.com/google/cloudprober/probes/http/proto/config.proto -package proto +package cloudprober_probes_http import ( fmt "fmt" proto "github.com/golang/protobuf/proto" + proto1 "github.com/google/cloudprober/metrics/payload/proto" math "math" ) @@ -115,7 +116,7 @@ func (ProbeConf_Method) EnumDescriptor() ([]byte, []int) { return fileDescriptor_4f0f7231b8fe2128, []int{0, 1} } -// Next tag: 15 +// Next tag: 18 type ProbeConf struct { // Which HTTP protocol to use Protocol *ProbeConf_ProtocolType `protobuf:"varint,1,opt,name=protocol,enum=cloudprober.probes.http.ProbeConf_ProtocolType,def=0" json:"protocol,omitempty"` @@ -133,7 +134,7 @@ type ProbeConf struct { // make a request using that while passing target name as Host header. ResolveFirst *bool `protobuf:"varint,4,opt,name=resolve_first,json=resolveFirst,def=0" json:"resolve_first,omitempty"` // Export response (body) count as a metric - ExportResponseAsMetrics *bool `protobuf:"varint,5,opt,name=export_response_as_metrics,json=exportResponseAsMetrics,def=0" json:"export_response_as_metrics,omitempty"` + ExportResponseCountAsMetric *bool `protobuf:"varint,5,opt,name=export_response_count_as_metric,json=exportResponseCountAsMetric,def=0" json:"export_response_count_as_metric,omitempty"` // HTTP request method Method *ProbeConf_Method `protobuf:"varint,7,opt,name=method,enum=cloudprober.probes.http.ProbeConf_Method,def=0" json:"method,omitempty"` // HTTP request headers @@ -158,10 +159,16 @@ type ProbeConf struct { // How long to wait between two requests to the same target // NOTE: This field is now deprecated and will be removed after the v0.10.3 // releases. - RequestsIntervalMsec *int32 `protobuf:"varint,99,opt,name=requests_interval_msec,json=requestsIntervalMsec,def=25" json:"requests_interval_msec,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + RequestsIntervalMsec *int32 `protobuf:"varint,99,opt,name=requests_interval_msec,json=requestsIntervalMsec,def=25" json:"requests_interval_msec,omitempty"` + // Output metrics options, where output is the response body returned by the + // HTTP probe process. Cloudprober expects variables to be in the following + // format in the response body: + // var1 value1 (for example: total_errors 589) + ExportResponseAsMetrics *bool `protobuf:"varint,16,opt,name=export_response_as_metrics,json=exportResponseAsMetrics,def=0" json:"export_response_as_metrics,omitempty"` + OutputMetricsOptions *proto1.OutputMetricsOptions `protobuf:"bytes,17,opt,name=output_metrics_options,json=outputMetricsOptions" json:"output_metrics_options,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *ProbeConf) Reset() { *m = ProbeConf{} } @@ -191,10 +198,11 @@ var xxx_messageInfo_ProbeConf proto.InternalMessageInfo const Default_ProbeConf_Protocol ProbeConf_ProtocolType = ProbeConf_HTTP const Default_ProbeConf_ResolveFirst bool = false -const Default_ProbeConf_ExportResponseAsMetrics bool = false +const Default_ProbeConf_ExportResponseCountAsMetric bool = false const Default_ProbeConf_Method ProbeConf_Method = ProbeConf_GET const Default_ProbeConf_RequestsPerProbe int32 = 1 const Default_ProbeConf_RequestsIntervalMsec int32 = 25 +const Default_ProbeConf_ExportResponseAsMetrics bool = false func (m *ProbeConf) GetProtocol() ProbeConf_ProtocolType { if m != nil && m.Protocol != nil { @@ -224,11 +232,11 @@ func (m *ProbeConf) GetResolveFirst() bool { return Default_ProbeConf_ResolveFirst } -func (m *ProbeConf) GetExportResponseAsMetrics() bool { - if m != nil && m.ExportResponseAsMetrics != nil { - return *m.ExportResponseAsMetrics +func (m *ProbeConf) GetExportResponseCountAsMetric() bool { + if m != nil && m.ExportResponseCountAsMetric != nil { + return *m.ExportResponseCountAsMetric } - return Default_ProbeConf_ExportResponseAsMetrics + return Default_ProbeConf_ExportResponseCountAsMetric } func (m *ProbeConf) GetMethod() ProbeConf_Method { @@ -287,6 +295,20 @@ func (m *ProbeConf) GetRequestsIntervalMsec() int32 { return Default_ProbeConf_RequestsIntervalMsec } +func (m *ProbeConf) GetExportResponseAsMetrics() bool { + if m != nil && m.ExportResponseAsMetrics != nil { + return *m.ExportResponseAsMetrics + } + return Default_ProbeConf_ExportResponseAsMetrics +} + +func (m *ProbeConf) GetOutputMetricsOptions() *proto1.OutputMetricsOptions { + if m != nil { + return m.OutputMetricsOptions + } + return nil +} + type ProbeConf_Header struct { Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` Value *string `protobuf:"bytes,2,opt,name=value" json:"value,omitempty"` @@ -346,40 +368,45 @@ func init() { } var fileDescriptor_4f0f7231b8fe2128 = []byte{ - // 545 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x92, 0x5d, 0x6b, 0xdb, 0x3c, - 0x14, 0xc7, 0xeb, 0xe6, 0xfd, 0x34, 0x2d, 0x46, 0xf4, 0x79, 0x2a, 0x0a, 0x83, 0xac, 0xbd, 0xc9, - 0x76, 0x61, 0xb3, 0xc0, 0xc6, 0x08, 0xbb, 0xc9, 0xd2, 0x74, 0x29, 0xac, 0xab, 0xa7, 0xba, 0xbb, - 0x35, 0x8e, 0x7d, 0x92, 0x98, 0x29, 0x96, 0x27, 0x29, 0x66, 0xfd, 0x6a, 0xfb, 0x74, 0x43, 0xb2, - 0x13, 0x72, 0x33, 0xe8, 0x95, 0x8e, 0xfe, 0xe7, 0xf7, 0x3f, 0x70, 0x5e, 0xe0, 0xd3, 0x2a, 0xd3, - 0xeb, 0xed, 0xc2, 0x4b, 0xc4, 0xc6, 0x5f, 0x09, 0xb1, 0xe2, 0xe8, 0x27, 0x5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0x6b, 0xe8, 0x1f, 0x9e, 0x20, 0xe9, 0x82, - 0x3d, 0x42, 0xf7, 0x88, 0xf4, 0xa0, 0x65, 0xa2, 0x47, 0xd7, 0xb9, 0x62, 0xd0, 0xae, 0xf6, 0x45, - 0x3a, 0x60, 0x36, 0xe6, 0x1e, 0x19, 0x2e, 0x78, 0x78, 0x0c, 0x5d, 0xc7, 0x48, 0xc1, 0x53, 0xe8, - 0x1e, 0x5b, 0xeb, 0x6c, 0x72, 0xe3, 0x36, 0x08, 0x40, 0xfb, 0x66, 0xf6, 0x75, 0x16, 0xce, 0xdc, - 0xa6, 0x29, 0x13, 0x4c, 0xc2, 0xe9, 0xdc, 0x6d, 0x91, 0x13, 0xe8, 0x3c, 0x04, 0xe1, 0xdd, 0xc3, - 0xb7, 0x47, 0xb7, 0xfd, 0x37, 0x00, 0x00, 0xff, 0xff, 0xe8, 0x4c, 0x07, 0x7a, 0x94, 0x03, 0x00, - 0x00, + // 630 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x93, 0x5f, 0x6f, 0xd3, 0x30, + 0x14, 0xc5, 0x97, 0xf5, 0xbf, 0xdb, 0x4d, 0xc1, 0x1a, 0x9b, 0x35, 0x84, 0x28, 0xdb, 0x4b, 0xe1, + 0x21, 0xd1, 0x2a, 0x81, 0x50, 0xc5, 0x03, 0xa5, 0xeb, 0xe8, 0x04, 0xa3, 0x21, 0xcb, 0x78, 0x8d, + 0xd2, 0xe4, 0xb6, 0x8d, 0x70, 0xe3, 0x60, 0x3b, 0x15, 0xfd, 0xd6, 0x7c, 0x04, 0x64, 0x27, 0xa9, + 0x3a, 0x34, 0xd0, 0x9e, 0x7a, 0x73, 0xee, 0xef, 0xdc, 0xca, 0xf7, 0xd8, 0xe8, 0xfd, 0x22, 0x96, + 0xcb, 0x6c, 0x66, 0x85, 0x6c, 0x65, 0x2f, 0x18, 0x5b, 0x50, 0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1b, 0x01, 0x21, 0xfe, 0x88, 0x4e, 0xff, 0x0e, 0x75, 0x1b, 0xa7, 0x20, + 0xe6, 0x6e, 0x9e, 0x27, 0xf7, 0xf3, 0x2c, 0xa3, 0x14, 0x78, 0x81, 0x8e, 0x59, 0x26, 0xd3, 0x4c, + 0x96, 0x3e, 0x9f, 0xa5, 0xea, 0x1c, 0x82, 0x3c, 0xe9, 0x1a, 0xbd, 0x76, 0xff, 0xe2, 0x5e, 0x24, + 0x05, 0x63, 0x15, 0xaf, 0xc5, 0x9a, 0x6a, 0x6b, 0x31, 0x6b, 0x9a, 0x1b, 0xdd, 0x23, 0xf6, 0x80, + 0x7a, 0xda, 0x47, 0xf5, 0x3c, 0x3a, 0x95, 0x58, 0x12, 0xac, 0x40, 0xbf, 0x9e, 0x96, 0xab, 0x6b, + 0x7c, 0x84, 0x6a, 0xeb, 0x80, 0x66, 0x50, 0xdc, 0xfd, 0xfc, 0xe3, 0xec, 0x1c, 0x75, 0x76, 0x1f, + 0x0e, 0x6e, 0x22, 0xfd, 0x74, 0xcc, 0x3d, 0xdc, 0x42, 0x35, 0x55, 0xdd, 0x9a, 0xc6, 0x99, 0x8b, + 0xea, 0xf9, 0xe5, 0xc2, 0x0d, 0xa4, 0xae, 0x97, 0xb9, 0xa7, 0x38, 0x67, 0x7a, 0xeb, 0x99, 0x86, + 0x92, 0x9c, 0x3b, 0xcf, 0xdc, 0xd7, 0xd6, 0xf1, 0xf0, 0xd2, 0xac, 0x60, 0x84, 0xea, 0x97, 0xe3, + 0x2f, 0x63, 0x6f, 0x6c, 0x56, 0xd5, 0x18, 0x67, 0xe8, 0x8d, 0x26, 0x66, 0x0d, 0xb7, 0x51, 0x63, + 0xea, 0x78, 0xd7, 0xd3, 0xaf, 0xb7, 0x66, 0xfd, 0x4f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x0f, 0x97, + 0x8f, 0x08, 0x8c, 0x04, 0x00, 0x00, } diff --git a/probes/http/proto/config.proto b/probes/http/proto/config.proto index 6ccb6bcb..13a510e8 100644 --- a/probes/http/proto/config.proto +++ b/probes/http/proto/config.proto @@ -2,7 +2,9 @@ syntax = "proto2"; package cloudprober.probes.http; -// Next tag: 15 +import "github.com/google/cloudprober/metrics/payload/proto/config.proto"; + +// Next tag: 18 message ProbeConf { enum ProtocolType { HTTP = 0; @@ -42,7 +44,7 @@ message ProbeConf { optional bool resolve_first = 4 [default = false]; // Export response (body) count as a metric - optional bool export_response_as_metrics = 5 [default = false]; + optional bool export_response_count_as_metric = 5 [default = false]; // HTTP request method optional Method method = 7 [default = GET]; @@ -76,4 +78,11 @@ message ProbeConf { // NOTE: This field is now deprecated and will be removed after the v0.10.3 // releases. optional int32 requests_interval_msec = 99 [default = 25]; + + // Output metrics options, where output is the response body returned by the + // HTTP probe process. Cloudprober expects variables to be in the following + // format in the response body: + // var1 value1 (for example: total_errors 589) + optional bool export_response_as_metrics = 16 [default = false]; + optional metrics.payload.OutputMetricsOptions output_metrics_options = 17; }