mirror of https://github.com/status-im/consul.git
Merge branch 'master' of github.com:captainill/consul
This commit is contained in:
commit
0b81dd467f
|
@ -134,7 +134,7 @@ func (c *Catalog) ServiceNodes(args *structs.ServiceSpecificRequest, reply *stru
|
|||
|
||||
// Get the nodes
|
||||
state := c.srv.fsm.State()
|
||||
return c.srv.blockingRPC(&args.BlockingQuery,
|
||||
err := c.srv.blockingRPC(&args.BlockingQuery,
|
||||
state.QueryTables("ServiceNodes"),
|
||||
func() (uint64, error) {
|
||||
if args.TagFilter {
|
||||
|
@ -144,6 +144,18 @@ func (c *Catalog) ServiceNodes(args *structs.ServiceSpecificRequest, reply *stru
|
|||
}
|
||||
return reply.Index, nil
|
||||
})
|
||||
|
||||
// Provide some metrics
|
||||
if err == nil {
|
||||
metrics.IncrCounter([]string{"consul", "catalog", "service", "query", args.ServiceName}, 1)
|
||||
if args.ServiceTag != "" {
|
||||
metrics.IncrCounter([]string{"consul", "catalog", "service", "query-tag", args.ServiceName, args.ServiceTag}, 1)
|
||||
}
|
||||
if len(reply.ServiceNodes) == 0 {
|
||||
metrics.IncrCounter([]string{"consul", "catalog", "service", "not-found", args.ServiceName}, 1)
|
||||
}
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
// NodeServices returns all the services registered as part of a node
|
||||
|
|
|
@ -2,6 +2,7 @@ package consul
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/armon/go-metrics"
|
||||
"github.com/hashicorp/consul/consul/structs"
|
||||
)
|
||||
|
||||
|
@ -80,7 +81,7 @@ func (h *Health) ServiceNodes(args *structs.ServiceSpecificRequest, reply *struc
|
|||
|
||||
// Get the nodes
|
||||
state := h.srv.fsm.State()
|
||||
return h.srv.blockingRPC(&args.BlockingQuery,
|
||||
err := h.srv.blockingRPC(&args.BlockingQuery,
|
||||
state.QueryTables("CheckServiceNodes"),
|
||||
func() (uint64, error) {
|
||||
if args.TagFilter {
|
||||
|
@ -90,4 +91,16 @@ func (h *Health) ServiceNodes(args *structs.ServiceSpecificRequest, reply *struc
|
|||
}
|
||||
return reply.Index, nil
|
||||
})
|
||||
|
||||
// Provide some metrics
|
||||
if err == nil {
|
||||
metrics.IncrCounter([]string{"consul", "health", "service", "query", args.ServiceName}, 1)
|
||||
if args.ServiceTag != "" {
|
||||
metrics.IncrCounter([]string{"consul", "health", "service", "query-tag", args.ServiceName, args.ServiceTag}, 1)
|
||||
}
|
||||
if len(reply.Nodes) == 0 {
|
||||
metrics.IncrCounter([]string{"consul", "health", "service", "not-found", args.ServiceName}, 1)
|
||||
}
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
|
|
@ -18,6 +18,10 @@ information to the stderr of the agent.
|
|||
In general, the telemetry information is used for debugging or otherwise
|
||||
getting a better view into what Consul is doing.
|
||||
|
||||
Additionally, if the `-statsite` [option](/docs/agent/options.html) is provided,
|
||||
then the telemetry information will be streamed to a [statsite](github.com/armon/statsite)
|
||||
server where it can be aggregate and flushed to Graphite or any other metrics store.
|
||||
|
||||
Below is an example output:
|
||||
|
||||
```
|
||||
|
|
Loading…
Reference in New Issue