Skip to content

Commit 13752be

Browse files
authored
Merge pull request #141 from ydb-platform/gtrace
Imported gtrace tool as part of sdk
2 parents 5ab005b + eaffaa0 commit 13752be

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+4680
-40
lines changed

.github/workflows/gtrace.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: gtrace
2+
on:
3+
push:
4+
tags:
5+
- v*
6+
branches:
7+
- master
8+
- '**'
9+
pull_request:
10+
workflow_dispatch:
11+
jobs:
12+
test:
13+
strategy:
14+
matrix:
15+
os: [ ubuntu-latest, macos-latest, windows-latest ]
16+
go: [1.14.x, 1.15.x, 1.16.x, 1.17.x]
17+
runs-on: ${{ matrix.os }}
18+
steps:
19+
- name: Checkout
20+
uses: actions/checkout@v2
21+
22+
- name: Setup Go
23+
uses: actions/setup-go@v2
24+
with:
25+
go-version: ${{ matrix.go }}
26+
27+
- name: Go Env
28+
run: |
29+
go env
30+
31+
- name: Build
32+
run: |
33+
go install ./cmd/gtrace
34+
35+
- name: Remove committed codegen file for recreate with gtrace on next step
36+
run: |
37+
rm ./cmd/gtrace/internal/test/*_gtrace.go
38+
39+
- name: Generate
40+
run: |
41+
cd ./cmd/gtrace/internal/test/ && go generate
42+
43+
- name: Test
44+
run: |
45+
go test -v ./cmd/gtrace/internal/test/

.github/workflows/tests.yml

Lines changed: 5 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
unit:
1313
strategy:
1414
matrix:
15-
go-version: [1.13.x, 1.14.x, 1.15.x, 1.16.x, 1.17.x]
15+
go-version: [1.14.x, 1.15.x, 1.16.x, 1.17.x]
1616
os: [ubuntu-latest, windows-latest, macOS-latest]
1717
env:
1818
OS: ${{ matrix.os }}
@@ -27,20 +27,6 @@ jobs:
2727
uses: actions/checkout@v2
2828
- name: Test
2929
run: go test -race -tags fast -coverprofile unit.txt -covermode atomic ./...
30-
- name: Clear report (unix)
31-
if: runner.os != 'Windows'
32-
run: |
33-
if [ "$RUNNER_OS" == "Linux" ]; then
34-
sed -i '/testutil\|trace\|test/d' unit.txt
35-
elif [ "$RUNNER_OS" == "macOS" ]; then
36-
sed -i '' '/testutil\|trace\|test/d' unit.txt
37-
fi
38-
shell: bash
39-
- name: Clear report (windows)
40-
if: runner.os == 'Windows'
41-
run: |
42-
(Get-Content unit.txt) -replace '^(testutil\|trace\|test).*$', '' | Out-File -encoding UTF8 unit.txt
43-
shell: pwsh
4430
- name: Upload coverage to Codecov
4531
uses: codecov/codecov-action@v2
4632
with:
@@ -80,10 +66,7 @@ jobs:
8066
- name: Checkout code
8167
uses: actions/checkout@v2
8268
- name: Test
83-
run: go test -race -coverpkg=./... -coverprofile table.txt -covermode atomic ./test/table_test.go
84-
- name: Clear report
85-
run: sed -i '/testutil\|trace\|test/d' table.txt
86-
shell: bash
69+
run: go test -race -coverpkg=./... -coverprofile unit.txt -covermode atomic ./test/table_test.go
8770
- name: Upload coverage to Codecov
8871
uses: codecov/codecov-action@v2
8972
with:
@@ -122,9 +105,7 @@ jobs:
122105
- name: Checkout code
123106
uses: actions/checkout@v2
124107
- name: Test
125-
run: go test -race -coverpkg=./... -coverprofile ratelimiter.txt -covermode atomic ./test/ratelimiter_test.go
126-
- name: Clear report
127-
run: sed -i '/testutil\|trace\|test/d' ratelimiter.txt
108+
run: go test -race -coverpkg=./... -coverprofile unit.txt -covermode atomic ./test/ratelimiter_test.go
128109
shell: bash
129110
- name: Upload coverage to Codecov
130111
uses: codecov/codecov-action@v2
@@ -164,10 +145,7 @@ jobs:
164145
- name: Checkout code
165146
uses: actions/checkout@v2
166147
- name: Test
167-
run: go test -race -coverpkg=./... -coverprofile scripting.txt -covermode atomic ./test/scripting_test.go
168-
- name: Clear report
169-
run: sed -i '/testutil\|trace\|test/d' scripting.txt
170-
shell: bash
148+
run: go test -race -coverpkg=./... -coverprofile unit.txt -covermode atomic ./test/scripting_test.go
171149
- name: Upload coverage to Codecov
172150
uses: codecov/codecov-action@v2
173151
with:
@@ -206,10 +184,7 @@ jobs:
206184
- name: Checkout code
207185
uses: actions/checkout@v2
208186
- name: Test
209-
run: go test -race -coverpkg=./... -coverprofile connection.txt -covermode atomic ./test/connection_test.go
210-
- name: Clear report
211-
run: sed -i '/testutil\|trace\|test/d' connection.txt
212-
shell: bash
187+
run: go test -race -coverpkg=./... -coverprofile unit.txt -covermode atomic ./test/connection_test.go
213188
- name: Upload coverage to Codecov
214189
uses: codecov/codecov-action@v2
215190
with:

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 3.11.10
2+
* Imported tool gtrace to `./cmd/gtrace`
3+
* Changed minimal version of go from 1.13 to 1.14
4+
15
## 3.11.9
26
* Fixed composing of service traces
37
* Fixed end-call of `trace.Driver.OnConnStateChange`

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ We are tried to support `go1.18` features seamlessly. But now we was tested `go1
5858

5959
## Prerequisites <a name="Prerequisites"></a>
6060

61-
Requires `go1.13` or later.
61+
Requires `go1.14` or later.
6262

6363
## Installation <a name="Installation"></a>
6464

cmd/gtrace/LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2020 Sergey Kamardin <[email protected]>
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

cmd/gtrace/Makefile

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
.PHONY: gtrace
2+
gtrace:
3+
go build -o gtrace ./cmd/gtrace
4+
5+
.PHONY: examples
6+
examples: gtrace
7+
PATH=$(PWD):$(PATH) go generate ./examples/...
8+
go build -o pinger ./examples/pinger
9+
go build -o buildtags ./examples/buildtags
10+
11+
.PHONY: test
12+
test: gtrace
13+
find ./test -name '*_gtrace*' -delete
14+
for os in linux darwin windows; do \
15+
echo "--------"; \
16+
echo "running: GOOS=$$os go generate ./test"; \
17+
echo "--------"; \
18+
PATH=$(PWD):$(PATH) GOOS=$$os go generate ./test; \
19+
if [[ $$? -ne 0 ]]; then \
20+
exit 1;\
21+
fi; \
22+
done; \
23+
for os in linux darwin; do \
24+
for arch in amd64 arm64; do \
25+
echo "--------"; \
26+
echo "running: GOOS=$$os GOARCH=$$arch go generate ./test"; \
27+
echo "--------"; \
28+
PATH=$(PWD):$(PATH) GOOS=$$os GOARCH=$$arch go generate ./test; \
29+
if [[ $$? -ne 0 ]]; then \
30+
exit 1;\
31+
fi; \
32+
done; \
33+
done
34+
go test -v ./test
35+
36+
clean:
37+
rm -f gtrace
38+
rm -f pinger
39+
find ./test -name '*_gtrace*' -delete
40+
find ./examples -name '*_gtrace*' -delete

0 commit comments

Comments
 (0)