Skip to content

Commit

Permalink
Metrics namespace change
Browse files Browse the repository at this point in the history
  • Loading branch information
herainman committed Oct 25, 2018
1 parent c662e77 commit c93c249
Show file tree
Hide file tree
Showing 146 changed files with 713 additions and 532 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Panics in endpoints are now caught (#458). HTTP endpoints return `502` status code with a body `"Unexpected workflow panic, recovered at endpoint."`. TChannel endpoints will return ErrCodeUnexpected.

### Changed
- **BREAKING** All [`metrics`](https://godoc.org/github.com/uber/zanzibar/runtime#call_metrics.go) counter and timer name has been changed and is using RootScope instead of AllHostScope and PerHostScope
- **BREAKING** Application packages must now export a global variable named `AppOptions` of type [`*zanzibar.Options`](https://godoc.org/github.com/uber/zanzibar/runtime#Options) to be located at package root (the package defined in `build.json`/`build.yaml`).
- Most built-in logs like `Finished an outgoing client HTTP request` now use the context logger.
- Added [`ContextExtractor`](https://godoc.org/github.com/uber/zanzibar/runtime#ContextExtractor) interface. It is part of the API for dfining "extractors" or functions to pull out dynamic fields like trace ID, request headers, etc. out of the context to be used in log fields and metric tags. These can be used to pull out fields that are application-specific without adding code to zanzibar.
Expand Down
8 changes: 4 additions & 4 deletions codegen/template_bundle/template_files.go

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

2 changes: 1 addition & 1 deletion codegen/templates/module_initializer.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func InitializeDependencies(
initializedDefaultDependencies := &zanzibar.DefaultDependencies{
Logger: g.Logger,
ContextLogger: g.ContextLogger,
Scope: g.AllHostScope,
Scope: g.RootScope,
Tracer: g.Tracer,
Config: g.Config,
Channel: g.Channel,
Expand Down
2 changes: 1 addition & 1 deletion codegen/templates/module_mock_initializer.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func InitializeDependenciesMock(
initializedDefaultDependencies := &zanzibar.DefaultDependencies{
ContextLogger: g.ContextLogger,
Logger: g.Logger,
Scope: g.AllHostScope,
Scope: g.RootScope,
Config: g.Config,
Channel: g.Channel,
Tracer: g.Tracer,
Expand Down
3 changes: 2 additions & 1 deletion codegen/test_data/clients/bar.gogen
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,11 @@ import (
"time"

"github.com/pkg/errors"
zanzibar "github.com/uber/zanzibar/runtime"

module "github.com/uber/zanzibar/.tmp_gen/clients/bar/module"
clientsBarBar "github.com/uber/zanzibar/examples/example-gateway/build/gen-code/clients/bar/bar"
clientsFooFoo "github.com/uber/zanzibar/examples/example-gateway/build/gen-code/clients/foo/foo"
zanzibar "github.com/uber/zanzibar/runtime"
)

// Client defines bar client interface.
Expand Down
8 changes: 5 additions & 3 deletions codegen/test_data/endpoints/bar_bar_method_argnotstruct.gogen
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,14 @@ import (

"github.com/opentracing/opentracing-go"
"github.com/pkg/errors"
module "github.com/uber/zanzibar/.tmp_gen/endpoints/bar/module"
workflow "github.com/uber/zanzibar/.tmp_gen/endpoints/bar/workflow"
endpointsBarBar "github.com/uber/zanzibar/examples/example-gateway/build/gen-code/endpoints/bar/bar"
zanzibar "github.com/uber/zanzibar/runtime"
"go.uber.org/zap"
"go.uber.org/zap/zapcore"

workflow "github.com/uber/zanzibar/.tmp_gen/endpoints/bar/workflow"
endpointsBarBar "github.com/uber/zanzibar/examples/example-gateway/build/gen-code/endpoints/bar/bar"

module "github.com/uber/zanzibar/.tmp_gen/endpoints/bar/module"
)

// BarArgNotStructHandler is the handler for "/bar/arg-not-struct-path"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,15 @@ import (

"github.com/opentracing/opentracing-go"
"github.com/pkg/errors"
module "github.com/uber/zanzibar/.tmp_gen/endpoints/bar/module"
workflow "github.com/uber/zanzibar/.tmp_gen/endpoints/bar/workflow"
endpointsBarBar "github.com/uber/zanzibar/examples/example-gateway/build/gen-code/endpoints/bar/bar"
zanzibar "github.com/uber/zanzibar/runtime"
"go.uber.org/thriftrw/ptr"
"go.uber.org/zap"
"go.uber.org/zap/zapcore"

workflow "github.com/uber/zanzibar/.tmp_gen/endpoints/bar/workflow"
endpointsBarBar "github.com/uber/zanzibar/examples/example-gateway/build/gen-code/endpoints/bar/bar"

module "github.com/uber/zanzibar/.tmp_gen/endpoints/bar/module"
)

// BarArgWithHeadersHandler is the handler for "/bar/argWithHeaders"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,15 @@ import (

"github.com/opentracing/opentracing-go"
"github.com/pkg/errors"
module "github.com/uber/zanzibar/.tmp_gen/endpoints/bar/module"
workflow "github.com/uber/zanzibar/.tmp_gen/endpoints/bar/workflow"
endpointsBarBar "github.com/uber/zanzibar/examples/example-gateway/build/gen-code/endpoints/bar/bar"
zanzibar "github.com/uber/zanzibar/runtime"
"go.uber.org/thriftrw/ptr"
"go.uber.org/zap"
"go.uber.org/zap/zapcore"

workflow "github.com/uber/zanzibar/.tmp_gen/endpoints/bar/workflow"
endpointsBarBar "github.com/uber/zanzibar/examples/example-gateway/build/gen-code/endpoints/bar/bar"

module "github.com/uber/zanzibar/.tmp_gen/endpoints/bar/module"
)

// BarArgWithManyQueryParamsHandler is the handler for "/bar/argWithManyQueryParams"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,15 @@ import (

"github.com/opentracing/opentracing-go"
"github.com/pkg/errors"
module "github.com/uber/zanzibar/.tmp_gen/endpoints/bar/module"
workflow "github.com/uber/zanzibar/.tmp_gen/endpoints/bar/workflow"
endpointsBarBar "github.com/uber/zanzibar/examples/example-gateway/build/gen-code/endpoints/bar/bar"
zanzibar "github.com/uber/zanzibar/runtime"
"go.uber.org/thriftrw/ptr"
"go.uber.org/zap"
"go.uber.org/zap/zapcore"

workflow "github.com/uber/zanzibar/.tmp_gen/endpoints/bar/workflow"
endpointsBarBar "github.com/uber/zanzibar/examples/example-gateway/build/gen-code/endpoints/bar/bar"

module "github.com/uber/zanzibar/.tmp_gen/endpoints/bar/module"
)

// BarArgWithNestedQueryParamsHandler is the handler for "/bar/argWithNestedQueryParams"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,14 @@ import (

"github.com/opentracing/opentracing-go"
"github.com/pkg/errors"
module "github.com/uber/zanzibar/.tmp_gen/endpoints/bar/module"
workflow "github.com/uber/zanzibar/.tmp_gen/endpoints/bar/workflow"
endpointsBarBar "github.com/uber/zanzibar/examples/example-gateway/build/gen-code/endpoints/bar/bar"
zanzibar "github.com/uber/zanzibar/runtime"
"go.uber.org/zap"
"go.uber.org/zap/zapcore"

workflow "github.com/uber/zanzibar/.tmp_gen/endpoints/bar/workflow"
endpointsBarBar "github.com/uber/zanzibar/examples/example-gateway/build/gen-code/endpoints/bar/bar"

module "github.com/uber/zanzibar/.tmp_gen/endpoints/bar/module"
)

// BarArgWithParamsHandler is the handler for "/bar/argWithParams/:uuid/segment/:user-uuid"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,15 @@ import (

"github.com/opentracing/opentracing-go"
"github.com/pkg/errors"
module "github.com/uber/zanzibar/.tmp_gen/endpoints/bar/module"
workflow "github.com/uber/zanzibar/.tmp_gen/endpoints/bar/workflow"
endpointsBarBar "github.com/uber/zanzibar/examples/example-gateway/build/gen-code/endpoints/bar/bar"
zanzibar "github.com/uber/zanzibar/runtime"
"go.uber.org/thriftrw/ptr"
"go.uber.org/zap"
"go.uber.org/zap/zapcore"

workflow "github.com/uber/zanzibar/.tmp_gen/endpoints/bar/workflow"
endpointsBarBar "github.com/uber/zanzibar/examples/example-gateway/build/gen-code/endpoints/bar/bar"

module "github.com/uber/zanzibar/.tmp_gen/endpoints/bar/module"
)

// BarArgWithQueryHeaderHandler is the handler for "/bar/argWithQueryHeader"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,15 @@ import (

"github.com/opentracing/opentracing-go"
"github.com/pkg/errors"
module "github.com/uber/zanzibar/.tmp_gen/endpoints/bar/module"
workflow "github.com/uber/zanzibar/.tmp_gen/endpoints/bar/workflow"
endpointsBarBar "github.com/uber/zanzibar/examples/example-gateway/build/gen-code/endpoints/bar/bar"
zanzibar "github.com/uber/zanzibar/runtime"
"go.uber.org/thriftrw/ptr"
"go.uber.org/zap"
"go.uber.org/zap/zapcore"

workflow "github.com/uber/zanzibar/.tmp_gen/endpoints/bar/workflow"
endpointsBarBar "github.com/uber/zanzibar/examples/example-gateway/build/gen-code/endpoints/bar/bar"

module "github.com/uber/zanzibar/.tmp_gen/endpoints/bar/module"
)

// BarArgWithQueryParamsHandler is the handler for "/bar/argWithQueryParams"
Expand Down
8 changes: 5 additions & 3 deletions codegen/test_data/endpoints/bar_bar_method_helloworld.gogen
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,14 @@ import (

"github.com/opentracing/opentracing-go"
"github.com/pkg/errors"
module "github.com/uber/zanzibar/.tmp_gen/endpoints/bar/module"
workflow "github.com/uber/zanzibar/.tmp_gen/endpoints/bar/workflow"
endpointsBarBar "github.com/uber/zanzibar/examples/example-gateway/build/gen-code/endpoints/bar/bar"
zanzibar "github.com/uber/zanzibar/runtime"
"go.uber.org/zap"
"go.uber.org/zap/zapcore"

workflow "github.com/uber/zanzibar/.tmp_gen/endpoints/bar/workflow"
endpointsBarBar "github.com/uber/zanzibar/examples/example-gateway/build/gen-code/endpoints/bar/bar"

module "github.com/uber/zanzibar/.tmp_gen/endpoints/bar/module"
)

// BarHelloWorldHandler is the handler for "/bar/hello"
Expand Down
8 changes: 5 additions & 3 deletions codegen/test_data/endpoints/bar_bar_method_missingarg.gogen
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,14 @@ import (

"github.com/opentracing/opentracing-go"
"github.com/pkg/errors"
module "github.com/uber/zanzibar/.tmp_gen/endpoints/bar/module"
workflow "github.com/uber/zanzibar/.tmp_gen/endpoints/bar/workflow"
endpointsBarBar "github.com/uber/zanzibar/examples/example-gateway/build/gen-code/endpoints/bar/bar"
zanzibar "github.com/uber/zanzibar/runtime"
"go.uber.org/zap"
"go.uber.org/zap/zapcore"

workflow "github.com/uber/zanzibar/.tmp_gen/endpoints/bar/workflow"
endpointsBarBar "github.com/uber/zanzibar/examples/example-gateway/build/gen-code/endpoints/bar/bar"

module "github.com/uber/zanzibar/.tmp_gen/endpoints/bar/module"
)

// BarMissingArgHandler is the handler for "/bar/missing-arg-path"
Expand Down
8 changes: 5 additions & 3 deletions codegen/test_data/endpoints/bar_bar_method_norequest.gogen
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,14 @@ import (

"github.com/opentracing/opentracing-go"
"github.com/pkg/errors"
module "github.com/uber/zanzibar/.tmp_gen/endpoints/bar/module"
workflow "github.com/uber/zanzibar/.tmp_gen/endpoints/bar/workflow"
endpointsBarBar "github.com/uber/zanzibar/examples/example-gateway/build/gen-code/endpoints/bar/bar"
zanzibar "github.com/uber/zanzibar/runtime"
"go.uber.org/zap"
"go.uber.org/zap/zapcore"

workflow "github.com/uber/zanzibar/.tmp_gen/endpoints/bar/workflow"
endpointsBarBar "github.com/uber/zanzibar/examples/example-gateway/build/gen-code/endpoints/bar/bar"

module "github.com/uber/zanzibar/.tmp_gen/endpoints/bar/module"
)

// BarNoRequestHandler is the handler for "/bar/no-request-path"
Expand Down
11 changes: 7 additions & 4 deletions codegen/test_data/endpoints/bar_bar_method_normal.gogen
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,16 @@ import (

"github.com/opentracing/opentracing-go"
"github.com/pkg/errors"
module "github.com/uber/zanzibar/.tmp_gen/endpoints/bar/module"
workflow "github.com/uber/zanzibar/.tmp_gen/endpoints/bar/workflow"
endpointsBarBar "github.com/uber/zanzibar/examples/example-gateway/build/gen-code/endpoints/bar/bar"
"github.com/uber/zanzibar/examples/example-gateway/middlewares/example"
zanzibar "github.com/uber/zanzibar/runtime"
"go.uber.org/zap"
"go.uber.org/zap/zapcore"

workflow "github.com/uber/zanzibar/.tmp_gen/endpoints/bar/workflow"
endpointsBarBar "github.com/uber/zanzibar/examples/example-gateway/build/gen-code/endpoints/bar/bar"

"github.com/uber/zanzibar/examples/example-gateway/middlewares/example"

module "github.com/uber/zanzibar/.tmp_gen/endpoints/bar/module"
)

// BarNormalHandler is the handler for "/bar/bar-path"
Expand Down
10 changes: 6 additions & 4 deletions codegen/test_data/endpoints/bar_bar_method_toomanyargs.gogen
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,15 @@ import (

"github.com/opentracing/opentracing-go"
"github.com/pkg/errors"
module "github.com/uber/zanzibar/.tmp_gen/endpoints/bar/module"
workflow "github.com/uber/zanzibar/.tmp_gen/endpoints/bar/workflow"
endpointsBarBar "github.com/uber/zanzibar/examples/example-gateway/build/gen-code/endpoints/bar/bar"
endpointsFooFoo "github.com/uber/zanzibar/examples/example-gateway/build/gen-code/endpoints/foo/foo"
zanzibar "github.com/uber/zanzibar/runtime"
"go.uber.org/zap"
"go.uber.org/zap/zapcore"

workflow "github.com/uber/zanzibar/.tmp_gen/endpoints/bar/workflow"
endpointsBarBar "github.com/uber/zanzibar/examples/example-gateway/build/gen-code/endpoints/bar/bar"
endpointsFooFoo "github.com/uber/zanzibar/examples/example-gateway/build/gen-code/endpoints/foo/foo"

module "github.com/uber/zanzibar/.tmp_gen/endpoints/bar/module"
)

// BarTooManyArgsHandler is the handler for "/bar/too-many-args-path"
Expand Down
3 changes: 2 additions & 1 deletion examples/example-gateway/build/clients/bar/bar.go

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

6 changes: 4 additions & 2 deletions examples/example-gateway/build/clients/baz/baz.go

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

5 changes: 3 additions & 2 deletions examples/example-gateway/build/clients/baz/baz_test_server.go

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

3 changes: 2 additions & 1 deletion examples/example-gateway/build/clients/contacts/contacts.go

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

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

6 changes: 4 additions & 2 deletions examples/example-gateway/build/clients/corge/corge.go

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

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

Loading

0 comments on commit c93c249

Please sign in to comment.