diff --git a/go.mod b/go.mod index 9540cba..f62492a 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.12 require ( github.com/google/gops v0.3.6 - github.com/insolar/insolar v1.5.1 + github.com/insolar/insolar v1.5.3 github.com/insolar/x-crypto v0.0.0-20191031140942-75fab8a325f6 github.com/pkg/errors v0.9.1 github.com/spf13/cobra v0.0.5 diff --git a/go.sum b/go.sum index 5297a5a..1045b4f 100644 --- a/go.sum +++ b/go.sum @@ -136,6 +136,8 @@ github.com/insolar/insolar v1.5.0 h1:KAX/+YVax0bqfShjkFZvoUDWm36KL8Loz+8arSCLXN0 github.com/insolar/insolar v1.5.0/go.mod h1:HpkU7MAOc4APtJ5QlLs/yC0PVfGD+xSxgf8s95O8hZo= github.com/insolar/insolar v1.5.1 h1:vI6P0FvDqLGe0yn3S+DjJ6PRsnvBCb9mY0z1rQg0NEI= github.com/insolar/insolar v1.5.1/go.mod h1:HvUtnqOPs4yaaLtzxOWAQbY58RWrwiIGqVyQajz24Nw= +github.com/insolar/insolar v1.5.3 h1:aj+v2JZk3TyM1U7nf+LLQlu3SJZwXJNDskNpL5n1yLg= +github.com/insolar/insolar v1.5.3/go.mod h1:HvUtnqOPs4yaaLtzxOWAQbY58RWrwiIGqVyQajz24Nw= github.com/insolar/rpc v1.2.2-0.20200331123021-db57b8833f82 h1:SbU7YjfN6JdDP3ULyYqqgxtSOlDkFPKm6ddN4tM0bFI= github.com/insolar/rpc v1.2.2-0.20200331123021-db57b8833f82/go.mod h1:BZcTsPtQu8QG8RqqQdAnuNAG8n6TOrdNxIHro0h99Ik= github.com/insolar/x-crypto v0.0.0-20191031140942-75fab8a325f6 h1:WS4a7qw+P1pcnviyxyMTA/aR+T51wJok1IC9rJkHrTg= diff --git a/insolar-scripts b/insolar-scripts index 67881ee..339c9ce 160000 --- a/insolar-scripts +++ b/insolar-scripts @@ -1 +1 @@ -Subproject commit 67881ee2de265077e85fd1fe72b586e4c46ab81c +Subproject commit 339c9ce2a2ccc21ba7b4cda7d4b161f323c70169 diff --git a/vendor/github.com/insolar/insolar/applicationbase/testutils/testrequest/request.go b/vendor/github.com/insolar/insolar/applicationbase/testutils/testrequest/request.go index 63f89d8..068b243 100644 --- a/vendor/github.com/insolar/insolar/applicationbase/testutils/testrequest/request.go +++ b/vendor/github.com/insolar/insolar/applicationbase/testutils/testrequest/request.go @@ -109,7 +109,7 @@ func MakeSignedRequest(URL string, user launchnet.User, method string, params in } -func SignedRequest(t *testing.T, URL string, user launchnet.User, method string, params interface{}) (interface{}, error) { +func SignedRequest(t testing.TB, URL string, user launchnet.User, method string, params interface{}) (interface{}, error) { res, refStr, err := MakeSignedRequest(URL, user, method, params) if err != nil { diff --git a/vendor/github.com/insolar/insolar/ledger/heavy/executor/heavyreplicator.go b/vendor/github.com/insolar/insolar/ledger/heavy/executor/heavyreplicator.go index e80d45c..c564676 100644 --- a/vendor/github.com/insolar/insolar/ledger/heavy/executor/heavyreplicator.go +++ b/vendor/github.com/insolar/insolar/ledger/heavy/executor/heavyreplicator.go @@ -16,6 +16,7 @@ import ( "github.com/insolar/insolar/insolar/pulse" "github.com/insolar/insolar/insolar/record" "github.com/insolar/insolar/instrumentation/inslogger" + "github.com/insolar/insolar/instrumentation/insmetrics" "github.com/insolar/insolar/ledger/drop" "go.opencensus.io/stats" @@ -145,6 +146,9 @@ func (h *HeavyReplicatorDefault) sync(ctx context.Context) { if err != nil { logger.Panic(errors.Wrapf(err, "heavy replicator failed to update jet %s", msg.Drop.JetID.DebugString())) } + logger.Debug("heavy count record in drop", len(msg.Records), msg.JetID.DebugString()) + ctx = insmetrics.InsertTag(ctx, TagJetID, msg.JetID.DebugString()) + stats.Record(ctx, statRecordInDrop.M(int64(len(msg.Records)))) logger.Debug("heavy replicator finalize pulse") FinalizePulse(ctx, h.pulseCalculator, h.backuper, h.keeper, h.indexes, msg.Drop.Pulse, h.gcRunner) diff --git a/vendor/github.com/insolar/insolar/ledger/heavy/executor/metrics.go b/vendor/github.com/insolar/insolar/ledger/heavy/executor/metrics.go index 41992f0..d97695a 100644 --- a/vendor/github.com/insolar/insolar/ledger/heavy/executor/metrics.go +++ b/vendor/github.com/insolar/insolar/ledger/heavy/executor/metrics.go @@ -8,10 +8,14 @@ package executor import ( "time" + "github.com/insolar/insolar/instrumentation/insmetrics" "go.opencensus.io/stats" "go.opencensus.io/stats/view" + "go.opencensus.io/tag" ) +var TagJetID = insmetrics.MustTagKey("jet_id_heavy") + var ( statJets = stats.Int64( "heavy_jets", @@ -87,6 +91,12 @@ var ( "retries while jetkeeper TruncateHead", stats.UnitDimensionless, ) + + statRecordInDrop = stats.Int64( + "record_in_drop_count", + "How many record in drop were received from a light-node", + stats.UnitDimensionless, + ) ) func init() { @@ -169,6 +179,13 @@ func init() { Measure: TruncateHeadRetries, Aggregation: view.Distribution(0, 1, 2, 3, 4, 5, 10), }, + &view.View{ + Name: statRecordInDrop.Name(), + Description: statRecordInDrop.Description(), + Measure: statRecordInDrop, + TagKeys: []tag.Key{TagJetID}, + Aggregation: view.Count(), + }, ) if err != nil { panic(err) diff --git a/vendor/github.com/insolar/insolar/ledger/heavy/exporter/metrics.go b/vendor/github.com/insolar/insolar/ledger/heavy/exporter/metrics.go index 87db54c..776543b 100644 --- a/vendor/github.com/insolar/insolar/ledger/heavy/exporter/metrics.go +++ b/vendor/github.com/insolar/insolar/ledger/heavy/exporter/metrics.go @@ -6,15 +6,20 @@ package exporter import ( + "context" + "go.opencensus.io/stats" "go.opencensus.io/stats/view" "go.opencensus.io/tag" + "google.golang.org/grpc/metadata" "github.com/insolar/insolar/instrumentation/insmetrics" ) var ( TagHeavyExporterMethodName = insmetrics.MustTagKey("heavy_exporter_method_name") + // public - data from observer on public side(crypto exchange). internal - from internal network + TagHeavyIdObserver = insmetrics.MustTagKey("heavy_exporter_type_observer") ) var ( @@ -31,7 +36,7 @@ func init() { Name: HeavyExporterMethodTiming.Name(), Description: HeavyExporterMethodTiming.Description(), Measure: HeavyExporterMethodTiming, - TagKeys: []tag.Key{TagHeavyExporterMethodName}, + TagKeys: []tag.Key{TagHeavyExporterMethodName, TagHeavyIdObserver}, Aggregation: view.Distribution(0.001, 0.01, 0.1, 1, 10, 100, 1000, 5000, 10000, 20000), }, ) @@ -39,3 +44,14 @@ func init() { panic(err) } } + +func addTagsForExporterMethodTiming(ctx context.Context, methodName string) context.Context { + typeObserver := "internal" + md, ok := metadata.FromIncomingContext(ctx) + if _, isContain := md["idobserver"]; isContain && ok { + typeObserver = md.Get("idobserver")[0] + } + ctx = insmetrics.InsertTag(ctx, TagHeavyIdObserver, typeObserver) + ctx = insmetrics.InsertTag(ctx, TagHeavyExporterMethodName, methodName) + return ctx +} diff --git a/vendor/github.com/insolar/insolar/ledger/heavy/exporter/pulse_exporter_server.go b/vendor/github.com/insolar/insolar/ledger/heavy/exporter/pulse_exporter_server.go index fbb7d81..f2cbec9 100644 --- a/vendor/github.com/insolar/insolar/ledger/heavy/exporter/pulse_exporter_server.go +++ b/vendor/github.com/insolar/insolar/ledger/heavy/exporter/pulse_exporter_server.go @@ -9,15 +9,13 @@ import ( "context" "time" - "go.opencensus.io/stats" - "github.com/insolar/insolar/insolar" "github.com/insolar/insolar/insolar/node" insolarPulse "github.com/insolar/insolar/insolar/pulse" "github.com/insolar/insolar/instrumentation/inslogger" - "github.com/insolar/insolar/instrumentation/insmetrics" "github.com/insolar/insolar/ledger/heavy/executor" "github.com/insolar/insolar/pulse" + "go.opencensus.io/stats" ) type PulseServer struct { @@ -40,7 +38,7 @@ func (p *PulseServer) Export(getPulses *GetPulses, stream PulseExporter_ExportSe exportStart := time.Now() defer func(ctx context.Context) { stats.Record( - insmetrics.InsertTag(ctx, TagHeavyExporterMethodName, "pulse-export"), + addTagsForExporterMethodTiming(ctx, "pulse-export"), HeavyExporterMethodTiming.M(float64(time.Since(exportStart).Nanoseconds())/1e6), ) }(ctx) @@ -104,7 +102,7 @@ func (p *PulseServer) TopSyncPulse(ctx context.Context, _ *GetTopSyncPulse) (*To exportStart := time.Now() defer func(ctx context.Context) { stats.Record( - insmetrics.InsertTag(ctx, TagHeavyExporterMethodName, "pulse-top-sync-pulse"), + addTagsForExporterMethodTiming(ctx, "pulse-top-sync-pulse"), HeavyExporterMethodTiming.M(float64(time.Since(exportStart).Nanoseconds())/1e6), ) }(ctx) diff --git a/vendor/github.com/insolar/insolar/ledger/heavy/exporter/record_exporter_server.go b/vendor/github.com/insolar/insolar/ledger/heavy/exporter/record_exporter_server.go index 42228dd..2a467ec 100644 --- a/vendor/github.com/insolar/insolar/ledger/heavy/exporter/record_exporter_server.go +++ b/vendor/github.com/insolar/insolar/ledger/heavy/exporter/record_exporter_server.go @@ -14,7 +14,6 @@ import ( "github.com/insolar/insolar/insolar" insolarPulse "github.com/insolar/insolar/insolar/pulse" "github.com/insolar/insolar/instrumentation/inslogger" - "github.com/insolar/insolar/instrumentation/insmetrics" "github.com/insolar/insolar/ledger/heavy/executor" "github.com/insolar/insolar/ledger/object" "github.com/insolar/insolar/pulse" @@ -49,7 +48,7 @@ func (r *RecordServer) Export(getRecords *GetRecords, stream RecordExporter_Expo exportStart := time.Now() defer func(ctx context.Context) { stats.Record( - insmetrics.InsertTag(ctx, TagHeavyExporterMethodName, "record-export"), + addTagsForExporterMethodTiming(ctx, "record-export"), HeavyExporterMethodTiming.M(float64(time.Since(exportStart).Nanoseconds())/1e6), ) }(ctx) diff --git a/vendor/github.com/insolar/insolar/ledger/object/postgres_index_db.go b/vendor/github.com/insolar/insolar/ledger/object/postgres_index_db.go index 77f9a63..f4f5317 100644 --- a/vendor/github.com/insolar/insolar/ledger/object/postgres_index_db.go +++ b/vendor/github.com/insolar/insolar/ledger/object/postgres_index_db.go @@ -158,7 +158,7 @@ func (i *PostgresIndexDB) UpdateLastKnownPulse(ctx context.Context, pn insolar.P for _, id := range rawIDs { _, err := tx.Exec(ctx, `INSERT INTO last_known_pulse_for_indexes VALUES($1, $2) - ON CONFLICT (object_id, pulse_number) + ON CONFLICT (object_id) DO UPDATE SET pulse_number = EXCLUDED.pulse_number`, id, pn) if err != nil { diff --git a/vendor/modules.txt b/vendor/modules.txt index 1ef8546..ff69e70 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -98,7 +98,7 @@ github.com/insolar/go-actors/actor/system github.com/insolar/go-actors/actor/mailbox # github.com/insolar/insconfig v0.0.0-20200227134411-011eca6dc866 github.com/insolar/insconfig -# github.com/insolar/insolar v1.5.1 +# github.com/insolar/insolar v1.5.3 github.com/insolar/insolar/cmd/insgocc github.com/insolar/insolar/cmd/keeperd github.com/insolar/insolar/cmd/pulsard @@ -478,6 +478,7 @@ google.golang.org/genproto/googleapis/api/httpbody google.golang.org/genproto/protobuf/field_mask # google.golang.org/grpc v1.21.0 google.golang.org/grpc +google.golang.org/grpc/metadata google.golang.org/grpc/balancer google.golang.org/grpc/balancer/roundrobin google.golang.org/grpc/codes @@ -496,7 +497,6 @@ google.golang.org/grpc/internal/grpcrand google.golang.org/grpc/internal/grpcsync google.golang.org/grpc/internal/transport google.golang.org/grpc/keepalive -google.golang.org/grpc/metadata google.golang.org/grpc/naming google.golang.org/grpc/peer google.golang.org/grpc/resolver