services

package
Version: v1.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 6, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PrometheusMetricsService

type PrometheusMetricsService struct {
	rpcservices.RestService
	// contains filtered or unexported fields
}

PrometheusMetricsService is service 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 RestService See RestClient

Example

   service := NewPrometheusMetricsService();
   service.Configure(cconf.NewConfigParamsFromTuples(
       "connection.protocol", "http",
       "connection.host", "localhost",
       "connection.port", "8080",
   ));

   err := service.Open("123")
   if  err == nil {
       fmt.Println("The Prometheus metrics service is accessible at http://localhost:8080/metrics");
       defer service.Close("")
   }

func NewPrometheusMetricsService

func NewPrometheusMetricsService() *PrometheusMetricsService

NewPrometheusMetricsService are creates a new instance of c service. Returns *PrometheusMetricsService pointer on new instance

func (*PrometheusMetricsService) Register

func (c *PrometheusMetricsService) Register()

Register method are registers all service routes in HTTP endpoint.

func (*PrometheusMetricsService) SetReferences

func (c *PrometheusMetricsService) SetReferences(references cref.IReferences)

SetReferences is sets references to dependent components. Parameters:

- references cref.IReferences

references to locate the component dependencies.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL