Skip to content

Commit

Permalink
Merge branch 'master' into update-cassandra-configs
Browse files Browse the repository at this point in the history
  • Loading branch information
vprithvi authored Jan 17, 2019
2 parents edb6775 + 7cbb25d commit 646b09d
Show file tree
Hide file tree
Showing 81 changed files with 526 additions and 293 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,16 @@ Changes by Version

##### Breaking Changes

- Update to jaeger-lib 2 and latest sha for jaeger-client-go, to pick up refactored metric names ([#1282](https://github.com/jaegertracing/jaeger/pull/1282), [@objectiser](https://github.com/objectiser))

Update to latest version of `jaeger-lib`, which includes a change to the naming of counters exported to
prometheus, to follow the convention of using a `_total` suffix, e.g. `jaeger_query_requests` is now
`jaeger_query_requests_total`.

Jaeger go client metrics, previously under the namespace `jaeger_client_jaeger_` are now under
`jaeger_tracer_`.


- Add gRPC metrics to agent ([#1180](https://github.com/jaegertracing/jaeger/pull/1180), [@pavolloffay](https://github.com/pavolloffay))

The following metrics:
Expand Down
20 changes: 9 additions & 11 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions Gopkg.toml
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,11 @@ required = [

[[constraint]]
name = "github.com/uber/jaeger-client-go"
version = "^2.15.0"
revision = "6733ee486c780528f2c8088305e16fdb685134c7"

[[constraint]]
name = "github.com/uber/jaeger-lib"
version = "^1.5.0"
version = "^2.0.0"

[[constraint]]
name = "github.com/uber/tchannel-go"
Expand All @@ -105,7 +105,7 @@ required = [

[[constraint]]
name = "github.com/gocql/gocql"
branch = "master"
revision = "181004e14a3fb735efcc826a4256369d0c96747b"

[[constraint]]
name = "github.com/gogo/googleapis"
Expand Down
5 changes: 2 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ ALL_SRC := $(shell find . -name '*.go' \
-type f | \
sort)

# ALL_PKGS is used with 'go cover'
# ALL_PKGS is used with 'go cover' and 'golint'
ALL_PKGS := $(shell go list $(sort $(dir $(ALL_SRC))))

RACE=-race
Expand Down Expand Up @@ -53,7 +53,6 @@ SWAGGER_GEN_DIR=swagger-gen

COLOR_PASS=$(shell printf "\033[32mPASS\033[0m")
COLOR_FAIL=$(shell printf "\033[31mFAIL\033[0m")
COLOR_FIXME=$(shell printf "\033[31mFIXME\033[0m")
COLORIZE=$(SED) ''/PASS/s//$(COLOR_PASS)/'' | $(SED) ''/FAIL/s//$(COLOR_FAIL)/''
DOCKER_NAMESPACE?=jaegertracing
DOCKER_TAG?=latest
Expand Down Expand Up @@ -110,7 +109,7 @@ cover: nocover
.PHONY: nocover
nocover:
@echo Verifying that all packages have test files to count in coverage
@scripts/check-test-files.sh $(subst github.com/jaegertracing/jaeger/,./,$(ALL_PKGS)) | $(SED) ''/FIXME/s//$(COLOR_FIXME)/''
@scripts/check-test-files.sh $(subst github.com/jaegertracing/jaeger/,./,$(ALL_PKGS))

.PHONY: fmt
fmt:
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<img align="right" width="290" height="290" src="http://jaeger.readthedocs.io/en/latest/images/jaeger-vector.svg">

[![Build Status][ci-img]][ci] [![Coverage Status][cov-img]][cov] [![Gitter chat][gitter-img]][gitter] [![OpenTracing-1.0][ot-badge]](http://opentracing.io) [![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fjaegertracing%2Fjaeger.svg?type=shield)](https://app.fossa.io/projects/git%2Bgithub.com%2Fjaegertracing%2Fjaeger?ref=badge_shield) [![CII Best Practices](https://bestpractices.coreinfrastructure.org/projects/1273/badge)](https://bestpractices.coreinfrastructure.org/projects/1273)
[![Build Status][ci-img]][ci] [![Coverage Status][cov-img]][cov] [![Gitter chat][gitter-img]][gitter] [![OpenTracing-1.0][ot-badge]](http://opentracing.io) [![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fjaegertracing%2Fjaeger.svg?type=shield)](https://app.fossa.io/projects/git%2Bgithub.com%2Fjaegertracing%2Fjaeger?ref=badge_shield) [![CII Best Practices](https://bestpractices.coreinfrastructure.org/projects/1273/badge)](https://bestpractices.coreinfrastructure.org/projects/1273) [![Project+Community stats][community-badge]][community-stats]

# Jaeger - a Distributed Tracing System

Expand Down Expand Up @@ -160,6 +160,8 @@ If you would like to add your organization to the list, please comment on our
[dapper]: https://research.google.com/pubs/pub36356.html
[ubeross]: http://uber.github.io
[ot-badge]: https://img.shields.io/badge/OpenTracing--1.x-inside-blue.svg
[community-badge]: https://img.shields.io/badge/Project+Community-stats-blue.svg
[community-stats]: https://all.devstats.cncf.io/d/54/project-health?orgId=1&var-repogroup_name=Jaeger
[hotrod-tutorial]: https://medium.com/@YuriShkuro/take-opentracing-for-a-hotrod-ride-f6e3141f7941
[gitter]: https://gitter.im/jaegertracing/Lobby
[gitter-img]: http://img.shields.io/badge/gitter-join%20chat%20%E2%86%92-brightgreen.svg
Expand Down
4 changes: 2 additions & 2 deletions cmd/agent/app/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,10 +141,10 @@ func (b *Builder) getProcessors(rep reporter.Reporter, mFactory metrics.Factory,
default:
return nil, fmt.Errorf("cannot find agent processor for data model %v", cfg.Model)
}
metrics := mFactory.Namespace("", map[string]string{
metrics := mFactory.Namespace(metrics.NSOptions{Name: "", Tags: map[string]string{
"protocol": string(cfg.Protocol),
"model": string(cfg.Model),
})
}})
processor, err := cfg.GetThriftProcessor(metrics, protoFactory, handler, logger)
if err != nil {
return nil, err
Expand Down
13 changes: 6 additions & 7 deletions cmd/agent/app/configmanager/metrics_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ import (

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/uber/jaeger-lib/metrics"
mTestutils "github.com/uber/jaeger-lib/metrics/testutils"
"github.com/uber/jaeger-lib/metrics/metricstest"

"github.com/jaegertracing/jaeger/thrift-gen/baggage"
"github.com/jaegertracing/jaeger/thrift-gen/sampling"
Expand All @@ -46,16 +45,16 @@ func (noopManager) GetBaggageRestrictions(s string) ([]*baggage.BaggageRestricti

func TestMetrics(t *testing.T) {
tests := []struct {
expected []mTestutils.ExpectedMetric
expected []metricstest.ExpectedMetric
err error
}{
{expected: []mTestutils.ExpectedMetric{
{expected: []metricstest.ExpectedMetric{
{Name: "collector-proxy", Tags: map[string]string{"result": "ok", "endpoint": "sampling"}, Value: 1},
{Name: "collector-proxy", Tags: map[string]string{"result": "err", "endpoint": "sampling"}, Value: 0},
{Name: "collector-proxy", Tags: map[string]string{"result": "ok", "endpoint": "baggage"}, Value: 1},
{Name: "collector-proxy", Tags: map[string]string{"result": "err", "endpoint": "baggage"}, Value: 0},
}},
{expected: []mTestutils.ExpectedMetric{
{expected: []metricstest.ExpectedMetric{
{Name: "collector-proxy", Tags: map[string]string{"result": "ok", "endpoint": "sampling"}, Value: 0},
{Name: "collector-proxy", Tags: map[string]string{"result": "err", "endpoint": "sampling"}, Value: 1},
{Name: "collector-proxy", Tags: map[string]string{"result": "ok", "endpoint": "baggage"}, Value: 0},
Expand All @@ -64,7 +63,7 @@ func TestMetrics(t *testing.T) {
}

for _, test := range tests {
metricsFactory := metrics.NewLocalFactory(time.Microsecond)
metricsFactory := metricstest.NewFactory(time.Microsecond)
mgr := WrapWithMetrics(&noopManager{}, metricsFactory)

if test.err != nil {
Expand All @@ -82,6 +81,6 @@ func TestMetrics(t *testing.T) {
require.NoError(t, err)
require.NotNil(t, b)
}
mTestutils.AssertCounterMetrics(t, metricsFactory, test.expected...)
metricsFactory.AssertCounterMetrics(t, test.expected...)
}
}
34 changes: 16 additions & 18 deletions cmd/agent/app/httpserver/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,15 @@ import (

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/uber/jaeger-lib/metrics"
"github.com/uber/jaeger-lib/metrics/testutils"
mTestutils "github.com/uber/jaeger-lib/metrics/testutils"
"github.com/uber/jaeger-lib/metrics/metricstest"

tSampling092 "github.com/jaegertracing/jaeger/cmd/agent/app/httpserver/thrift-0.9.2"
"github.com/jaegertracing/jaeger/thrift-gen/baggage"
"github.com/jaegertracing/jaeger/thrift-gen/sampling"
)

type testServer struct {
metricsFactory *metrics.LocalFactory
metricsFactory *metricstest.Factory
mgr *mockManager
server *httptest.Server
}
Expand All @@ -45,7 +43,7 @@ func withServer(
mockBaggageResponse []*baggage.BaggageRestriction,
runTest func(server *testServer),
) {
metricsFactory := metrics.NewLocalFactory(0)
metricsFactory := metricstest.NewFactory(0)
mgr := &mockManager{
samplingResponse: mockSamplingResponse,
baggageResponse: mockBaggageResponse,
Expand Down Expand Up @@ -100,7 +98,7 @@ func TestHTTPHandler(t *testing.T) {
})

// handler must emit metrics
testutils.AssertCounterMetrics(t, ts.metricsFactory, []testutils.ExpectedMetric{
ts.metricsFactory.AssertCounterMetrics(t, []metricstest.ExpectedMetric{
{Name: "http-server.requests", Tags: map[string]string{"type": "sampling"}, Value: 1},
{Name: "http-server.requests", Tags: map[string]string{"type": "sampling-legacy"}, Value: 1},
{Name: "http-server.requests", Tags: map[string]string{"type": "baggage"}, Value: 1},
Expand All @@ -116,14 +114,14 @@ func TestHTTPHandlerErrors(t *testing.T) {
url string
statusCode int
body string
metrics []mTestutils.ExpectedMetric
metrics []metricstest.ExpectedMetric
}{
{
description: "no service name",
url: "",
statusCode: http.StatusBadRequest,
body: "'service' parameter must be provided once\n",
metrics: []mTestutils.ExpectedMetric{
metrics: []metricstest.ExpectedMetric{
{Name: "http-server.errors", Tags: map[string]string{"source": "all", "status": "4xx"}, Value: 1},
},
},
Expand All @@ -132,7 +130,7 @@ func TestHTTPHandlerErrors(t *testing.T) {
url: "?service=Y&service=Y",
statusCode: http.StatusBadRequest,
body: "'service' parameter must be provided once\n",
metrics: []mTestutils.ExpectedMetric{
metrics: []metricstest.ExpectedMetric{
{Name: "http-server.errors", Tags: map[string]string{"source": "all", "status": "4xx"}, Value: 1},
},
},
Expand All @@ -141,7 +139,7 @@ func TestHTTPHandlerErrors(t *testing.T) {
url: "/baggageRestrictions?service=Y&service=Y",
statusCode: http.StatusBadRequest,
body: "'service' parameter must be provided once\n",
metrics: []mTestutils.ExpectedMetric{
metrics: []metricstest.ExpectedMetric{
{Name: "http-server.errors", Tags: map[string]string{"source": "all", "status": "4xx"}, Value: 1},
},
},
Expand All @@ -150,7 +148,7 @@ func TestHTTPHandlerErrors(t *testing.T) {
url: "?service=Y",
statusCode: http.StatusInternalServerError,
body: "collector error: no mock response provided\n",
metrics: []mTestutils.ExpectedMetric{
metrics: []metricstest.ExpectedMetric{
{Name: "http-server.errors", Tags: map[string]string{"source": "collector-proxy", "status": "5xx"}, Value: 1},
},
},
Expand All @@ -159,7 +157,7 @@ func TestHTTPHandlerErrors(t *testing.T) {
url: "/baggageRestrictions?service=Y",
statusCode: http.StatusInternalServerError,
body: "collector error: no mock response provided\n",
metrics: []mTestutils.ExpectedMetric{
metrics: []metricstest.ExpectedMetric{
{Name: "http-server.errors", Tags: map[string]string{"source": "collector-proxy", "status": "5xx"}, Value: 1},
},
},
Expand All @@ -169,7 +167,7 @@ func TestHTTPHandlerErrors(t *testing.T) {
url: "?service=Y",
statusCode: http.StatusInternalServerError,
body: "Cannot marshall Thrift to JSON\n",
metrics: []mTestutils.ExpectedMetric{
metrics: []metricstest.ExpectedMetric{
{Name: "http-server.errors", Tags: map[string]string{"source": "thrift", "status": "5xx"}, Value: 1},
},
},
Expand All @@ -188,7 +186,7 @@ func TestHTTPHandlerErrors(t *testing.T) {
}

if len(testCase.metrics) > 0 {
mTestutils.AssertCounterMetrics(t, ts.metricsFactory, testCase.metrics...)
ts.metricsFactory.AssertCounterMetrics(t, testCase.metrics...)
}
})
})
Expand All @@ -202,14 +200,14 @@ func TestHTTPHandlerErrors(t *testing.T) {
w := &mockWriter{header: make(http.Header)}
handler.serveSamplingHTTP(w, req, false)

mTestutils.AssertCounterMetrics(t, ts.metricsFactory,
mTestutils.ExpectedMetric{Name: "http-server.errors", Tags: map[string]string{"source": "write", "status": "5xx"}, Value: 1})
ts.metricsFactory.AssertCounterMetrics(t,
metricstest.ExpectedMetric{Name: "http-server.errors", Tags: map[string]string{"source": "write", "status": "5xx"}, Value: 1})

req = httptest.NewRequest("GET", "http://localhost:80/baggageRestrictions?service=X", nil)
handler.serveBaggageHTTP(w, req)

mTestutils.AssertCounterMetrics(t, ts.metricsFactory,
mTestutils.ExpectedMetric{Name: "http-server.errors", Tags: map[string]string{"source": "write", "status": "5xx"}, Value: 2})
ts.metricsFactory.AssertCounterMetrics(t,
metricstest.ExpectedMetric{Name: "http-server.errors", Tags: map[string]string{"source": "write", "status": "5xx"}, Value: 2})
})
})
}
Expand Down
Loading

0 comments on commit 646b09d

Please sign in to comment.