Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions dgraph/cmd/alpha/mutations_mode/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ services:
target: /gobin
read_only: true
command:
/gobin/dgraph ${COVERAGE_OUTPUT} alpha --telemetry "reports=false;" --my=alpha1:7080
/gobin/dgraph ${COVERAGE_OUTPUT} alpha --my=alpha1:7080
--zero=zero1:5080,zero2:5080,zero3:5080 --logtostderr -v=2 --security
"whitelist=10.0.0.0/8,172.16.0.0/12,192.168.0.0/16;" --limit "mutations=disallow;"
alpha2:
Expand All @@ -34,7 +34,7 @@ services:
target: /gobin
read_only: true
command:
/gobin/dgraph ${COVERAGE_OUTPUT} alpha --telemetry "reports=false;" --my=alpha2:7080
/gobin/dgraph ${COVERAGE_OUTPUT} alpha --my=alpha2:7080
--zero=zero1:5080,zero2:5080,zero3:5080 --logtostderr -v=2 --security
"whitelist=10.0.0.0/8,172.16.0.0/12,192.168.0.0/16;" --limit "mutations=strict;"
alpha3:
Expand All @@ -51,7 +51,7 @@ services:
target: /gobin
read_only: true
command:
/gobin/dgraph ${COVERAGE_OUTPUT} alpha --telemetry "reports=false;" --my=alpha3:7080
/gobin/dgraph ${COVERAGE_OUTPUT} alpha --my=alpha3:7080
--zero=zero1:5080,zero2:5080,zero3:5080 --logtostderr -v=2 --security
"whitelist=10.0.0.0/8,172.16.0.0/12,192.168.0.0/16;" --limit "mutations=strict;"
zero1:
Expand Down
9 changes: 2 additions & 7 deletions dgraph/cmd/alpha/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -612,9 +612,8 @@ func setupServer(closer *z.Closer) {
}

func run() {
var err error

telemetry := z.NewSuperFlag(Alpha.Conf.GetString("telemetry")).
// keeping this flag for backward compatibility
_ = z.NewSuperFlag(Alpha.Conf.GetString("telemetry")).
MergeAndCheckDefault(x.TelemetryDefaults)

bindall = Alpha.Conf.GetBool("bindall")
Expand Down Expand Up @@ -712,10 +711,6 @@ func run() {
}
x.WorkerConfig.Parse(Alpha.Conf)

if telemetry.GetBool("reports") {
go edgraph.PeriodicallyPostTelemetry()
}

// Set the directory for temporary buffers.
z.SetTmpDir(x.WorkerConfig.TmpDir)

Expand Down
1 change: 0 additions & 1 deletion dgraph/cmd/zero/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,6 @@ func (st *state) serveGRPC(l net.Listener, store *raftwal.DiskStorage) {
}

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

Expand Down
40 changes: 23 additions & 17 deletions dgraph/cmd/zero/zero.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import (
"crypto/tls"
"fmt"
"math"
"net/http"
"runtime"
"sync"
"time"

Expand All @@ -23,7 +25,6 @@ import (
"github.com/dgraph-io/ristretto/v2/z"
"github.com/hypermodeinc/dgraph/v25/conn"
"github.com/hypermodeinc/dgraph/v25/protos/pb"
"github.com/hypermodeinc/dgraph/v25/telemetry"
"github.com/hypermodeinc/dgraph/v25/x"
)

Expand Down Expand Up @@ -98,34 +99,39 @@ func (s *Server) Init() {
}

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

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

var lastPostedAt time.Time
for range ticker.C {
for ; true; <-time.Tick(time.Hour * 6) {
if !s.Node.AmLeader() {
continue
}
if time.Since(lastPostedAt) < time.Hour {

if time.Since(lastPostedAt) < time.Hour*24 {
continue
}

ms := s.membershipState()
t := telemetry.NewZero(ms)
if t == nil {
continue
var numAlphas, numTablets int
for _, g := range ms.GetGroups() {
numAlphas += len(g.GetMembers())
numTablets += len(g.GetTablets())
}
t.SinceHours = int(time.Since(start).Hours())
glog.V(2).Infof("Posting Telemetry data: %+v", t)

err := t.Post()
if err == nil {
lastPostedAt = time.Now()
} else {
glog.V(2).Infof("Telemetry couldn't be posted. Error: %v", err)
url := fmt.Sprintf("https://dgraph.gateway.scarf.sh/%v/%v/%v/%v/%v",
x.Version(), runtime.GOOS, numAlphas, len(ms.GetZeros()), numTablets)
glog.Infof("Posting Telemetry data to [%v]", url)

resp, err := http.Get(url)
if err != nil {
glog.Infof("Telemetry couldn't be posted. Error: %v", err)
continue
}
_ = resp.Body.Close()
lastPostedAt = time.Now()
}
}

Expand Down
30 changes: 15 additions & 15 deletions dgraph/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,9 @@ services:
cluster: test
service: alpha
command:
/gobin/dgraph ${COVERAGE_OUTPUT} alpha --telemetry "reports=false;" --encryption
"key-file=/dgraph-enc/enc-key;" --my=alpha2:7080 --zero=zero1:5080,zero2:5080,zero3:5080
--expose_trace --profile_mode block --block_rate 10 --logtostderr -v=2 --security
/gobin/dgraph ${COVERAGE_OUTPUT} alpha --encryption "key-file=/dgraph-enc/enc-key;"
--my=alpha2:7080 --zero=zero1:5080,zero2:5080,zero3:5080 --expose_trace --profile_mode block
--block_rate 10 --logtostderr -v=2 --security
"whitelist=10.0.0.0/8,172.16.0.0/12,192.168.0.0/16;" --acl
"secret-file=/dgraph-acl/hmac-secret; access-ttl=20s;"

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

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

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

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

Expand Down
32 changes: 0 additions & 32 deletions edgraph/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ import (
"github.com/hypermodeinc/dgraph/v25/protos/pb"
"github.com/hypermodeinc/dgraph/v25/query"
"github.com/hypermodeinc/dgraph/v25/schema"
"github.com/hypermodeinc/dgraph/v25/telemetry"
"github.com/hypermodeinc/dgraph/v25/tok"
"github.com/hypermodeinc/dgraph/v25/types"
"github.com/hypermodeinc/dgraph/v25/types/facets"
Expand Down Expand Up @@ -108,37 +107,6 @@ type existingGQLSchemaQryResp struct {
ExistingGQLSchema []graphQLSchemaNode `json:"ExistingGQLSchema"`
}

// PeriodicallyPostTelemetry periodically reports telemetry data for alpha.
func PeriodicallyPostTelemetry() {
glog.V(2).Infof("Starting telemetry data collection for alpha...")

start := time.Now()
ticker := time.NewTicker(time.Minute * 10)
defer ticker.Stop()

var lastPostedAt time.Time
for range ticker.C {
if time.Since(lastPostedAt) < time.Hour {
continue
}
ms := worker.GetMembershipState()
t := telemetry.NewAlpha(ms)
t.NumDQL = atomic.SwapUint64(&numDQL, 0)
t.NumGraphQL = atomic.SwapUint64(&numGraphQL, 0)
t.SinceHours = int(time.Since(start).Hours())
glog.V(2).Infof("Posting Telemetry data: %+v", t)

err := t.Post()
if err == nil {
lastPostedAt = time.Now()
} else {
atomic.AddUint64(&numDQL, t.NumDQL)
atomic.AddUint64(&numGraphQL, t.NumGraphQL)
glog.V(2).Infof("Telemetry couldn't be posted. Error: %v", err)
}
}
}

// GetGQLSchema queries for the GraphQL schema node, and returns the uid and the GraphQL schema.
// If multiple schema nodes were found, it returns an error.
func GetGQLSchema(namespace uint64) (uid, graphQLSchema string, err error) {
Expand Down
7 changes: 3 additions & 4 deletions graphql/e2e/admin_auth/poorman_auth/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ services:
cluster: test
service: alpha1
command:
/gobin/dgraph ${COVERAGE_OUTPUT} alpha --telemetry "reports=false;" --my=alpha1:7080
--zero=zero1:5080 --expose_trace --profile_mode block --block_rate 10 --logtostderr -v=2
--security "whitelist=10.0.0.0/8,172.16.0.0/12,192.168.0.0/16; token=itIsSecret;" --trace
"ratio=1.0;"
/gobin/dgraph ${COVERAGE_OUTPUT} alpha --my=alpha1:7080 --zero=zero1:5080 --expose_trace
--profile_mode block --block_rate 10 --logtostderr -v=2 --security
"whitelist=10.0.0.0/8,172.16.0.0/12,192.168.0.0/16; token=itIsSecret;" --trace "ratio=1.0;"
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ services:
cluster: test
service: alpha1
command:
/gobin/dgraph ${COVERAGE_OUTPUT} alpha --telemetry "reports=false;" --my=alpha1:7080
--zero=zero1:5080 --expose_trace --profile_mode block --block_rate 10 --logtostderr -v=2
--security "whitelist=10.0.0.0/8,172.16.0.0/12,192.168.0.0/16; token=itIsSecret;" --acl
/gobin/dgraph ${COVERAGE_OUTPUT} alpha --my=alpha1:7080 --zero=zero1:5080 --expose_trace
--profile_mode block --block_rate 10 --logtostderr -v=2 --security
"whitelist=10.0.0.0/8,172.16.0.0/12,192.168.0.0/16; token=itIsSecret;" --acl
"secret-file=/dgraph-acl/hmac-secret; access-ttl=3s;" --trace "ratio=1.0;"
6 changes: 3 additions & 3 deletions graphql/e2e/auth/debug_off/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,6 @@ services:
cluster: test
service: alpha1
command:
/gobin/dgraph ${COVERAGE_OUTPUT} alpha --telemetry "reports=false;" --zero=zero1:5080
--expose_trace --profile_mode block --block_rate 10 --logtostderr -v=3 --my=alpha1:7080
--security "whitelist=10.0.0.0/8,172.16.0.0/12,192.168.0.0/16;" --trace "ratio=1.0;"
/gobin/dgraph ${COVERAGE_OUTPUT} alpha --zero=zero1:5080 --expose_trace --profile_mode block
--block_rate 10 --logtostderr -v=3 --my=alpha1:7080 --security
"whitelist=10.0.0.0/8,172.16.0.0/12,192.168.0.0/16;" --trace "ratio=1.0;"
8 changes: 4 additions & 4 deletions graphql/e2e/auth/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ services:
cluster: test
service: alpha1
command:
/gobin/dgraph ${COVERAGE_OUTPUT} alpha --telemetry "reports=false;" --zero=zero1:5080
--expose_trace --profile_mode block --block_rate 10 --logtostderr -v=3 --my=alpha1:7080
--security "whitelist=10.0.0.0/8,172.16.0.0/12,192.168.0.0/16;" --graphql "debug=true;"
--trace "ratio=1.0;"
/gobin/dgraph ${COVERAGE_OUTPUT} alpha --zero=zero1:5080 --expose_trace --profile_mode block
--block_rate 10 --logtostderr -v=3 --my=alpha1:7080 --security
"whitelist=10.0.0.0/8,172.16.0.0/12,192.168.0.0/16;" --graphql "debug=true;" --trace
"ratio=1.0;"
8 changes: 4 additions & 4 deletions graphql/e2e/auth_closed_by_default/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ services:
cluster: test
service: alpha1
command:
/gobin/dgraph ${COVERAGE_OUTPUT} alpha --telemetry "reports=false;" --zero=zero1:5080
--expose_trace --profile_mode block --block_rate 10 --logtostderr -v=3 --my=alpha1:7080
--security "whitelist=10.0.0.0/8,172.16.0.0/12,192.168.0.0/16;" --graphql "debug=true;"
--trace "ratio=1.0;"
/gobin/dgraph ${COVERAGE_OUTPUT} alpha --zero=zero1:5080 --expose_trace --profile_mode block
--block_rate 10 --logtostderr -v=3 --my=alpha1:7080 --security
"whitelist=10.0.0.0/8,172.16.0.0/12,192.168.0.0/16;" --graphql "debug=true;" --trace
"ratio=1.0;"
5 changes: 2 additions & 3 deletions graphql/e2e/custom_logic/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,8 @@ services:
target: /gobin
read_only: true
command:
/gobin/dgraph ${COVERAGE_OUTPUT} alpha --telemetry "reports=false;" --my=alpha1:7080
--zero=zero1:5080 --logtostderr -v=2 --raft="idx=1;" --security
"whitelist=10.0.0.0/8,172.16.0.0/12,192.168.0.0/16;"
/gobin/dgraph ${COVERAGE_OUTPUT} alpha --my=alpha1:7080 --zero=zero1:5080 --logtostderr -v=2
--raft="idx=1;" --security "whitelist=10.0.0.0/8,172.16.0.0/12,192.168.0.0/16;"
zero1:
image: dgraph/dgraph:local
working_dir: /data/zero1
Expand Down
6 changes: 3 additions & 3 deletions graphql/e2e/directives/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ services:
cluster: test
service: alpha1
command:
/gobin/dgraph ${COVERAGE_OUTPUT} alpha --telemetry "reports=false;" --zero=zero1:5080
--expose_trace --profile_mode block --block_rate 10 --logtostderr -v=2 --my=alpha1:7080
--security "whitelist=10.0.0.0/8,172.16.0.0/12,192.168.0.0/16;" --graphql
/gobin/dgraph ${COVERAGE_OUTPUT} alpha --zero=zero1:5080 --expose_trace --profile_mode block
--block_rate 10 --logtostderr -v=2 --my=alpha1:7080 --security
"whitelist=10.0.0.0/8,172.16.0.0/12,192.168.0.0/16;" --graphql
"lambda-url=http://lambda:8686/graphql-worker; debug=true;" --trace "ratio=1.0;"

lambda:
Expand Down
15 changes: 6 additions & 9 deletions graphql/e2e/multi_tenancy/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,8 @@ services:
target: /dgraph-acl/hmac-secret
read_only: true
command:
/gobin/dgraph ${COVERAGE_OUTPUT} alpha --telemetry "reports=false;" --my=alpha1:7080
--zero=zero1:5080 --logtostderr -v=2 --raft "idx=1;" --security
"whitelist=10.0.0.0/8,172.16.0.0/12,192.168.0.0/16;" --acl
/gobin/dgraph ${COVERAGE_OUTPUT} alpha --my=alpha1:7080 --zero=zero1:5080 --logtostderr -v=2
--raft "idx=1;" --security "whitelist=10.0.0.0/8,172.16.0.0/12,192.168.0.0/16;" --acl
"secret-file=/dgraph-acl/hmac-secret; access-ttl=3000s;"
alpha2:
image: dgraph/dgraph:local
Expand All @@ -44,9 +43,8 @@ services:
target: /dgraph-acl/hmac-secret
read_only: true
command:
/gobin/dgraph ${COVERAGE_OUTPUT} alpha --telemetry "reports=false;" --my=alpha2:7080
--zero=zero1:5080 --logtostderr -v=2 --raft "idx=2;" --security
"whitelist=10.0.0.0/8,172.16.0.0/12,192.168.0.0/16;" --acl
/gobin/dgraph ${COVERAGE_OUTPUT} alpha --my=alpha2:7080 --zero=zero1:5080 --logtostderr -v=2
--raft "idx=2;" --security "whitelist=10.0.0.0/8,172.16.0.0/12,192.168.0.0/16;" --acl
"secret-file=/dgraph-acl/hmac-secret; access-ttl=3000s;"
alpha3:
image: dgraph/dgraph:local
Expand All @@ -68,9 +66,8 @@ services:
target: /dgraph-acl/hmac-secret
read_only: true
command:
/gobin/dgraph ${COVERAGE_OUTPUT} alpha --telemetry "reports=false;" --my=alpha3:7080
--zero=zero1:5080 --logtostderr -v=2 --raft "idx=3;" --security
"whitelist=10.0.0.0/8,172.16.0.0/12,192.168.0.0/16;" --acl
/gobin/dgraph ${COVERAGE_OUTPUT} alpha --my=alpha3:7080 --zero=zero1:5080 --logtostderr -v=2
--raft "idx=3;" --security "whitelist=10.0.0.0/8,172.16.0.0/12,192.168.0.0/16;" --acl
"secret-file=/dgraph-acl/hmac-secret; access-ttl=3000s;"
zero1:
image: dgraph/dgraph:local
Expand Down
6 changes: 3 additions & 3 deletions graphql/e2e/normal/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ services:
cluster: test
service: alpha1
command:
/gobin/dgraph ${COVERAGE_OUTPUT} alpha --telemetry "reports=false;" --zero=zero1:5080
--expose_trace --profile_mode block --block_rate 10 --logtostderr -v=2 --my=alpha1:7080
--security "whitelist=10.0.0.0/8,172.16.0.0/12,192.168.0.0/16;" --graphql
/gobin/dgraph ${COVERAGE_OUTPUT} alpha --zero=zero1:5080 --expose_trace --profile_mode block
--block_rate 10 --logtostderr -v=2 --my=alpha1:7080 --security
"whitelist=10.0.0.0/8,172.16.0.0/12,192.168.0.0/16;" --graphql
"lambda-url=http://lambda:8686/graphql-worker; debug=true;" --trace "ratio=1.0;"

lambda:
Expand Down
Loading