Skip to content

Commit

Permalink
Merge a89637d into 2f9c950
Browse files Browse the repository at this point in the history
  • Loading branch information
herainman committed Oct 26, 2018
2 parents 2f9c950 + a89637d commit 42f8adf
Show file tree
Hide file tree
Showing 71 changed files with 233 additions and 250 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed
- **BREAKING** Use [`ContextMerics`](https://godoc.org/github.com/uber/zanzibar/runtime#ContextMerics) instead of tally.Scope at [`NewRouterEndpoint`](https://godoc.org/github.com/uber/zanzibar/runtime#NewRouterEndpointContext), [`NewHTTPClient`](https://godoc.org/github.com/uber/zanzibar/runtime#NewHTTPClient), [`NewTChannelClient`](https://godoc.org/github.com/uber/zanzibar/runtime#NewTChannelClient)
- **BREAKING** Use [`ContextMerics`](https://godoc.org/github.com/uber/zanzibar/runtime#ContextMerics) to emit metrics instead of metrics from call_metrics.go.
- **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
18 changes: 9 additions & 9 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/endpoint.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ func (h *{{$handlerName}}) HandleRequest(
zap.String("stacktrace", stacktrace),
zap.String("endpoint", h.endpoint.EndpointName))

h.endpoint.ContextMetrics.IncCounter(ctx, zanzibar.InboundCallsPanic, 1)
h.endpoint.ContextMetrics.IncCounter(ctx, zanzibar.EndpointPanics, 1)
res.SendError(502, "Unexpected workflow panic, recovered at endpoint.", nil)
}
}()
Expand Down
4 changes: 2 additions & 2 deletions codegen/templates/module_initializer.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ func InitializeDependencies(
Logger: g.Logger,
ContextExtractor: g.ContextExtractor,
ContextLogger: g.ContextLogger,
ContextMetrics: zanzibar.NewContextMetrics(g.AllHostScope),
Scope: g.AllHostScope,
ContextMetrics: zanzibar.NewContextMetrics(g.RootScope),
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 @@ -57,7 +57,7 @@ func InitializeDependenciesMock(
ContextMetrics: g.ContextMetrics,
ContextLogger: g.ContextLogger,
Logger: g.Logger,
Scope: g.AllHostScope,
Scope: g.RootScope,
Config: g.Config,
Channel: g.Channel,
Tracer: g.Tracer,
Expand Down
2 changes: 1 addition & 1 deletion codegen/templates/tchannel_endpoint.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ func (h *{{$handlerName}}) Handle(
zap.String("stacktrace", stacktrace),
zap.String("endpoint", h.endpoint.EndpointID))

h.endpoint.ContextMetrics.IncCounter(ctx, zanzibar.InboundCallsPanic, 1)
h.endpoint.ContextMetrics.IncCounter(ctx, zanzibar.EndpointPanics, 1)
isSuccessful = false
response = nil
headers = nil
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ func (h *BarArgNotStructHandler) HandleRequest(
zap.String("stacktrace", stacktrace),
zap.String("endpoint", h.endpoint.EndpointName))

h.endpoint.ContextMetrics.IncCounter(ctx, zanzibar.InboundCallsPanic, 1)
h.endpoint.ContextMetrics.IncCounter(ctx, zanzibar.EndpointPanics, 1)
res.SendError(502, "Unexpected workflow panic, recovered at endpoint.", nil)
}
}()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ func (h *BarArgWithHeadersHandler) HandleRequest(
zap.String("stacktrace", stacktrace),
zap.String("endpoint", h.endpoint.EndpointName))

h.endpoint.ContextMetrics.IncCounter(ctx, zanzibar.InboundCallsPanic, 1)
h.endpoint.ContextMetrics.IncCounter(ctx, zanzibar.EndpointPanics, 1)
res.SendError(502, "Unexpected workflow panic, recovered at endpoint.", nil)
}
}()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ func (h *BarArgWithManyQueryParamsHandler) HandleRequest(
zap.String("stacktrace", stacktrace),
zap.String("endpoint", h.endpoint.EndpointName))

h.endpoint.ContextMetrics.IncCounter(ctx, zanzibar.InboundCallsPanic, 1)
h.endpoint.ContextMetrics.IncCounter(ctx, zanzibar.EndpointPanics, 1)
res.SendError(502, "Unexpected workflow panic, recovered at endpoint.", nil)
}
}()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ func (h *BarArgWithNestedQueryParamsHandler) HandleRequest(
zap.String("stacktrace", stacktrace),
zap.String("endpoint", h.endpoint.EndpointName))

h.endpoint.ContextMetrics.IncCounter(ctx, zanzibar.InboundCallsPanic, 1)
h.endpoint.ContextMetrics.IncCounter(ctx, zanzibar.EndpointPanics, 1)
res.SendError(502, "Unexpected workflow panic, recovered at endpoint.", nil)
}
}()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ func (h *BarArgWithParamsHandler) HandleRequest(
zap.String("stacktrace", stacktrace),
zap.String("endpoint", h.endpoint.EndpointName))

h.endpoint.ContextMetrics.IncCounter(ctx, zanzibar.InboundCallsPanic, 1)
h.endpoint.ContextMetrics.IncCounter(ctx, zanzibar.EndpointPanics, 1)
res.SendError(502, "Unexpected workflow panic, recovered at endpoint.", nil)
}
}()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ func (h *BarArgWithQueryHeaderHandler) HandleRequest(
zap.String("stacktrace", stacktrace),
zap.String("endpoint", h.endpoint.EndpointName))

h.endpoint.ContextMetrics.IncCounter(ctx, zanzibar.InboundCallsPanic, 1)
h.endpoint.ContextMetrics.IncCounter(ctx, zanzibar.EndpointPanics, 1)
res.SendError(502, "Unexpected workflow panic, recovered at endpoint.", nil)
}
}()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ func (h *BarArgWithQueryParamsHandler) HandleRequest(
zap.String("stacktrace", stacktrace),
zap.String("endpoint", h.endpoint.EndpointName))

h.endpoint.ContextMetrics.IncCounter(ctx, zanzibar.InboundCallsPanic, 1)
h.endpoint.ContextMetrics.IncCounter(ctx, zanzibar.EndpointPanics, 1)
res.SendError(502, "Unexpected workflow panic, recovered at endpoint.", nil)
}
}()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ func (h *BarHelloWorldHandler) HandleRequest(
zap.String("stacktrace", stacktrace),
zap.String("endpoint", h.endpoint.EndpointName))

h.endpoint.ContextMetrics.IncCounter(ctx, zanzibar.InboundCallsPanic, 1)
h.endpoint.ContextMetrics.IncCounter(ctx, zanzibar.EndpointPanics, 1)
res.SendError(502, "Unexpected workflow panic, recovered at endpoint.", nil)
}
}()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ func (h *BarMissingArgHandler) HandleRequest(
zap.String("stacktrace", stacktrace),
zap.String("endpoint", h.endpoint.EndpointName))

h.endpoint.ContextMetrics.IncCounter(ctx, zanzibar.InboundCallsPanic, 1)
h.endpoint.ContextMetrics.IncCounter(ctx, zanzibar.EndpointPanics, 1)
res.SendError(502, "Unexpected workflow panic, recovered at endpoint.", nil)
}
}()
Expand Down
2 changes: 1 addition & 1 deletion codegen/test_data/endpoints/bar_bar_method_norequest.gogen
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ func (h *BarNoRequestHandler) HandleRequest(
zap.String("stacktrace", stacktrace),
zap.String("endpoint", h.endpoint.EndpointName))

h.endpoint.ContextMetrics.IncCounter(ctx, zanzibar.InboundCallsPanic, 1)
h.endpoint.ContextMetrics.IncCounter(ctx, zanzibar.EndpointPanics, 1)
res.SendError(502, "Unexpected workflow panic, recovered at endpoint.", nil)
}
}()
Expand Down
2 changes: 1 addition & 1 deletion codegen/test_data/endpoints/bar_bar_method_normal.gogen
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ func (h *BarNormalHandler) HandleRequest(
zap.String("stacktrace", stacktrace),
zap.String("endpoint", h.endpoint.EndpointName))

h.endpoint.ContextMetrics.IncCounter(ctx, zanzibar.InboundCallsPanic, 1)
h.endpoint.ContextMetrics.IncCounter(ctx, zanzibar.EndpointPanics, 1)
res.SendError(502, "Unexpected workflow panic, recovered at endpoint.", nil)
}
}()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ func (h *BarTooManyArgsHandler) HandleRequest(
zap.String("stacktrace", stacktrace),
zap.String("endpoint", h.endpoint.EndpointName))

h.endpoint.ContextMetrics.IncCounter(ctx, zanzibar.InboundCallsPanic, 1)
h.endpoint.ContextMetrics.IncCounter(ctx, zanzibar.EndpointPanics, 1)
res.SendError(502, "Unexpected workflow panic, recovered at endpoint.", nil)
}
}()
Expand Down

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.

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.

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.

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.

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.

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.

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.

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.

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.

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

Loading

0 comments on commit 42f8adf

Please sign in to comment.