chore(telemetry): add deployment type (#875)

Signed-off-by: Prashant Shahi <prashant@signoz.io>
This commit is contained in:
Prashant Shahi 2022-03-21 20:39:53 +05:30 committed by GitHub
parent ab10a699b1
commit 561d18efec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 19 additions and 0 deletions

View File

@ -37,6 +37,11 @@ services:
- STORAGE=clickhouse
- POSTHOG_API_KEY=H-htDCae7CR3RV57gUzmol6IAKtm5IMCvbcm_fwnL-w
- GODEBUG=netdns=go
- TELEMETRY_ENABLED=true
- DEPLOYMENT_TYPE=docker-swarm
deploy:
restart_policy:
condition: on-failure
depends_on:
- clickhouse

View File

@ -35,6 +35,8 @@ services:
- STORAGE=clickhouse
- GODEBUG=netdns=go
- TELEMETRY_ENABLED=true
- DEPLOYMENT_TYPE=docker-standalone-arm
restart: on-failure
depends_on:
clickhouse:
condition: service_healthy

View File

@ -38,6 +38,8 @@ services:
- STORAGE=clickhouse
- GODEBUG=netdns=go
- TELEMETRY_ENABLED=true
- DEPLOYMENT_TYPE=docker-standalone-amd
restart: on-failure
depends_on:
clickhouse:
condition: service_healthy

View File

@ -3,6 +3,7 @@ package telemetry
import (
"io/ioutil"
"net/http"
"os"
"sync"
"time"
@ -111,6 +112,7 @@ func (a *Telemetry) SendEvent(event string, data map[string]interface{}) {
// zap.S().Info(data)
properties := analytics.NewProperties()
properties.Set("version", version.GetVersion())
properties.Set("deploymentType", getDeploymentType())
for k, v := range data {
properties.Set(k, v)
@ -159,3 +161,11 @@ func GetInstance() *Telemetry {
return telemetry
}
func getDeploymentType() string {
deploymentType := os.Getenv("DEPLOYMENT_TYPE")
if deploymentType == "" {
return "unknown"
}
return deploymentType
}