Comments (3)
Now that we have a datastore abstraction, adding metrics on top would be a great place to start, and I'd like to tackle this sometime soon.
Here's what I'd like to do.
package datastore
// a private type that embeds the datastore interface
type instrumented struct {
count metrics.Counter
latency metrics.TimeHistogram
Datastore
}
accept a datastore and return back the above one
func NewWithMetrics(ds Datastore) Datastore {
count := metrics.NewCounter(...)
latency := metrics. NewTimeHistogram(...)
return instrumented{count, latency, ds}
}
layer methods on top of datastore
func (mw instrumented) NewUser(user *kolide.User) (user *kolide.User, err error) {
// from go-kit metrics example
defer func(begin time.Time) {
methodField := metrics.Field{Key: "method", Value: "newuser"}
errorField := metrics.Field{Key: "error", Value: fmt.Sprintf("%v", err)}
mw.requestCount.With(methodField).With(errorField).Add(1)
mw.requestLatency.With(methodField).With(errorField).Observe(time.Since(begin))
}(time.Now())
user, err = mw.Datastore.NewUser(user)
}
from fleet.
This should be easy to do now that we're using go-kit.
from fleet.
Closing as I've begun initial work in #236
Will continue going down this path from now on.
from fleet.
Related Issues (20)
- Fleet producing 500 Error HOT 5
- Kolide Fleet, incoming host indefinitely HOT 13
- Host won't reenroll with different MAC address HOT 1
- Kolide Slack is down HOT 2
- Data Transfer from kolide fleet to Kafka broker by using Kolide API token HOT 1
- Feature request: `fleetctl get hosts` should show osquery version HOT 1
- Live queries fail and cause the query to be run over and over on the host HOT 8
- Allow programmatic user management HOT 2
- Integer conversion errors in 32-bit builds HOT 6
- Unexpected EOF when pulling hosts HOT 5
- ui edge case: Wrong empty state and filter sidebar after canceling "Add new label"
- Logs on local machine with launcher started HOT 5
- feature: add ability to filter additional host info HOT 2
- Case-insensitive enroll secret and node_key validation
- fleet prepare db with Specified key was too long error HOT 1
- fleet consider support osquery query denylist parameter
- Execute commands on the agent side HOT 1
- Improper error handling for parsing of certificate PEM in fleetctl HOT 3
- fleetctl hosts json output has no status field
- Saving logs on fleet clients machines HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fleet.