Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PrometheusMetricsController ¶
type PrometheusMetricsController struct { httpctrl.RestController // contains filtered or unexported fields }
PrometheusMetricsController is controller that exposes "/metrics" route for Prometheus to scap performance metrics.
Configuration parameters: - dependencies: - endpoint: override for HTTP Endpoint dependency - prometheus-counters: override for PrometheusCounters dependency - connection(s): - discovery_key: (optional) a key to retrieve the connection from IDiscovery - protocol: connection protocol: http or https - host: host name or IP address - port: port number - uri: resource URI or connection string with all parameters in it References: - *:logger:*:*:1.0 (optional) ILogger components to pass log messages - *:counters:*:*:1.0 (optional) ICounters components to pass collected measurements - *:discovery:*:*:1.0 (optional) IDiscovery services to resolve connection - *:endpoint:http:*:1.0 (optional) HttpEndpoint reference to expose REST operation - *:counters:prometheus:*:1.0 PrometheusCounters reference to retrieve collected metrics
See RestController See RestClient
Example
ctx := context.Context() service := NewPrometheusMetricsController(); service.Configure(ctx, cconf.NewConfigParamsFromTuples( "connection.protocol", "http", "connection.host", "localhost", "connection.port", "8080", )); err := service.Open(ctx) if err == nil { fmt.Println("The Prometheus metrics service is accessible at http://localhost:8080/metrics"); defer service.Close(ctx) }
func NewPrometheusMetricsController ¶
func NewPrometheusMetricsController() *PrometheusMetricsController
NewPrometheusMetricsController are creates a new instance of c service. Returns *PrometheusMetricsController pointer on new instance
func (*PrometheusMetricsController) Register ¶
func (c *PrometheusMetricsController) Register()
Register method are registers all service routes in HTTP endpoint.
func (*PrometheusMetricsController) SetReferences ¶
func (c *PrometheusMetricsController) SetReferences(ctx context.Context, references cref.IReferences)
SetReferences is sets references to dependent components.
Parameters: - ctx context.Context operation context - references cref.IReferences
references to locate the component dependencies.
Click to show internal directories.
Click to hide internal directories.