Skip to content

Commit eec03bd

Browse files
authored
Merge pull request #431 from GoRethink/develop
v4: connection refactor, some tests and opentracing.
2 parents 7f5bdfd + b4cac7c commit eec03bd

File tree

124 files changed

+1670
-779
lines changed

Some content is hidden

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

124 files changed

+1670
-779
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,5 @@ _testmain.go
2525

2626
*.exe
2727
.wercker
28+
29+
cover.html

.travis.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
language: go
22

33
go:
4-
- 1.7.5
5-
- 1.8.1
4+
- 1.7.x
5+
- 1.8.x
6+
- 1.9.x
67
- tip
78

89
cache: apt
910

10-
go_import_path: gopkg.in/gorethink/gorethink.v3
11+
go_import_path: gopkg.in/gorethink/gorethink.v4
12+
13+
install: go get -t ./...
1114

1215
before_script:
1316
- source /etc/lsb-release && echo "deb http://download.rethinkdb.com/apt $DISTRIB_CODENAME main" | sudo tee /etc/apt/sources.list.d/rethinkdb.list

CHANGELOG.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,19 @@
22
All notable changes to this project will be documented in this file.
33
This project adheres to [Semantic Versioning](http://semver.org/).
44

5+
## v4.0.0 - 2017-12-14
6+
7+
### Fixed
8+
9+
- `Connection` work with sockets, now only a single goroutine reads from socket.
10+
- Optimized threadsafe operations in `Connection` with channels and atomics instead of mutex.
11+
- All tests with real db moved to integration folder
12+
13+
### Added
14+
15+
- Added support for tracing with `opentracing-go`
16+
- Added a brand-new unit tests for `Connection`
17+
518
## v3.0.5 - 2017-09-28
619

720
- Fixed typo at http opts

Makefile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
test:
2+
test -d ${GOPATH}/src/gopkg.in/gorethink/gorethink.v4 && mv ${GOPATH}/src/gopkg.in/gorethink/gorethink.v4 ${GOPATH}/src/gopkg.in/gorethink/gorethink.v4.bak; true
3+
cp -R . ${GOPATH}/src/gopkg.in/gorethink/gorethink.v4
4+
go test -coverprofile=cover.out -race gopkg.in/gorethink/gorethink.v4; true
5+
go tool cover -html=cover.out -o cover.html; true
6+
rm -f cover.out; true
7+
rm -rf ${GOPATH}/src/gopkg.in/gorethink/gorethink.v4
8+
test -d ${GOPATH}/src/gopkg.in/gorethink/gorethink.v4.bak && mv ${GOPATH}/src/gopkg.in/gorethink/gorethink.v4.bak ${GOPATH}/src/gopkg.in/gorethink/gorethink.v4; true

README.md

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
![GoRethink Logo](https://raw.github.com/wiki/gorethink/gorethink/gopher-and-thinker-s.png "Golang Gopher and RethinkDB Thinker")
1111

12-
Current version: v3.0.5 (RethinkDB v2.3)
12+
Current version: v4.0.0 (RethinkDB v2.3)
1313

1414
<!-- This project is no longer maintained, for more information see the [v3.0.0 release](https://github.com/gorethink/gorethink/releases/tag/v3.0.0)-->
1515

@@ -20,10 +20,10 @@ If you need any help you can find me on the [RethinkDB slack](http://slack.rethi
2020
## Installation
2121

2222
```
23-
go get gopkg.in/gorethink/gorethink.v3
23+
go get gopkg.in/gorethink/gorethink.v4
2424
```
2525

26-
Replace `v3` with `v2` or `v1` to use previous versions.
26+
Replace `v4` with `v3` or `v2` to use previous versions.
2727

2828
## Example
2929

@@ -35,7 +35,7 @@ import (
3535
"fmt"
3636
"log"
3737

38-
r "gopkg.in/gorethink/gorethink.v3"
38+
r "gopkg.in/gorethink/gorethink.v4"
3939
)
4040

4141
func Example() {
@@ -413,6 +413,15 @@ r.Log.Out = os.Stderr
413413
r.Log.Out = ioutil.Discard
414414
```
415415

416+
## Tracing
417+
418+
The driver supports [opentracing-go](https://github.com/opentracing/opentracing-go/). You can enable this feature by setting `UseOpentracing` to true in the `ConnectOpts`. Then driver will expect `opentracing.Span` in the `RunOpts.Context` and will start new child spans for queries.
419+
Also you need to configure tracer in your program by yourself.
420+
421+
The driver starts span for the whole query, from the first byte is sent to the cursor closed, and second-level span for each query for fetching data.
422+
423+
So you can trace how much time you program spends for RethinkDB queries.
424+
416425
## Mocking
417426

418427
The driver includes the ability to mock queries meaning that you can test your code without needing to talk to a real RethinkDB cluster, this is perfect for ensuring that your application has high unit test coverage.

0 commit comments

Comments
 (0)