update deps (#32)

This commit is contained in:
Victor Vrantchan
2016-10-11 23:28:09 -04:00
committed by GitHub
parent 3991374503
commit 1cd3a459eb
8 changed files with 112 additions and 114 deletions

8
glide.lock generated
View File

@@ -1,5 +1,5 @@
hash: 9065f050a8e87468098f6df070622f57a29d2de83efebb67363efa781f612080
updated: 2016-10-07T10:39:12.797010091-04:00
updated: 2016-10-11T23:26:43.205635472-04:00
imports:
- name: github.com/beorn7/perks
version: 4c0e84591b9aa9e6dcfdf3e020114cd81f89d5f9
@@ -19,7 +19,7 @@ imports:
- internal
- redis
- name: github.com/go-kit/kit
version: f4b6110ad931c7b2915f65bace5081ec60e17d64
version: fa37eda80c7ca0329458495b0299f068f3f19d70
vcs: git
subpackages:
- endpoint
@@ -48,7 +48,7 @@ imports:
- name: github.com/kr/logfmt
version: b84e30acd515aadc4b783ad4ff83aff3299bdfe0
- name: github.com/lib/pq
version: 50761b0867bd1d9d069276790bcd4a3bccf2324a
version: 068cb1c8e4be77b9bdef4d0d91f162160537779e
subpackages:
- oid
- name: github.com/matttproud/golang_protobuf_extensions
@@ -58,7 +58,7 @@ imports:
- name: github.com/micromdm/dep
version: 38c81b11544f31c2be14e0b3bcfa12f656fcc709
- name: github.com/micromdm/mdm
version: 1b3e0e090d7a4faa4b2e432a84d2eca04dbe2e95
version: 6e0586cca72594720a1c7c48214661a87c73bd17
- name: github.com/pkg/errors
version: 17b591df37844cde689f4d5813e5cea0927d8dd2
- name: github.com/prometheus/client_golang

View File

@@ -12,10 +12,10 @@ import (
"github.com/lightstep/lightstep-tracer-go"
stdopentracing "github.com/opentracing/opentracing-go"
zipkin "github.com/openzipkin/zipkin-go-opentracing"
appdashot "github.com/sourcegraph/appdash/opentracing"
"golang.org/x/net/context"
"google.golang.org/grpc"
"sourcegraph.com/sourcegraph/appdash"
appdashot "sourcegraph.com/sourcegraph/appdash/opentracing"
"github.com/go-kit/kit/examples/addsvc"
grpcclient "github.com/go-kit/kit/examples/addsvc/client/grpc"

View File

@@ -16,10 +16,10 @@ import (
stdopentracing "github.com/opentracing/opentracing-go"
zipkin "github.com/openzipkin/zipkin-go-opentracing"
stdprometheus "github.com/prometheus/client_golang/prometheus"
appdashot "github.com/sourcegraph/appdash/opentracing"
"golang.org/x/net/context"
"google.golang.org/grpc"
"sourcegraph.com/sourcegraph/appdash"
appdashot "sourcegraph.com/sourcegraph/appdash/opentracing"
"github.com/go-kit/kit/endpoint"
"github.com/go-kit/kit/examples/addsvc"

View File

@@ -2,49 +2,58 @@
## Development and Testing Set-up
Setting up [Zipkin] is not an easy thing to do. It will also demand quite some
resources. To help you get started with development and testing we've made a
docker-compose file available for running a full Zipkin stack.
Great efforts have been made to make [Zipkin] easier to test, develop and
experiment against. [Zipkin] can now be run from a single Docker container or by
running its self-contained executable jar without extensive configuration. In
its default configuration you will run Zipkin with a HTTP collector, In memory
Span storage backend and web UI on port 9411.
You will need [docker-compose] 1.6.0+ and [docker-engine] 1.10.0+.
If running on Linux `HOSTNAME` can be set to `localhost`. If running on Mac OS X
or Windows you probably need to set the hostname environment variable to the
hostname of the VM running the docker containers.
```sh
cd tracing/zipkin
HOSTNAME=localhost docker-compose -f docker-compose-zipkin.yml up
Example:
```
docker run -d -p 9411:9411 openzipkin/zipkin
```
[Zipkin]: http://zipkin.io/
[docker-compose]: https://docs.docker.com/compose/
[docker-engine]: https://docs.docker.com/engine/
As mentioned the [Zipkin] stack is quite heavy and may take a few minutes to
fully initialize.
The following services have been set-up to run:
- Apache Cassandra (port: 9160 (thrift), 9042 (native))
- Apache ZooKeeper (port: 2181)
- Apache Kafka (port: 9092)
- Zipkin Collector
- Zipkin Query
- Zipkin Web (port: 8080, 9990)
[zipkin]: http://zipkin.io
Instrumenting your services with Zipkin distributed tracing using the default
configuration is now possible with the latest release of [zipkin-go-opentracing]
as it includes an HTTP transport for sending spans to the [Zipkin] HTTP
Collector.
## Middleware Usage
Follow the [addsvc] example to check out how to wire the Zipkin Middleware. The
changes should be relatively minor.
The [zipkin-go-opentracing] package has support for Kafka and Scribe collectors
as well as using Go Kit's [Log] package for logging.
The [zipkin-go-opentracing] package has support for HTTP, Kafka and Scribe
collectors as well as using Go Kit's [Log] package for logging.
### Configuring for the Zipkin HTTP Collector
To select the transport for the HTTP Collector, you configure the `Recorder`
with the appropriate collector like this:
```go
var (
debugMode = false
serviceName = "MyService"
serviceHostPort = "localhost:8000"
zipkinHTTPEndpoint = "localhost:9411"
)
collector, err = zipkin.NewHTTPCollector(zipkinHTTPEndpoint)
if err != nil {
// handle error
}
tracer, err = zipkin.NewTracer(
zipkin.NewRecorder(collector, debugMode, serviceHostPort, serviceName),
...
)
```
### Span per Node vs. Span per RPC
By default Zipkin V1 considers either side of an RPC to have the same identity
and differs in that respect from many other tracing systems which consider the
caller to be the parent and the receiver the child. The OpenTracing
caller to be the parent and the receiver to be the child. The OpenTracing
specification does not dictate one model over the other, but the Zipkin team is
looking into these [single-host-spans] to potentially bring Zipkin more in-line
with the other tracing systems.
@@ -135,6 +144,7 @@ func (svc *Service) GetMeSomeExamples(ctx context.Context, ...) ([]Examples, err
parentSpan := opentracing.SpanFromContext(ctx)
if parentSpan == nil {
parentSpan = opentracing.StartSpan(queryLabel)
defer parentSpan.Finish()
}
// create a new span to record the resource interaction

View File

@@ -1,76 +0,0 @@
# This file uses the version 2 docker-compose file format, described here:
# https://docs.docker.com/compose/compose-file/#version-2
#
# It runs the zipkin-cassandra, zipkin-collector, zipkin-query, zipkin-web, and
# zookeeper-exhibitor containers.
#
# On linux you probably want to start this composition like this:
#
# HOSTNAME=localhost docker-compose -f docker-compose-zipkin.yml up
#
# On OS X you will probably start like this:
#
# HOSTNAME=default docker-compose -f docker-compose-zipkin.yml up
version: '2'
services:
cassandra:
image: openzipkin/zipkin-cassandra:1.39.4
network_mode: host
zookeeper:
image: mbabineau/zookeeper-exhibitor:latest
network_mode: host
environment:
HOSTNAME: ${HOSTNAME}
kafka:
image: wurstmeister/kafka
network_mode: host
environment:
KAFKA_CREATE_TOPICS: "zipkin:1:1"
KAFKA_ZOOKEEPER_CONNECTION_TIMEOUT_MS: 60000
KAFKA_ADVERTISED_PORT: 9092
KAFKA_ADVERTISED_HOST_NAME: ${HOSTNAME}
KAFKA_ZOOKEEPER_CONNECT: ${HOSTNAME}:2181
depends_on:
- zookeeper
collector:
image: openzipkin/zipkin-collector:1.39.4
network_mode: host
environment:
STORAGE_TYPE: cassandra
TRANSPORT_TYPE: kafka
CASSANDRA_CONTACT_POINTS: ${HOSTNAME}
KAFKA_ZOOKEEPER: ${HOSTNAME}:2181
METADATA_BROKER_LIST: ${HOSTNAME}:9092
depends_on:
- cassandra
- kafka
query:
image: openzipkin/zipkin-query:1.39.4
network_mode: host
environment:
STORAGE_TYPE: cassandra
TRANSPORT_TYPE: kafka
CASSANDRA_CONTACT_POINTS: ${HOSTNAME}
KAFKA_ZOOKEEPER: ${HOSTNAME}:2181
METADATA_BROKER_LIST: ${HOSTNAME}:9092
depends_on:
- cassandra
- kafka
web:
image: openzipkin/zipkin-web:1.39.4
network_mode: host
environment:
TRANSPORT_TYPE: kafka
KAFKA_ZOOKEEPER: ${HOSTNAME}:2181
METADATA_BROKER_LIST: ${HOSTNAME}:9092
QUERY_PORT_9411_TCP_ADDR: ${HOSTNAME}
ROOTURL: http://${HOSTNAME}:8080
depends_on:
- cassandra
- kafka

31
vendor/github.com/lib/pq/conn.go generated vendored
View File

@@ -32,6 +32,10 @@ var (
ErrSSLNotSupported = errors.New("pq: SSL is not enabled on the server")
ErrSSLKeyHasWorldPermissions = errors.New("pq: Private key file has group or world access. Permissions should be u=rw (0600) or less.")
ErrCouldNotDetectUsername = errors.New("pq: Could not detect default username. Please provide one explicitly.")
errUnexpectedReady = errors.New("unexpected ReadyForQuery")
errNoRowsAffected = errors.New("no RowsAffected available after the empty statement")
errNoLastInsertId = errors.New("no LastInsertId available after the empty statement")
)
type drv struct{}
@@ -598,11 +602,16 @@ func (cn *conn) simpleExec(q string) (res driver.Result, commandTag string, err
res, commandTag = cn.parseComplete(r.string())
case 'Z':
cn.processReadyForQuery(r)
if res == nil && err == nil {
err = errUnexpectedReady
}
// done
return
case 'E':
err = parseError(r)
case 'T', 'D', 'I':
case 'I':
res = emptyRows
case 'T', 'D':
// ignore any results
default:
cn.bad = true
@@ -666,6 +675,20 @@ func (cn *conn) simpleQuery(q string) (res *rows, err error) {
}
}
type noRows struct{}
var emptyRows noRows
var _ driver.Result = noRows{}
func (noRows) LastInsertId() (int64, error) {
return 0, errNoLastInsertId
}
func (noRows) RowsAffected() (int64, error) {
return 0, errNoRowsAffected
}
// Decides which column formats to use for a prepared statement. The input is
// an array of type oids, one element per result column.
func decideColumnFormats(colTyps []oid.Oid, forceText bool) (colFmts []format, colFmtData []byte) {
@@ -1720,6 +1743,9 @@ func (cn *conn) readExecuteResponse(protocolState string) (res driver.Result, co
res, commandTag = cn.parseComplete(r.string())
case 'Z':
cn.processReadyForQuery(r)
if res == nil && err == nil {
err = errUnexpectedReady
}
return res, commandTag, err
case 'E':
err = parseError(r)
@@ -1728,6 +1754,9 @@ func (cn *conn) readExecuteResponse(protocolState string) (res driver.Result, co
cn.bad = true
errorf("unexpected %q after error %s", t, err)
}
if t == 'I' {
res = emptyRows
}
// ignore any results
default:
cn.bad = true

View File

@@ -385,10 +385,16 @@ func TestEmptyQuery(t *testing.T) {
db := openTestConn(t)
defer db.Close()
_, err := db.Exec("")
res, err := db.Exec("")
if err != nil {
t.Fatal(err)
}
if _, err := res.RowsAffected(); err != errNoRowsAffected {
t.Fatalf("expected %s, got %v", errNoRowsAffected, err)
}
if _, err := res.LastInsertId(); err != errNoLastInsertId {
t.Fatalf("expected %s, got %v", errNoLastInsertId, err)
}
rows, err := db.Query("")
if err != nil {
t.Fatal(err)
@@ -411,10 +417,16 @@ func TestEmptyQuery(t *testing.T) {
if err != nil {
t.Fatal(err)
}
_, err = stmt.Exec()
res, err = stmt.Exec()
if err != nil {
t.Fatal(err)
}
if _, err := res.RowsAffected(); err != errNoRowsAffected {
t.Fatalf("expected %s, got %v", errNoRowsAffected, err)
}
if _, err := res.LastInsertId(); err != errNoLastInsertId {
t.Fatalf("expected %s, got %v", errNoLastInsertId, err)
}
rows, err = stmt.Query()
if err != nil {
t.Fatal(err)

23
vendor/github.com/lib/pq/doc.go generated vendored
View File

@@ -89,8 +89,10 @@ provided connection parameters.
The pgpass mechanism as described in http://www.postgresql.org/docs/current/static/libpq-pgpass.html
is supported, but on Windows PGPASSFILE must be specified explicitly.
Queries
database/sql does not dictate any specific format for parameter
markers in query strings, and pq uses the Postgres-native ordinal markers,
as shown above. The same marker can be reused for the same parameter:
@@ -114,8 +116,29 @@ For more details on RETURNING, see the Postgres documentation:
For additional instructions on querying see the documentation for the database/sql package.
Data Types
Parameters pass through driver.DefaultParameterConverter before they are handled
by this package. When the binary_parameters connection option is enabled,
[]byte values are sent directly to the backend as data in binary format.
This package returns the following types for values from the PostgreSQL backend:
- integer types smallint, integer, and bigint are returned as int64
- floating-point types real and double precision are returned as float64
- character types char, varchar, and text are returned as string
- temporal types date, time, timetz, timestamp, and timestamptz are returned as time.Time
- the boolean type is returned as bool
- the bytea type is returned as []byte
All other types are returned directly from the backend as []byte values in text format.
Errors
pq may return errors of type *pq.Error which can be interrogated for error details:
if err, ok := err.(*pq.Error); ok {