2021-01-03 18:15:44 +05:30
|
|
|
package constants
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"os"
|
2022-01-26 21:40:44 +05:30
|
|
|
"strconv"
|
2021-01-03 18:15:44 +05:30
|
|
|
)
|
|
|
|
|
|
2022-05-03 15:26:32 +05:30
|
|
|
const (
|
2022-05-13 03:06:09 +05:30
|
|
|
HTTPHostPort = "0.0.0.0:8080" // Address to serve http (query service)
|
|
|
|
|
DebugHttpPort = "0.0.0.0:6060" // Address to serve http (pprof)
|
2022-05-03 15:26:32 +05:30
|
|
|
)
|
2021-01-03 18:15:44 +05:30
|
|
|
|
2022-01-26 21:40:44 +05:30
|
|
|
var DEFAULT_TELEMETRY_ANONYMOUS = false
|
|
|
|
|
|
|
|
|
|
func IsTelemetryEnabled() bool {
|
|
|
|
|
isTelemetryEnabledStr := os.Getenv("TELEMETRY_ENABLED")
|
|
|
|
|
isTelemetryEnabledBool, err := strconv.ParseBool(isTelemetryEnabledStr)
|
|
|
|
|
if err != nil {
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
return isTelemetryEnabledBool
|
|
|
|
|
}
|
2021-10-20 13:18:19 +05:30
|
|
|
|
|
|
|
|
const TraceTTL = "traces"
|
|
|
|
|
const MetricsTTL = "metrics"
|
2021-11-22 16:15:58 +05:30
|
|
|
|
2022-02-09 22:05:27 +01:00
|
|
|
func GetAlertManagerApiPrefix() string {
|
|
|
|
|
if os.Getenv("ALERTMANAGER_API_PREFIX") != "" {
|
|
|
|
|
return os.Getenv("ALERTMANAGER_API_PREFIX")
|
|
|
|
|
}
|
|
|
|
|
return "http://alertmanager:9093/api/"
|
|
|
|
|
}
|
|
|
|
|
|
2022-03-28 21:44:40 +05:30
|
|
|
// Alert manager channel subpath
|
2022-03-28 21:01:57 +05:30
|
|
|
var AmChannelApiPath = GetOrDefaultEnv("ALERTMANAGER_API_CHANNEL_PATH", "v1/routes")
|
|
|
|
|
|
|
|
|
|
var RELATIONAL_DATASOURCE_PATH = GetOrDefaultEnv("SIGNOZ_LOCAL_DB_PATH", "/var/lib/signoz/signoz.db")
|
2022-01-28 22:56:54 +05:30
|
|
|
|
|
|
|
|
const (
|
2022-05-25 16:55:30 +05:30
|
|
|
ServiceName = "serviceName"
|
|
|
|
|
HttpRoute = "httpRoute"
|
|
|
|
|
HttpCode = "httpCode"
|
|
|
|
|
HttpHost = "httpHost"
|
|
|
|
|
HttpUrl = "httpUrl"
|
|
|
|
|
HttpMethod = "httpMethod"
|
|
|
|
|
Component = "component"
|
|
|
|
|
OperationDB = "name"
|
|
|
|
|
OperationRequest = "operation"
|
|
|
|
|
Status = "status"
|
|
|
|
|
Duration = "duration"
|
|
|
|
|
DBName = "dbName"
|
|
|
|
|
DBOperation = "dbOperation"
|
|
|
|
|
DBSystem = "dbSystem"
|
|
|
|
|
MsgSystem = "msgSystem"
|
|
|
|
|
MsgOperation = "msgOperation"
|
|
|
|
|
Timestamp = "timestamp"
|
|
|
|
|
Descending = "descending"
|
|
|
|
|
Ascending = "ascending"
|
|
|
|
|
ContextTimeout = 60 // seconds
|
|
|
|
|
StatusPending = "pending"
|
|
|
|
|
StatusFailed = "failed"
|
|
|
|
|
StatusSuccess = "success"
|
2022-01-28 22:56:54 +05:30
|
|
|
)
|
2022-03-28 21:01:57 +05:30
|
|
|
|
|
|
|
|
func GetOrDefaultEnv(key string, fallback string) string {
|
|
|
|
|
v := os.Getenv(key)
|
|
|
|
|
if len(v) == 0 {
|
|
|
|
|
return fallback
|
|
|
|
|
}
|
|
|
|
|
return v
|
2022-03-28 21:44:40 +05:30
|
|
|
}
|