Skip to content

Commit

Permalink
fix(telemetry): Track enterprise feature usage (#7495)
Browse files Browse the repository at this point in the history
Fixes - DGRAPH-2997
  • Loading branch information
Ibrahim Jarif authored Mar 15, 2021
1 parent 4e48426 commit 1cabd86
Showing 1 changed file with 16 additions and 13 deletions.
29 changes: 16 additions & 13 deletions telemetry/telemetry.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
"runtime"
"time"

"github.com/dgraph-io/dgraph/ee"
"github.com/dgraph-io/dgraph/protos/pb"
"github.com/dgraph-io/dgraph/x"
"github.com/golang/glog"
Expand All @@ -32,19 +33,20 @@ import (

// Telemetry holds information about the state of the zero and alpha server.
type Telemetry struct {
Arch string `json:",omitempty"`
Cid string `json:",omitempty"`
ClusterSize int `json:",omitempty"`
DiskUsageMB int64 `json:",omitempty"`
NumAlphas int `json:",omitempty"`
NumGroups int `json:",omitempty"`
NumTablets int `json:",omitempty"`
NumZeros int `json:",omitempty"`
OS string `json:",omitempty"`
SinceHours int `json:",omitempty"`
Version string `json:",omitempty"`
NumGraphQLPM uint64 `json:",omitempty"`
NumGraphQL uint64 `json:",omitempty"`
Arch string `json:",omitempty"`
Cid string `json:",omitempty"`
ClusterSize int `json:",omitempty"`
DiskUsageMB int64 `json:",omitempty"`
NumAlphas int `json:",omitempty"`
NumGroups int `json:",omitempty"`
NumTablets int `json:",omitempty"`
NumZeros int `json:",omitempty"`
OS string `json:",omitempty"`
SinceHours int `json:",omitempty"`
Version string `json:",omitempty"`
NumGraphQLPM uint64 `json:",omitempty"`
NumGraphQL uint64 `json:",omitempty"`
EEFeaturesList []string `json:",omitempty"`
}

const url = "https://ping.dgraph.io/3.0/projects/5b809dfac9e77c0001783ad0/events"
Expand Down Expand Up @@ -87,6 +89,7 @@ func NewAlpha(ms *pb.MembershipState) *Telemetry {

// Post reports the Telemetry to the stats server.
func (t *Telemetry) Post() error {
t.EEFeaturesList = ee.GetEEFeaturesList()
data, err := json.Marshal(t)
if err != nil {
return err
Expand Down

0 comments on commit 1cabd86

Please sign in to comment.