Merge pull request #88 from liquidata-inc/db/metrics-attributes

Db/metrics attributes
This commit is contained in:
Dustin Brown
2019-09-27 15:48:10 -07:00
committed by GitHub
12 changed files with 319 additions and 209 deletions
+9 -3
View File
@@ -22,20 +22,21 @@ import (
"path/filepath"
"sync"
"github.com/liquidata-inc/dolt/go/libraries/utils/strhelp"
"github.com/liquidata-inc/dolt/go/store/datas"
"github.com/liquidata-inc/dolt/go/cmd/dolt/cli"
"github.com/liquidata-inc/dolt/go/cmd/dolt/errhand"
eventsapi "github.com/liquidata-inc/dolt/go/gen/proto/dolt/services/eventsapi/v1alpha1"
"github.com/liquidata-inc/dolt/go/libraries/doltcore/dbfactory"
"github.com/liquidata-inc/dolt/go/libraries/doltcore/doltdb"
"github.com/liquidata-inc/dolt/go/libraries/doltcore/env"
"github.com/liquidata-inc/dolt/go/libraries/doltcore/env/actions"
"github.com/liquidata-inc/dolt/go/libraries/doltcore/ref"
"github.com/liquidata-inc/dolt/go/libraries/doltcore/remotestorage"
"github.com/liquidata-inc/dolt/go/libraries/events"
"github.com/liquidata-inc/dolt/go/libraries/utils/argparser"
"github.com/liquidata-inc/dolt/go/libraries/utils/earl"
"github.com/liquidata-inc/dolt/go/libraries/utils/filesys"
"github.com/liquidata-inc/dolt/go/libraries/utils/strhelp"
"github.com/liquidata-inc/dolt/go/store/datas"
"github.com/liquidata-inc/dolt/go/store/types"
)
@@ -94,6 +95,11 @@ func Clone(ctx context.Context, commandStr string, args []string, dEnv *env.Dolt
if verr == nil {
verr = cloneRemote(ctx, srcDB, remoteName, branch, dEnv)
if verr == nil {
evt := events.GetEventFromContext(ctx)
evt.SetAttribute(eventsapi.AttributeID_ACTIVE_REMOTE_URL, remoteUrl)
}
// Make best effort to delete the directory we created.
if verr != nil {
_ = os.Chdir("../")
+5
View File
@@ -19,10 +19,12 @@ import (
"github.com/liquidata-inc/dolt/go/cmd/dolt/cli"
"github.com/liquidata-inc/dolt/go/cmd/dolt/errhand"
eventsapi "github.com/liquidata-inc/dolt/go/gen/proto/dolt/services/eventsapi/v1alpha1"
"github.com/liquidata-inc/dolt/go/libraries/doltcore/doltdb"
"github.com/liquidata-inc/dolt/go/libraries/doltcore/env"
"github.com/liquidata-inc/dolt/go/libraries/doltcore/env/actions"
"github.com/liquidata-inc/dolt/go/libraries/doltcore/ref"
"github.com/liquidata-inc/dolt/go/libraries/events"
"github.com/liquidata-inc/dolt/go/libraries/utils/argparser"
"github.com/liquidata-inc/dolt/go/store/datas"
)
@@ -158,6 +160,9 @@ func fetchRefSpecs(ctx context.Context, dEnv *env.DoltEnv, rem env.Remote, refSp
}
func fetchRemoteBranch(ctx context.Context, rem env.Remote, srcDB, destDB *doltdb.DoltDB, srcRef, destRef ref.DoltRef) errhand.VerboseError {
evt := events.GetEventFromContext(ctx)
evt.SetAttribute(eventsapi.AttributeID_ACTIVE_REMOTE_URL, rem.Url)
cs, _ := doltdb.NewCommitSpec("HEAD", srcRef.String())
cm, err := srcDB.Resolve(ctx, cs)
+5
View File
@@ -23,11 +23,13 @@ import (
"github.com/liquidata-inc/dolt/go/cmd/dolt/cli"
"github.com/liquidata-inc/dolt/go/cmd/dolt/errhand"
eventsapi "github.com/liquidata-inc/dolt/go/gen/proto/dolt/services/eventsapi/v1alpha1"
"github.com/liquidata-inc/dolt/go/libraries/doltcore/doltdb"
"github.com/liquidata-inc/dolt/go/libraries/doltcore/env"
"github.com/liquidata-inc/dolt/go/libraries/doltcore/env/actions"
"github.com/liquidata-inc/dolt/go/libraries/doltcore/ref"
"github.com/liquidata-inc/dolt/go/libraries/doltcore/remotestorage"
"github.com/liquidata-inc/dolt/go/libraries/events"
"github.com/liquidata-inc/dolt/go/libraries/utils/argparser"
"github.com/liquidata-inc/dolt/go/libraries/utils/earl"
"github.com/liquidata-inc/dolt/go/store/datas"
@@ -230,6 +232,9 @@ func deleteRemoteBranch(ctx context.Context, toDelete, remoteRef ref.DoltRef, lo
}
func pushToRemoteBranch(ctx context.Context, srcRef, destRef, remoteRef ref.DoltRef, localDB, remoteDB *doltdb.DoltDB, remote env.Remote) errhand.VerboseError {
evt := events.GetEventFromContext(ctx)
evt.SetAttribute(eventsapi.AttributeID_ACTIVE_REMOTE_URL, remote.Url)
cs, _ := doltdb.NewCommitSpec("HEAD", srcRef.GetPath())
cm, err := localDB.Resolve(ctx, cs)
+35 -3
View File
@@ -16,6 +16,9 @@ package commands
import (
"context"
"fmt"
"log"
"strconv"
"time"
"github.com/fatih/color"
@@ -42,7 +45,9 @@ func SendMetrics(ctx context.Context, commandStr string, args []string, dEnv *en
help, _ := cli.HelpAndUsagePrinters(commandStr, sendMetricsShortDec, "", []string{}, ap)
apr := cli.ParseArgs(ap, args, help)
disabled, err := events.AreMetricsDisabled(dEnv)
metricsDisabled := dEnv.Config.GetStringOrDefault(env.MetricsDisabled, "false")
disabled, err := strconv.ParseBool(*metricsDisabled)
if err != nil {
// log.Print(err)
return 1
@@ -68,9 +73,11 @@ func SendMetrics(ctx context.Context, commandStr string, args []string, dEnv *en
var flusher events.Flusher
if apr.Contains(outputFlag) {
flusher = events.NewIOFlusher(dEnv.FS, root, dolt, dEnv)
flusher = events.NewIOFlusher(dEnv.FS, root, dolt)
} else {
flusher = events.NewGrpcEventFlusher(dEnv.FS, root, dolt, dEnv)
grpcEmitter := getGRPCEmitter(dEnv)
flusher = events.NewGrpcEventFlusher(dEnv.FS, root, dolt, grpcEmitter)
}
err = flusher.Flush(ctx)
@@ -88,3 +95,28 @@ func SendMetrics(ctx context.Context, commandStr string, args []string, dEnv *en
return 1
}
// getGRPCEmitter gets the connection to the events grpc service
func getGRPCEmitter(dEnv *env.DoltEnv) *events.GrpcEmitter {
host := dEnv.Config.GetStringOrDefault(env.MetricsHost, env.DefaultMetricsHost)
portStr := dEnv.Config.GetStringOrDefault(env.MetricsPort, env.DefaultMetricsPort)
insecureStr := dEnv.Config.GetStringOrDefault(env.MetricsInsecure, "false")
port, err := strconv.ParseUint(*portStr, 10, 16)
if err != nil {
log.Println(color.YellowString("The config value of '%s' is '%s' which is not a valid port.", env.MetricsPort, *portStr))
return nil
}
insecure, err := strconv.ParseBool(*insecureStr)
if err != nil {
log.Println(color.YellowString("The config value of '%s' is '%s' which is not a valid true/false value", env.MetricsInsecure, *insecureStr))
}
hostAndPort := fmt.Sprintf("%s:%d", *host, port)
conn, _ := dEnv.GrpcConnWithCreds(hostAndPort, insecure, nil)
return events.NewGrpcEmitter(conn)
}
+12 -2
View File
@@ -19,6 +19,7 @@ import (
"fmt"
"os"
"os/exec"
"strconv"
"github.com/fatih/color"
"github.com/pkg/profile"
@@ -30,6 +31,7 @@ import (
"github.com/liquidata-inc/dolt/go/cmd/dolt/commands/sqlserver"
"github.com/liquidata-inc/dolt/go/cmd/dolt/commands/tblcmds"
eventsapi "github.com/liquidata-inc/dolt/go/gen/proto/dolt/services/eventsapi/v1alpha1"
"github.com/liquidata-inc/dolt/go/libraries/doltcore/dbfactory"
"github.com/liquidata-inc/dolt/go/libraries/doltcore/doltdb"
"github.com/liquidata-inc/dolt/go/libraries/doltcore/env"
"github.com/liquidata-inc/dolt/go/libraries/events"
@@ -131,13 +133,21 @@ func runMain() int {
dEnv := env.Load(context.TODO(), env.GetCurrentUserHomeDir, filesys.LocalFS, doltdb.LocalDirDoltDB)
emitter := events.NewFileEmitter()
root, err := env.GetCurrentUserHomeDir()
if err != nil {
return 1
}
emitter := events.NewFileEmitter(root, dbfactory.DoltDir)
defer func() {
ces := events.GlobalCollector.Close()
// events.WriterEmitter{cli.CliOut}.LogEvents(Version, ces)
disabled, err := events.AreMetricsDisabled(dEnv)
metricsDisabled := dEnv.Config.GetStringOrDefault(env.MetricsDisabled, "false")
disabled, err := strconv.ParseBool(*metricsDisabled)
if err != nil {
// log.Print(err)
return
@@ -61,43 +61,51 @@ func (Platform) EnumDescriptor() ([]byte, []int) {
type ClientEventType int32
const (
ClientEventType_TYPE_UNSPECIFIED ClientEventType = 0
ClientEventType_INIT ClientEventType = 1
ClientEventType_STATUS ClientEventType = 2
ClientEventType_ADD ClientEventType = 3
ClientEventType_RESET ClientEventType = 4
ClientEventType_COMMIT ClientEventType = 5
ClientEventType_SQL ClientEventType = 6
ClientEventType_SQL_SERVER ClientEventType = 7
ClientEventType_LOG ClientEventType = 8
ClientEventType_DIFF ClientEventType = 9
ClientEventType_MERGE ClientEventType = 10
ClientEventType_BRANCH ClientEventType = 11
ClientEventType_CHECKOUT ClientEventType = 12
ClientEventType_REMOTE ClientEventType = 13
ClientEventType_PUSH ClientEventType = 14
ClientEventType_PULL ClientEventType = 15
ClientEventType_FETCH ClientEventType = 16
ClientEventType_CLONE ClientEventType = 17
ClientEventType_LOGIN ClientEventType = 18
ClientEventType_VERSION ClientEventType = 19
ClientEventType_CONFIG ClientEventType = 20
ClientEventType_LS ClientEventType = 21
ClientEventType_SCHEMA ClientEventType = 22
ClientEventType_TABLE_IMPORT ClientEventType = 23
ClientEventType_TABLE_EXPORT ClientEventType = 24
ClientEventType_TABLE_CREATE ClientEventType = 25
ClientEventType_TABLE_RM ClientEventType = 26
ClientEventType_TABLE_MV ClientEventType = 27
ClientEventType_TABLE_CP ClientEventType = 28
ClientEventType_TABLE_SELECT ClientEventType = 29
ClientEventType_TABLE_PUT_ROW ClientEventType = 30
ClientEventType_TABLE_RM_ROW ClientEventType = 31
ClientEventType_CREDS_NEW ClientEventType = 32
ClientEventType_CREDS_RM ClientEventType = 33
ClientEventType_CREDS_LS ClientEventType = 34
ClientEventType_CONF_CAT ClientEventType = 35
ClientEventType_CONF_RESOLVE ClientEventType = 36
ClientEventType_TYPE_UNSPECIFIED ClientEventType = 0
ClientEventType_INIT ClientEventType = 1
ClientEventType_STATUS ClientEventType = 2
ClientEventType_ADD ClientEventType = 3
ClientEventType_RESET ClientEventType = 4
ClientEventType_COMMIT ClientEventType = 5
ClientEventType_SQL ClientEventType = 6
ClientEventType_SQL_SERVER ClientEventType = 7
ClientEventType_LOG ClientEventType = 8
ClientEventType_DIFF ClientEventType = 9
ClientEventType_MERGE ClientEventType = 10
ClientEventType_BRANCH ClientEventType = 11
ClientEventType_CHECKOUT ClientEventType = 12
ClientEventType_REMOTE ClientEventType = 13
ClientEventType_PUSH ClientEventType = 14
ClientEventType_PULL ClientEventType = 15
ClientEventType_FETCH ClientEventType = 16
ClientEventType_CLONE ClientEventType = 17
ClientEventType_LOGIN ClientEventType = 18
ClientEventType_VERSION ClientEventType = 19
ClientEventType_CONFIG ClientEventType = 20
ClientEventType_LS ClientEventType = 21
ClientEventType_SCHEMA ClientEventType = 22
ClientEventType_TABLE_IMPORT ClientEventType = 23
ClientEventType_TABLE_EXPORT ClientEventType = 24
ClientEventType_TABLE_CREATE ClientEventType = 25
ClientEventType_TABLE_RM ClientEventType = 26
ClientEventType_TABLE_MV ClientEventType = 27
ClientEventType_TABLE_CP ClientEventType = 28
ClientEventType_TABLE_SELECT ClientEventType = 29
ClientEventType_TABLE_PUT_ROW ClientEventType = 30
ClientEventType_TABLE_RM_ROW ClientEventType = 31
ClientEventType_CREDS_NEW ClientEventType = 32
ClientEventType_CREDS_RM ClientEventType = 33
ClientEventType_CREDS_LS ClientEventType = 34
ClientEventType_CONF_CAT ClientEventType = 35
ClientEventType_CONF_RESOLVE ClientEventType = 36
ClientEventType_REMOTEAPI_GET_REPO_METADATA ClientEventType = 37
ClientEventType_REMOTEAPI_HAS_CHUNKS ClientEventType = 38
ClientEventType_REMOTEAPI_GET_DOWNLOAD_LOCATIONS ClientEventType = 39
ClientEventType_REMOTEAPI_GET_UPLOAD_LOCATIONS ClientEventType = 40
ClientEventType_REMOTEAPI_REBASE ClientEventType = 41
ClientEventType_REMOTEAPI_ROOT ClientEventType = 42
ClientEventType_REMOTEAPI_COMMIT ClientEventType = 43
ClientEventType_REMOTEAPI_LIST_TABLE_FILES ClientEventType = 44
)
var ClientEventType_name = map[int32]string{
@@ -138,46 +146,62 @@ var ClientEventType_name = map[int32]string{
34: "CREDS_LS",
35: "CONF_CAT",
36: "CONF_RESOLVE",
37: "REMOTEAPI_GET_REPO_METADATA",
38: "REMOTEAPI_HAS_CHUNKS",
39: "REMOTEAPI_GET_DOWNLOAD_LOCATIONS",
40: "REMOTEAPI_GET_UPLOAD_LOCATIONS",
41: "REMOTEAPI_REBASE",
42: "REMOTEAPI_ROOT",
43: "REMOTEAPI_COMMIT",
44: "REMOTEAPI_LIST_TABLE_FILES",
}
var ClientEventType_value = map[string]int32{
"TYPE_UNSPECIFIED": 0,
"INIT": 1,
"STATUS": 2,
"ADD": 3,
"RESET": 4,
"COMMIT": 5,
"SQL": 6,
"SQL_SERVER": 7,
"LOG": 8,
"DIFF": 9,
"MERGE": 10,
"BRANCH": 11,
"CHECKOUT": 12,
"REMOTE": 13,
"PUSH": 14,
"PULL": 15,
"FETCH": 16,
"CLONE": 17,
"LOGIN": 18,
"VERSION": 19,
"CONFIG": 20,
"LS": 21,
"SCHEMA": 22,
"TABLE_IMPORT": 23,
"TABLE_EXPORT": 24,
"TABLE_CREATE": 25,
"TABLE_RM": 26,
"TABLE_MV": 27,
"TABLE_CP": 28,
"TABLE_SELECT": 29,
"TABLE_PUT_ROW": 30,
"TABLE_RM_ROW": 31,
"CREDS_NEW": 32,
"CREDS_RM": 33,
"CREDS_LS": 34,
"CONF_CAT": 35,
"CONF_RESOLVE": 36,
"TYPE_UNSPECIFIED": 0,
"INIT": 1,
"STATUS": 2,
"ADD": 3,
"RESET": 4,
"COMMIT": 5,
"SQL": 6,
"SQL_SERVER": 7,
"LOG": 8,
"DIFF": 9,
"MERGE": 10,
"BRANCH": 11,
"CHECKOUT": 12,
"REMOTE": 13,
"PUSH": 14,
"PULL": 15,
"FETCH": 16,
"CLONE": 17,
"LOGIN": 18,
"VERSION": 19,
"CONFIG": 20,
"LS": 21,
"SCHEMA": 22,
"TABLE_IMPORT": 23,
"TABLE_EXPORT": 24,
"TABLE_CREATE": 25,
"TABLE_RM": 26,
"TABLE_MV": 27,
"TABLE_CP": 28,
"TABLE_SELECT": 29,
"TABLE_PUT_ROW": 30,
"TABLE_RM_ROW": 31,
"CREDS_NEW": 32,
"CREDS_RM": 33,
"CREDS_LS": 34,
"CONF_CAT": 35,
"CONF_RESOLVE": 36,
"REMOTEAPI_GET_REPO_METADATA": 37,
"REMOTEAPI_HAS_CHUNKS": 38,
"REMOTEAPI_GET_DOWNLOAD_LOCATIONS": 39,
"REMOTEAPI_GET_UPLOAD_LOCATIONS": 40,
"REMOTEAPI_REBASE": 41,
"REMOTEAPI_ROOT": 42,
"REMOTEAPI_COMMIT": 43,
"REMOTEAPI_LIST_TABLE_FILES": 44,
}
func (x ClientEventType) String() string {
@@ -194,18 +218,21 @@ const (
MetricID_METRIC_UNSPECIFIED MetricID = 0
MetricID_BYTES_DOWNLOADED MetricID = 1
MetricID_DOWNLOAD_MS_ELAPSED MetricID = 2
MetricID_REMOTEAPI_RPC_ERROR MetricID = 3
)
var MetricID_name = map[int32]string{
0: "METRIC_UNSPECIFIED",
1: "BYTES_DOWNLOADED",
2: "DOWNLOAD_MS_ELAPSED",
3: "REMOTEAPI_RPC_ERROR",
}
var MetricID_value = map[string]int32{
"METRIC_UNSPECIFIED": 0,
"BYTES_DOWNLOADED": 1,
"DOWNLOAD_MS_ELAPSED": 2,
"REMOTEAPI_RPC_ERROR": 3,
}
func (x MetricID) String() string {
@@ -220,17 +247,17 @@ type AttributeID int32
const (
AttributeID_ATTRIBUTE_UNSPECIFIED AttributeID = 0
AttributeID_LOCAL_REMOTE_URLS AttributeID = 1
AttributeID_ACTIVE_REMOTE_URL AttributeID = 1
)
var AttributeID_name = map[int32]string{
0: "ATTRIBUTE_UNSPECIFIED",
1: "LOCAL_REMOTE_URLS",
1: "ACTIVE_REMOTE_URL",
}
var AttributeID_value = map[string]int32{
"ATTRIBUTE_UNSPECIFIED": 0,
"LOCAL_REMOTE_URLS": 1,
"ACTIVE_REMOTE_URL": 1,
}
func (x AttributeID) String() string {
@@ -574,70 +601,78 @@ func init() {
}
var fileDescriptor_2059ca7f76f8dca6 = []byte{
// 1006 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0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0x24,
0x82, 0xf2, 0xea, 0x2e, 0x90, 0xd6, 0xee, 0xfb, 0xb4, 0xfd, 0xab, 0x38, 0xbd, 0x7e, 0x16, 0x27,
0xb9, 0x6c, 0xed, 0xc1, 0xaf, 0xfd, 0xb1, 0x17, 0x3d, 0x2e, 0xee, 0x1b, 0xc3, 0x60, 0xda, 0x9c,
0x78, 0x9f, 0x16, 0xde, 0xc8, 0x89, 0x9c, 0x4b, 0xcf, 0x1f, 0x36, 0xc5, 0xa3, 0x3e, 0x0e, 0x9a,
0x63, 0xd7, 0x4f, 0x9e, 0xd8, 0xe6, 0xae, 0x67, 0xfe, 0xc7, 0x95, 0xe9, 0xbe, 0x20, 0x18, 0xd7,
0xff, 0x06, 0x00, 0x00, 0xff, 0xff, 0x5a, 0xef, 0xb5, 0x5b, 0x1b, 0x08, 0x00, 0x00,
// 1127 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x56, 0xef, 0x72, 0xdb, 0x44,
0x10, 0xaf, 0xed, 0x38, 0xb1, 0xd7, 0x69, 0xba, 0xb9, 0xa4, 0xad, 0x9b, 0xd2, 0x34, 0x98, 0x02,
0x21, 0x50, 0x7b, 0x9a, 0x0c, 0x30, 0x0c, 0xc3, 0x30, 0xb2, 0x74, 0x8e, 0x35, 0xd5, 0xbf, 0xde,
0x9d, 0xe3, 0x96, 0x2f, 0x1a, 0xc5, 0x56, 0x53, 0x81, 0x63, 0xb9, 0x96, 0x9c, 0xa1, 0xcf, 0xc0,
0x33, 0xf1, 0x34, 0xbc, 0x00, 0x2f, 0xc0, 0x0c, 0x73, 0x27, 0xff, 0xab, 0xf9, 0x60, 0xf2, 0xcd,
0xbb, 0xfb, 0xfb, 0xfd, 0x6e, 0x77, 0x6f, 0xb5, 0x3e, 0x38, 0xeb, 0xc7, 0x83, 0xb4, 0x91, 0x84,
0xe3, 0x9b, 0xa8, 0x17, 0x26, 0x8d,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a2, 0xee, 0xc3, 0xae,
0xa6, 0x0b, 0xf3, 0x82, 0xfa, 0x99, 0x92, 0xdf, 0x61, 0x16, 0xe6, 0x4e, 0xff, 0xc8, 0xc1, 0xde,
0xd2, 0x27, 0x99, 0xf0, 0x6c, 0x63, 0x90, 0x14, 0xca, 0xf3, 0x4d, 0x40, 0x4e, 0xd7, 0x6f, 0x93,
0xd5, 0x45, 0x79, 0x70, 0x76, 0x2b, 0x4e, 0xb6, 0x6a, 0x9a, 0xdd, 0x5f, 0x3a, 0x57, 0x51, 0xfa,
0x6e, 0x72, 0x59, 0xef, 0xc5, 0xd7, 0x8d, 0x41, 0xf4, 0x7e, 0x12, 0xf5, 0x83, 0x34, 0x78, 0x1e,
0x0d, 0x7b, 0x0d, 0xf5, 0xa4, 0xb9, 0x8a, 0x1b, 0x57, 0xe1, 0x30, 0x7b, 0x60, 0x34, 0xd6, 0x3d,
0x72, 0x7e, 0x9c, 0xbb, 0x2e, 0x37, 0x15, 0xe3, 0xec, 0xdf, 0x00, 0x00, 0x00, 0xff, 0xff, 0xe6,
0xa6, 0xa7, 0x7b, 0x19, 0x09, 0x00, 0x00,
}
// Reference imports to suppress errors if they are not otherwise used.
@@ -30,7 +30,9 @@ import (
"github.com/cenkalti/backoff"
"github.com/golang/snappy"
eventsapi "github.com/liquidata-inc/dolt/go/gen/proto/dolt/services/eventsapi/v1alpha1"
remotesapi "github.com/liquidata-inc/dolt/go/gen/proto/dolt/services/remotesapi/v1alpha1"
"github.com/liquidata-inc/dolt/go/libraries/events"
"github.com/liquidata-inc/dolt/go/libraries/utils/iohelp"
"github.com/liquidata-inc/dolt/go/store/chunks"
"github.com/liquidata-inc/dolt/go/store/hash"
@@ -101,6 +103,11 @@ func NewDoltChunkStore(ctx context.Context, nbf *types.NomsBinFormat, org, repoN
csClient = RetryingChunkStoreServiceClient{csClient}
}
evt := events.NewEvent(eventsapi.ClientEventType_REMOTEAPI_GET_REPO_METADATA)
defer events.GlobalCollector.CloseEventAndAdd(evt)
counter := events.NewCounter(eventsapi.MetricID_REMOTEAPI_RPC_ERROR)
metadata, err := csClient.GetRepoMetadata(ctx, &remotesapi.GetRepoMetadataRequest{
RepoId: &remotesapi.RepoId{
Org: org,
@@ -112,8 +119,10 @@ func NewDoltChunkStore(ctx context.Context, nbf *types.NomsBinFormat, org, repoN
},
})
if err != nil {
counter.Inc()
return nil, err
}
return &DoltChunkStore{org, repoName, host, csClient, newMapChunkCache(), metadata, nbf, globalHttpFetcher}, nil
}
@@ -229,10 +238,16 @@ func (dcs *DoltChunkStore) getDLLocs(ctx context.Context, hashes []hash.Hash) (m
batchItr(len(hashesBytes), getLocsBatchSize, func(st, end int) (stop bool) {
batch := hashesBytes[st:end]
f := func() error {
evt := events.NewEvent(eventsapi.ClientEventType_REMOTEAPI_GET_DOWNLOAD_LOCATIONS)
defer events.GlobalCollector.CloseEventAndAdd(evt)
counter := events.NewCounter(eventsapi.MetricID_REMOTEAPI_RPC_ERROR)
req := remotesapi.GetDownloadLocsRequest{RepoId: dcs.getRepoId(), ChunkHashes: batch}
resp, err := dcs.csClient.GetDownloadLocations(ctx, &req)
if err != nil {
counter.Inc()
return NewRpcError(err, "GetDownloadLocations", dcs.host, req)
}
@@ -347,12 +362,19 @@ func (dcs *DoltChunkStore) HasMany(ctx context.Context, hashes hash.HashSet) (ha
currHashSl := hashSl[st:end]
currByteSl := byteSl[st:end]
evt := events.NewEvent(eventsapi.ClientEventType_REMOTEAPI_HAS_CHUNKS)
defer events.GlobalCollector.CloseEventAndAdd(evt)
counter := events.NewCounter(eventsapi.MetricID_REMOTEAPI_RPC_ERROR)
// send a request to the remote api to determine which chunks the remote api already has
req := remotesapi.HasChunksRequest{RepoId: dcs.getRepoId(), Hashes: currByteSl}
resp, err := dcs.csClient.HasChunks(ctx, &req)
if err != nil {
err = NewRpcError(err, "HasMany", dcs.host, req)
counter.Inc()
return true
}
@@ -415,10 +437,16 @@ func (dcs *DoltChunkStore) Version() string {
// Rebase brings this ChunkStore into sync with the persistent storage's
// current root.
func (dcs *DoltChunkStore) Rebase(ctx context.Context) error {
evt := events.NewEvent(eventsapi.ClientEventType_REMOTEAPI_REBASE)
defer events.GlobalCollector.CloseEventAndAdd(evt)
counter := events.NewCounter(eventsapi.MetricID_REMOTEAPI_RPC_ERROR)
req := &remotesapi.RebaseRequest{RepoId: dcs.getRepoId()}
_, err := dcs.csClient.Rebase(ctx, req)
if err != nil {
counter.Inc()
return NewRpcError(err, "Rebase", dcs.host, req)
}
@@ -428,10 +456,16 @@ func (dcs *DoltChunkStore) Rebase(ctx context.Context) error {
// Root returns the root of the database as of the time the ChunkStore
// was opened or the most recent call to Rebase.
func (dcs *DoltChunkStore) Root(ctx context.Context) (hash.Hash, error) {
evt := events.NewEvent(eventsapi.ClientEventType_REMOTEAPI_ROOT)
defer events.GlobalCollector.CloseEventAndAdd(evt)
counter := events.NewCounter(eventsapi.MetricID_REMOTEAPI_RPC_ERROR)
req := &remotesapi.RootRequest{RepoId: dcs.getRepoId()}
resp, err := dcs.csClient.Root(ctx, req)
if err != nil {
counter.Inc()
return hash.Hash{}, NewRpcError(err, "Root", dcs.host, req)
}
@@ -442,9 +476,15 @@ func (dcs *DoltChunkStore) Root(ctx context.Context) (hash.Hash, error) {
// persisted root hash from last to current (or keeps it the same).
// If last doesn't match the root in persistent storage, returns false.
func (dcs *DoltChunkStore) Commit(ctx context.Context, current, last hash.Hash) (bool, error) {
evt := events.NewEvent(eventsapi.ClientEventType_REMOTEAPI_COMMIT)
defer events.GlobalCollector.CloseEventAndAdd(evt)
counter := events.NewCounter(eventsapi.MetricID_REMOTEAPI_RPC_ERROR)
hashToChunkCount, err := dcs.uploadChunks(ctx)
if err != nil {
counter.Inc()
return false, err
}
@@ -466,6 +506,7 @@ func (dcs *DoltChunkStore) Commit(ctx context.Context, current, last hash.Hash)
resp, err := dcs.csClient.Commit(ctx, req)
if err != nil {
counter.Inc()
return false, NewRpcError(err, "Commit", dcs.host, req)
}
@@ -529,10 +570,16 @@ func (dcs *DoltChunkStore) uploadChunks(ctx context.Context) (map[hash.Hash]int,
hashBytes = append(hashBytes, tmp[:])
}
evt := events.NewEvent(eventsapi.ClientEventType_REMOTEAPI_GET_UPLOAD_LOCATIONS)
defer events.GlobalCollector.CloseEventAndAdd(evt)
counter := events.NewCounter(eventsapi.MetricID_REMOTEAPI_RPC_ERROR)
req := &remotesapi.GetUploadLocsRequest{RepoId: dcs.getRepoId(), TableFileHashes: hashBytes}
resp, err := dcs.csClient.GetUploadLocations(ctx, req)
if err != nil {
counter.Inc()
return map[hash.Hash]int{}, err
}
@@ -548,6 +595,7 @@ func (dcs *DoltChunkStore) uploadChunks(ctx context.Context) (map[hash.Hash]int,
}
if err != nil {
counter.Inc()
return map[hash.Hash]int{}, err
}
}
@@ -781,10 +829,16 @@ func (dcs *DoltChunkStore) NewSink(ctx context.Context, fileId string, numChunks
// Sources retrieves the current root hash, and a list of all the table files
func (dcs *DoltChunkStore) Sources(ctx context.Context) (hash.Hash, []nbs.TableFile, error) {
evt := events.NewEvent(eventsapi.ClientEventType_REMOTEAPI_LIST_TABLE_FILES)
defer events.GlobalCollector.CloseEventAndAdd(evt)
counter := events.NewCounter(eventsapi.MetricID_REMOTEAPI_RPC_ERROR)
req := &remotesapi.ListTableFilesRequest{RepoId: dcs.getRepoId()}
resp, err := dcs.csClient.ListTableFiles(ctx, req)
if err != nil {
counter.Inc()
return hash.Hash{}, nil, err
}
+3 -20
View File
@@ -19,7 +19,6 @@ import (
"fmt"
"io"
"runtime"
"strconv"
"strings"
"time"
@@ -27,8 +26,6 @@ import (
"google.golang.org/grpc"
eventsapi "github.com/liquidata-inc/dolt/go/gen/proto/dolt/services/eventsapi/v1alpha1"
"github.com/liquidata-inc/dolt/go/libraries/doltcore/dbfactory"
"github.com/liquidata-inc/dolt/go/libraries/doltcore/env"
"github.com/liquidata-inc/dolt/go/libraries/utils/filesys"
"github.com/liquidata-inc/dolt/go/libraries/utils/iohelp"
)
@@ -84,6 +81,7 @@ type GrpcEmitter struct {
client eventsapi.ClientEventsServiceClient
}
// NewGrpcEmitter creates a new GrpcEmitter
func NewGrpcEmitter(conn *grpc.ClientConn) *GrpcEmitter {
client := eventsapi.NewClientEventsServiceClient(conn)
return &GrpcEmitter{client}
@@ -130,17 +128,10 @@ type FileEmitter struct {
}
// NewFileEmitter creates a new file emitter
func NewFileEmitter() *FileEmitter {
func NewFileEmitter(userHomeDir string, doltDir string) *FileEmitter {
fs := filesys.LocalFS
root, err := env.GetCurrentUserHomeDir()
if err != nil {
panic(err)
}
dolt := dbfactory.DoltDir
return &FileEmitter{fbp: NewFileBackedProc(fs, root, dolt, MD5FileNamer, CheckFilenameMD5)}
return &FileEmitter{fbp: NewFileBackedProc(fs, userHomeDir, doltDir, MD5FileNamer, CheckFilenameMD5)}
}
// LogEvents implements the Emitter interface and writes events requests to files
@@ -151,11 +142,3 @@ func (fe *FileEmitter) LogEvents(version string, evts []*eventsapi.ClientEvent)
return nil
}
// AreMetricsDisabled returns true if the dolt config has the metrics.disabled property
// set to true, otherwise returns false
func AreMetricsDisabled(dEnv *env.DoltEnv) (bool, error) {
metricsDisabled := dEnv.Config.GetStringOrDefault(env.MetricsDisabled, "false")
return strconv.ParseBool(*metricsDisabled)
}
+4 -32
View File
@@ -18,15 +18,12 @@ import (
"context"
"errors"
"fmt"
"log"
"strconv"
"github.com/fatih/color"
"github.com/golang/protobuf/proto"
"github.com/juju/fslock"
eventsapi "github.com/liquidata-inc/dolt/go/gen/proto/dolt/services/eventsapi/v1alpha1"
"github.com/liquidata-inc/dolt/go/libraries/doltcore/env"
"github.com/liquidata-inc/dolt/go/libraries/utils/filesys"
)
@@ -50,31 +47,6 @@ type Flusher interface {
Flush(ctx context.Context) error
}
// getGRPCEmitter gets the connection to the events grpc service
func getGRPCEmitter(dEnv *env.DoltEnv) *GrpcEmitter {
host := dEnv.Config.GetStringOrDefault(env.MetricsHost, env.DefaultMetricsHost)
portStr := dEnv.Config.GetStringOrDefault(env.MetricsPort, env.DefaultMetricsPort)
insecureStr := dEnv.Config.GetStringOrDefault(env.MetricsInsecure, "false")
port, err := strconv.ParseUint(*portStr, 10, 16)
if err != nil {
log.Println(color.YellowString("The config value of '%s' is '%s' which is not a valid port.", env.MetricsPort, *portStr))
return nil
}
insecure, err := strconv.ParseBool(*insecureStr)
if err != nil {
log.Println(color.YellowString("The config value of '%s' is '%s' which is not a valid true/false value", env.MetricsInsecure, *insecureStr))
}
hostAndPort := fmt.Sprintf("%s:%d", *host, port)
conn, _ := dEnv.GrpcConnWithCreds(hostAndPort, insecure, nil)
return NewGrpcEmitter(conn)
}
// lockAndFlush locks the given lockPath and passes the flushCB to the filesys' Iter method
func lockAndFlush(ctx context.Context, fs filesys.Filesys, dirPath string, lockPath string, fcb flushCB) error {
fsLock := filesys.CreateFilesysLock(fs, lockPath)
@@ -122,15 +94,14 @@ type GrpcEventFlusher struct {
}
// NewGrpcEventFlusher creates a new GrpcEventFlusher
func NewGrpcEventFlusher(fs filesys.Filesys, userHomeDir string, doltDir string, dEnv *env.DoltEnv) *GrpcEventFlusher {
func NewGrpcEventFlusher(fs filesys.Filesys, userHomeDir string, doltDir string, grpcEmitter *GrpcEmitter) *GrpcEventFlusher {
fbp := NewFileBackedProc(fs, userHomeDir, doltDir, MD5FileNamer, CheckFilenameMD5)
if exists := fbp.EventsDirExists(); !exists {
panic(ErrEventsDataDir)
}
// return &GrpcEventFlusher{em: getGRPCEmitter(dEnv), fbp: fbp, LockPath: fbp.GetEventsDirPath()}
return &GrpcEventFlusher{em: getGRPCEmitter(dEnv), fbp: fbp}
return &GrpcEventFlusher{em: grpcEmitter, fbp: fbp}
}
// flush has the function signature of the flushCb type
@@ -186,7 +157,7 @@ type IOFlusher struct {
}
// NewIOFlusher creates a new IOFlusher
func NewIOFlusher(fs filesys.Filesys, userHomeDir string, doltDir string, dEnv *env.DoltEnv) *IOFlusher {
func NewIOFlusher(fs filesys.Filesys, userHomeDir string, doltDir string) *IOFlusher {
fbp := NewFileBackedProc(fs, userHomeDir, doltDir, MD5FileNamer, CheckFilenameMD5)
if exists := fbp.EventsDirExists(); !exists {
@@ -212,6 +183,7 @@ func (iof *IOFlusher) flush(ctx context.Context, path string) error {
return err
}
// needed for bats test
fmt.Fprintf(color.Output, "%+v\n", req)
if err := fs.DeleteFile(path); err != nil {
+4 -5
View File
@@ -23,7 +23,6 @@ import (
"google.golang.org/grpc"
eventsapi "github.com/liquidata-inc/dolt/go/gen/proto/dolt/services/eventsapi/v1alpha1"
"github.com/liquidata-inc/dolt/go/libraries/doltcore/dbfactory"
"github.com/liquidata-inc/dolt/go/libraries/utils/filesys"
testLib "github.com/liquidata-inc/dolt/go/libraries/utils/test"
)
@@ -31,10 +30,10 @@ import (
var (
testVersion = "1.0.0"
homeDir = "/home/"
dPath = dbfactory.DoltDir
dPath = ".dolt"
evtPath = eventsDir
doltDir = filepath.Join(homeDir, dPath)
tempEvtsDir = filepath.Join(doltDir, evtPath)
doltTestDir = filepath.Join(homeDir, dPath)
tempEvtsDir = filepath.Join(doltTestDir, evtPath)
)
type TestClient struct {
@@ -102,7 +101,7 @@ func TestEventFlushing(t *testing.T) {
if fsName == "inMemFS" {
fs := filesys.NewInMemFS([]string{tempEvtsDir}, nil, tempEvtsDir)
ft = createFlushTester(fs, homeDir, doltDir)
ft = createFlushTester(fs, homeDir, doltTestDir)
} else {
fs := filesys.LocalFS
+2 -2
View File
@@ -28,7 +28,7 @@ func TestEvents(t *testing.T) {
collector := NewCollector()
testEvent := NewEvent(eventsapi.ClientEventType_CLONE)
testEvent.SetAttribute(eventsapi.AttributeID_LOCAL_REMOTE_URLS, remoteUrl)
testEvent.SetAttribute(eventsapi.AttributeID_ACTIVE_REMOTE_URL, remoteUrl)
counter := NewCounter(eventsapi.MetricID_METRIC_UNSPECIFIED)
counter.Inc()
@@ -52,7 +52,7 @@ func TestEvents(t *testing.T) {
assert.NotNil(t, clientEvents[0].StartTime)
assert.NotNil(t, clientEvents[0].EndTime)
assert.Equal(t, eventsapi.AttributeID_LOCAL_REMOTE_URLS, clientEvents[0].Attributes[0].Id)
assert.Equal(t, eventsapi.AttributeID_ACTIVE_REMOTE_URL, clientEvents[0].Attributes[0].Id)
assert.Equal(t, remoteUrl, clientEvents[0].Attributes[0].Value)
_, isCounter := clientEvents[0].Metrics[0].MetricOneof.(*eventsapi.ClientEventMetric_Count)
assert.True(t, isCounter)
@@ -70,17 +70,26 @@ enum ClientEventType {
CREDS_LS = 34;
CONF_CAT = 35;
CONF_RESOLVE = 36;
REMOTEAPI_GET_REPO_METADATA = 37;
REMOTEAPI_HAS_CHUNKS = 38;
REMOTEAPI_GET_DOWNLOAD_LOCATIONS = 39;
REMOTEAPI_GET_UPLOAD_LOCATIONS = 40;
REMOTEAPI_REBASE = 41;
REMOTEAPI_ROOT = 42;
REMOTEAPI_COMMIT = 43;
REMOTEAPI_LIST_TABLE_FILES = 44;
}
enum MetricID {
METRIC_UNSPECIFIED = 0;
BYTES_DOWNLOADED = 1;
DOWNLOAD_MS_ELAPSED = 2;
REMOTEAPI_RPC_ERROR = 3;
}
enum AttributeID {
ATTRIBUTE_UNSPECIFIED = 0;
LOCAL_REMOTE_URLS = 1;
ACTIVE_REMOTE_URL = 1;
}
message ClientEventAttribute {