github.com/cilium/cilium@v1.16.2/pkg/hubble/metrics/http/plugin.go (about) 1 // SPDX-License-Identifier: Apache-2.0 2 // Copyright Authors of Hubble 3 4 package http 5 6 import ( 7 "github.com/cilium/cilium/pkg/hubble/metrics/api" 8 ) 9 10 type httpPlugin struct{} 11 12 func (p *httpPlugin) NewHandler() api.Handler { 13 return &httpHandler{} 14 } 15 16 func (p *httpPlugin) HelpText() string { 17 return `http - HTTP metrics 18 Metrics related to the HTTP protocol 19 20 Metrics: 21 http_requests_total - Count of HTTP requests by methods. 22 http_responses_total - Count of HTTP responses by methods and status codes. 23 http_request_duration_seconds - Median, 90th and 99th percentile of request duration. 24 25 Options:` + 26 api.ContextOptionsHelp 27 } 28 29 func (p *httpPlugin) ConflictingPlugins() []string { 30 return []string{"httpV2"} 31 } 32 33 type httpV2Plugin struct{} 34 35 func (p *httpV2Plugin) NewHandler() api.Handler { 36 return &httpHandler{useV2: true} 37 } 38 39 func (p *httpV2Plugin) HelpText() string { 40 return `httpV2 - HTTP metrics 41 Metrics related to the HTTP protocol 42 43 Metrics: 44 http_requests_total - Count of HTTP requests by method, protocol, and status code. 45 http_request_duration_seconds - Median, 90th and 99th percentile of request duration. 46 47 Options:` + 48 api.ContextOptionsHelp 49 } 50 51 func (p *httpV2Plugin) ConflictingPlugins() []string { 52 return []string{"http"} 53 } 54 55 func init() { 56 api.DefaultRegistry().Register("http", &httpPlugin{}) 57 api.DefaultRegistry().Register("httpV2", &httpV2Plugin{}) 58 }