未验证 提交 54e683fb 编写于 作者: K kezhenxu94 提交者: GitHub

Generate GraphQL codes dynamically (#29)

上级 faecb185
......@@ -36,7 +36,13 @@ jobs:
id: go
- name: Check out code into the Go module directory
uses: actions/checkout@v1
uses: actions/checkout@v2
- name: checkout submodules
shell: bash
run: |
git submodule sync --recursive
git -c protocol.version=2 submodule update --init --force --recursive --depth=1
- name: Check License
run: make license
......
.idea
bin
coverage.txt
\ No newline at end of file
coverage.txt
graphql/schema/schema.go
[submodule "query-protocol"]
path = query-protocol
url = http://github.com/apache/skywalking-query-protocol/
......@@ -41,11 +41,16 @@ ARCH = amd64
SHELL = /bin/bash
all: clean deps lint test license build
all: clean deps codegen lint test license build
deps:
$(GO_GET) -v -t -d ./...
codegen:
echo 'scalar Long' > query-protocol/schema.graphqls
$(GO) run github.com/99designs/gqlgen generate
-rm -rf generated.go
.PHONY: $(PLATFORMS)
$(PLATFORMS):
mkdir -p $(OUT_DIR)
......@@ -57,7 +62,7 @@ lint:
$(GO_LINT) run -v ./...
.PHONE: test
test: clean lint
test: clean codegen lint
$(GO_TEST) ./... -coverprofile=coverage.txt -covermode=atomic
.PHONY: build
......@@ -66,7 +71,7 @@ build: deps windows linux darwin
.PHONY: license
license: clean
$(GO_LICENSER) -version || GO111MODULE=off $(GO_GET) -u github.com/elastic/go-licenser
$(GO_LICENSER) -d -licensor='Apache Software Foundation (ASF)' .
$(GO_LICENSER) -exclude graphql/schema/ -d -licensor='Apache Software Foundation (ASF)' .
.PHONY: verify
verify: clean lint test license
......@@ -98,6 +103,7 @@ release-src: clean
--exclude .DS_Store \
--exclude .github \
--exclude $(RELEASE_SRC).tgz \
--exclude graphql/schema/schema.go \
.
release-bin: build
......
......@@ -209,7 +209,7 @@ The text of each license is the standard Apache 2.0 license.
machinebox (graphql) 0.2.2: https://github.com/machinebox/graphql Apache 2.0
mum4k (termdash) 0.10.0: https://github.com/mum4k/termdash Apache 2.0
yaml.v2 2.2.2: https://gopkg.in/yaml.v2 Apache 2.0
yaml.v2 2.2.4: https://gopkg.in/yaml.v2 Apache 2.0
========================================================================
MIT licenses
......@@ -230,4 +230,4 @@ BSD licenses
The following components are provided under a BSD license. See project link for details.
The text of each license is also included at licenses/LICENSE-[project].txt.
pkg (errors) 0.8.1 https://github.com/pkg/errors BSD 2-Clause
\ No newline at end of file
pkg (errors) 0.8.1 https://github.com/pkg/errors BSD 2-Clause
......@@ -3,12 +3,12 @@ module github.com/apache/skywalking-cli
go 1.13
require (
github.com/99designs/gqlgen v0.11.1 // indirect
github.com/machinebox/graphql v0.2.2
github.com/mum4k/termdash v0.10.0
github.com/nsf/termbox-go v0.0.0-20190817171036-93860e161317 // indirect
github.com/olekukonko/tablewriter v0.0.2
github.com/pkg/errors v0.8.1 // indirect
github.com/sirupsen/logrus v1.4.2
github.com/urfave/cli v1.22.1
gopkg.in/yaml.v2 v2.2.2
gopkg.in/yaml.v2 v2.2.4
)
github.com/99designs/gqlgen v0.11.1 h1:QoSL8/AAJ2T3UOeQbdnBR32JcG4pO08+P/g5jdbFkUg=
github.com/99designs/gqlgen v0.11.1/go.mod h1:vjFOyBZ7NwDl+GdSD4PFn7BQn5Fy7ohJwXn7Vk8zz+c=
github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/agnivade/levenshtein v1.0.1/go.mod h1:CURSv5d9Uaml+FovSIICkLbAUZ9S4RqaHDIsdSBg7lM=
github.com/agnivade/levenshtein v1.0.3 h1:M5ZnqLOoZR8ygVq0FfkXsNOKzMCk0xRiow0R5+5VkQ0=
github.com/agnivade/levenshtein v1.0.3/go.mod h1:4SFRZbbXWLF4MU1T9Qg0pGgH3Pjs+t6ie5efyrwRJXs=
github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883/go.mod h1:rCTlJbsFo29Kk6CurOXKm700vrz8f0KW0JNfpkRJY/8=
github.com/arbovm/levenshtein v0.0.0-20160628152529-48b4e1c0c4d0/go.mod h1:t2tdKJDJF9BV14lnkjHmOQgcvEKgtqs5a1N3LNdJhGE=
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d h1:U+s90UTSYgptZMwQh2aRr3LuazLJIa+Pg3Kc1ylSYVY=
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/dgryski/trifles v0.0.0-20190318185328-a8d75aae118c/go.mod h1:if7Fbed8SFyPtHLHbg49SI7NAdJiC5WIA09pe59rfAA=
github.com/go-chi/chi v3.3.2+incompatible/go.mod h1:eB3wogJHnLi3x/kFX2A+IbTBlXxmMeXJVKy9tTv1XzQ=
github.com/gogo/protobuf v1.0.0/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
github.com/gorilla/context v0.0.0-20160226214623-1ea25387ff6f/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg=
github.com/gorilla/mux v1.6.1/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs=
github.com/gorilla/websocket v1.2.0 h1:VJtLvh6VQym50czpZzx07z/kw9EgAxI3x1ZB8taTMQQ=
github.com/gorilla/websocket v1.2.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ=
github.com/hashicorp/golang-lru v0.5.0 h1:CL2msUPvZTLb5O648aiLNJw3hnBxN2+1Jq8rCOH9wdo=
github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
github.com/konsorten/go-windows-terminal-sequences v1.0.1 h1:mweAR1A6xJ3oS2pRaGiHgQ4OO8tzTaLawm8vnODuwDk=
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/logrusorgru/aurora v0.0.0-20200102142835-e9ef32dff381/go.mod h1:7rIyQOR62GCctdiQpZ/zOJlFyk6y+94wXzv6RNZgaR4=
github.com/lytics/logrus v0.0.0-20170528191427-4389a17ed024 h1:QaKVrqyQRNPbdBNCpiU0Ei3iDQko3qoiUUXMiTWhzZM=
github.com/lytics/logrus v0.0.0-20170528191427-4389a17ed024/go.mod h1:SkQviJ2s7rFyzyuxdVp6osZceHOabU91ZhKsEXF0RWg=
github.com/machinebox/graphql v0.2.2 h1:dWKpJligYKhYKO5A2gvNhkJdQMNZeChZYyBbrZkBZfo=
github.com/machinebox/graphql v0.2.2/go.mod h1:F+kbVMHuwrQ5tYgU9JXlnskM8nOaFxCAEolaQybkjWA=
github.com/matryer/moq v0.0.0-20200106131100-75d0ddfc0007/go.mod h1:9ELz6aaclSIGnZBoaSLZ3NAl1VTufbOrXBPvtcy6WiQ=
github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE=
github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
github.com/mattn/go-runewidth v0.0.4 h1:2BvfKmzob6Bmd4YsL0zygOqfdFnK7GR4QL06Do4/p7Y=
github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU=
github.com/mitchellh/mapstructure v0.0.0-20180203102830-a4e142e9c047 h1:zCoDWFD5nrJJVjbXiDZcVhOBSzKn3o9LgRLLMRNuru8=
github.com/mitchellh/mapstructure v0.0.0-20180203102830-a4e142e9c047/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
github.com/mum4k/termdash v0.10.0 h1:uqM6ePiMf+smecb1tJJeON36o1hREeCfOmLFG0iz4a0=
github.com/mum4k/termdash v0.10.0/go.mod h1:l3tO+lJi9LZqXRq7cu7h5/8rDIK3AzelSuq2v/KncxI=
github.com/nsf/termbox-go v0.0.0-20190817171036-93860e161317 h1:hhGN4SFXgXo61Q4Sjj/X9sBjyeSa2kdpaOzCO+8EVQw=
......@@ -18,21 +45,57 @@ github.com/nsf/termbox-go v0.0.0-20190817171036-93860e161317/go.mod h1:IuKpRQcYE
github.com/olekukonko/tablewriter v0.0.1/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo=
github.com/olekukonko/tablewriter v0.0.2 h1:sq53g+DWf0J6/ceFUHpQ0nAEb6WgM++fq16MZ91cS6o=
github.com/olekukonko/tablewriter v0.0.2/go.mod h1:rSAaSIOAGT9odnlyGlUfAJaoc5w2fSBUmeGDbRWPxyQ=
github.com/opentracing/basictracer-go v1.0.0/go.mod h1:QfBfYuafItcjQuMwinw9GhYKwFXS9KnPs5lxoYwgW74=
github.com/opentracing/opentracing-go v1.0.2/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o=
github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I=
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/rs/cors v1.6.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU=
github.com/russross/blackfriday/v2 v2.0.1 h1:lPqVAte+HuHNfhJ/0LC98ESWRz8afy9tM/0RK8m9o+Q=
github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM=
github.com/shurcooL/httpfs v0.0.0-20171119174359-809beceb2371/go.mod h1:ZY1cvUeJuFPAdZ/B6v7RHavJWZn2YPVFQ1OSXhCGOkg=
github.com/shurcooL/sanitized_anchor_name v1.0.0 h1:PdmoCO6wvbs+7yrJyMORt4/BmY5IYyJwS/kOiWx8mHo=
github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
github.com/shurcooL/vfsgen v0.0.0-20180121065927-ffb13db8def0/go.mod h1:TrYk7fJVaAttu97ZZKrO9UbRa8izdowaMIZcxYMbVaw=
github.com/sirupsen/logrus v1.4.2 h1:SPIRibHv4MatM3XXNO2BJeFLZwZ2LvZgfQ5+UNI2im4=
github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.2.1/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA=
github.com/urfave/cli v1.22.1 h1:+mkCCcOFKPnCmVYVcURKps1Xe+3zP90gSYGNfRkjoIY=
github.com/urfave/cli v1.22.1/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0=
github.com/vektah/dataloaden v0.2.1-0.20190515034641-a19b9a6e7c9e/go.mod h1:/HUdMve7rvxZma+2ZELQeNh88+003LL7Pf/CZ089j8U=
github.com/vektah/gqlparser/v2 v2.0.1 h1:xgl5abVnsd4hkN9rk65OJID9bfcLSMuTaTcZj777q1o=
github.com/vektah/gqlparser/v2 v2.0.1/go.mod h1:SyUiHgLATUR8BiYURfTirrTcGpcE+4XkV2se04Px1Ms=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg=
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190422165155-953cdadca894 h1:Cz4ceDQGXuKRnVBDTS23GTn/pU5OE2C0WrNTOYK1Uuc=
golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200116001909-b77594299b42 h1:vEOn+mP2zCOVzKckCZy6YsCtDblrpj/w7B9nxGNELpg=
golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/tools v0.0.0-20190125232054-d66bd3c5d5a6/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20190515012406-7d7faa4812bd/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
golang.org/x/tools v0.0.0-20200114235610-7ae403b6b589 h1:rjUrONFu4kLchcZTfp3/96bR8bW8dIa8uz3cR5n0cgM=
golang.org/x/tools v0.0.0-20200114235610-7ae403b6b589/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.4 h1:/eiJrUcujPVeJ3xlSWaiNi3uSVmDGBK1pDHUHAnao1I=
gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
sourcegraph.com/sourcegraph/appdash v0.0.0-20180110180208-2cc67fd64755/go.mod h1:hI742Nqp5OhwiqlzhgfbWU4mW4yO10fP+LoT9WOswdU=
sourcegraph.com/sourcegraph/appdash-data v0.0.0-20151005221446-73f23eafcf67/go.mod h1:L5q+DGLGOQFpo1snNEkLOJT2d1YTW66rWNzatr3He1k=
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you 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.
schema:
- query-protocol/*.graphqls
skip_validation: true
model:
filename: graphql/schema/schema.go
package: schema
models:
Long:
model: github.com/99designs/gqlgen/graphql.Int64
\ No newline at end of file
// Licensed to Apache Software Foundation (ASF) under one or more contributor
// license agreements. See the NOTICE file distributed with
// this work for additional information regarding copyright
// ownership. Apache Software Foundation (ASF) licenses this file to you 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 schema
import (
"fmt"
"io"
"strconv"
)
type AlarmMessage struct {
StartTime int64 `json:"startTime"`
Scope *Scope `json:"scope"`
ID string `json:"id"`
Message string `json:"message"`
}
type AlarmTrend struct {
NumOfAlarm []*int `json:"numOfAlarm"`
}
type Alarms struct {
Msgs []*AlarmMessage `json:"msgs"`
Total int `json:"total"`
}
type Attribute struct {
Name string `json:"name"`
Value string `json:"value"`
}
type BasicTrace struct {
SegmentID string `json:"segmentId"`
EndpointNames []string `json:"endpointNames"`
Duration int `json:"duration"`
Start string `json:"start"`
IsError *bool `json:"isError"`
TraceIds []string `json:"traceIds"`
}
type BatchMetricConditions struct {
Name string `json:"name"`
Ids []string `json:"ids"`
}
type Call struct {
Source string `json:"source"`
SourceComponents []string `json:"sourceComponents"`
Target string `json:"target"`
TargetComponents []string `json:"targetComponents"`
ID string `json:"id"`
DetectPoints []DetectPoint `json:"detectPoints"`
}
type ClusterBrief struct {
NumOfService int `json:"numOfService"`
NumOfEndpoint int `json:"numOfEndpoint"`
NumOfDatabase int `json:"numOfDatabase"`
NumOfCache int `json:"numOfCache"`
NumOfMq int `json:"numOfMQ"`
}
type Database struct {
ID string `json:"id"`
Name string `json:"name"`
Type string `json:"type"`
}
type Duration struct {
Start string `json:"start"`
End string `json:"end"`
Step Step `json:"step"`
}
type Endpoint struct {
ID string `json:"id"`
Name string `json:"name"`
}
type EndpointInfo struct {
ID string `json:"id"`
Name string `json:"name"`
ServiceID string `json:"serviceId"`
ServiceName string `json:"serviceName"`
}
type IntValues struct {
Values []*KVInt `json:"values"`
}
type KVInt struct {
ID string `json:"id"`
Value int64 `json:"value"`
}
type KeyValue struct {
Key string `json:"key"`
Value *string `json:"value"`
}
type Log struct {
ServiceName *string `json:"serviceName"`
ServiceID *string `json:"serviceId"`
ServiceInstanceName *string `json:"serviceInstanceName"`
ServiceInstanceID *string `json:"serviceInstanceId"`
EndpointName *string `json:"endpointName"`
EndpointID *string `json:"endpointId"`
TraceID *string `json:"traceId"`
Timestamp string `json:"timestamp"`
IsError *bool `json:"isError"`
StatusCode *string `json:"statusCode"`
ContentType ContentType `json:"contentType"`
Content *string `json:"content"`
}
type LogEntity struct {
Time int64 `json:"time"`
Data []*KeyValue `json:"data"`
}
type LogQueryCondition struct {
MetricName *string `json:"metricName"`
ServiceID *string `json:"serviceId"`
ServiceInstanceID *string `json:"serviceInstanceId"`
EndpointID *string `json:"endpointId"`
TraceID *string `json:"traceId"`
QueryDuration *Duration `json:"queryDuration"`
State LogState `json:"state"`
StateCode *string `json:"stateCode"`
Paging *Pagination `json:"paging"`
}
type Logs struct {
Logs []*Log `json:"logs"`
Total int `json:"total"`
}
type MetricCondition struct {
Name string `json:"name"`
ID *string `json:"id"`
}
type Node struct {
ID string `json:"id"`
Name string `json:"name"`
Type *string `json:"type"`
IsReal bool `json:"isReal"`
}
type Pagination struct {
PageNum *int `json:"pageNum"`
PageSize int `json:"pageSize"`
NeedTotal *bool `json:"needTotal"`
}
type Ref struct {
TraceID string `json:"traceId"`
ParentSegmentID string `json:"parentSegmentId"`
ParentSpanID int `json:"parentSpanId"`
Type RefType `json:"type"`
}
type Service struct {
ID string `json:"id"`
Name string `json:"name"`
}
type ServiceInstance struct {
ID string `json:"id"`
Name string `json:"name"`
Attributes []*Attribute `json:"attributes"`
Language Language `json:"language"`
InstanceUUID string `json:"instanceUUID"`
}
type Span struct {
TraceID string `json:"traceId"`
SegmentID string `json:"segmentId"`
SpanID int `json:"spanId"`
ParentSpanID int `json:"parentSpanId"`
Refs []*Ref `json:"refs"`
ServiceCode string `json:"serviceCode"`
StartTime int64 `json:"startTime"`
EndTime int64 `json:"endTime"`
EndpointName *string `json:"endpointName"`
Type string `json:"type"`
Peer *string `json:"peer"`
Component *string `json:"component"`
IsError *bool `json:"isError"`
Layer *string `json:"layer"`
Tags []*KeyValue `json:"tags"`
Logs []*LogEntity `json:"logs"`
}
type Thermodynamic struct {
Nodes [][]*int `json:"nodes"`
AxisYStep int `json:"axisYStep"`
}
type TimeInfo struct {
Timezone *string `json:"timezone"`
CurrentTimestamp *int64 `json:"currentTimestamp"`
}
type TopNEntity struct {
Name string `json:"name"`
ID string `json:"id"`
Value int64 `json:"value"`
}
type TopNRecord struct {
Statement *string `json:"statement"`
Latency int64 `json:"latency"`
TraceID *string `json:"traceId"`
}
type TopNRecordsCondition struct {
ServiceID string `json:"serviceId"`
MetricName string `json:"metricName"`
TopN int `json:"topN"`
Order Order `json:"order"`
Duration *Duration `json:"duration"`
}
type Topology struct {
Nodes []*Node `json:"nodes"`
Calls []*Call `json:"calls"`
}
type Trace struct {
Spans []*Span `json:"spans"`
}
type TraceBrief struct {
Traces []*BasicTrace `json:"data"`
Total int `json:"total"`
}
type TraceQueryCondition struct {
ServiceID *string `json:"serviceId"`
ServiceInstanceID *string `json:"serviceInstanceId"`
TraceID *string `json:"traceId"`
EndpointID *string `json:"endpointId"`
EndpointName *string `json:"endpointName"`
QueryDuration *Duration `json:"queryDuration"`
MinTraceDuration *int `json:"minTraceDuration"`
MaxTraceDuration *int `json:"maxTraceDuration"`
TraceState TraceState `json:"traceState"`
QueryOrder QueryOrder `json:"queryOrder"`
Paging *Pagination `json:"paging"`
}
type ContentType string
const (
ContentTypeText ContentType = "TEXT"
ContentTypeJSON ContentType = "JSON"
ContentTypeNone ContentType = "NONE"
)
var AllContentType = []ContentType{
ContentTypeText,
ContentTypeJSON,
ContentTypeNone,
}
func (e ContentType) IsValid() bool {
switch e {
case ContentTypeText, ContentTypeJSON, ContentTypeNone:
return true
}
return false
}
func (e ContentType) String() string {
return string(e)
}
func (e *ContentType) UnmarshalGQL(v interface{}) error {
str, ok := v.(string)
if !ok {
return fmt.Errorf("enums must be strings")
}
*e = ContentType(str)
if !e.IsValid() {
return fmt.Errorf("%s is not a valid ContentType", str)
}
return nil
}
func (e ContentType) MarshalGQL(w io.Writer) {
fmt.Fprint(w, strconv.Quote(e.String()))
}
type DetectPoint string
const (
DetectPointClient DetectPoint = "CLIENT"
DetectPointServer DetectPoint = "SERVER"
DetectPointProxy DetectPoint = "PROXY"
)
var AllDetectPoint = []DetectPoint{
DetectPointClient,
DetectPointServer,
DetectPointProxy,
}
func (e DetectPoint) IsValid() bool {
switch e {
case DetectPointClient, DetectPointServer, DetectPointProxy:
return true
}
return false
}
func (e DetectPoint) String() string {
return string(e)
}
func (e *DetectPoint) UnmarshalGQL(v interface{}) error {
str, ok := v.(string)
if !ok {
return fmt.Errorf("enums must be strings")
}
*e = DetectPoint(str)
if !e.IsValid() {
return fmt.Errorf("%s is not a valid DetectPoint", str)
}
return nil
}
func (e DetectPoint) MarshalGQL(w io.Writer) {
fmt.Fprint(w, strconv.Quote(e.String()))
}
type Language string
const (
LanguageUnknown Language = "UNKNOWN"
LanguageJava Language = "JAVA"
LanguageDotnet Language = "DOTNET"
LanguageNodejs Language = "NODEJS"
LanguagePython Language = "PYTHON"
LanguageRuby Language = "RUBY"
)
var AllLanguage = []Language{
LanguageUnknown,
LanguageJava,
LanguageDotnet,
LanguageNodejs,
LanguagePython,
LanguageRuby,
}
func (e Language) IsValid() bool {
switch e {
case LanguageUnknown, LanguageJava, LanguageDotnet, LanguageNodejs, LanguagePython, LanguageRuby:
return true
}
return false
}
func (e Language) String() string {
return string(e)
}
func (e *Language) UnmarshalGQL(v interface{}) error {
str, ok := v.(string)
if !ok {
return fmt.Errorf("enums must be strings")
}
*e = Language(str)
if !e.IsValid() {
return fmt.Errorf("%s is not a valid Language", str)
}
return nil
}
func (e Language) MarshalGQL(w io.Writer) {
fmt.Fprint(w, strconv.Quote(e.String()))
}
type LogState string
const (
LogStateAll LogState = "ALL"
LogStateSuccess LogState = "SUCCESS"
LogStateError LogState = "ERROR"
)
var AllLogState = []LogState{
LogStateAll,
LogStateSuccess,
LogStateError,
}
func (e LogState) IsValid() bool {
switch e {
case LogStateAll, LogStateSuccess, LogStateError:
return true
}
return false
}
func (e LogState) String() string {
return string(e)
}
func (e *LogState) UnmarshalGQL(v interface{}) error {
str, ok := v.(string)
if !ok {
return fmt.Errorf("enums must be strings")
}
*e = LogState(str)
if !e.IsValid() {
return fmt.Errorf("%s is not a valid LogState", str)
}
return nil
}
func (e LogState) MarshalGQL(w io.Writer) {
fmt.Fprint(w, strconv.Quote(e.String()))
}
type NodeType string
const (
NodeTypeService NodeType = "SERVICE"
NodeTypeEndpoint NodeType = "ENDPOINT"
NodeTypeUser NodeType = "USER"
)
var AllNodeType = []NodeType{
NodeTypeService,
NodeTypeEndpoint,
NodeTypeUser,
}
func (e NodeType) IsValid() bool {
switch e {
case NodeTypeService, NodeTypeEndpoint, NodeTypeUser:
return true
}
return false
}
func (e NodeType) String() string {
return string(e)
}
func (e *NodeType) UnmarshalGQL(v interface{}) error {
str, ok := v.(string)
if !ok {
return fmt.Errorf("enums must be strings")
}
*e = NodeType(str)
if !e.IsValid() {
return fmt.Errorf("%s is not a valid NodeType", str)
}
return nil
}
func (e NodeType) MarshalGQL(w io.Writer) {
fmt.Fprint(w, strconv.Quote(e.String()))
}
type Order string
const (
OrderAsc Order = "ASC"
OrderDes Order = "DES"
)
var AllOrder = []Order{
OrderAsc,
OrderDes,
}
func (e Order) IsValid() bool {
switch e {
case OrderAsc, OrderDes:
return true
}
return false
}
func (e Order) String() string {
return string(e)
}
func (e *Order) UnmarshalGQL(v interface{}) error {
str, ok := v.(string)
if !ok {
return fmt.Errorf("enums must be strings")
}
*e = Order(str)
if !e.IsValid() {
return fmt.Errorf("%s is not a valid Order", str)
}
return nil
}
func (e Order) MarshalGQL(w io.Writer) {
fmt.Fprint(w, strconv.Quote(e.String()))
}
type QueryOrder string
const (
QueryOrderByStartTime QueryOrder = "BY_START_TIME"
QueryOrderByDuration QueryOrder = "BY_DURATION"
)
var AllQueryOrder = []QueryOrder{
QueryOrderByStartTime,
QueryOrderByDuration,
}
func (e QueryOrder) IsValid() bool {
switch e {
case QueryOrderByStartTime, QueryOrderByDuration:
return true
}
return false
}
func (e QueryOrder) String() string {
return string(e)
}
func (e *QueryOrder) UnmarshalGQL(v interface{}) error {
str, ok := v.(string)
if !ok {
return fmt.Errorf("enums must be strings")
}
*e = QueryOrder(str)
if !e.IsValid() {
return fmt.Errorf("%s is not a valid QueryOrder", str)
}
return nil
}
func (e QueryOrder) MarshalGQL(w io.Writer) {
fmt.Fprint(w, strconv.Quote(e.String()))
}
type RefType string
const (
RefTypeCrossProcess RefType = "CROSS_PROCESS"
RefTypeCrossThread RefType = "CROSS_THREAD"
)
var AllRefType = []RefType{
RefTypeCrossProcess,
RefTypeCrossThread,
}
func (e RefType) IsValid() bool {
switch e {
case RefTypeCrossProcess, RefTypeCrossThread:
return true
}
return false
}
func (e RefType) String() string {
return string(e)
}
func (e *RefType) UnmarshalGQL(v interface{}) error {
str, ok := v.(string)
if !ok {
return fmt.Errorf("enums must be strings")
}
*e = RefType(str)
if !e.IsValid() {
return fmt.Errorf("%s is not a valid RefType", str)
}
return nil
}
func (e RefType) MarshalGQL(w io.Writer) {
fmt.Fprint(w, strconv.Quote(e.String()))
}
type Scope string
const (
ScopeService Scope = "Service"
ScopeServiceInstance Scope = "ServiceInstance"
ScopeEndpoint Scope = "Endpoint"
ScopeServiceRelation Scope = "ServiceRelation"
ScopeServiceInstanceRelation Scope = "ServiceInstanceRelation"
ScopeEndpointRelation Scope = "EndpointRelation"
)
var AllScope = []Scope{
ScopeService,
ScopeServiceInstance,
ScopeEndpoint,
ScopeServiceRelation,
ScopeServiceInstanceRelation,
ScopeEndpointRelation,
}
func (e Scope) IsValid() bool {
switch e {
case ScopeService,
ScopeServiceInstance,
ScopeEndpoint,
ScopeServiceRelation,
ScopeServiceInstanceRelation,
ScopeEndpointRelation:
return true
}
return false
}
func (e Scope) String() string {
return string(e)
}
func (e *Scope) UnmarshalGQL(v interface{}) error {
str, ok := v.(string)
if !ok {
return fmt.Errorf("enums must be strings")
}
*e = Scope(str)
if !e.IsValid() {
return fmt.Errorf("%s is not a valid Scope", str)
}
return nil
}
func (e Scope) MarshalGQL(w io.Writer) {
fmt.Fprint(w, strconv.Quote(e.String()))
}
type Step string
const (
StepMonth Step = "MONTH"
StepDay Step = "DAY"
StepHour Step = "HOUR"
StepMinute Step = "MINUTE"
StepSecond Step = "SECOND"
)
var AllStep = []Step{
StepMonth,
StepDay,
StepHour,
StepMinute,
StepSecond,
}
func (e Step) IsValid() bool {
switch e {
case StepMonth, StepDay, StepHour, StepMinute, StepSecond:
return true
}
return false
}
func (e Step) String() string {
return string(e)
}
func (e *Step) UnmarshalGQL(v interface{}) error {
str, ok := v.(string)
if !ok {
return fmt.Errorf("enums must be strings")
}
*e = Step(str)
if !e.IsValid() {
return fmt.Errorf("%s is not a valid Step", str)
}
return nil
}
func (e Step) MarshalGQL(w io.Writer) {
fmt.Fprint(w, strconv.Quote(e.String()))
}
type TraceState string
const (
TraceStateAll TraceState = "ALL"
TraceStateSuccess TraceState = "SUCCESS"
TraceStateError TraceState = "ERROR"
)
var AllTraceState = []TraceState{
TraceStateAll,
TraceStateSuccess,
TraceStateError,
}
func (e TraceState) IsValid() bool {
switch e {
case TraceStateAll, TraceStateSuccess, TraceStateError:
return true
}
return false
}
func (e TraceState) String() string {
return string(e)
}
func (e *TraceState) UnmarshalGQL(v interface{}) error {
str, ok := v.(string)
if !ok {
return fmt.Errorf("enums must be strings")
}
*e = TraceState(str)
if !e.IsValid() {
return fmt.Errorf("%s is not a valid TraceState", str)
}
return nil
}
func (e TraceState) MarshalGQL(w io.Writer) {
fmt.Fprint(w, strconv.Quote(e.String()))
}
query-protocol @ 8c9a8c45
Subproject commit 8c9a8c45b9dbe954efa6de50202d05b1ef8e6be2
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册