From b0752f5385697e9ff8ae7e0a7c8efdb426485099 Mon Sep 17 00:00:00 2001 From: vvakame Date: Mon, 29 Oct 2018 19:18:59 +0900 Subject: [PATCH] add complexity values to tracing data --- server/go.mod | 2 +- server/go.sum | 2 ++ server/gqlapi/gqlopencensus/tracer.go | 2 ++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/server/go.mod b/server/go.mod index 75e1851..3a252a5 100644 --- a/server/go.mod +++ b/server/go.mod @@ -2,7 +2,7 @@ module github.com/mercari/mtc2018-web/server require ( cloud.google.com/go v0.30.0 - github.com/99designs/gqlgen v0.4.5-0.20181028055237-0d5c65b6dc1c + github.com/99designs/gqlgen v0.4.5-0.20181029101704-784dc01fdb4f github.com/DataDog/datadog-go v0.0.0-20180822151419-281ae9f2d895 // indirect github.com/DataDog/opencensus-go-exporter-datadog v0.0.0-20180917103902-e6c7f767dc57 github.com/agnivade/levenshtein v1.0.1 // indirect diff --git a/server/go.sum b/server/go.sum index 4cc3d66..b0f591f 100644 --- a/server/go.sum +++ b/server/go.sum @@ -4,6 +4,8 @@ cloud.google.com/go v0.30.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMT git.apache.org/thrift.git v0.0.0-20180902110319-2566ecd5d999/go.mod h1:fPE2ZNJGynbRyZ4dJvy6G277gSllfV2HJqblrnkyeyg= github.com/99designs/gqlgen v0.4.5-0.20181028055237-0d5c65b6dc1c h1:enfJ7MaOw8DuF2USF9LeFjp4XaV3fqUnhaNuALWYsTM= github.com/99designs/gqlgen v0.4.5-0.20181028055237-0d5c65b6dc1c/go.mod h1:KSQDfLlTTGmzlRgLGm6HeKKKo598l5E2svEM6Nz2Jnw= +github.com/99designs/gqlgen v0.4.5-0.20181029101704-784dc01fdb4f h1:H0iZ0U3L4GHjod/wAdRpf5sm4XcKN9DyM/X4W/Z+rl8= +github.com/99designs/gqlgen v0.4.5-0.20181029101704-784dc01fdb4f/go.mod h1:KSQDfLlTTGmzlRgLGm6HeKKKo598l5E2svEM6Nz2Jnw= github.com/DataDog/datadog-go v0.0.0-20180822151419-281ae9f2d895 h1:dmc/C8bpE5VkQn65PNbbyACDC8xw8Hpp/NEurdPmQDQ= github.com/DataDog/datadog-go v0.0.0-20180822151419-281ae9f2d895/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= github.com/DataDog/opencensus-go-exporter-datadog v0.0.0-20180917103902-e6c7f767dc57 h1:V1H8VVVxLALfaPLvAFCPoa0AN5nVPAqEu2UvH+QP3Vc= diff --git a/server/gqlapi/gqlopencensus/tracer.go b/server/gqlapi/gqlopencensus/tracer.go index dfe34a1..e0eb6fb 100644 --- a/server/gqlapi/gqlopencensus/tracer.go +++ b/server/gqlapi/gqlopencensus/tracer.go @@ -40,6 +40,8 @@ func (t *tracerImpl) StartOperationExecution(ctx context.Context) context.Contex requestContext := graphql.GetRequestContext(ctx) span.AddAttributes( trace.StringAttribute("request.query", requestContext.RawQuery), + trace.Int64Attribute("request.complexityLimit", int64(requestContext.ComplexityLimit)), + trace.Int64Attribute("request.operationComplexity", int64(requestContext.OperationComplexity)), ) for key, val := range requestContext.Variables { span.AddAttributes(