gocraft / health Goto Github PK
View Code? Open in Web Editor NEWInstrument your web apps with logging and metrics
License: MIT License
Instrument your web apps with logging and metrics
License: MIT License
i am using this in an environment where the WAN gateway is not always up.
The servers are in remote locations.
So i was wondering if this supports some sort of log rotation, but still able to work with sinks ?
I'm serving the JsonPollingSink data myself. It'd be nice to have access to the intervalDuration for that sink.
hi,@gocraft ,I've looked into the source code of gocraft/health,what surprises me is that the aggregation part is totally free of lock.what I'm wondering is how you guarantee the concurrency safety.
for example,the code of func ingest
in interval_aggregation.go
func (a *TimerAggregation) ingest(nanos int64) {
a.Count++
a.NanosSum += nanos
floatNano := float64(nanos)
a.NanosSumSquares += (floatNano * floatNano)
if a.Count == 1 || nanos < a.NanosMin {
a.NanosMin = nanos
}
if a.Count == 1 || nanos > a.NanosMax {
a.NanosMax = nanos
}
}
while doing the plus operation,the value may be modified in other goroutines.the plus operation +
is not atomic,the whole ingest
may produce inconsistent for relevant fields or wrong result of computation.
in the aggregator.go
func (a *aggregator) getIntervalAggregation() *IntervalAggregation {
intervalStart := now().Truncate(a.intervalDuration)
n := len(a.intervalAggregations)
if n > 0 && a.intervalAggregations[n-1].IntervalStart == intervalStart {
return a.intervalAggregations[n-1]
}
return a.createIntervalAggregation(intervalStart)
}
the judge for existence if not atomic either,the *IntervalAggregation can be created for many times.
i am logging JSON and sending to Bugsnap for now. All great.
But for the business analytics, i need to log as CSV and send up to S3.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.