Skip to content

Commit

Permalink
Revert "Metrics namespace change (#499)"
Browse files Browse the repository at this point in the history
This reverts commit 19aa43d.
  • Loading branch information
herainman committed Oct 27, 2018
1 parent 19aa43d commit f643381
Show file tree
Hide file tree
Showing 71 changed files with 250 additions and 234 deletions.
1 change: 0 additions & 1 deletion CHANGELOG.md
Expand Up @@ -13,7 +13,6 @@ 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
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.EndpointPanics, 1)
h.endpoint.ContextMetrics.IncCounter(ctx, zanzibar.InboundCallsPanic, 1)
res.SendError(502, "Unexpected workflow panic, recovered at endpoint.", nil)
}
}()
Expand Down
4 changes: 2 additions & 2 deletions codegen/templates/module_initializer.tmpl
Expand Up @@ -41,8 +41,8 @@ func InitializeDependencies(
Logger: g.Logger,
ContextExtractor: g.ContextExtractor,
ContextLogger: g.ContextLogger,
ContextMetrics: zanzibar.NewContextMetrics(g.RootScope),
Scope: g.RootScope,
ContextMetrics: zanzibar.NewContextMetrics(g.AllHostScope),
Scope: g.AllHostScope,
Tracer: g.Tracer,
Config: g.Config,
Channel: g.Channel,
Expand Down
2 changes: 1 addition & 1 deletion codegen/templates/module_mock_initializer.tmpl
Expand Up @@ -57,7 +57,7 @@ func InitializeDependenciesMock(
ContextMetrics: g.ContextMetrics,
ContextLogger: g.ContextLogger,
Logger: g.Logger,
Scope: g.RootScope,
Scope: g.AllHostScope,
Config: g.Config,
Channel: g.Channel,
Tracer: g.Tracer,
Expand Down
2 changes: 1 addition & 1 deletion codegen/templates/tchannel_endpoint.tmpl
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.EndpointPanics, 1)
h.endpoint.ContextMetrics.IncCounter(ctx, zanzibar.InboundCallsPanic, 1)
isSuccessful = false
response = nil
headers = nil
Expand Down
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.EndpointPanics, 1)
h.endpoint.ContextMetrics.IncCounter(ctx, zanzibar.InboundCallsPanic, 1)
res.SendError(502, "Unexpected workflow panic, recovered at endpoint.", nil)
}
}()
Expand Down
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.EndpointPanics, 1)
h.endpoint.ContextMetrics.IncCounter(ctx, zanzibar.InboundCallsPanic, 1)
res.SendError(502, "Unexpected workflow panic, recovered at endpoint.", nil)
}
}()
Expand Down
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.EndpointPanics, 1)
h.endpoint.ContextMetrics.IncCounter(ctx, zanzibar.InboundCallsPanic, 1)
res.SendError(502, "Unexpected workflow panic, recovered at endpoint.", nil)
}
}()
Expand Down
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.EndpointPanics, 1)
h.endpoint.ContextMetrics.IncCounter(ctx, zanzibar.InboundCallsPanic, 1)
res.SendError(502, "Unexpected workflow panic, recovered at endpoint.", nil)
}
}()
Expand Down
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.EndpointPanics, 1)
h.endpoint.ContextMetrics.IncCounter(ctx, zanzibar.InboundCallsPanic, 1)
res.SendError(502, "Unexpected workflow panic, recovered at endpoint.", nil)
}
}()
Expand Down
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.EndpointPanics, 1)
h.endpoint.ContextMetrics.IncCounter(ctx, zanzibar.InboundCallsPanic, 1)
res.SendError(502, "Unexpected workflow panic, recovered at endpoint.", nil)
}
}()
Expand Down
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.EndpointPanics, 1)
h.endpoint.ContextMetrics.IncCounter(ctx, zanzibar.InboundCallsPanic, 1)
res.SendError(502, "Unexpected workflow panic, recovered at endpoint.", nil)
}
}()
Expand Down
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.EndpointPanics, 1)
h.endpoint.ContextMetrics.IncCounter(ctx, zanzibar.InboundCallsPanic, 1)
res.SendError(502, "Unexpected workflow panic, recovered at endpoint.", nil)
}
}()
Expand Down
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.EndpointPanics, 1)
h.endpoint.ContextMetrics.IncCounter(ctx, zanzibar.InboundCallsPanic, 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
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.EndpointPanics, 1)
h.endpoint.ContextMetrics.IncCounter(ctx, zanzibar.InboundCallsPanic, 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
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.EndpointPanics, 1)
h.endpoint.ContextMetrics.IncCounter(ctx, zanzibar.InboundCallsPanic, 1)
res.SendError(502, "Unexpected workflow panic, recovered at endpoint.", nil)
}
}()
Expand Down
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.EndpointPanics, 1)
h.endpoint.ContextMetrics.IncCounter(ctx, zanzibar.InboundCallsPanic, 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.

0 comments on commit f643381

Please sign in to comment.