diff --git a/cli/start.go b/cli/start.go index 2d41b0ce..e639d57a 100644 --- a/cli/start.go +++ b/cli/start.go @@ -20,7 +20,6 @@ import ( "github.com/abcum/surreal/db" "github.com/abcum/surreal/kvs" "github.com/abcum/surreal/log" - "github.com/abcum/surreal/trc" "github.com/abcum/surreal/web" ) @@ -32,11 +31,6 @@ var startCmd = &cobra.Command{ }, RunE: func(cmd *cobra.Command, args []string) (err error) { - if err = trc.Setup(opts); err != nil { - log.Fatal(err) - return - } - if err = kvs.Setup(opts); err != nil { log.Fatal(err) return diff --git a/db/executor.go b/db/executor.go index 6834eeb5..36809bd1 100644 --- a/db/executor.go +++ b/db/executor.go @@ -27,7 +27,6 @@ import ( "github.com/abcum/surreal/kvs" "github.com/abcum/surreal/log" "github.com/abcum/surreal/sql" - "github.com/abcum/surreal/trc" "github.com/abcum/surreal/txn" ) @@ -69,13 +68,6 @@ func newExecutor(id, ns, db string) (e *executor) { func (e *executor) execute(ctx context.Context, ast *sql.Query) { - // Create a new trace span so we can analyse - // the execution time of this method, and - // detect problems with long-running queries. - - ctx, span := trc.Start(ctx, "db::execute") - defer span.End() - // Ensure that the executor is added back into // the executor pool when the executor has // finished processing the request. @@ -109,8 +101,6 @@ func (e *executor) execute(ctx context.Context, ast *sql.Query) { if log.IsError() { log.WithPrefix(logKeyDB).WithFields(map[string]interface{}{ logKeyId: e.id, - logKeySpan: span.SpanContext().SpanID.String(), - logKeyTrace: span.SpanContext().TraceID.String(), logKeyStack: string(debug.Stack()), logKeyFibre: ctx.Value(ctxKeyFibre).(*fibre.Context), }).Errorln(err) @@ -138,13 +128,6 @@ func (e *executor) conduct(ctx context.Context, stm sql.Statement) { var rsp *Response var res []interface{} - // Create a new trace span so we can analyse - // the execution time of this method, and - // detect problems with long-running queries. - - ctx, span := trc.Start(ctx, "db::conduct") - defer span.End() - // If we are not inside a global transaction // then reset the error to nil so that the // next statement is not ignored. @@ -215,8 +198,6 @@ func (e *executor) conduct(ctx context.Context, stm sql.Statement) { logKeyKind: ctx.Value(ctxKeyKind), logKeyVars: ctx.Value(ctxKeyVars), logKeyTime: time.Since(e.time).String(), - logKeySpan: span.SpanContext().SpanID.String(), - logKeyTrace: span.SpanContext().TraceID.String(), logKeyFibre: ctx.Value(ctxKeyFibre).(*fibre.Context), }).Debugln(stm) } @@ -229,8 +210,6 @@ func (e *executor) conduct(ctx context.Context, stm sql.Statement) { logKeyKind: ctx.Value(ctxKeyKind), logKeyVars: ctx.Value(ctxKeyVars), logKeyTime: time.Since(e.time).String(), - logKeySpan: span.SpanContext().SpanID.String(), - logKeyTrace: span.SpanContext().TraceID.String(), logKeyFibre: ctx.Value(ctxKeyFibre).(*fibre.Context), logKeyError: detail(e.err), }).Errorln(stm) @@ -270,13 +249,6 @@ func (e *executor) operate(ctx context.Context, stm sql.Statement) (res []interf var trw bool var canc context.CancelFunc - // Create a new trace span so we can analyse - // the execution time of this method, and - // detect problems with long-running queries. - - ctx, span := trc.Start(ctx, "db::operate") - defer span.End() - // If we are not inside a global transaction // then grab a new transaction, ensuring that // it is closed at the end. diff --git a/main.go b/main.go index 76cab3f7..e001694d 100644 --- a/main.go +++ b/main.go @@ -21,10 +21,7 @@ import ( "github.com/pkg/profile" - "cloud.google.com/go/profiler" - "github.com/abcum/surreal/cli" - "github.com/abcum/surreal/util/build" ) func main() { @@ -40,12 +37,6 @@ func main() { runtime.GOMAXPROCS(runtime.NumCPU()) - profiler.Start(profiler.Config{ - ProjectID: "surreal-io", - Service: "surreal", - ServiceVersion: build.GetInfo().Ver, - }) - cli.Init() } diff --git a/trc/main.go b/trc/main.go deleted file mode 100644 index 85feb1df..00000000 --- a/trc/main.go +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright © 2016 Abcum Ltd -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package trc - -import ( - "context" - - "go.opencensus.io/trace" - - "github.com/abcum/surreal/cnf" - "github.com/abcum/surreal/log" - - "contrib.go.opencensus.io/exporter/stackdriver" -) - -func Setup(opts *cnf.Options) (err error) { - - log.WithPrefix("log").Infof("Starting open tracing framework") - - var exporter *stackdriver.Exporter - - opt := stackdriver.Options{ - ProjectID: "surreal-io", - OnError: func(error) {}, - } - - exporter, err = stackdriver.NewExporter(opt) - if err != nil { - return err - } - - err = exporter.StartMetricsExporter() - if err != nil { - return err - } - - trace.ApplyConfig(trace.Config{ - DefaultSampler: trace.AlwaysSample(), - }) - - trace.RegisterExporter(exporter) - - return - -} - -func Start(ctx context.Context, name string) (context.Context, *trace.Span) { - return trace.StartSpan(ctx, name) -}