Releases: reddit/baseplate.go
v0.9.1
Non-breaking changes since v0.9.0
:
- Doc updates (0a6da65, 0189544)
thriftbp
:ClientPool
improvements regarding client ttl (5ff49d6, aeb1b61)baseplate.Config.Timeout
.thriftbp.ServerConfig.Timeout
, and top-level yaml configtimeout
are deprecated and no-op now. They will be removed in a future breaking change.
v0.9.0
Breaking Changes:
- YAML serialization tags have been updated across the repo:
- Some config types are removed and consolidated into the
Config
types:metricsbp.StatsdConfig
tracing.TracerConfig
baseplate
: YAML parsing now runs on strict modebaseplate
:New
is now split into two steps:ParseConfigYAML
andNew
.- The path to the config file is no longer taken as an arg. Instead it's taken directly from
BASEPLATE_CONFIG_PATH
environment variable.
- The path to the config file is no longer taken as an arg. Instead it's taken directly from
kafkabp
:Consumer.IsHealthy
now takes an additionalctx
arg.thriftbp
:ClientPool
no longer implementsthrift.TClient
.ClientPool.TClient()
is added to return athrift.TClient
implementation.redisbp
is now un-deprecated. All redis related packages' import paths
have been changed:thriftbp
: RemovedBaseplateErrorCode
.tracing
: UUID related configs have been renamed to Hex.thriftbp
: The string constants for THeader keys have been moved to newtransport
package so they can be shared with the newly addedgrpcbp
package.log
:ZapWrapper
's args is now a struct, and it takes additional kv pairs.redisbp
:MonitoredCmdable
&MonitoredCmdableFactory
types are removed.NewMonitoredClient
andNewMonitoredFailoverClient
are the replacements to create monitored Redis clients.- The following already deprecated things are now removed:
batchcloser.CloseError
metricsbp.Config.CounterSampleRate
retrybp.PoolExhaustedFilter
&retrybp.UnrecoverableErrorFilter
- Untagged metrics from spans
- Minimal supported Go version has been upgraded to 1.17.2.
- Dependency updates:
- thrift has been upgraded to v0.15.0
- sentry has been upgraded to v0.11.0
- go-redis has been upgraded to v8.10.0
- As a result, all commands require
ctx
arg now.
- As a result, all commands require
- opentracing has been upgraded to v1.2.0
- sarama has been upgraded to v1.29.1
Behavior Changes:
httpbp
&thriftbp
: The default list of retryable error codes has been updated.tracing
&events
: The default timeout for sending to message queue has been changed to 0 (non-blocking mode).log
: DefaultWrapper
is nowErrorWithSentryWrapper
, this can be changed vialog.DefaultWrapper
global variable.log
:IDLExceptionSuppressor
no longer suppressesbaseplate.Error
with5xx
code.
Non-breaking Changes:
baseplate
: AddedDrainer
.mqsend
: Now support non-blocking mode.thriftbp
: AddedRecoverPanic
server middleware and added to default list.redisbp
: AddedClusterClient.Wait
.thriftbp
:WrapBaseplateError
will avoid double wrapping now.thriftbp
: Fixed a bug that inClientPool
, DNS resolution is not part of the configuredConnectTimeout
.thriftbp/thrifttest
: AddedServerConfig.EdgeContextImpl
.thriftbp
: Added support for User-Agent THeader.breakerbp
: AddedFailureRatioBreaker.State
.- Added
iobp
package andiobp.CountingSink
. log
: We addedBeforeSend
support for Sentry and provided an implementation to swap the exceptions' type and value for better legibility.thriftbp
: A bug inTTLClient
that negativeMaxConnectionAge
does not really disable TTL has been fixed.metricsbp
: Fixed a bug thatStatsd.Close
does not wait for flushing to finish.- New
configbp
,transport
packages are added. log
:Attach
now attaches both logger and sentry hub.httpbp
: Bugs inCircuitBreaker
client middleware have been fixed (#428).- Added
grpcbp
package to provide server middlewares for grpc.
v0.8.3
Bug fixes:
thriftbp
: Fix a bug thatWrapBaseplateError
could drop additional info wrapped tobaseplate.Error
.
New features:
httpbp
: Add support forClientMiddleware
.
Other improvements:
log
: No longer drop pre-init logs.
v0.8.2
Bugfixes:
metricsbp
: Fix a race condition inStatsd.Close
.
Improvements:
thriftbp
: Listen on localhost on unit teststhriftbp
: AddWrapBaseplateError
andBaseplateErrorWrapper
.BaseplateErrorWrapper
is also added toBaseplateDefaultClientMiddlewares
.thriftbp
: Add yaml tags toClientPoolConfig
.log
: Fortime.Duration
values, the default encoder is nowStringDurationEncoder
, so 1 millisecond would show in log as"1ms"
instead of0.001
.
Doc improvements:
- thriftbp: Add doc regarding the concurrency of client pools.
- tracing: Add more doc and example to
SpanTypeOption
.
v0.8.1
New feature:
- Add healthcheck binary, it also comes with a library so you can build the binary in your own code instead if desired.
Other improvements:
- There were a few configs added to
tracing.TracerConfig
but nottracing.Config
so they cannot be configured through yaml. They are added totracing.Config
now:MaxQueueSize
UseUUID
- The types defined in
timebp
package now also implementencoding.TextMarshaler
andencoding.TextUnmarshaler
so they can be used beyond json.
v0.8.0
Deprecated
The following are deprecated in v0.8.0
and will be removed in a future release (likely v0.9.0
):
- In
metricsbp
, the globalCounterSampleRate
config is deprecated. There's really not a reason to sample counters globally in Baseplate.go. - The metrics coming from span hook have been updated according to new Baseplate spec. Currently both the old one and the new one are emitting to avoid breaking dashboards, but the old ones are deprecated and will be removed in the future.
namespace.server.endpoint
is changing tonamespace.baseplate.server.latency
withendpoint
tag for latency, andnamespace.baseplate.server.rate
withendpoint
andsuccess
tags for request numbers.namespace.client.server.endpoint
is changing tonamespace.baseplate.client.latency
withclient
andendpoint
tags for latency, andnamespace.baseplate.client.rate
withendpoint
,client
, andsuccess
tags for request numbers.namespace.local.name
is changing tonamespace.baseplate.local.latency
withendpoint
tag for latency, andnamespace.baseplate.local.rate
withendpoint
andsuccess
tags for number of executions.
redisbp
package is deprecated. Please use the newredispipebp
andredisx
packages instead. Theredisbp
package is still available for now, with changed import path to"github.com/reddit/baseplate.go/redis/deprecated/redisbp"
.retrybp
:PoolExhaustedFilter
andUnrecoverableErrorFilter
are deprecated. They should be replaced byRetryableErrorFilter
.
Other breaking changes
- Minimal go version has been updated to 1.16.
- Thrift library and compiler have been upgraded to 0.14.1.
retry-go
dependency has been upgraded to 3.0.metricsbp
: The args ofCounterWithRate
,HistogramWithRate
, andTimingWithRate
have been converted to a struct, and a new feature to report already sampled rate has been added. Here's a simple example:
const rate = 0.01
if randbp.ShouldSampleWithRate(rate) {
if err := myFancyWork(); err != nil {
metricsbp.M.CounterWithRate(metricsbp.RateArgs{
Name: "my.fancy.work.errors",
// 100% report it because we are already sampling it.
Rate: 1,
// but adjust the reporting rate to the actual sample rate.
AlreadySampledAt: metricsbp.Float64Ptr(rate),
}).Add(1)
}
}
tracing
:LocalComponentOption
is removed. For local spans usetracing.SpanTypeOption{Type: tracing.SpanTypeLocal}
instead.edgecontext
package is removed.ecinterface
package has been introduced to define the interface, and the actual implementation can be found at"github.com/reddit/edgecontext/lib/go/edgecontext"
. You need to change the args ofbaseplate.New
to add the edgecontext implementation:
ctx, bp, err := baseplate.New(
context.Background(),
baseplate.NewArgs{
ConfigPath: *configPath,
ServiceCfg: &cfg,
EdgeContextFactory: edgecontext.Factory(edgecontext.Config{
Logger: log.ErrorWithSentryWrapper(),
}),
},
)
Other non-breaking changes
thriftbp
: A new counter,"pool-closed-connections"
, has been added to client pools.retrybp
: AddRetryableError
interface definition andRetryableErrorFilter
filter implementation. Also add support to generic thrift retryable exceptions.events
&tracing
: AddMaxQueueSize
config.log
: Add support for a global version tag for all logs and sentry reports. You can "stamp" the git commit hash as the version at build time by usinggo build -ldflags "-X github.com/reddit/baseplate.go/log.Version=$(git rev-parse HEAD)"
.tracing
: Add support for UUID trace/span ids. Support for UUID ids from downstream services are always turned on, support for generating new ids using UUID is currently opt in by theUseUUID
config. You should only turn it on if you know all of your upstream services support UUID ids (Baseplate.go v0.8.0+ or Baseplate.py v2.0.0+).
v0.7.3
Bug fixes
- When we added conversion for all
int64
anduint64
fields in zap to string, we introduced a bug that caused zap logging lost callers (line numbers and call stacks). This bug is fixed.
Improvements
- The metrics reported from
thriftbp.ReportPayloadSizeMetrics
server middleware will also be tagged with the THeader protocol info.
v0.7.2
Bug fixes
- Although
thriftbp.SetDeadlineBudget
was added sincev0.1.0
, there was a bug that it never set the deadline on the wire correctly. It's fixed. A new helper function,thriftbp.AddClientHeader
, has also been added to do similar things correctly.
Other improvements
- Added
thriftbp.IDLExceptionSuppressor
, which is anerrorsbp.ErrorSuppressor
implementation that can be used to suppress all thrift exceptions defined in IDLs. It's also the new defaultErrorSpanSuppressor
used by thrift clients and servers. edgecontext
package is using the newedgecontext.thrift
now. There should be no visible changes from users.
v0.7.1
Notable new features
- New
kafkabp
package provides kafka consumer implementations, wrapping sarama package with baseplate flavor. log.Wrapper
in config structs can be set directly from yaml config file now (doc).thriftbp.ClientPoolConfig
addedValidate
function to help users validate the errors in the config.- A new middleware,
ReportPayloadSizeMetrics
, has been added to thriftbp's default server middlewares. It's by default turned off and can be enabled by passing a non-zero sample rate to the config. thriftbp
client pool now uses THeader+TCompact protocol by default. All THeader servers should be able to detect and handle them automatically so there should not be any visible changes, but the payload on the wire should be smaller.
Other notable bug fixes and improvements:
metricsbp
package will now batch messages together and send fewer UDP messages to statsd collector. Before it sends one UDP message per metric. The batch size can be configured viaStatsdConfig.BufferSize
.- NOTE: When using telegraf as the statsd collector, it's recommended to use telegraf v1.16.3+. Earlier version might have a bug to produce malformed metric lines triggered by this change.
log.Attach
now can be used to add key-value pairs other than trace id to the context object.filewatcher
had a bug that could cause panic when opening the file failed. The bug was fixed.- We now auto convert all
int64
anduint64
log fields to strings, to avoid loss of precision from log ingesters' json parsing.
v0.7.0
Breaking changes:
-
baseplate.Serve
function now takes a struct as the arg. This allows users to add additional closers to be closed before and after the server during graceful shutdown. -
randbp.GenerateRandomString
function now takes a struct as the arg. This allows users to define the minimal length of the generated random string, and easier default arg fallbacks. See example for usages. -
In the yaml config file, the sentry part was previously misspelt as "setry", it's now corrected to "sentry". If you have customized configs in the sentry portion of your config file, you need to rename "setry" into "sentry" to make it work in new version of Baseplate.go.
-
metricsbp.Timer
type's functions now return self for chaining.
Other non-breaking new features and bug fixes:
-
Added
retrybp.CappedExponentialBackoff
, and make it the default retry policy used byretrybp
package. It's an exponential backoff retry policy with random jitter and guarantee of no overflow after large number of retries. -
In json logging, the
trace_id
field is now logged as string instead of uint64. This improves compatibility against some log ingesters that has problem with numbers larger than max signed int64. -
metricsbp.Timer
addedOverrideStartTime
andObserveWithEndTime
functions for overriding start/end times. They are also both chainable. -
In
secrets
package, using empty secret path now will produce an explicit error. -
Across Baseplate.go libraries, you'll see better quoted string args in error messages.
-
Dependency updates on thrift and retry packages.