mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-08-12 21:09:03 +08:00
fix: concurrent writes to map
This commit is contained in:
parent
e8f341b850
commit
cab9e04cdd
@ -45,9 +45,9 @@ const ph_api_key = "H-htDCae7CR3RV57gUzmol6IAKtm5IMCvbcm_fwnL-w"
|
|||||||
const IP_NOT_FOUND_PLACEHOLDER = "NA"
|
const IP_NOT_FOUND_PLACEHOLDER = "NA"
|
||||||
const DEFAULT_NUMBER_OF_SERVICES = 6
|
const DEFAULT_NUMBER_OF_SERVICES = 6
|
||||||
|
|
||||||
const HEART_BEAT_DURATION = 6 * time.Hour
|
// const HEART_BEAT_DURATION = 6 * time.Hour
|
||||||
|
|
||||||
// const HEART_BEAT_DURATION = 10 * time.Second
|
const HEART_BEAT_DURATION = 30 * time.Second
|
||||||
|
|
||||||
const RATE_LIMIT_CHECK_DURATION = 1 * time.Minute
|
const RATE_LIMIT_CHECK_DURATION = 1 * time.Minute
|
||||||
const RATE_LIMIT_VALUE = 2
|
const RATE_LIMIT_VALUE = 2
|
||||||
@ -88,13 +88,19 @@ func (telemetry *Telemetry) CheckSigNozMetrics(compositeMetricQueryMap map[strin
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (telemetry *Telemetry) AddActiveTracesUser() {
|
func (telemetry *Telemetry) AddActiveTracesUser() {
|
||||||
|
telemetry.mutex.Lock()
|
||||||
telemetry.activeUser["traces"] = 1
|
telemetry.activeUser["traces"] = 1
|
||||||
|
telemetry.mutex.Unlock()
|
||||||
}
|
}
|
||||||
func (telemetry *Telemetry) AddActiveMetricsUser() {
|
func (telemetry *Telemetry) AddActiveMetricsUser() {
|
||||||
|
telemetry.mutex.Lock()
|
||||||
telemetry.activeUser["metrics"] = 1
|
telemetry.activeUser["metrics"] = 1
|
||||||
|
telemetry.mutex.Unlock()
|
||||||
}
|
}
|
||||||
func (telemetry *Telemetry) AddActiveLogsUser() {
|
func (telemetry *Telemetry) AddActiveLogsUser() {
|
||||||
|
telemetry.mutex.Lock()
|
||||||
telemetry.activeUser["logs"] = 1
|
telemetry.activeUser["logs"] = 1
|
||||||
|
telemetry.mutex.Unlock()
|
||||||
}
|
}
|
||||||
|
|
||||||
type Telemetry struct {
|
type Telemetry struct {
|
||||||
@ -111,6 +117,7 @@ type Telemetry struct {
|
|||||||
rateLimits map[string]int8
|
rateLimits map[string]int8
|
||||||
activeUser map[string]int8
|
activeUser map[string]int8
|
||||||
countUsers int8
|
countUsers int8
|
||||||
|
mutex sync.RWMutex
|
||||||
}
|
}
|
||||||
|
|
||||||
func createTelemetry() {
|
func createTelemetry() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user