Skip to content

Commit b191d77

Browse files
committed
remove telemetry from alpha and push very basic telemetry in zero
1 parent e01eebd commit b191d77

59 files changed

Lines changed: 316 additions & 510 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

dgraph/cmd/alpha/mutations_mode/docker-compose.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ services:
1717
target: /gobin
1818
read_only: true
1919
command:
20-
/gobin/dgraph ${COVERAGE_OUTPUT} alpha --telemetry "reports=false;" --my=alpha1:7080
20+
/gobin/dgraph ${COVERAGE_OUTPUT} alpha --my=alpha1:7080
2121
--zero=zero1:5080,zero2:5080,zero3:5080 --logtostderr -v=2 --security
2222
"whitelist=10.0.0.0/8,172.16.0.0/12,192.168.0.0/16;" --limit "mutations=disallow;"
2323
alpha2:
@@ -34,7 +34,7 @@ services:
3434
target: /gobin
3535
read_only: true
3636
command:
37-
/gobin/dgraph ${COVERAGE_OUTPUT} alpha --telemetry "reports=false;" --my=alpha2:7080
37+
/gobin/dgraph ${COVERAGE_OUTPUT} alpha --my=alpha2:7080
3838
--zero=zero1:5080,zero2:5080,zero3:5080 --logtostderr -v=2 --security
3939
"whitelist=10.0.0.0/8,172.16.0.0/12,192.168.0.0/16;" --limit "mutations=strict;"
4040
alpha3:
@@ -51,7 +51,7 @@ services:
5151
target: /gobin
5252
read_only: true
5353
command:
54-
/gobin/dgraph ${COVERAGE_OUTPUT} alpha --telemetry "reports=false;" --my=alpha3:7080
54+
/gobin/dgraph ${COVERAGE_OUTPUT} alpha --my=alpha3:7080
5555
--zero=zero1:5080,zero2:5080,zero3:5080 --logtostderr -v=2 --security
5656
"whitelist=10.0.0.0/8,172.16.0.0/12,192.168.0.0/16;" --limit "mutations=strict;"
5757
zero1:

dgraph/cmd/alpha/run.go

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -612,9 +612,8 @@ func setupServer(closer *z.Closer) {
612612
}
613613

614614
func run() {
615-
var err error
616-
617-
telemetry := z.NewSuperFlag(Alpha.Conf.GetString("telemetry")).
615+
// keeping this flag for backward compatibility
616+
_ = z.NewSuperFlag(Alpha.Conf.GetString("telemetry")).
618617
MergeAndCheckDefault(x.TelemetryDefaults)
619618

620619
bindall = Alpha.Conf.GetBool("bindall")
@@ -712,10 +711,6 @@ func run() {
712711
}
713712
x.WorkerConfig.Parse(Alpha.Conf)
714713

715-
if telemetry.GetBool("reports") {
716-
go edgraph.PeriodicallyPostTelemetry()
717-
}
718-
719714
// Set the directory for temporary buffers.
720715
z.SetTmpDir(x.WorkerConfig.TmpDir)
721716

dgraph/cmd/zero/run.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,6 @@ func (st *state) serveGRPC(l net.Listener, store *raftwal.DiskStorage) {
199199
}
200200

201201
func run() {
202-
// keeping this flag for backward compatibility
203202
telemetry := z.NewSuperFlag(Zero.Conf.GetString("telemetry")).
204203
MergeAndCheckDefault(x.TelemetryDefaults)
205204

dgraph/cmd/zero/zero.go

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ import (
1010
"crypto/tls"
1111
"fmt"
1212
"math"
13+
"net/http"
14+
"runtime"
1315
"sync"
1416
"time"
1517

@@ -23,7 +25,6 @@ import (
2325
"github.com/dgraph-io/ristretto/v2/z"
2426
"github.com/hypermodeinc/dgraph/v25/conn"
2527
"github.com/hypermodeinc/dgraph/v25/protos/pb"
26-
"github.com/hypermodeinc/dgraph/v25/telemetry"
2728
"github.com/hypermodeinc/dgraph/v25/x"
2829
)
2930

@@ -98,34 +99,39 @@ func (s *Server) Init() {
9899
}
99100

100101
func (s *Server) periodicallyPostTelemetry() {
101-
glog.V(2).Infof("Starting telemetry data collection for zero...")
102-
start := time.Now()
102+
// sleep so that a leader is elected by this time
103+
time.Sleep(time.Minute)
103104

104-
ticker := time.NewTicker(time.Minute * 10)
105-
defer ticker.Stop()
105+
glog.Infof("Starting telemetry data collection for zero...")
106106

107107
var lastPostedAt time.Time
108-
for range ticker.C {
108+
for ; true; <-time.Tick(time.Hour * 6) {
109109
if !s.Node.AmLeader() {
110110
continue
111111
}
112-
if time.Since(lastPostedAt) < time.Hour {
112+
113+
if time.Since(lastPostedAt) < time.Hour*24 {
113114
continue
114115
}
116+
115117
ms := s.membershipState()
116-
t := telemetry.NewZero(ms)
117-
if t == nil {
118-
continue
118+
var numAlphas, numTablets int
119+
for _, g := range ms.GetGroups() {
120+
numAlphas += len(g.GetMembers())
121+
numTablets += len(g.GetTablets())
119122
}
120-
t.SinceHours = int(time.Since(start).Hours())
121-
glog.V(2).Infof("Posting Telemetry data: %+v", t)
122123

123-
err := t.Post()
124-
if err == nil {
125-
lastPostedAt = time.Now()
126-
} else {
127-
glog.V(2).Infof("Telemetry couldn't be posted. Error: %v", err)
124+
url := fmt.Sprintf("https://dgraph.gateway.scarf.sh/%v/%v/%v/%v/%v",
125+
x.Version(), runtime.GOOS, numAlphas, len(ms.GetZeros()), numTablets)
126+
glog.Infof("Posting Telemetry data to [%v]", url)
127+
128+
resp, err := http.Get(url)
129+
if err != nil {
130+
glog.Infof("Telemetry couldn't be posted. Error: %v", err)
131+
continue
128132
}
133+
_ = resp.Body.Close()
134+
lastPostedAt = time.Now()
129135
}
130136
}
131137

dgraph/docker-compose.yml

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,9 @@ services:
113113
cluster: test
114114
service: alpha
115115
command:
116-
/gobin/dgraph ${COVERAGE_OUTPUT} alpha --telemetry "reports=false;" --encryption
117-
"key-file=/dgraph-enc/enc-key;" --my=alpha2:7080 --zero=zero1:5080,zero2:5080,zero3:5080
118-
--expose_trace --profile_mode block --block_rate 10 --logtostderr -v=2 --security
116+
/gobin/dgraph ${COVERAGE_OUTPUT} alpha --encryption "key-file=/dgraph-enc/enc-key;"
117+
--my=alpha2:7080 --zero=zero1:5080,zero2:5080,zero3:5080 --expose_trace --profile_mode block
118+
--block_rate 10 --logtostderr -v=2 --security
119119
"whitelist=10.0.0.0/8,172.16.0.0/12,192.168.0.0/16;" --acl
120120
"secret-file=/dgraph-acl/hmac-secret; access-ttl=20s;"
121121

@@ -144,9 +144,9 @@ services:
144144
cluster: test
145145
service: alpha
146146
command:
147-
/gobin/dgraph ${COVERAGE_OUTPUT} alpha --telemetry "reports=false;" --encryption
148-
"key-file=/dgraph-enc/enc-key;" --my=alpha3:7080 --zero=zero1:5080,zero2:5080,zero3:5080
149-
--expose_trace --profile_mode block --block_rate 10 --logtostderr -v=2 --security
147+
/gobin/dgraph ${COVERAGE_OUTPUT} alpha --encryption "key-file=/dgraph-enc/enc-key;"
148+
--my=alpha3:7080 --zero=zero1:5080,zero2:5080,zero3:5080 --expose_trace --profile_mode block
149+
--block_rate 10 --logtostderr -v=2 --security
150150
"whitelist=10.0.0.0/8,172.16.0.0/12,192.168.0.0/16;" --acl
151151
"secret-file=/dgraph-acl/hmac-secret; access-ttl=20s;"
152152

@@ -175,9 +175,9 @@ services:
175175
cluster: test
176176
service: alpha
177177
command:
178-
/gobin/dgraph ${COVERAGE_OUTPUT} alpha --telemetry "reports=false;" --encryption
179-
"key-file=/dgraph-enc/enc-key;" --my=alpha4:7080 --zero=zero1:5080,zero2:5080,zero3:5080
180-
--expose_trace --profile_mode block --block_rate 10 --logtostderr -v=2 --security
178+
/gobin/dgraph ${COVERAGE_OUTPUT} alpha --encryption "key-file=/dgraph-enc/enc-key;"
179+
--my=alpha4:7080 --zero=zero1:5080,zero2:5080,zero3:5080 --expose_trace --profile_mode block
180+
--block_rate 10 --logtostderr -v=2 --security
181181
"whitelist=10.0.0.0/8,172.16.0.0/12,192.168.0.0/16;" --acl
182182
"secret-file=/dgraph-acl/hmac-secret; access-ttl=20s;"
183183

@@ -206,9 +206,9 @@ services:
206206
cluster: test
207207
service: alpha
208208
command:
209-
/gobin/dgraph ${COVERAGE_OUTPUT} alpha --telemetry "reports=false;" --encryption
210-
"key-file=/dgraph-enc/enc-key;" --my=alpha5:7080 --zero=zero1:5080,zero2:5080,zero3:5080
211-
--expose_trace --profile_mode block --block_rate 10 --logtostderr -v=2 --security
209+
/gobin/dgraph ${COVERAGE_OUTPUT} alpha --encryption "key-file=/dgraph-enc/enc-key;"
210+
--my=alpha5:7080 --zero=zero1:5080,zero2:5080,zero3:5080 --expose_trace --profile_mode block
211+
--block_rate 10 --logtostderr -v=2 --security
212212
"whitelist=10.0.0.0/8,172.16.0.0/12,192.168.0.0/16;" --acl
213213
"secret-file=/dgraph-acl/hmac-secret; access-ttl=20s;"
214214

@@ -237,9 +237,9 @@ services:
237237
cluster: test
238238
service: alpha
239239
command:
240-
/gobin/dgraph ${COVERAGE_OUTPUT} alpha --telemetry "reports=false;" --encryption
241-
"key-file=/dgraph-enc/enc-key;" --my=alpha6:7080 --zero=zero1:5080,zero2:5080,zero3:5080
242-
--expose_trace --profile_mode block --block_rate 10 --logtostderr -v=2 --security
240+
/gobin/dgraph ${COVERAGE_OUTPUT} alpha --encryption "key-file=/dgraph-enc/enc-key;"
241+
--my=alpha6:7080 --zero=zero1:5080,zero2:5080,zero3:5080 --expose_trace --profile_mode block
242+
--block_rate 10 --logtostderr -v=2 --security
243243
"whitelist=10.0.0.0/8,172.16.0.0/12,192.168.0.0/16;" --acl
244244
"secret-file=/dgraph-acl/hmac-secret; access-ttl=20s;"
245245

edgraph/server.go

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ import (
4343
"github.com/hypermodeinc/dgraph/v25/protos/pb"
4444
"github.com/hypermodeinc/dgraph/v25/query"
4545
"github.com/hypermodeinc/dgraph/v25/schema"
46-
"github.com/hypermodeinc/dgraph/v25/telemetry"
4746
"github.com/hypermodeinc/dgraph/v25/tok"
4847
"github.com/hypermodeinc/dgraph/v25/types"
4948
"github.com/hypermodeinc/dgraph/v25/types/facets"
@@ -108,37 +107,6 @@ type existingGQLSchemaQryResp struct {
108107
ExistingGQLSchema []graphQLSchemaNode `json:"ExistingGQLSchema"`
109108
}
110109

111-
// PeriodicallyPostTelemetry periodically reports telemetry data for alpha.
112-
func PeriodicallyPostTelemetry() {
113-
glog.V(2).Infof("Starting telemetry data collection for alpha...")
114-
115-
start := time.Now()
116-
ticker := time.NewTicker(time.Minute * 10)
117-
defer ticker.Stop()
118-
119-
var lastPostedAt time.Time
120-
for range ticker.C {
121-
if time.Since(lastPostedAt) < time.Hour {
122-
continue
123-
}
124-
ms := worker.GetMembershipState()
125-
t := telemetry.NewAlpha(ms)
126-
t.NumDQL = atomic.SwapUint64(&numDQL, 0)
127-
t.NumGraphQL = atomic.SwapUint64(&numGraphQL, 0)
128-
t.SinceHours = int(time.Since(start).Hours())
129-
glog.V(2).Infof("Posting Telemetry data: %+v", t)
130-
131-
err := t.Post()
132-
if err == nil {
133-
lastPostedAt = time.Now()
134-
} else {
135-
atomic.AddUint64(&numDQL, t.NumDQL)
136-
atomic.AddUint64(&numGraphQL, t.NumGraphQL)
137-
glog.V(2).Infof("Telemetry couldn't be posted. Error: %v", err)
138-
}
139-
}
140-
}
141-
142110
// GetGQLSchema queries for the GraphQL schema node, and returns the uid and the GraphQL schema.
143111
// If multiple schema nodes were found, it returns an error.
144112
func GetGQLSchema(namespace uint64) (uid, graphQLSchema string, err error) {

graphql/e2e/admin_auth/poorman_auth/docker-compose.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ services:
3333
cluster: test
3434
service: alpha1
3535
command:
36-
/gobin/dgraph ${COVERAGE_OUTPUT} alpha --telemetry "reports=false;" --my=alpha1:7080
37-
--zero=zero1:5080 --expose_trace --profile_mode block --block_rate 10 --logtostderr -v=2
38-
--security "whitelist=10.0.0.0/8,172.16.0.0/12,192.168.0.0/16; token=itIsSecret;" --trace
39-
"ratio=1.0;"
36+
/gobin/dgraph ${COVERAGE_OUTPUT} alpha --my=alpha1:7080 --zero=zero1:5080 --expose_trace
37+
--profile_mode block --block_rate 10 --logtostderr -v=2 --security
38+
"whitelist=10.0.0.0/8,172.16.0.0/12,192.168.0.0/16; token=itIsSecret;" --trace "ratio=1.0;"

graphql/e2e/admin_auth/poorman_auth_with_acl/docker-compose.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ services:
3737
cluster: test
3838
service: alpha1
3939
command:
40-
/gobin/dgraph ${COVERAGE_OUTPUT} alpha --telemetry "reports=false;" --my=alpha1:7080
41-
--zero=zero1:5080 --expose_trace --profile_mode block --block_rate 10 --logtostderr -v=2
42-
--security "whitelist=10.0.0.0/8,172.16.0.0/12,192.168.0.0/16; token=itIsSecret;" --acl
40+
/gobin/dgraph ${COVERAGE_OUTPUT} alpha --my=alpha1:7080 --zero=zero1:5080 --expose_trace
41+
--profile_mode block --block_rate 10 --logtostderr -v=2 --security
42+
"whitelist=10.0.0.0/8,172.16.0.0/12,192.168.0.0/16; token=itIsSecret;" --acl
4343
"secret-file=/dgraph-acl/hmac-secret; access-ttl=3s;" --trace "ratio=1.0;"

graphql/e2e/auth/debug_off/docker-compose.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,6 @@ services:
3333
cluster: test
3434
service: alpha1
3535
command:
36-
/gobin/dgraph ${COVERAGE_OUTPUT} alpha --telemetry "reports=false;" --zero=zero1:5080
37-
--expose_trace --profile_mode block --block_rate 10 --logtostderr -v=3 --my=alpha1:7080
38-
--security "whitelist=10.0.0.0/8,172.16.0.0/12,192.168.0.0/16;" --trace "ratio=1.0;"
36+
/gobin/dgraph ${COVERAGE_OUTPUT} alpha --zero=zero1:5080 --expose_trace --profile_mode block
37+
--block_rate 10 --logtostderr -v=3 --my=alpha1:7080 --security
38+
"whitelist=10.0.0.0/8,172.16.0.0/12,192.168.0.0/16;" --trace "ratio=1.0;"

graphql/e2e/auth/docker-compose.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ services:
3333
cluster: test
3434
service: alpha1
3535
command:
36-
/gobin/dgraph ${COVERAGE_OUTPUT} alpha --telemetry "reports=false;" --zero=zero1:5080
37-
--expose_trace --profile_mode block --block_rate 10 --logtostderr -v=3 --my=alpha1:7080
38-
--security "whitelist=10.0.0.0/8,172.16.0.0/12,192.168.0.0/16;" --graphql "debug=true;"
39-
--trace "ratio=1.0;"
36+
/gobin/dgraph ${COVERAGE_OUTPUT} alpha --zero=zero1:5080 --expose_trace --profile_mode block
37+
--block_rate 10 --logtostderr -v=3 --my=alpha1:7080 --security
38+
"whitelist=10.0.0.0/8,172.16.0.0/12,192.168.0.0/16;" --graphql "debug=true;" --trace
39+
"ratio=1.0;"

0 commit comments

Comments
 (0)