mirror of
https://github.com/pomerium/pomerium.git
synced 2025-04-29 18:36:30 +02:00
telemetry/tracing: Add Zipkin tracing support (#723)
This commit is contained in:
parent
14c27974b9
commit
1f1e63a75b
7 changed files with 136 additions and 67 deletions
|
@ -212,6 +212,7 @@ func setupTracing(opt *config.Options) error {
|
|||
Debug: opt.TracingDebug,
|
||||
JaegerAgentEndpoint: opt.TracingJaegerAgentEndpoint,
|
||||
JaegerCollectorEndpoint: opt.TracingJaegerCollectorEndpoint,
|
||||
ZipkinEndpoint: opt.ZipkinEndpoint,
|
||||
}
|
||||
if err := trace.RegisterTracing(tracingOpts); err != nil {
|
||||
return err
|
||||
|
|
|
@ -182,7 +182,13 @@ type Options struct {
|
|||
TracingJaegerCollectorEndpoint string `mapstructure:"tracing_jaeger_collector_endpoint" yaml:"tracing_jaeger_collector_endpoint,omitempty"`
|
||||
// AgentEndpoint instructs exporter to send spans to jaeger-agent at this address.
|
||||
// For example, localhost:6831.
|
||||
|
||||
// Zipkin
|
||||
//
|
||||
// ZipkinEndpoint configures the zipkin collector URI
|
||||
// Example: http://zipkin:9411/api/v2/spans
|
||||
TracingJaegerAgentEndpoint string `mapstructure:"tracing_jaeger_agent_endpoint" yaml:"tracing_jaeger_agent_endpoint,omitempty"`
|
||||
ZipkinEndpoint string `mapstructure:"tracing_zipkin_endpoint" yaml:"tracing_zipkin_endpoint"`
|
||||
|
||||
// GRPC Service Settings
|
||||
|
||||
|
|
|
@ -384,62 +384,62 @@ Expose a prometheus format HTTP endpoint on the specified port. Disabled by defa
|
|||
|
||||
**Metrics tracked**
|
||||
|
||||
Name | Type | Description
|
||||
--------------------------------------------- | --------- | -----------------------------------------------------------------------
|
||||
boltdb_free_alloc_size_bytes | Gauge | Bytes allocated in free pages
|
||||
boltdb_free_page_n | Gauge | Number of free pages on the freelist
|
||||
boltdb_freelist_inuse_size_bytes | Gauge | Bytes used by the freelist
|
||||
boltdb_open_txn | Gauge | number of currently open read transactions
|
||||
boltdb_pending_page_n | Gauge | Number of pending pages on the freelist
|
||||
boltdb_txn | Gauge | total number of started read transactions
|
||||
boltdb_txn_cursor_total | Counter | Total number of cursors created
|
||||
boltdb_txn_node_deref_total | Counter | Total number of node dereferences
|
||||
boltdb_txn_node_total | Counter | Total number of node allocations
|
||||
boltdb_txn_page_alloc_size_bytes_total | Counter | Total bytes allocated
|
||||
boltdb_txn_page_total | Counter | Total number of page allocations
|
||||
boltdb_txn_rebalance_duration_ms_total | Counter | Total time spent rebalancing
|
||||
boltdb_txn_rebalance_total | Counter | Total number of node rebalances
|
||||
boltdb_txn_spill_duration_ms_total | Counter | Total time spent spilling
|
||||
boltdb_txn_spill_total | Counter | Total number of nodes spilled
|
||||
boltdb_txn_split_total | Counter | Total number of nodes split
|
||||
boltdb_txn_write_duration_ms_total | Counter | Total time spent writing to disk
|
||||
boltdb_txn_write_total | Counter | Total number of writes performed
|
||||
groupcache_cache_hits_total | Counter | Total cache hits in local or cluster cache
|
||||
groupcache_cache_hits_total | Counter | Total cache hits in local or cluster cache
|
||||
groupcache_gets_total | Counter | Total get request, including from peers
|
||||
groupcache_loads_deduped_total | Counter | gets without cache hits after duplicate suppression
|
||||
groupcache_loads_total | Counter | Total gets without cache hits
|
||||
groupcache_local_load_errs_total | Counter | Total local load errors
|
||||
groupcache_local_loads_total | Counter | Total good local loads
|
||||
groupcache_peer_errors_total | Counter | Total errors from peers
|
||||
groupcache_peer_loads_total | Counter | Total remote loads or cache hits without error
|
||||
groupcache_server_requests_total | Counter | Total gets from peers
|
||||
grpc_client_request_duration_ms | Histogram | GRPC client request duration by service
|
||||
grpc_client_request_size_bytes | Histogram | GRPC client request size by service
|
||||
grpc_client_requests_total | Counter | Total GRPC client requests made by service
|
||||
grpc_client_response_size_bytes | Histogram | GRPC client response size by service
|
||||
grpc_server_request_duration_ms | Histogram | GRPC server request duration by service
|
||||
grpc_server_request_size_bytes | Histogram | GRPC server request size by service
|
||||
grpc_server_requests_total | Counter | Total GRPC server requests made by service
|
||||
grpc_server_response_size_bytes | Histogram | GRPC server response size by service
|
||||
http_client_request_duration_ms | Histogram | HTTP client request duration by service
|
||||
http_client_request_size_bytes | Histogram | HTTP client request size by service
|
||||
http_client_requests_total | Counter | Total HTTP client requests made by service
|
||||
http_client_response_size_bytes | Histogram | HTTP client response size by service
|
||||
http_server_request_duration_ms | Histogram | HTTP server request duration by service
|
||||
http_server_request_size_bytes | Histogram | HTTP server request size by service
|
||||
http_server_requests_total | Counter | Total HTTP server requests handled by service
|
||||
http_server_response_size_bytes | Histogram | HTTP server response size by service
|
||||
pomerium_build_info | Gauge | Pomerium build metadata by git revision, service, version and goversion
|
||||
pomerium_config_checksum_int64 | Gauge | Currently loaded configuration checksum by service
|
||||
pomerium_config_last_reload_success | Gauge | Whether the last configuration reload succeeded by service
|
||||
pomerium_config_last_reload_success_timestamp | Gauge | The timestamp of the last successful configuration reload by service
|
||||
redis_conns | Gauge | Number of total connections in the pool
|
||||
redis_hits_total | Counter | Total number of times free connection was found in the pool
|
||||
redis_idle_conns | Gauge | Number of idle connections in the pool
|
||||
redis_misses_total | Counter | Total number of times free connection was NOT found in the pool
|
||||
redis_stale_conns_total | Counter | Total number of stale connections removed from the pool
|
||||
redis_timeouts_total | Counter | Total number of times a wait timeout occurred
|
||||
| Name | Type | Description |
|
||||
| --------------------------------------------- | --------- | ----------------------------------------------------------------------- |
|
||||
| boltdb_free_alloc_size_bytes | Gauge | Bytes allocated in free pages |
|
||||
| boltdb_free_page_n | Gauge | Number of free pages on the freelist |
|
||||
| boltdb_freelist_inuse_size_bytes | Gauge | Bytes used by the freelist |
|
||||
| boltdb_open_txn | Gauge | number of currently open read transactions |
|
||||
| boltdb_pending_page_n | Gauge | Number of pending pages on the freelist |
|
||||
| boltdb_txn | Gauge | total number of started read transactions |
|
||||
| boltdb_txn_cursor_total | Counter | Total number of cursors created |
|
||||
| boltdb_txn_node_deref_total | Counter | Total number of node dereferences |
|
||||
| boltdb_txn_node_total | Counter | Total number of node allocations |
|
||||
| boltdb_txn_page_alloc_size_bytes_total | Counter | Total bytes allocated |
|
||||
| boltdb_txn_page_total | Counter | Total number of page allocations |
|
||||
| boltdb_txn_rebalance_duration_ms_total | Counter | Total time spent rebalancing |
|
||||
| boltdb_txn_rebalance_total | Counter | Total number of node rebalances |
|
||||
| boltdb_txn_spill_duration_ms_total | Counter | Total time spent spilling |
|
||||
| boltdb_txn_spill_total | Counter | Total number of nodes spilled |
|
||||
| boltdb_txn_split_total | Counter | Total number of nodes split |
|
||||
| boltdb_txn_write_duration_ms_total | Counter | Total time spent writing to disk |
|
||||
| boltdb_txn_write_total | Counter | Total number of writes performed |
|
||||
| groupcache_cache_hits_total | Counter | Total cache hits in local or cluster cache |
|
||||
| groupcache_cache_hits_total | Counter | Total cache hits in local or cluster cache |
|
||||
| groupcache_gets_total | Counter | Total get request, including from peers |
|
||||
| groupcache_loads_deduped_total | Counter | gets without cache hits after duplicate suppression |
|
||||
| groupcache_loads_total | Counter | Total gets without cache hits |
|
||||
| groupcache_local_load_errs_total | Counter | Total local load errors |
|
||||
| groupcache_local_loads_total | Counter | Total good local loads |
|
||||
| groupcache_peer_errors_total | Counter | Total errors from peers |
|
||||
| groupcache_peer_loads_total | Counter | Total remote loads or cache hits without error |
|
||||
| groupcache_server_requests_total | Counter | Total gets from peers |
|
||||
| grpc_client_request_duration_ms | Histogram | GRPC client request duration by service |
|
||||
| grpc_client_request_size_bytes | Histogram | GRPC client request size by service |
|
||||
| grpc_client_requests_total | Counter | Total GRPC client requests made by service |
|
||||
| grpc_client_response_size_bytes | Histogram | GRPC client response size by service |
|
||||
| grpc_server_request_duration_ms | Histogram | GRPC server request duration by service |
|
||||
| grpc_server_request_size_bytes | Histogram | GRPC server request size by service |
|
||||
| grpc_server_requests_total | Counter | Total GRPC server requests made by service |
|
||||
| grpc_server_response_size_bytes | Histogram | GRPC server response size by service |
|
||||
| http_client_request_duration_ms | Histogram | HTTP client request duration by service |
|
||||
| http_client_request_size_bytes | Histogram | HTTP client request size by service |
|
||||
| http_client_requests_total | Counter | Total HTTP client requests made by service |
|
||||
| http_client_response_size_bytes | Histogram | HTTP client response size by service |
|
||||
| http_server_request_duration_ms | Histogram | HTTP server request duration by service |
|
||||
| http_server_request_size_bytes | Histogram | HTTP server request size by service |
|
||||
| http_server_requests_total | Counter | Total HTTP server requests handled by service |
|
||||
| http_server_response_size_bytes | Histogram | HTTP server response size by service |
|
||||
| pomerium_build_info | Gauge | Pomerium build metadata by git revision, service, version and goversion |
|
||||
| pomerium_config_checksum_int64 | Gauge | Currently loaded configuration checksum by service |
|
||||
| pomerium_config_last_reload_success | Gauge | Whether the last configuration reload succeeded by service |
|
||||
| pomerium_config_last_reload_success_timestamp | Gauge | The timestamp of the last successful configuration reload by service |
|
||||
| redis_conns | Gauge | Number of total connections in the pool |
|
||||
| redis_hits_total | Counter | Total number of times free connection was found in the pool |
|
||||
| redis_idle_conns | Gauge | Number of idle connections in the pool |
|
||||
| redis_misses_total | Counter | Total number of times free connection was NOT found in the pool |
|
||||
| redis_stale_conns_total | Counter | Total number of stale connections removed from the pool |
|
||||
| redis_timeouts_total | Counter | Total number of times a wait timeout occurred |
|
||||
|
||||
### Tracing
|
||||
|
||||
|
@ -449,12 +449,15 @@ Each unit work is called a Span in a trace. Spans include metadata about the wor
|
|||
|
||||
#### Shared Tracing Settings
|
||||
|
||||
Config Key | Description | Required
|
||||
:--------------- | :---------------------------------------------------------------- | --------
|
||||
tracing_provider | The name of the tracing provider. (e.g. jaeger) | ✅
|
||||
tracing_debug | Will disable [sampling](https://opencensus.io/tracing/sampling/). | ❌
|
||||
| Config Key | Description | Required |
|
||||
| :--------------- | :---------------------------------------------------------------- | -------- |
|
||||
| tracing_provider | The name of the tracing provider. (e.g. jaeger, zipkin) | ✅ |
|
||||
| tracing_debug | Will disable [sampling](https://opencensus.io/tracing/sampling/). | ❌ |
|
||||
|
||||
#### Jaeger
|
||||
#### Jaeger (partial)
|
||||
|
||||
**Warning** At this time, Jaeger protocol does not capture spans inside the proxy service. Please
|
||||
use Zipkin protocol with Jaeger for full support.
|
||||
|
||||
[Jaeger](https://www.jaegertracing.io/) is a distributed tracing system released as open source by Uber Technologies. It is used for monitoring and troubleshooting microservices-based distributed systems, including:
|
||||
|
||||
|
@ -464,10 +467,21 @@ tracing_debug | Will disable [sampling](https://opencensus.io/tracing/samplin
|
|||
- Service dependency analysis
|
||||
- Performance / latency optimization
|
||||
|
||||
Config Key | Description | Required
|
||||
:-------------------------------- | :------------------------------------------ | --------
|
||||
tracing_jaeger_collector_endpoint | Url to the Jaeger HTTP Thrift collector. | ✅
|
||||
tracing_jaeger_agent_endpoint | Send spans to jaeger-agent at this address. | ✅
|
||||
| Config Key | Description | Required |
|
||||
| :-------------------------------- | :------------------------------------------ | -------- |
|
||||
| tracing_jaeger_collector_endpoint | Url to the Jaeger HTTP Thrift collector. | ✅ |
|
||||
| tracing_jaeger_agent_endpoint | Send spans to jaeger-agent at this address. | ✅ |
|
||||
|
||||
#### Zipkin
|
||||
|
||||
Zipkin is an open source distributed tracing system and protocol.
|
||||
|
||||
Many tracing backends support zipkin either directly or through intermediary agents, including Jaeger. For full tracing support, we recommend using the Zipkin tracing protocol.
|
||||
|
||||
| Config Key | Description | Required |
|
||||
| :---------------------- | :------------------------------- | -------- |
|
||||
| tracing_zipkin_endpoint | Url to the Zipkin HTTP endpoint. | ✅ |
|
||||
|
||||
|
||||
#### Example
|
||||
|
||||
|
|
|
@ -5,6 +5,14 @@ description: >-
|
|||
for Pomerium. Please read it carefully.
|
||||
---
|
||||
|
||||
# Since 0.8.0
|
||||
|
||||
## Breaking
|
||||
|
||||
### Tracing
|
||||
|
||||
Jaeger tracing support is no longer end-to-end in the proxy service. We recommend updating to the Zipkin provider for proper tracing support. Jaeger will continue to work but will not have coverage in the data plane.
|
||||
|
||||
# Since 0.7.0
|
||||
|
||||
## Breaking
|
||||
|
|
2
go.mod
2
go.mod
|
@ -5,6 +5,7 @@ go 1.12
|
|||
require (
|
||||
contrib.go.opencensus.io/exporter/jaeger v0.2.0
|
||||
contrib.go.opencensus.io/exporter/prometheus v0.1.0
|
||||
contrib.go.opencensus.io/exporter/zipkin v0.1.1
|
||||
github.com/caddyserver/certmagic v0.10.12
|
||||
github.com/cespare/xxhash/v2 v2.1.1
|
||||
github.com/coreos/go-oidc v2.2.1+incompatible
|
||||
|
@ -28,6 +29,7 @@ require (
|
|||
github.com/onsi/gocleanup v0.0.0-20140331211545-c1a5478700b5
|
||||
github.com/onsi/gomega v1.8.1 // indirect
|
||||
github.com/open-policy-agent/opa v0.19.2
|
||||
github.com/openzipkin/zipkin-go v0.2.2
|
||||
github.com/pelletier/go-toml v1.6.0 // indirect
|
||||
github.com/pomerium/autocache v0.0.0-20200505053831-8c1cd659f055
|
||||
github.com/pomerium/csrf v1.6.2-0.20190918035251-f3318380bad3
|
||||
|
|
11
go.sum
11
go.sum
|
@ -31,6 +31,8 @@ contrib.go.opencensus.io/exporter/jaeger v0.2.0/go.mod h1:ukdzwIYYHgZ7QYtwVFQUji
|
|||
contrib.go.opencensus.io/exporter/ocagent v0.4.12/go.mod h1:450APlNTSR6FrvC3CTRqYosuDstRB9un7SOx2k/9ckA=
|
||||
contrib.go.opencensus.io/exporter/prometheus v0.1.0 h1:SByaIoWwNgMdPSgl5sMqM2KDE5H/ukPWBRo314xiDvg=
|
||||
contrib.go.opencensus.io/exporter/prometheus v0.1.0/go.mod h1:cGFniUXGZlKRjzOyuZJ6mgB+PgBcCIa79kEKR8YCW+A=
|
||||
contrib.go.opencensus.io/exporter/zipkin v0.1.1 h1:PR+1zWqY8ceXs1qDQQIlgXe+sdiwCf0n32bH4+Epk8g=
|
||||
contrib.go.opencensus.io/exporter/zipkin v0.1.1/go.mod h1:GMvdSl3eJ2gapOaLKzTKE3qDgUkJ86k9k3yY2eqwkzc=
|
||||
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
|
||||
github.com/Azure/azure-sdk-for-go v32.4.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc=
|
||||
github.com/Azure/go-autorest/autorest v0.1.0/go.mod h1:AKyIcETwSUFxIcs/Wnq/C+kwCtlEYGUVd7FPNb2slmg=
|
||||
|
@ -125,6 +127,7 @@ github.com/dnsimple/dnsimple-go v0.60.0/go.mod h1:O5TJ0/U6r7AfT8niYNlmohpLbCSG+c
|
|||
github.com/eapache/go-resiliency v1.1.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5mFgVsvEsIPBvNs=
|
||||
github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21/go.mod h1:+020luEh2TKB4/GOp8oxxtq0Daoen/Cii55CzbTV6DU=
|
||||
github.com/eapache/queue v1.1.0/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFPTqq+I=
|
||||
github.com/envoyproxy/go-control-plane v0.6.9/go.mod h1:SBwIajubJHhxtWwsL9s8ss4safvEdbitLhGGK48rN6g=
|
||||
github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
|
||||
github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
|
||||
github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98=
|
||||
|
@ -162,6 +165,7 @@ github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/me
|
|||
github.com/gobwas/glob v0.2.3 h1:A4xDbljILXROh+kObIiy5kIaPYD8e96x1tgBhUI5J+Y=
|
||||
github.com/gobwas/glob v0.2.3/go.mod h1:d3Ez4x06l9bZtSvzIay5+Yzi0fmZzPgnTbPcKjJAkT8=
|
||||
github.com/gofrs/uuid v3.2.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM=
|
||||
github.com/gogo/googleapis v1.1.0/go.mod h1:gf4bu3Q80BeJ6H1S1vYPm8/ELATdvryBaNFGgqEef3s=
|
||||
github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
|
||||
github.com/gogo/protobuf v1.2.0/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
|
||||
github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4=
|
||||
|
@ -321,6 +325,7 @@ github.com/linode/linodego v0.10.0/go.mod h1:cziNP7pbvE3mXIPneHj0oRY8L1WtGEIKlZ8
|
|||
github.com/liquidweb/liquidweb-go v1.6.0/go.mod h1:UDcVnAMDkZxpw4Y7NOHkqoeiGacVLEIG/i5J9cyixzQ=
|
||||
github.com/lithammer/shortuuid/v3 v3.0.4 h1:uj4xhotfY92Y1Oa6n6HUiFn87CdoEHYUlTy0+IgbLrs=
|
||||
github.com/lithammer/shortuuid/v3 v3.0.4/go.mod h1:RviRjexKqIzx/7r1peoAITm6m7gnif/h+0zmolKJjzw=
|
||||
github.com/lyft/protoc-gen-validate v0.0.13/go.mod h1:XbGvPuh87YZc5TdIa2/I4pLk0QoUACkjt2znoq26NVQ=
|
||||
github.com/magiconair/properties v1.8.1 h1:ZC2Vc7/ZFkGmsVC9KvOjumD+G5lXy2RtTKyzRKO2BQ4=
|
||||
github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ=
|
||||
github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU=
|
||||
|
@ -382,6 +387,8 @@ github.com/onsi/gomega v1.8.1/go.mod h1:Ho0h+IUsWyvy1OpqCwxlQ/21gkhVunqlU8fDGcoT
|
|||
github.com/open-policy-agent/opa v0.19.2 h1:H6Q56OHkBXr2TgX+qhlYWrM+H9lh6fKbg9IWVZWELwQ=
|
||||
github.com/open-policy-agent/opa v0.19.2/go.mod h1:rrwxoT/b011T0cyj+gg2VvxqTtn6N3gp/jzmr3fjW44=
|
||||
github.com/openzipkin/zipkin-go v0.1.6/go.mod h1:QgAqvLzwWbR/WpD4A3cGpPtJrZXNIiJc5AZX7/PBEpw=
|
||||
github.com/openzipkin/zipkin-go v0.2.2 h1:nY8Hti+WKaP0cRsSeQ026wU03QsM762XBeCXBb9NAWI=
|
||||
github.com/openzipkin/zipkin-go v0.2.2/go.mod h1:NaW6tEwdmWMaCDZzg8sh+IBNOxHMPnhQw8ySjnjRyN4=
|
||||
github.com/oracle/oci-go-sdk v7.0.0+incompatible/go.mod h1:VQb79nF8Z2cwLkLS35ukwStZIg5F66tcBccjip/j888=
|
||||
github.com/ovh/go-ovh v0.0.0-20181109152953-ba5adb4cf014/go.mod h1:joRatxRJaZBsY3JAOEMcoOp05CnZzsx4scTxi95DHyQ=
|
||||
github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=
|
||||
|
@ -391,12 +398,14 @@ github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/9
|
|||
github.com/pelletier/go-toml v1.6.0 h1:aetoXYr0Tv7xRU/V4B4IZJ2QcbtMUFoNb3ORp7TzIK4=
|
||||
github.com/pelletier/go-toml v1.6.0/go.mod h1:5N711Q9dKgbdkxHL+MEfF31hpT7l0S0s/t2kKREewys=
|
||||
github.com/peterh/liner v0.0.0-20170211195444-bf27d3ba8e1d/go.mod h1:xIteQHvHuaLYG9IFj6mSxM0fCKrs34IrEQUhOYuGPHc=
|
||||
github.com/pierrec/lz4 v1.0.2-0.20190131084431-473cd7ce01a1/go.mod h1:3/3N9NVKO0jef7pBehbT1qWhCMrIgbYNnFAZCqQ5LRc=
|
||||
github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY=
|
||||
github.com/pkg/errors v0.0.0-20181023235946-059132a15dd0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
|
||||
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||
github.com/pkg/profile v1.2.1/go.mod h1:hJw3o1OdXxsrSjjVksARp5W95eeEaEfptyVZyv6JUPA=
|
||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/pomerium/autocache v0.0.0-20200505053831-8c1cd659f055 h1:y73x4eEnZkCHdC46HG2h+ZAuNQUW1tu7hgvC7v+jI2o=
|
||||
|
@ -490,6 +499,7 @@ github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
|
|||
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
|
||||
github.com/spf13/viper v1.7.0 h1:xVKxvI7ouOI5I+U9s2eeiUfMaWBVoXA3AWskkrqK0VM=
|
||||
github.com/spf13/viper v1.7.0/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5qpdg=
|
||||
github.com/streadway/amqp v0.0.0-20190404075320-75d898a42a94/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw=
|
||||
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.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
||||
|
@ -769,6 +779,7 @@ google.golang.org/genproto v0.0.0-20200331122359-1ee6d9798940/go.mod h1:55QSHmfG
|
|||
google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs=
|
||||
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
|
||||
google.golang.org/grpc v1.19.1/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
|
||||
google.golang.org/grpc v1.20.0/go.mod h1:chYK+tFQF0nDUGJgXMSgLCQk3phJEuONr2DCgLDdAQM=
|
||||
google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38=
|
||||
google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM=
|
||||
google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg=
|
||||
|
|
|
@ -4,15 +4,20 @@ import (
|
|||
"context"
|
||||
"fmt"
|
||||
|
||||
"github.com/pomerium/pomerium/internal/log"
|
||||
|
||||
"contrib.go.opencensus.io/exporter/jaeger"
|
||||
ocZipkin "contrib.go.opencensus.io/exporter/zipkin"
|
||||
"github.com/openzipkin/zipkin-go"
|
||||
zipkinHTTP "github.com/openzipkin/zipkin-go/reporter/http"
|
||||
"go.opencensus.io/trace"
|
||||
|
||||
"github.com/pomerium/pomerium/internal/log"
|
||||
)
|
||||
|
||||
const (
|
||||
// JaegerTracingProviderName is the name of the tracing provider Jaeger.
|
||||
JaegerTracingProviderName = "jaeger"
|
||||
// ZipkinTracingProviderName is the name of the tracing provider Zipkin.
|
||||
ZipkinTracingProviderName = "zipkin"
|
||||
)
|
||||
|
||||
// TracingOptions contains the configurations settings for a http server.
|
||||
|
@ -30,6 +35,12 @@ type TracingOptions struct {
|
|||
// AgentEndpoint instructs exporter to send spans to jaeger-agent at this address.
|
||||
// For example, localhost:6831.
|
||||
JaegerAgentEndpoint string `mapstructure:"tracing_jaeger_agent_endpoint"`
|
||||
|
||||
// Zipkin
|
||||
|
||||
// ZipkinEndpoint configures the zipkin collector URI
|
||||
// Example: http://zipkin:9411/api/v2/spans
|
||||
ZipkinEndpoint string `mapstructure:"tracing_zipkin_endpoint"`
|
||||
}
|
||||
|
||||
// RegisterTracing creates a new trace exporter from TracingOptions.
|
||||
|
@ -38,6 +49,8 @@ func RegisterTracing(opts *TracingOptions) error {
|
|||
switch opts.Provider {
|
||||
case JaegerTracingProviderName:
|
||||
err = registerJaeger(opts)
|
||||
case ZipkinTracingProviderName:
|
||||
err = registerZipkin(opts)
|
||||
default:
|
||||
return fmt.Errorf("telemetry/trace: provider %s unknown", opts.Provider)
|
||||
}
|
||||
|
@ -66,6 +79,20 @@ func registerJaeger(opts *TracingOptions) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
func registerZipkin(opts *TracingOptions) error {
|
||||
localEndpoint, err := zipkin.NewEndpoint(opts.Service, "")
|
||||
if err != nil {
|
||||
return fmt.Errorf("telemetry/trace: could not create local endpoint: %w", err)
|
||||
}
|
||||
|
||||
reporter := zipkinHTTP.NewReporter(opts.ZipkinEndpoint)
|
||||
|
||||
exporter := ocZipkin.NewExporter(reporter, localEndpoint)
|
||||
trace.RegisterExporter(exporter)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// StartSpan starts a new child span of the current span in the context. If
|
||||
// there is no span in the context, creates a new trace and span.
|
||||
//
|
||||
|
|
Loading…
Add table
Reference in a new issue