mirror of
https://github.com/temporalio/temporal.git
synced 2026-08-30 18:41:49 -07:00
chore: update code to use new log aliases where applicable (#9177)
## What changed? This updates the server code to use the shorthand log tag constructors introduced in #9174. As part of this it _does_ make a breaking change to the `Bool` constructor: it now takes in the key as a string to be consistent. The only inconsistent one is now `Error`, but that's used so heavily that changing it is likely not worth the time. ## Why? Consistency! ## How did you test it? Existing tests ## Potential risks The only risk is that I _have_ introduced a breaking change to the Bool constructor. I'm happy to undo that if my reviewers desire: my goal is minimal breaking changes. I'd prefer none, but I made this change to stir up discussion
This commit is contained in:
@@ -46,7 +46,7 @@ func (c chasmInvocation) WrapError(result invocationResult, err error) error {
|
||||
// returned. Intended to be used to hide internal errors from end users.
|
||||
func logInternalError(logger log.Logger, internalMsg string, internalErr error) error {
|
||||
referenceID := uuid.NewString()
|
||||
logger.Error(internalMsg, tag.Error(internalErr), tag.NewStringTag("reference-id", referenceID))
|
||||
logger.Error(internalMsg, tag.Error(internalErr), tag.String("reference-id", referenceID))
|
||||
return fmt.Errorf("internal error, reference-id: %v", referenceID)
|
||||
}
|
||||
|
||||
|
||||
@@ -69,7 +69,7 @@ func (n nexusInvocation) Invoke(
|
||||
traceLogger := log.With(e.logger,
|
||||
tag.WorkflowNamespace(ns.Name().String()),
|
||||
tag.Operation("CompleteNexusOperation"),
|
||||
tag.NewStringTag("destination", taskAttr.Destination),
|
||||
tag.String("destination", taskAttr.Destination),
|
||||
tag.WorkflowID(n.workflowID),
|
||||
tag.WorkflowRunID(n.runID),
|
||||
tag.AttemptStart(time.Now().UTC()),
|
||||
@@ -127,7 +127,7 @@ func (n nexusInvocation) Invoke(
|
||||
|
||||
retryable := isRetryableHTTPResponse(response)
|
||||
err = readHandlerErrFromResponse(response, e.logger)
|
||||
e.logger.Error("Callback request failed", tag.Error(err), tag.NewStringTag("status", response.Status), tag.NewBoolTag("retryable", retryable))
|
||||
e.logger.Error("Callback request failed", tag.Error(err), tag.String("status", response.Status), tag.Bool("retryable", retryable))
|
||||
if retryable {
|
||||
return invocationResultRetry{err: err}
|
||||
}
|
||||
@@ -146,7 +146,7 @@ func readHandlerErrFromResponse(response *http.Response, logger log.Logger) erro
|
||||
|
||||
body, err := readAndReplaceBody(response)
|
||||
if err != nil {
|
||||
logger.Error("Error reading response body for non-ok callback request", tag.Error(err), tag.NewStringTag("status", response.Status))
|
||||
logger.Error("Error reading response body for non-ok callback request", tag.Error(err), tag.String("status", response.Status))
|
||||
return err
|
||||
}
|
||||
|
||||
|
||||
@@ -78,7 +78,7 @@ func (b *BackfillerTaskExecutor) Execute(
|
||||
// Buffer is full, back off and retry later. Unlike the generator, the
|
||||
// backfiller doesn't drop actions - it will retry after backoff.
|
||||
logger.Debug("Buffer full, backing off backfill",
|
||||
tag.NewStringTag("backfill-id", backfiller.GetBackfillId()))
|
||||
tag.String("backfill-id", backfiller.GetBackfillId()))
|
||||
b.rescheduleBackfill(ctx, backfiller)
|
||||
return nil
|
||||
}
|
||||
@@ -106,7 +106,7 @@ func (b *BackfillerTaskExecutor) Execute(
|
||||
// any more tasks.
|
||||
if result.Complete {
|
||||
logger.Debug("backfill complete, deleting Backfiller",
|
||||
tag.NewStringTag("backfill-id", backfiller.GetBackfillId()))
|
||||
tag.String("backfill-id", backfiller.GetBackfillId()))
|
||||
delete(scheduler.Backfillers, backfiller.GetBackfillId())
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -76,8 +76,8 @@ func (g *GeneratorTaskExecutor) Execute(
|
||||
t2 := ctx.Now(generator).UTC()
|
||||
if t2.Before(t1) {
|
||||
logger.Error("time went backwards",
|
||||
tag.NewStringerTag("time", t1),
|
||||
tag.NewStringerTag("time", t2))
|
||||
tag.Stringer("time", t1),
|
||||
tag.Stringer("time", t2))
|
||||
t2 = t1
|
||||
}
|
||||
|
||||
@@ -99,7 +99,7 @@ func (g *GeneratorTaskExecutor) Execute(
|
||||
// Emit metrics and update state for any dropped actions.
|
||||
if result.DroppedCount > 0 {
|
||||
logger.Warn("Buffer overrun, dropping actions",
|
||||
tag.NewInt64("dropped-count", result.DroppedCount))
|
||||
tag.Int64("dropped-count", result.DroppedCount))
|
||||
metricsHandler.Counter(metrics.ScheduleBufferOverruns.Name()).Record(result.DroppedCount)
|
||||
scheduler.Info.BufferDropped += result.DroppedCount
|
||||
}
|
||||
@@ -143,8 +143,8 @@ func (g *GeneratorTaskExecutor) Execute(
|
||||
|
||||
func (g *GeneratorTaskExecutor) logSchedule(logger log.Logger, msg string, scheduler *Scheduler) {
|
||||
logger.Debug(msg,
|
||||
tag.NewStringerTag("spec", jsonStringer{scheduler.Schedule.Spec}),
|
||||
tag.NewStringerTag("policies", jsonStringer{scheduler.Schedule.Policies}))
|
||||
tag.Stringer("spec", jsonStringer{scheduler.Schedule.Spec}),
|
||||
tag.Stringer("policies", jsonStringer{scheduler.Schedule.Policies}))
|
||||
}
|
||||
|
||||
func (g *GeneratorTaskExecutor) Validate(
|
||||
|
||||
@@ -86,10 +86,10 @@ func (s *SpecProcessorImpl) ProcessTimeRange(
|
||||
overlapPolicy = scheduler.resolveOverlapPolicy(overlapPolicy)
|
||||
|
||||
s.logger.Debug("ProcessTimeRange",
|
||||
tag.NewTimeTag("start", start),
|
||||
tag.NewTimeTag("end", end),
|
||||
tag.NewAnyTag("overlap-policy", overlapPolicy),
|
||||
tag.NewBoolTag("manual", manual))
|
||||
tag.Time("start", start),
|
||||
tag.Time("end", end),
|
||||
tag.Any("overlap-policy", overlapPolicy),
|
||||
tag.Bool("manual", manual))
|
||||
|
||||
// Peek at paused/remaining actions state and don't bother if we're not going to
|
||||
// take an action now. (Don't count as missed catchup window either.)
|
||||
@@ -132,15 +132,15 @@ func (s *SpecProcessorImpl) ProcessTimeRange(
|
||||
// Skip this check for manual (backfill) actions since they explicitly request
|
||||
// past times.
|
||||
s.logger.Info("ProcessBuffer skipped an action due to update time",
|
||||
tag.NewTimeTag("updateTime", scheduler.Info.UpdateTime.AsTime()),
|
||||
tag.NewTimeTag("droppedActionTime", next.Next))
|
||||
tag.Time("updateTime", scheduler.Info.UpdateTime.AsTime()),
|
||||
tag.Time("droppedActionTime", next.Next))
|
||||
continue
|
||||
}
|
||||
|
||||
if !manual && end.Sub(next.Next) > catchupWindow {
|
||||
s.logger.Info("Schedule missed catchup window",
|
||||
tag.NewTimeTag("now", end),
|
||||
tag.NewTimeTag("time", next.Next))
|
||||
tag.Time("now", end),
|
||||
tag.Time("time", next.Next))
|
||||
metricsHandler.Counter(metrics.ScheduleMissedCatchupWindow.Name()).Record(1)
|
||||
|
||||
scheduler.Info.MissedCatchupWindow++
|
||||
|
||||
@@ -1184,7 +1184,7 @@ func (n *Node) deserializeComponentNode(
|
||||
softassert.Fail(
|
||||
n.logger,
|
||||
"field.kind can be unspecified only if err is not nil, and there is a check for it above",
|
||||
tag.NewStringTag("node name", n.nodeName))
|
||||
tag.String("node name", n.nodeName))
|
||||
case fieldKindData:
|
||||
value, err := unmarshalProto(n.serializedNode.GetData(), field.typ)
|
||||
if err != nil {
|
||||
|
||||
@@ -205,8 +205,8 @@ func (r *CachingRedirector[C]) handleSolError(opEntry cacheEntry[C], solErr *ser
|
||||
if len(solErrNewOwner) != 0 && solErrNewOwner != opEntry.address {
|
||||
r.logger.Info("historyClient: updating cache from shard ownership lost error",
|
||||
tag.ShardID(opEntry.shardID),
|
||||
tag.NewAnyTag("oldAddress", opEntry.address),
|
||||
tag.NewAnyTag("newAddress", solErrNewOwner))
|
||||
tag.Any("oldAddress", opEntry.address),
|
||||
tag.Any("newAddress", solErrNewOwner))
|
||||
return r.cacheAddLocked(opEntry.shardID, solErrNewOwner), true
|
||||
}
|
||||
|
||||
|
||||
@@ -164,7 +164,7 @@ func (c *clientImpl) processInputPartition(proto *taskqueuepb.TaskQueue, nsid st
|
||||
if err != nil {
|
||||
// We preserve the old logic (not returning error in case of invalid proto info) until it's verified that
|
||||
// clients are not sending invalid names.
|
||||
c.logger.Info("invalid tq partition", tag.Error(err), tag.NewStringerTag("proto", proto))
|
||||
c.logger.Info("invalid tq partition", tag.Error(err), tag.Stringer("proto", proto))
|
||||
metrics.MatchingClientInvalidTaskQueuePartition.With(c.metricsHandler).Record(1)
|
||||
return tqid.UnsafeTaskQueueFamily(nsid, proto.GetName()).TaskQueue(taskType).RootPartition(), nil
|
||||
}
|
||||
|
||||
@@ -162,7 +162,7 @@ func (c *metricClient) emitForwardedSourceStats(
|
||||
// it means some mangled name come here; need to check why
|
||||
_, err := tqid.NewTaskQueueFamily("", taskQueue.GetName())
|
||||
if err != nil {
|
||||
c.logger.Info("invalid tq name", tag.Error(err), tag.NewStringsTag("proto", []string{taskQueue.GetName()}))
|
||||
c.logger.Info("invalid tq name", tag.Error(err), tag.String("proto", taskQueue.GetName()))
|
||||
metrics.MatchingClientInvalidTaskQueueName.With(metricsHandler).Record(1)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -183,15 +183,15 @@ func buildCLI() *cli.App {
|
||||
|
||||
logger := log.NewZapLogger(log.BuildZapLogger(cfg.Log))
|
||||
logger.Info("Build info.",
|
||||
tag.NewTimeTag("git-time", build.InfoData.GitTime),
|
||||
tag.NewStringTag("git-revision", build.InfoData.GitRevision),
|
||||
tag.NewBoolTag("git-modified", build.InfoData.GitModified),
|
||||
tag.NewStringTag("go-arch", build.InfoData.GoArch),
|
||||
tag.NewStringTag("go-os", build.InfoData.GoOs),
|
||||
tag.NewStringTag("go-version", build.InfoData.GoVersion),
|
||||
tag.NewBoolTag("cgo-enabled", build.InfoData.CgoEnabled),
|
||||
tag.NewStringTag("server-version", headers.ServerVersion),
|
||||
tag.NewBoolTag("debug-mode", debug.Enabled),
|
||||
tag.Time("git-time", build.InfoData.GitTime),
|
||||
tag.String("git-revision", build.InfoData.GitRevision),
|
||||
tag.Bool("git-modified", build.InfoData.GitModified),
|
||||
tag.String("go-arch", build.InfoData.GoArch),
|
||||
tag.String("go-os", build.InfoData.GoOs),
|
||||
tag.String("go-version", build.InfoData.GoVersion),
|
||||
tag.Bool("cgo-enabled", build.InfoData.CgoEnabled),
|
||||
tag.String("server-version", headers.ServerVersion),
|
||||
tag.Bool("debug-mode", debug.Enabled),
|
||||
)
|
||||
|
||||
var dynamicConfigClient dynamicconfig.Client
|
||||
|
||||
@@ -106,8 +106,8 @@ func (f *Finalizer) Run(
|
||||
}
|
||||
|
||||
f.logger.Debug("finalizer starting",
|
||||
tag.NewInt("items", totalCount),
|
||||
tag.NewDurationTag("timeout", timeout))
|
||||
tag.Int("items", totalCount),
|
||||
tag.Duration("timeout", timeout))
|
||||
|
||||
startTime := time.Now()
|
||||
defer func() { metrics.FinalizerLatency.With(f.metricsHandler).Record(time.Since(startTime)) }()
|
||||
@@ -150,14 +150,14 @@ func (f *Finalizer) Run(
|
||||
completedCallbacks += 1
|
||||
if completedCallbacks == totalCount {
|
||||
f.logger.Debug("finalizer completed",
|
||||
tag.NewInt("completed", completedCallbacks))
|
||||
tag.Int("completed", completedCallbacks))
|
||||
return completedCallbacks
|
||||
}
|
||||
|
||||
case <-ctx.Done():
|
||||
f.logger.Error("finalizer timed out",
|
||||
tag.NewInt("completed", completedCallbacks),
|
||||
tag.NewInt("unfinished", totalCount-completedCallbacks))
|
||||
tag.Int("completed", completedCallbacks),
|
||||
tag.Int("unfinished", totalCount-completedCallbacks))
|
||||
return completedCallbacks
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ func (l *SdkLogger) tags(keyvals []interface{}) []tag.Tag {
|
||||
i++
|
||||
}
|
||||
|
||||
tags = append(tags, tag.NewAnyTag(key, val))
|
||||
tags = append(tags, tag.Any(key, val))
|
||||
}
|
||||
|
||||
return tags
|
||||
|
||||
@@ -36,21 +36,21 @@ func (s *SdkLoggerSuite) TearDownTest() {
|
||||
}
|
||||
|
||||
func (s *SdkLoggerSuite) TestEvenKeyValPairs() {
|
||||
s.underlyingLogger.EXPECT().Info("msg", tag.NewAnyTag("key1", "val1"), tag.NewAnyTag("key2", "val2"))
|
||||
s.underlyingLogger.EXPECT().Info("msg", tag.Any("key1", "val1"), tag.Any("key2", "val2"))
|
||||
s.sdkLogger.Info("msg", "key1", "val1", "key2", "val2")
|
||||
}
|
||||
|
||||
func (s *SdkLoggerSuite) TestOddKeyValPairs() {
|
||||
s.underlyingLogger.EXPECT().Info("msg", tag.NewAnyTag("key1", "val1"), tag.NewAnyTag("key2", "no value"))
|
||||
s.underlyingLogger.EXPECT().Info("msg", tag.Any("key1", "val1"), tag.Any("key2", "no value"))
|
||||
s.sdkLogger.Info("msg", "key1", "val1", "key2")
|
||||
}
|
||||
|
||||
func (s *SdkLoggerSuite) TestKeyValPairsWithTag() {
|
||||
s.underlyingLogger.EXPECT().Info("msg", tag.NewAnyTag("key1", "val1"), tag.NewStringTag("key3", "val3"), tag.NewAnyTag("key2", "val2"))
|
||||
s.sdkLogger.Info("msg", "key1", "val1", tag.NewStringTag("key3", "val3"), "key2", "val2")
|
||||
s.underlyingLogger.EXPECT().Info("msg", tag.Any("key1", "val1"), tag.String("key3", "val3"), tag.Any("key2", "val2"))
|
||||
s.sdkLogger.Info("msg", "key1", "val1", tag.String("key3", "val3"), "key2", "val2")
|
||||
|
||||
s.underlyingLogger.EXPECT().Info("msg", tag.NewAnyTag("key1", "val1"), tag.NewInt("key3", 3), tag.NewAnyTag("key2", "val2"))
|
||||
s.sdkLogger.Info("msg", "key1", "val1", tag.NewInt("key3", 3), "key2", "val2")
|
||||
s.underlyingLogger.EXPECT().Info("msg", tag.Any("key1", "val1"), tag.Int("key3", 3), tag.Any("key2", "val2"))
|
||||
s.sdkLogger.Info("msg", "key1", "val1", tag.Int("key3", 3), "key2", "val2")
|
||||
|
||||
}
|
||||
|
||||
@@ -60,6 +60,6 @@ func (s *SdkLoggerSuite) TestEmptyKeyValPairs() {
|
||||
}
|
||||
|
||||
func (s *SdkLoggerSuite) TestSingleKeyValPairs() {
|
||||
s.underlyingLogger.EXPECT().Info("msg", tag.NewAnyTag("key1", "no value"))
|
||||
s.underlyingLogger.EXPECT().Info("msg", tag.Any("key1", "no value"))
|
||||
s.sdkLogger.Info("msg", "key1")
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ func (h *handler) Handle(_ context.Context, record slog.Record) error {
|
||||
tags := make([]tag.Tag, len(h.tags), len(h.tags)+record.NumAttrs())
|
||||
copy(tags, h.tags)
|
||||
record.Attrs(func(attr slog.Attr) bool {
|
||||
tags = append(tags, tag.NewZapTag(convertAttrToField(h.prependGroup(attr))))
|
||||
tags = append(tags, tag.Zap(convertAttrToField(h.prependGroup(attr))))
|
||||
return true
|
||||
})
|
||||
// Not capturing the log location and stack trace here. We seem to not need this functionality since our zapLogger
|
||||
@@ -72,7 +72,7 @@ func (h *handler) WithAttrs(attrs []slog.Attr) slog.Handler {
|
||||
tags := make([]tag.Tag, len(h.tags), len(h.tags)+len(attrs))
|
||||
copy(tags, h.tags)
|
||||
for _, attr := range attrs {
|
||||
tags = append(tags, tag.NewZapTag(convertAttrToField(h.prependGroup(attr))))
|
||||
tags = append(tags, tag.Zap(convertAttrToField(h.prependGroup(attr))))
|
||||
}
|
||||
return &handler{logger: h.logger, zapLogger: h.zapLogger, tags: tags, group: h.group}
|
||||
}
|
||||
|
||||
@@ -537,11 +537,6 @@ func NextNumber(n int64) ZapTag {
|
||||
return NewInt64("next-number", n)
|
||||
}
|
||||
|
||||
// Bool returns tag for Bool
|
||||
func Bool(b bool) ZapTag {
|
||||
return NewBoolTag("bool", b)
|
||||
}
|
||||
|
||||
// ServerName returns tag for ServerName
|
||||
func ServerName(serverName string) ZapTag {
|
||||
return NewStringTag("server-name", serverName)
|
||||
|
||||
@@ -33,7 +33,7 @@ func (t ZapTag) Key() string {
|
||||
return t.field.Key
|
||||
}
|
||||
|
||||
func (t ZapTag) Value() interface{} {
|
||||
func (t ZapTag) Value() any {
|
||||
// Not for production use.
|
||||
enc := zapcore.NewMapObjectEncoder()
|
||||
t.field.AddTo(enc)
|
||||
@@ -153,7 +153,7 @@ func NewTimePtrTag(key string, value *timestamppb.Timestamp) ZapTag {
|
||||
}
|
||||
}
|
||||
|
||||
func NewAnyTag(key string, value interface{}) ZapTag {
|
||||
func NewAnyTag(key string, value any) ZapTag {
|
||||
return ZapTag{
|
||||
field: zap.Any(key, value),
|
||||
}
|
||||
@@ -230,3 +230,13 @@ func Any(key string, value any) ZapTag {
|
||||
func Binary(key string, value []byte) ZapTag {
|
||||
return NewBinaryTag(key, value)
|
||||
}
|
||||
|
||||
func Bool(key string, b bool) ZapTag {
|
||||
return NewBoolTag(key, b)
|
||||
}
|
||||
|
||||
func Zap(field zap.Field) ZapTag {
|
||||
return ZapTag{
|
||||
field: field,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -179,8 +179,8 @@ func (l *zapLogger) Fatal(msg string, tags ...tag.Tag) {
|
||||
// With() handles the provided tags as "upserts", replacing any matching keys with new values.
|
||||
// Note that we distinguish between the following two seemingly identical lines:
|
||||
//
|
||||
// logger.With(logger, tag.NewStringTag("foo", "bar")).Info("msg")
|
||||
// logger.Info("msg", tag.NewStringTag("foo", "bar")
|
||||
// logger.With(logger, tag.String("foo", "bar")).Info("msg")
|
||||
// logger.Info("msg", tag.String("foo", "bar")
|
||||
//
|
||||
// by deduping "foo" against any existing "foo" tags *only in the former*
|
||||
func (l *zapLogger) With(tags ...tag.Tag) Logger {
|
||||
|
||||
@@ -95,8 +95,8 @@ func TestDefaultLogger(t *testing.T) {
|
||||
|
||||
// Test tags with duplicate keys are replaced
|
||||
withLogger := With(logger,
|
||||
tag.NewStringTag("xray", "alpha"), tag.NewStringTag("xray", "yankee")) // alpha will never be seen
|
||||
withLogger = With(withLogger, tag.NewStringTag("xray", "zulu"))
|
||||
tag.String("xray", "alpha"), tag.String("xray", "yankee")) // alpha will never be seen
|
||||
withLogger = With(withLogger, tag.String("xray", "zulu"))
|
||||
withLogger.Info("Log message with tag")
|
||||
|
||||
// put Stdout back to normal state
|
||||
|
||||
@@ -87,7 +87,7 @@ func (omp *otelMetricsHandler) Counter(counter string) CounterIface {
|
||||
opts := addOptions(omp, counterOptions{}, counter)
|
||||
c, err := omp.provider.GetMeter().Int64Counter(counter, opts...)
|
||||
if err != nil {
|
||||
omp.l.Error("error getting metric", tag.NewStringTag("MetricName", counter), tag.Error(err))
|
||||
omp.l.Error("error getting metric", tag.String("MetricName", counter), tag.Error(err))
|
||||
return CounterFunc(func(i int64, t ...Tag) {})
|
||||
}
|
||||
|
||||
@@ -115,7 +115,7 @@ func (omp *otelMetricsHandler) getGaugeAdapter(gauge string) (*gaugeAdapter, err
|
||||
_, err := omp.provider.GetMeter().Float64ObservableGauge(gauge, opts...)
|
||||
if err != nil {
|
||||
omp.gauges.Delete(gauge)
|
||||
omp.l.Error("error getting metric", tag.NewStringTag("MetricName", gauge), tag.Error(err))
|
||||
omp.l.Error("error getting metric", tag.String("MetricName", gauge), tag.Error(err))
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -162,7 +162,7 @@ func (omp *otelMetricsHandler) timerInMilliseconds(timer string) TimerIface {
|
||||
opts := addOptions(omp, int64HistogramOptions{metric.WithUnit(Milliseconds)}, timer)
|
||||
c, err := omp.provider.GetMeter().Int64Histogram(timer, opts...)
|
||||
if err != nil {
|
||||
omp.l.Error("error getting metric", tag.NewStringTag("MetricName", timer), tag.Error(err))
|
||||
omp.l.Error("error getting metric", tag.String("MetricName", timer), tag.Error(err))
|
||||
return TimerFunc(func(i time.Duration, t ...Tag) {})
|
||||
}
|
||||
|
||||
@@ -176,7 +176,7 @@ func (omp *otelMetricsHandler) timerInSeconds(timer string) TimerIface {
|
||||
opts := addOptions(omp, float64HistogramOptions{metric.WithUnit(Seconds)}, timer)
|
||||
c, err := omp.provider.GetMeter().Float64Histogram(timer, opts...)
|
||||
if err != nil {
|
||||
omp.l.Error("error getting metric", tag.NewStringTag("MetricName", timer), tag.Error(err))
|
||||
omp.l.Error("error getting metric", tag.String("MetricName", timer), tag.Error(err))
|
||||
return TimerFunc(func(i time.Duration, t ...Tag) {})
|
||||
}
|
||||
|
||||
@@ -191,7 +191,7 @@ func (omp *otelMetricsHandler) Histogram(histogram string, unit MetricUnit) Hist
|
||||
opts := addOptions(omp, int64HistogramOptions{metric.WithUnit(string(unit))}, histogram)
|
||||
c, err := omp.provider.GetMeter().Int64Histogram(histogram, opts...)
|
||||
if err != nil {
|
||||
omp.l.Error("error getting metric", tag.NewStringTag("MetricName", histogram), tag.Error(err))
|
||||
omp.l.Error("error getting metric", tag.String("MetricName", histogram), tag.Error(err))
|
||||
return HistogramFunc(func(i int64, t ...Tag) {})
|
||||
}
|
||||
|
||||
|
||||
@@ -322,12 +322,12 @@ func TestOtelMetricsHandler_Error(t *testing.T) {
|
||||
msg := "error getting metric"
|
||||
errTag := tag.Error(testErr)
|
||||
|
||||
logger.EXPECT().Error(msg, tag.NewStringTag("MetricName", "counter"), errTag)
|
||||
logger.EXPECT().Error(msg, tag.String("MetricName", "counter"), errTag)
|
||||
handler.Counter("counter").Record(1)
|
||||
logger.EXPECT().Error(msg, tag.NewStringTag("MetricName", "timer"), errTag)
|
||||
logger.EXPECT().Error(msg, tag.String("MetricName", "timer"), errTag)
|
||||
handler.Timer("timer").Record(time.Second)
|
||||
logger.EXPECT().Error(msg, tag.NewStringTag("MetricName", "gauge"), errTag)
|
||||
logger.EXPECT().Error(msg, tag.String("MetricName", "gauge"), errTag)
|
||||
handler.Gauge("gauge").Record(1.0)
|
||||
logger.EXPECT().Error(msg, tag.NewStringTag("MetricName", "histogram"), errTag)
|
||||
logger.EXPECT().Error(msg, tag.String("MetricName", "histogram"), errTag)
|
||||
handler.Histogram("histogram", Bytes).Record(1)
|
||||
}
|
||||
|
||||
@@ -82,7 +82,7 @@ func (e *statsdExporter) Export(ctx context.Context, rm *metricdata.ResourceMetr
|
||||
for _, sm := range rm.ScopeMetrics {
|
||||
for _, m := range sm.Metrics {
|
||||
if err := e.exportMetric(m); err != nil {
|
||||
e.logger.Error("Failed to export metric to StatsD", tag.Error(err), tag.NewStringTag("metric_name", m.Name))
|
||||
e.logger.Error("Failed to export metric to StatsD", tag.Error(err), tag.String("metric_name", m.Name))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -124,7 +124,7 @@ func (e *statsdExporter) exportMetric(m metricdata.Metrics) error {
|
||||
case metricdata.Histogram[float64]:
|
||||
return e.exportHistogramFloat64(m.Name, data)
|
||||
default:
|
||||
e.logger.Warn("Unsupported metric type for StatsD export", tag.NewStringTag("metric_name", m.Name))
|
||||
e.logger.Warn("Unsupported metric type for StatsD export", tag.String("metric_name", m.Name))
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
@@ -279,7 +279,7 @@ func (r *registry) RegisterStateChangeCallback(key any, cb namespace.StateChange
|
||||
r.logger.Warn(
|
||||
"Namespace registry callback slow",
|
||||
tag.Key(fmt.Sprintf("%v", key)),
|
||||
tag.NewDurationTag("duration", duration),
|
||||
tag.Duration("duration", duration),
|
||||
)
|
||||
}
|
||||
}()
|
||||
@@ -404,7 +404,7 @@ func (r *registry) watchLoop(ctx context.Context, watchCh <-chan *persistence.Na
|
||||
}
|
||||
|
||||
if !ok || err != nil {
|
||||
r.logger.Error("Namespace watch failed, restarting", tag.Error(err), tag.NewBoolTag("closed", ok))
|
||||
r.logger.Error("Namespace watch failed, restarting", tag.Error(err), tag.Bool("closed", ok))
|
||||
metrics.NamespaceRegistryWatchReconnections.With(r.metricsHandler).Record(1)
|
||||
return
|
||||
}
|
||||
@@ -655,7 +655,7 @@ func (r *registry) processWatchEvent(event *persistence.NamespaceWatchEvent) err
|
||||
ns = r.deleteNamespace(event.NamespaceID)
|
||||
executeCallbacks = ns != nil
|
||||
default:
|
||||
r.logger.Warn("Unknown namespace watch event type", tag.NewInt("eventType", int(event.Type)))
|
||||
r.logger.Warn("Unknown namespace watch event type", tag.Int("eventType", int(event.Type)))
|
||||
}
|
||||
|
||||
if executeCallbacks {
|
||||
|
||||
@@ -109,8 +109,8 @@ func (h *taskExecutorImpl) shouldProcessTask(ctx context.Context, task *replicat
|
||||
h.logger.Error(
|
||||
"namespace replication encountered UUID collision processing namespace replication task",
|
||||
tag.WorkflowNamespaceID(resp.Namespace.Info.Id),
|
||||
tag.NewStringTag("Task Namespace Id", task.GetId()),
|
||||
tag.NewStringTag("Task Namespace Info Id", task.Info.GetId()))
|
||||
tag.String("Task Namespace Id", task.GetId()),
|
||||
tag.String("Task Namespace Info Id", task.Info.GetId()))
|
||||
return false, ErrNameUUIDCollision
|
||||
}
|
||||
|
||||
@@ -178,8 +178,8 @@ func (h *taskExecutorImpl) handleNamespaceCreationReplicationTask(
|
||||
if resp.Namespace.Info.Id != task.GetId() {
|
||||
h.logger.Error("namespace replication encountered UUID collision during NamespaceCreationReplicationTask",
|
||||
tag.WorkflowNamespaceID(resp.Namespace.Info.Id),
|
||||
tag.NewStringTag("Task Namespace Id", task.GetId()),
|
||||
tag.NewStringTag("Task Namespace Info Id", task.Info.GetId()),
|
||||
tag.String("Task Namespace Id", task.GetId()),
|
||||
tag.String("Task Namespace Info Id", task.Info.GetId()),
|
||||
tag.Error(err))
|
||||
return ErrNameUUIDCollision
|
||||
}
|
||||
@@ -205,7 +205,7 @@ func (h *taskExecutorImpl) handleNamespaceCreationReplicationTask(
|
||||
h.logger.Error(
|
||||
"namespace replication encountered name collision during NamespaceCreationReplicationTask",
|
||||
tag.WorkflowNamespace(resp.Namespace.Info.Name),
|
||||
tag.NewStringTag("Task Namespace Name", task.Info.GetName()),
|
||||
tag.String("Task Namespace Name", task.Info.GetName()),
|
||||
tag.Error(err))
|
||||
return ErrNameUUIDCollision
|
||||
}
|
||||
|
||||
@@ -116,23 +116,23 @@ func (p *LoggedHTTPClientTraceProvider) newClientTrace(logger log.Logger, hooks
|
||||
clientTrace.GotConn = func(info httptrace.GotConnInfo) {
|
||||
logger.Info("got HTTP connection for Nexus request",
|
||||
tag.Timestamp(time.Now().UTC()),
|
||||
tag.NewBoolTag("reused", info.Reused),
|
||||
tag.NewBoolTag("was-idle", info.WasIdle),
|
||||
tag.NewDurationTag("idle-time", info.IdleTime))
|
||||
tag.Bool("reused", info.Reused),
|
||||
tag.Bool("was-idle", info.WasIdle),
|
||||
tag.Duration("idle-time", info.IdleTime))
|
||||
}
|
||||
case "ConnectStart":
|
||||
clientTrace.ConnectStart = func(network, addr string) {
|
||||
logger.Info("starting dial for new connection for Nexus request",
|
||||
tag.Timestamp(time.Now().UTC()),
|
||||
tag.Address(addr),
|
||||
tag.NewStringTag("network", network))
|
||||
tag.String("network", network))
|
||||
}
|
||||
case "ConnectDone":
|
||||
clientTrace.ConnectDone = func(network, addr string, err error) {
|
||||
logger.Info("finished dial for new connection for Nexus request",
|
||||
tag.Timestamp(time.Now().UTC()),
|
||||
tag.Address(addr),
|
||||
tag.NewStringTag("network", network),
|
||||
tag.String("network", network),
|
||||
tag.Error(err))
|
||||
}
|
||||
case "DNSStart":
|
||||
@@ -151,7 +151,7 @@ func (p *LoggedHTTPClientTraceProvider) newClientTrace(logger log.Logger, hooks
|
||||
tag.Timestamp(time.Now().UTC()),
|
||||
tag.Addresses(addresses),
|
||||
tag.Error(info.Err),
|
||||
tag.NewBoolTag("coalesced", info.Coalesced))
|
||||
tag.Bool("coalesced", info.Coalesced))
|
||||
}
|
||||
case "TLSHandshakeStart":
|
||||
clientTrace.TLSHandshakeStart = func() {
|
||||
@@ -161,7 +161,7 @@ func (p *LoggedHTTPClientTraceProvider) newClientTrace(logger log.Logger, hooks
|
||||
clientTrace.TLSHandshakeDone = func(state tls.ConnectionState, err error) {
|
||||
logger.Info("finished TLS handshake for Nexus request",
|
||||
tag.Timestamp(time.Now().UTC()),
|
||||
tag.NewBoolTag("handshake-complete", state.HandshakeComplete),
|
||||
tag.Bool("handshake-complete", state.HandshakeComplete),
|
||||
tag.Error(err))
|
||||
}
|
||||
case "WroteRequest":
|
||||
|
||||
@@ -146,7 +146,7 @@ func (s *TestCluster) CreateSession(
|
||||
if err != nil {
|
||||
s.logger.Fatal("CreateSession", tag.Error(err))
|
||||
}
|
||||
s.logger.Debug("created session", tag.NewStringTag("keyspace", keyspace))
|
||||
s.logger.Debug("created session", tag.String("keyspace", keyspace))
|
||||
}
|
||||
|
||||
// CreateDatabase from PersistenceTestCluster interface
|
||||
@@ -155,7 +155,7 @@ func (s *TestCluster) CreateDatabase() {
|
||||
if err != nil {
|
||||
s.logger.Fatal("CreateCassandraKeyspace", tag.Error(err))
|
||||
}
|
||||
s.logger.Info("created database", tag.NewStringTag("database", s.DatabaseName()))
|
||||
s.logger.Info("created database", tag.String("database", s.DatabaseName()))
|
||||
}
|
||||
|
||||
// DropDatabase from PersistenceTestCluster interface
|
||||
@@ -164,7 +164,7 @@ func (s *TestCluster) DropDatabase() {
|
||||
if err != nil && !strings.Contains(err.Error(), "AlreadyExists") {
|
||||
s.logger.Fatal("DropCassandraKeyspace", tag.Error(err))
|
||||
}
|
||||
s.logger.Info("dropped database", tag.NewStringTag("database", s.DatabaseName()))
|
||||
s.logger.Info("dropped database", tag.String("database", s.DatabaseName()))
|
||||
}
|
||||
|
||||
// LoadSchema from PersistenceTestCluster interface
|
||||
|
||||
@@ -115,10 +115,10 @@ func (rl *HealthRequestRateLimiterImpl) refreshRate() {
|
||||
metrics.DynamicRateLimiterMultiplier.With(rl.metricsHandler).Record(curRateMultiplier)
|
||||
rl.logger.Info(
|
||||
"Health threshold exceeded, reducing rate limit.",
|
||||
tag.NewFloat64("newMulti", curRateMultiplier),
|
||||
tag.NewFloat64("newRate", rl.rateLimiter.Rate()),
|
||||
tag.NewFloat64("latencyAvg", rl.healthSignals.AverageLatency()),
|
||||
tag.NewFloat64("errorRatio", rl.healthSignals.ErrorRatio()),
|
||||
tag.Float64("newMulti", curRateMultiplier),
|
||||
tag.Float64("newRate", rl.rateLimiter.Rate()),
|
||||
tag.Float64("latencyAvg", rl.healthSignals.AverageLatency()),
|
||||
tag.Float64("errorRatio", rl.healthSignals.ErrorRatio()),
|
||||
)
|
||||
} else if curRateMultiplier < curOptions.RateMultiMax {
|
||||
// already doing backoff and under thresholds, increase limit
|
||||
@@ -126,10 +126,10 @@ func (rl *HealthRequestRateLimiterImpl) refreshRate() {
|
||||
metrics.DynamicRateLimiterMultiplier.With(rl.metricsHandler).Record(curRateMultiplier)
|
||||
rl.logger.Info(
|
||||
"System healthy, increasing rate limit.",
|
||||
tag.NewFloat64("newMulti", curRateMultiplier),
|
||||
tag.NewFloat64("newRate", rl.rateLimiter.Rate()),
|
||||
tag.NewFloat64("latencyAvg", rl.healthSignals.AverageLatency()),
|
||||
tag.NewFloat64("errorRatio", rl.healthSignals.ErrorRatio()),
|
||||
tag.Float64("newMulti", curRateMultiplier),
|
||||
tag.Float64("newRate", rl.rateLimiter.Rate()),
|
||||
tag.Float64("latencyAvg", rl.healthSignals.AverageLatency()),
|
||||
tag.Float64("errorRatio", rl.healthSignals.ErrorRatio()),
|
||||
)
|
||||
}
|
||||
rl.curRateMultiplier.Store(&curRateMultiplier)
|
||||
|
||||
@@ -70,7 +70,7 @@ func (s *session) refresh() {
|
||||
|
||||
if time.Now().UTC().Sub(s.sessionInitTime) < sessionRefreshMinInternal {
|
||||
s.logger.Warn("gocql wrapper: did not refresh gocql session because the last refresh was too close",
|
||||
tag.NewDurationTag("min_refresh_interval_seconds", sessionRefreshMinInternal))
|
||||
tag.Duration("min_refresh_interval_seconds", sessionRefreshMinInternal))
|
||||
handler := s.metricsHandler.WithTags(metrics.FailureTag(refreshThrottleTagValue))
|
||||
metrics.CassandraSessionRefreshFailures.With(handler).Record(1)
|
||||
return
|
||||
|
||||
@@ -97,7 +97,7 @@ func (h *DatabaseHandle) reconnect(force bool) *sqlx.DB {
|
||||
lastRefresh := h.lastRefresh
|
||||
if now.Sub(lastRefresh) < sessionRefreshMinInternal {
|
||||
h.logger.Warn("sql handle: did not refresh database connection pool because the last refresh was too close",
|
||||
tag.NewDurationTag("min_refresh_interval_seconds", sessionRefreshMinInternal))
|
||||
tag.Duration("min_refresh_interval_seconds", sessionRefreshMinInternal))
|
||||
handler := h.metrics.WithTags(metrics.FailureTag("throttle"))
|
||||
metrics.PersistenceSessionRefreshFailures.With(handler).Record(1)
|
||||
return nil
|
||||
|
||||
@@ -134,7 +134,7 @@ func (s *TestCluster) CreateDatabase() {
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
s.logger.Info("created database", tag.NewStringTag("database", s.cfg.DatabaseName))
|
||||
s.logger.Info("created database", tag.String("database", s.cfg.DatabaseName))
|
||||
}
|
||||
|
||||
// DropDatabase from PersistenceTestCluster interface
|
||||
@@ -168,7 +168,7 @@ func (s *TestCluster) DropDatabase() {
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
s.logger.Info("dropped database", tag.NewStringTag("database", s.cfg.DatabaseName))
|
||||
s.logger.Info("dropped database", tag.String("database", s.cfg.DatabaseName))
|
||||
}
|
||||
|
||||
// LoadSchema from PersistenceTestCluster interface
|
||||
|
||||
@@ -144,8 +144,8 @@ func newVisibilityManager(
|
||||
}
|
||||
logger.Info(
|
||||
"creating new visibility manager",
|
||||
tag.NewStringTag(visibilityPluginNameTag.Key, visibilityPluginNameTag.Value),
|
||||
tag.NewStringTag(visibilityIndexNameTag.Key, visibilityIndexNameTag.Value),
|
||||
tag.String(visibilityPluginNameTag.Key, visibilityPluginNameTag.Value),
|
||||
tag.String(visibilityIndexNameTag.Key, visibilityIndexNameTag.Value),
|
||||
)
|
||||
var visManager manager.VisibilityManager = newVisibilityManagerImpl(
|
||||
visStore,
|
||||
|
||||
@@ -170,7 +170,7 @@ func (p *processorImpl) Add(request *client.BulkableRequest, visibilityTaskKey s
|
||||
p.logger.Fatal(fmt.Sprintf("mapToAckFuture has item of a wrong type %T (%T expected).", value, &ackFuture{}), tag.Value(key))
|
||||
}
|
||||
|
||||
p.logger.Warn("Skipping duplicate ES request for visibility task key.", tag.Key(visibilityTaskKey), tag.ESDocID(request.ID), tag.Value(request.Doc), tag.NewDurationTag("interval-between-duplicates", newFuture.createdAt.Sub(existingFuture.createdAt)))
|
||||
p.logger.Warn("Skipping duplicate ES request for visibility task key.", tag.Key(visibilityTaskKey), tag.ESDocID(request.ID), tag.Value(request.Doc), tag.Duration("interval-between-duplicates", newFuture.createdAt.Sub(existingFuture.createdAt)))
|
||||
metrics.ElasticsearchBulkProcessorDuplicateRequest.With(p.metricsHandler).Record(1)
|
||||
newFuture = existingFuture
|
||||
return nil
|
||||
|
||||
@@ -122,9 +122,9 @@ func (m *visibilityManagerMetrics) ListWorkflowExecutions(
|
||||
elapsed := time.Since(startTime)
|
||||
if elapsed > m.slowQueryThreshold() {
|
||||
m.logger.Warn("List query exceeded threshold",
|
||||
tag.NewDurationTag("duration", elapsed),
|
||||
tag.NewStringTag("visibility-query", request.Query),
|
||||
tag.NewStringerTag("namespace", request.Namespace),
|
||||
tag.Duration("duration", elapsed),
|
||||
tag.String("visibility-query", request.Query),
|
||||
tag.Stringer("namespace", request.Namespace),
|
||||
)
|
||||
}
|
||||
metrics.VisibilityPersistenceLatency.With(handler).Record(elapsed)
|
||||
@@ -140,9 +140,9 @@ func (m *visibilityManagerMetrics) ListChasmExecutions(
|
||||
elapsed := time.Since(startTime)
|
||||
if elapsed > m.slowQueryThreshold() {
|
||||
m.logger.Warn("List query exceeded threshold",
|
||||
tag.NewDurationTag("duration", elapsed),
|
||||
tag.NewStringTag("visibility-query", request.Query),
|
||||
tag.NewStringerTag("namespace", request.Namespace),
|
||||
tag.Duration("duration", elapsed),
|
||||
tag.String("visibility-query", request.Query),
|
||||
tag.Stringer("namespace", request.Namespace),
|
||||
)
|
||||
}
|
||||
metrics.VisibilityPersistenceLatency.With(handler).Record(elapsed)
|
||||
|
||||
@@ -98,7 +98,7 @@ func (l *quotaLogger[T]) updateQuota(newQuota T) {
|
||||
}
|
||||
|
||||
l.logger.Info("Quota changed",
|
||||
tag.NewAnyTag("current-quota", currentQuota),
|
||||
tag.NewAnyTag("new-quota", newQuota),
|
||||
tag.Any("current-quota", currentQuota),
|
||||
tag.Any("new-quota", newQuota),
|
||||
)
|
||||
}
|
||||
|
||||
@@ -24,8 +24,8 @@ func newDialTracer(
|
||||
) *dialTracer {
|
||||
l := log.With(
|
||||
logger,
|
||||
tag.NewStringTag("service", "client"),
|
||||
tag.NewStringTag("address", address),
|
||||
tag.String("service", "client"),
|
||||
tag.String("address", address),
|
||||
)
|
||||
|
||||
return &dialTracer{
|
||||
@@ -61,14 +61,14 @@ func (d *dialTracer) endNetworkDial(ndt *networkDialTrace, dialErr error) {
|
||||
|
||||
if dialErr != nil {
|
||||
fields := []tag.Tag{
|
||||
tag.NewDurationTag("totalDuration", total),
|
||||
tag.Duration("totalDuration", total),
|
||||
tag.Error(dialErr),
|
||||
tag.ErrorType(dialErr),
|
||||
tag.NewDurationTag("connectDuration", ndt.connectDuration),
|
||||
tag.NewStringTag("connectAddr", ndt.connectAddr),
|
||||
tag.Duration("connectDuration", ndt.connectDuration),
|
||||
tag.String("connectAddr", ndt.connectAddr),
|
||||
}
|
||||
if ndt.connectErr != nil {
|
||||
fields = append(fields, tag.NewStringTag("connectErr", ndt.connectErr.Error()))
|
||||
fields = append(fields, tag.String("connectErr", ndt.connectErr.Error()))
|
||||
}
|
||||
d.logger.Warn("network dial error", fields...)
|
||||
metrics.ServiceDialErrorCount.With(d.metricsHandler).Record(1)
|
||||
|
||||
@@ -126,7 +126,7 @@ func (i *BusinessIDInterceptor) Intercept(
|
||||
if businessID := extractor(ctx, req, info.FullMethod); businessID != "" {
|
||||
i.logger.Debug("business ID extraction: adding business ID to context",
|
||||
tag.WorkflowID(businessID),
|
||||
tag.NewStringTag("grpc-method", info.FullMethod),
|
||||
tag.String("grpc-method", info.FullMethod),
|
||||
)
|
||||
ctx = AddBusinessIDToContext(ctx, businessID)
|
||||
break
|
||||
|
||||
@@ -103,9 +103,9 @@ func (mi *MaskInternalErrorDetailsInterceptor) logError(
|
||||
logTags = []tag.Tag{tag.Operation(overridedMethodName), tag.WorkflowNamespace(nsName.String())}
|
||||
}
|
||||
|
||||
logTags = append(logTags, tag.NewStringTag("hash", errorHash))
|
||||
logTags = append(logTags, tag.String("hash", errorHash))
|
||||
|
||||
logTags = append(logTags, tag.NewStringerTag("grpc_code", statusCode))
|
||||
logTags = append(logTags, tag.Stringer("grpc_code", statusCode))
|
||||
logTags = append(logTags, mi.workflowTags.Extract(req, fullMethod)...)
|
||||
|
||||
mi.logger.Error("masked service failures", append(logTags, tag.Error(err))...)
|
||||
|
||||
@@ -90,7 +90,7 @@ func (eh *RequestErrorHandler) logError(
|
||||
return
|
||||
}
|
||||
|
||||
logTags = append(logTags, tag.NewStringerTag("grpc_code", statusCode))
|
||||
logTags = append(logTags, tag.Stringer("grpc_code", statusCode))
|
||||
logTags = append(logTags, eh.workflowTags.Extract(req, fullMethod)...)
|
||||
|
||||
eh.logger.Error("service failures", append(logTags, tag.Error(err))...)
|
||||
|
||||
@@ -59,8 +59,8 @@ func (i *SlowRequestLoggerInterceptor) logSlowRequest(
|
||||
method := info.FullMethod
|
||||
|
||||
tags := i.workflowTags.Extract(request, method)
|
||||
tags = append(tags, tag.NewDurationTag("duration", elapsed))
|
||||
tags = append(tags, tag.NewStringTag("method", method))
|
||||
tags = append(tags, tag.Duration("duration", elapsed))
|
||||
tags = append(tags, tag.String("method", method))
|
||||
|
||||
i.logger.Warn("Slow gRPC call", tags...)
|
||||
}
|
||||
|
||||
@@ -110,7 +110,7 @@ func (f *clientFactory) GetSystemClient() sdkclient.Client {
|
||||
}
|
||||
|
||||
if size := f.stickyCacheSize(); size > 0 {
|
||||
f.logger.Info("setting sticky workflow cache size", tag.NewInt("size", size))
|
||||
f.logger.Info("setting sticky workflow cache size", tag.Int("size", size))
|
||||
sdkworker.SetStickyWorkflowCacheSize(size)
|
||||
}
|
||||
})
|
||||
|
||||
@@ -39,7 +39,7 @@ func That(logger log.Logger, condition bool, staticMessage string, tags ...tag.T
|
||||
// Dynamic information should be passed via `tags`.
|
||||
//
|
||||
// Example:
|
||||
// softassert.Fail(logger, "unreachable code reached", tag.NewStringTag("state", object.state))
|
||||
// softassert.Fail(logger, "unreachable code reached", tag.String("state", object.state))
|
||||
func Fail(logger log.Logger, staticMessage string, tags ...tag.Tag) {
|
||||
logger.Error("failed assertion: "+staticMessage, append([]tag.Tag{tag.FailedAssertion}, tags...)...)
|
||||
}
|
||||
|
||||
@@ -80,13 +80,13 @@ func assertMatches(t *testing.T, level testlogger.Level, msg string, tags []tag.
|
||||
func TestTestLogger_ExpectationsMatch(t *testing.T) {
|
||||
for _, level := range []testlogger.Level{testlogger.Error, testlogger.DPanic, testlogger.Panic, testlogger.Fatal} {
|
||||
t.Run(level.String()+" with tags", func(t *testing.T) {
|
||||
assertMatches(t, level, "message with tags", []tag.Tag{tag.NewStringTag("key", "value")})
|
||||
assertMatches(t, level, "message with tags", []tag.Tag{tag.String("key", "value")})
|
||||
})
|
||||
t.Run(level.String()+" without tags", func(t *testing.T) {
|
||||
assertMatches(t, level, "message without tags", nil)
|
||||
})
|
||||
t.Run(level.String()+" no message only tags", func(t *testing.T) {
|
||||
assertMatches(t, level, "", []tag.Tag{tag.NewStringTag("key", "value")})
|
||||
assertMatches(t, level, "", []tag.Tag{tag.String("key", "value")})
|
||||
})
|
||||
}
|
||||
|
||||
@@ -118,20 +118,20 @@ func TestTestLogger_Uncaught(t *testing.T) {
|
||||
// Non-panicking levels
|
||||
for _, level := range []testlogger.Level{testlogger.Error, testlogger.DPanic} {
|
||||
t.Run(level.String()+" with tags", func(t *testing.T) {
|
||||
assertFails(t, level, "message with tags", []tag.Tag{tag.NewStringTag("key", "value")})
|
||||
assertFails(t, level, "message with tags", []tag.Tag{tag.String("key", "value")})
|
||||
})
|
||||
t.Run(level.String()+" without tags", func(t *testing.T) {
|
||||
assertFails(t, level, "message without tags", nil)
|
||||
})
|
||||
t.Run(level.String()+" no message only tags", func(t *testing.T) {
|
||||
assertFails(t, level, "", []tag.Tag{tag.NewStringTag("key", "value")})
|
||||
assertFails(t, level, "", []tag.Tag{tag.String("key", "value")})
|
||||
})
|
||||
}
|
||||
// Panicking levels
|
||||
for _, level := range []testlogger.Level{testlogger.Panic, testlogger.Fatal} {
|
||||
t.Run(level.String()+" with tags", func(t *testing.T) {
|
||||
require.Panics(t, func() {
|
||||
assertFails(t, level, "message with tags", []tag.Tag{tag.NewStringTag("key", "value")})
|
||||
assertFails(t, level, "message with tags", []tag.Tag{tag.String("key", "value")})
|
||||
})
|
||||
})
|
||||
t.Run(level.String()+" without tags", func(t *testing.T) {
|
||||
@@ -141,7 +141,7 @@ func TestTestLogger_Uncaught(t *testing.T) {
|
||||
})
|
||||
t.Run(level.String()+" no message only tags", func(t *testing.T) {
|
||||
require.Panics(t, func() {
|
||||
assertFails(t, level, "", []tag.Tag{tag.NewStringTag("key", "value")})
|
||||
assertFails(t, level, "", []tag.Tag{tag.String("key", "value")})
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ func (c chasmInvocation) WrapError(result invocationResult, err error) error {
|
||||
// returned. Intended to be used to hide internal errors from end users.
|
||||
func logInternalError(logger log.Logger, internalMsg string, internalErr error) error {
|
||||
referenceID := uuid.NewString()
|
||||
logger.Error(internalMsg, tag.Error(internalErr), tag.NewStringTag("reference-id", referenceID))
|
||||
logger.Error(internalMsg, tag.Error(internalErr), tag.String("reference-id", referenceID))
|
||||
return fmt.Errorf("internal error, reference-id: %v", referenceID)
|
||||
}
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@ func (n nexusInvocation) Invoke(ctx context.Context, ns *namespace.Namespace, e
|
||||
traceLogger := log.With(e.Logger,
|
||||
tag.WorkflowNamespace(ns.Name().String()),
|
||||
tag.Operation("CompleteNexusOperation"),
|
||||
tag.NewStringTag("destination", task.destination),
|
||||
tag.String("destination", task.destination),
|
||||
tag.WorkflowID(n.workflowID),
|
||||
tag.WorkflowRunID(n.runID),
|
||||
tag.AttemptStart(time.Now().UTC()),
|
||||
@@ -124,7 +124,7 @@ func (n nexusInvocation) Invoke(ctx context.Context, ns *namespace.Namespace, e
|
||||
|
||||
retryable := isRetryableHTTPResponse(response)
|
||||
err = readHandlerErrFromResponse(response, e.Logger)
|
||||
e.Logger.Error("Callback request failed", tag.Error(err), tag.NewStringTag("status", response.Status), tag.NewBoolTag("retryable", retryable))
|
||||
e.Logger.Error("Callback request failed", tag.Error(err), tag.String("status", response.Status), tag.Bool("retryable", retryable))
|
||||
if retryable {
|
||||
return invocationResultRetry{err}
|
||||
}
|
||||
@@ -143,7 +143,7 @@ func readHandlerErrFromResponse(response *http.Response, logger log.Logger) erro
|
||||
|
||||
body, err := readAndReplaceBody(response)
|
||||
if err != nil {
|
||||
logger.Error("Error reading response body for non-ok callback request", tag.Error(err), tag.NewStringTag("status", response.Status))
|
||||
logger.Error("Error reading response body for non-ok callback request", tag.Error(err), tag.String("status", response.Status))
|
||||
return err
|
||||
}
|
||||
|
||||
|
||||
@@ -150,7 +150,7 @@ func (h *completionHandler) CompleteOperation(ctx context.Context, r *nexusrpc.C
|
||||
"namespace ID in token doesn't match the token",
|
||||
tag.WorkflowNamespaceID(ns.ID().String()),
|
||||
tag.Error(err),
|
||||
tag.NewStringTag("completion-namespace-id", completion.GetNamespaceId()),
|
||||
tag.String("completion-namespace-id", completion.GetNamespaceId()),
|
||||
)
|
||||
return nexus.HandlerErrorf(nexus.HandlerErrorTypeBadRequest, "invalid callback token")
|
||||
}
|
||||
@@ -226,7 +226,7 @@ func (h *completionHandler) CompleteOperation(ctx context.Context, r *nexusrpc.C
|
||||
}
|
||||
default:
|
||||
// The Nexus SDK ensures this never happens but just in case...
|
||||
logger.Error("invalid operation state in completion request", tag.NewStringTag("state", string(r.State)), tag.Error(err))
|
||||
logger.Error("invalid operation state in completion request", tag.String("state", string(r.State)), tag.Error(err))
|
||||
return nexus.HandlerErrorf(nexus.HandlerErrorTypeBadRequest, "invalid completion state")
|
||||
}
|
||||
_, err = h.HistoryClient.CompleteNexusOperation(ctx, hr)
|
||||
|
||||
@@ -90,13 +90,13 @@ func (h *healthCheckerImpl) Check(ctx context.Context) (enumsspb.HealthState, er
|
||||
|
||||
hostDeclinedServingProportion := hostDeclinedServingCount / float64(len(hosts))
|
||||
if hostDeclinedServingProportion > proportionOfDeclinedServiceHosts {
|
||||
h.logger.Warn("health check exceeded host declined serving proportion threshold", tag.NewFloat64("host declined serving proportion threshold", proportionOfDeclinedServiceHosts))
|
||||
h.logger.Warn("health check exceeded host declined serving proportion threshold", tag.Float64("host declined serving proportion threshold", proportionOfDeclinedServiceHosts))
|
||||
return enumsspb.HEALTH_STATE_DECLINED_SERVING, nil
|
||||
}
|
||||
|
||||
failedHostCountProportion := failedHostCount / float64(len(hosts))
|
||||
if failedHostCountProportion+hostDeclinedServingProportion > h.hostFailurePercentage() {
|
||||
h.logger.Warn("health check exceeded host failure percentage threshold", tag.NewFloat64("host failure percentage threshold", h.hostFailurePercentage()), tag.NewFloat64("host failure percentage", failedHostCountProportion), tag.NewFloat64("host declined serving percentage", hostDeclinedServingProportion))
|
||||
h.logger.Warn("health check exceeded host failure percentage threshold", tag.Float64("host failure percentage threshold", h.hostFailurePercentage()), tag.Float64("host failure percentage", failedHostCountProportion), tag.Float64("host declined serving percentage", hostDeclinedServingProportion))
|
||||
return enumsspb.HEALTH_STATE_NOT_SERVING, nil
|
||||
}
|
||||
|
||||
|
||||
@@ -235,8 +235,8 @@ func (h *HTTPAPIServer) serveHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
h.logger.Debug(
|
||||
"HTTP API call",
|
||||
tag.NewStringTag("http-method", r.Method),
|
||||
tag.NewAnyTag("http-url", r.URL),
|
||||
tag.String("http-method", r.Method),
|
||||
tag.Any("http-url", r.URL),
|
||||
)
|
||||
|
||||
// Need to change the accept header based on whether pretty and/or
|
||||
|
||||
@@ -1029,9 +1029,9 @@ func (d *namespaceHandler) maybeUpdateFailoverHistory(
|
||||
) []*persistencespb.FailoverStatus {
|
||||
d.logger.Debug(
|
||||
"maybeUpdateFailoverHistory",
|
||||
tag.NewAnyTag("failoverHistory", failoverHistory),
|
||||
tag.NewAnyTag("updateReplConfig", updateReplicationConfig),
|
||||
tag.NewAnyTag("namespaceDetail", namespaceDetail),
|
||||
tag.Any("failoverHistory", failoverHistory),
|
||||
tag.Any("updateReplConfig", updateReplicationConfig),
|
||||
tag.Any("namespaceDetail", namespaceDetail),
|
||||
)
|
||||
if updateReplicationConfig == nil {
|
||||
d.logger.Debug("updateReplicationConfig was nil")
|
||||
|
||||
@@ -40,15 +40,15 @@ func (h *OpenAPIHTTPHandler) RegisterRoutes(r *mux.Router) {
|
||||
|
||||
rdr, err := gzip.NewReader(bytes.NewReader(spec))
|
||||
if err != nil {
|
||||
h.logger.Error("failed to initialize openapi spec reader", tag.NewInt("version", version), tag.Error(err))
|
||||
h.logger.Error("failed to initialize openapi spec reader", tag.Int("version", version), tag.Error(err))
|
||||
w.WriteHeader(http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
if _, err := io.Copy(w, rdr); err != nil {
|
||||
h.logger.Error("failed to send openapi spec", tag.NewInt("version", version), tag.Error(err))
|
||||
h.logger.Error("failed to send openapi spec", tag.Int("version", version), tag.Error(err))
|
||||
}
|
||||
if err := rdr.Close(); err != nil {
|
||||
h.logger.Error("failed to verify openapi spec checksum", tag.NewInt("version", version), tag.Error(err))
|
||||
h.logger.Error("failed to verify openapi spec checksum", tag.Int("version", version), tag.Error(err))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -214,8 +214,8 @@ func (h *OperatorHandlerImpl) addSearchAttributesElasticsearch(
|
||||
} else {
|
||||
h.logger.Warn(
|
||||
fmt.Sprintf(errSearchAttributeAlreadyExistsMessage, saName),
|
||||
tag.NewStringTag(visibilityIndexNameTagName, indexName),
|
||||
tag.NewStringTag(visibilitySearchAttributeTagName, saName),
|
||||
tag.String(visibilityIndexNameTagName, indexName),
|
||||
tag.String(visibilitySearchAttributeTagName, saName),
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -281,8 +281,8 @@ func (h *OperatorHandlerImpl) addSearchAttributesSQL(
|
||||
if _, ok := aliasToFieldMap[saName]; ok {
|
||||
h.logger.Warn(
|
||||
fmt.Sprintf(errSearchAttributeAlreadyExistsMessage, saName),
|
||||
tag.NewStringTag(namespaceTagName, nsName),
|
||||
tag.NewStringTag(visibilitySearchAttributeTagName, saName),
|
||||
tag.String(namespaceTagName, nsName),
|
||||
tag.String(visibilitySearchAttributeTagName, saName),
|
||||
)
|
||||
continue
|
||||
}
|
||||
|
||||
@@ -3343,7 +3343,7 @@ func (wh *WorkflowHandler) CreateSchedule(
|
||||
wh.logger.Debug("Received CreateSchedule",
|
||||
tag.ScheduleID(request.ScheduleId),
|
||||
tag.WorkflowNamespace(namespaceName.String()),
|
||||
tag.NewBoolTag("chasm-enabled", useChasmScheduler))
|
||||
tag.Bool("chasm-enabled", useChasmScheduler))
|
||||
|
||||
if request.Schedule == nil {
|
||||
request.Schedule = &schedulepb.Schedule{}
|
||||
@@ -5323,7 +5323,7 @@ func (wh *WorkflowHandler) DescribeBatchOperation(
|
||||
operationType = enumspb.BATCH_OPERATION_TYPE_UNPAUSE_ACTIVITY
|
||||
default:
|
||||
operationType = enumspb.BATCH_OPERATION_TYPE_UNSPECIFIED
|
||||
wh.throttledLogger.Warn("Unknown batch operation type", tag.NewStringTag("batch-operation-type", operationTypeString))
|
||||
wh.throttledLogger.Warn("Unknown batch operation type", tag.String("batch-operation-type", operationTypeString))
|
||||
}
|
||||
|
||||
batchOperationResp := &workflowservice.DescribeBatchOperationResponse{
|
||||
|
||||
@@ -245,9 +245,9 @@ func (handler *workflowTaskCompletedHandler) rejectUnprocessedUpdates(
|
||||
tag.WorkflowID(wfKey.WorkflowID),
|
||||
tag.WorkflowRunID(wfKey.RunID),
|
||||
tag.WorkflowEventID(workflowTaskScheduledEventID),
|
||||
tag.NewStringTag("worker-identity", workerIdentity),
|
||||
tag.NewStringsTag("update-ids", rejectedUpdateIDs),
|
||||
tag.NewInt("rejected-count", len(rejectedUpdateIDs)),
|
||||
tag.String("worker-identity", workerIdentity),
|
||||
tag.Strings("update-ids", rejectedUpdateIDs),
|
||||
tag.Int("rejected-count", len(rejectedUpdateIDs)),
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -257,7 +257,7 @@ func (a *archiver) recordArchiveTargetResult(logger log.Logger, startTime time.T
|
||||
if *err != nil {
|
||||
status = "err"
|
||||
|
||||
logger.Error("failed to archive target", tag.NewStringTag("target", string(target)), tag.Error(*err))
|
||||
logger.Error("failed to archive target", tag.String("target", string(target)), tag.Error(*err))
|
||||
}
|
||||
|
||||
tags := []metrics.Tag{
|
||||
|
||||
@@ -123,7 +123,7 @@ func (q *DLQWriter) WriteTaskToDLQ(
|
||||
tag.SourceCluster(sourceCluster),
|
||||
tag.TargetCluster(targetCluster),
|
||||
tag.TaskType(task.GetType()),
|
||||
tag.NewStringTag("task-category", task.GetCategory().Name()),
|
||||
tag.String("task-category", task.GetCategory().Name()),
|
||||
namespaceTag,
|
||||
)
|
||||
return nil
|
||||
|
||||
@@ -555,7 +555,7 @@ func (e *executableImpl) HandleErr(err error) (retErr error) {
|
||||
tag.Attempt(int32(e.attempt)),
|
||||
tag.UnexpectedErrorAttempts(int32(e.unexpectedErrorAttempts)),
|
||||
tag.LifeCycleProcessingFailed,
|
||||
tag.NewStringTag("task-category", e.GetCategory().Name()),
|
||||
tag.String("task-category", e.GetCategory().Name()),
|
||||
)
|
||||
if e.attempt > taskCriticalLogMetricAttempts {
|
||||
logger.Error("Critical error processing task, retrying.", tag.OperationCritical)
|
||||
|
||||
@@ -115,8 +115,8 @@ func NewScheduler(
|
||||
if !ok || weight <= 0 {
|
||||
logger.Warn("Task priority weight not specified or is invalid, using default weight",
|
||||
tag.TaskPriority(key.Priority.String()),
|
||||
tag.NewInt("priority-weight", weight),
|
||||
tag.NewInt("default-weight", configs.DefaultPriorityWeight),
|
||||
tag.Int("priority-weight", weight),
|
||||
tag.Int("default-weight", configs.DefaultPriorityWeight),
|
||||
)
|
||||
weight = configs.DefaultPriorityWeight
|
||||
}
|
||||
|
||||
@@ -461,8 +461,8 @@ func (e *ExecutableTaskImpl) Resend(
|
||||
tag.WorkflowNamespaceID(retryErr.NamespaceId),
|
||||
tag.WorkflowID(retryErr.WorkflowId),
|
||||
tag.WorkflowRunID(retryErr.RunId),
|
||||
tag.NewStringTag("first-resend-error", retryErr.Error()),
|
||||
tag.NewStringTag("second-resend-error", resendErr.Error()),
|
||||
tag.String("first-resend-error", retryErr.Error()),
|
||||
tag.String("second-resend-error", resendErr.Error()),
|
||||
)
|
||||
}
|
||||
// handle 2nd resend error, then 1st resend error
|
||||
@@ -474,8 +474,8 @@ func (e *ExecutableTaskImpl) Resend(
|
||||
tag.WorkflowNamespaceID(resendErr.NamespaceId),
|
||||
tag.WorkflowID(resendErr.WorkflowId),
|
||||
tag.WorkflowRunID(resendErr.RunId),
|
||||
tag.NewStringTag("first-resend-error", retryErr.Error()),
|
||||
tag.NewStringTag("second-resend-error", resendErr.Error()),
|
||||
tag.String("first-resend-error", retryErr.Error()),
|
||||
tag.String("second-resend-error", resendErr.Error()),
|
||||
tag.Error(err),
|
||||
)
|
||||
return false, resendErr
|
||||
@@ -484,8 +484,8 @@ func (e *ExecutableTaskImpl) Resend(
|
||||
tag.WorkflowNamespaceID(retryErr.NamespaceId),
|
||||
tag.WorkflowID(retryErr.WorkflowId),
|
||||
tag.WorkflowRunID(retryErr.RunId),
|
||||
tag.NewStringTag("first-resend-error", retryErr.Error()),
|
||||
tag.NewStringTag("second-resend-error", resendErr.Error()),
|
||||
tag.String("first-resend-error", retryErr.Error()),
|
||||
tag.String("second-resend-error", resendErr.Error()),
|
||||
)
|
||||
return false, resendErr
|
||||
}
|
||||
|
||||
@@ -106,7 +106,7 @@ func (s *Service) Start() {
|
||||
// pausing before joining membership can help separate the shard movement
|
||||
// caused by another history instance terminating with this instance starting.
|
||||
s.logger.Info("history start: delaying before membership start",
|
||||
tag.NewDurationTag("startupMembershipJoinDelay", delay))
|
||||
tag.Duration("startupMembershipJoinDelay", delay))
|
||||
time.Sleep(delay)
|
||||
}
|
||||
s.membershipMonitor.Start()
|
||||
|
||||
@@ -1340,7 +1340,7 @@ Loop:
|
||||
metrics.ShardInfoScheduledQueueLagTimer.With(metricsHandler).
|
||||
Record(lag, metrics.TaskCategoryTag(category.Name()))
|
||||
default:
|
||||
s.contextTaggedLogger.Error("Unknown task category type", tag.NewStringerTag("task-category", category.Type()))
|
||||
s.contextTaggedLogger.Error("Unknown task category type", tag.Stringer("task-category", category.Type()))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2086,7 +2086,7 @@ func newContext(
|
||||
if ioConcurrency != 1 && persistenceConfig.DataStores[persistenceConfig.DefaultStore].Cassandra != nil {
|
||||
throttledLogger.Warn(
|
||||
fmt.Sprintf("Cassandra persistence implementation only supports %v == 1", dynamicconfig.ShardIOConcurrency),
|
||||
tag.NewInt("shard-io-concurrency", ioConcurrency),
|
||||
tag.Int("shard-io-concurrency", ioConcurrency),
|
||||
)
|
||||
ioConcurrency = 1
|
||||
}
|
||||
|
||||
@@ -366,7 +366,7 @@ func (c *ControllerImpl) doLinger(ctx context.Context, shard historyi.Controllab
|
||||
if err := limiter.Wait(ctx); err != nil {
|
||||
c.contextTaggedLogger.Info("shardLinger: wait timed out",
|
||||
tag.ShardID(shard.GetShardID()),
|
||||
tag.NewDurationTag("duration", time.Now().Sub(startTime)),
|
||||
tag.Duration("duration", time.Since(startTime)),
|
||||
)
|
||||
metrics.ShardLingerTimeouts.With(c.taggedMetricsHandler).Record(1)
|
||||
break
|
||||
@@ -513,10 +513,10 @@ func (c *ControllerImpl) checkShardReadiness(
|
||||
|
||||
if ready.Load() != int32(len(shards)) {
|
||||
c.contextTaggedLogger.Info("initial shards not ready",
|
||||
tag.NewInt32("ready", ready.Load()), tag.NewInt("total", len(shards)))
|
||||
tag.Int32("ready", ready.Load()), tag.Int("total", len(shards)))
|
||||
return false
|
||||
}
|
||||
c.contextTaggedLogger.Info("initial shards ready", tag.NewInt("total", len(shards)))
|
||||
c.contextTaggedLogger.Info("initial shards ready", tag.Int("total", len(shards)))
|
||||
return true
|
||||
}
|
||||
|
||||
@@ -594,5 +594,5 @@ func IsShardOwnershipLostError(err error) bool {
|
||||
}
|
||||
|
||||
func numShardsTag(n int) tag.ZapTag {
|
||||
return tag.NewInt("numShards", n)
|
||||
return tag.Int("numShards", n)
|
||||
}
|
||||
|
||||
@@ -414,7 +414,7 @@ func (t *visibilityQueueTaskExecutor) processChasmTask(
|
||||
if err != nil {
|
||||
// To reach here, either the search attribute has been deregistered before task execution, which is valid behavior,
|
||||
// or there are delays in propagating search attribute mappings to History.
|
||||
t.logger.Warn("Failed to get field name for alias, ignoring search attribute", tag.NewStringTag("alias", alias), tag.Error(err))
|
||||
t.logger.Warn("Failed to get field name for alias, ignoring search attribute", tag.String("alias", alias), tag.Error(err))
|
||||
continue
|
||||
}
|
||||
searchattributes[fieldName] = value
|
||||
|
||||
@@ -188,7 +188,7 @@ func (c *ContextImpl) LoadMutableState(ctx context.Context, shardContext history
|
||||
|
||||
c.logger.Warn("Potential ID conflict across different archetypes",
|
||||
tag.Archetype(contextArchetype),
|
||||
tag.NewStringTag("mutable-state-archetype", mutableStateArchetype),
|
||||
tag.String("mutable-state-archetype", mutableStateArchetype),
|
||||
)
|
||||
return nil, serviceerror.NewNotFoundf(
|
||||
"CHASM Archetype missmatch for %v, expected: %s, actual: %s",
|
||||
|
||||
@@ -4167,7 +4167,7 @@ func (ms *MutableStateImpl) AddActivityTaskCompletedEvent(
|
||||
ms.logger.Warn(mutableStateInvalidHistoryActionMsg, opTag,
|
||||
tag.WorkflowEventID(ms.GetNextEventID()),
|
||||
tag.ErrorTypeInvalidHistoryAction,
|
||||
tag.Bool(ok),
|
||||
tag.Bool("hasActivityInfo", ok),
|
||||
tag.WorkflowScheduledEventID(scheduledEventID),
|
||||
tag.WorkflowStartedEventID(startedEventID))
|
||||
return nil, ms.createInternalServerError(opTag)
|
||||
@@ -4216,7 +4216,7 @@ func (ms *MutableStateImpl) AddActivityTaskFailedEvent(
|
||||
ms.logger.Warn(mutableStateInvalidHistoryActionMsg, opTag,
|
||||
tag.WorkflowEventID(ms.GetNextEventID()),
|
||||
tag.ErrorTypeInvalidHistoryAction,
|
||||
tag.Bool(ok),
|
||||
tag.Bool("hasActivityInfo", ok),
|
||||
tag.WorkflowScheduledEventID(scheduledEventID),
|
||||
tag.WorkflowStartedEventID(startedEventID))
|
||||
return nil, ms.createInternalServerError(opTag)
|
||||
@@ -4267,7 +4267,7 @@ func (ms *MutableStateImpl) AddActivityTaskTimedOutEvent(
|
||||
ms.logger.Warn(mutableStateInvalidHistoryActionMsg, opTag,
|
||||
tag.WorkflowEventID(ms.GetNextEventID()),
|
||||
tag.ErrorTypeInvalidHistoryAction,
|
||||
tag.Bool(ok),
|
||||
tag.Bool("hasActivityInfo", ok),
|
||||
tag.WorkflowScheduledEventID(ai.ScheduledEventId),
|
||||
tag.WorkflowStartedEventID(ai.StartedEventId),
|
||||
tag.WorkflowTimeoutType(timeoutType))
|
||||
@@ -4318,7 +4318,7 @@ func (ms *MutableStateImpl) AddActivityTaskCancelRequestedEvent(
|
||||
ms.logWarn(mutableStateInvalidHistoryActionMsg, opTag,
|
||||
tag.WorkflowEventID(ms.GetNextEventID()),
|
||||
tag.ErrorTypeInvalidHistoryAction,
|
||||
tag.Bool(ok),
|
||||
tag.Bool("hasActivityInfo", ok),
|
||||
tag.WorkflowScheduledEventID(scheduledEventID))
|
||||
|
||||
return nil, nil, ms.createCallerError(opTag, fmt.Sprintf("ScheduledEventID: %d", scheduledEventID))
|
||||
@@ -4330,7 +4330,7 @@ func (ms *MutableStateImpl) AddActivityTaskCancelRequestedEvent(
|
||||
ms.logWarn(mutableStateInvalidHistoryActionMsg, opTag,
|
||||
tag.WorkflowEventID(ms.GetNextEventID()),
|
||||
tag.ErrorTypeInvalidHistoryAction,
|
||||
tag.Bool(ok),
|
||||
tag.Bool("hasActivityInfo", ok),
|
||||
tag.WorkflowScheduledEventID(scheduledEventID))
|
||||
|
||||
return nil, nil, ms.createCallerError(opTag, fmt.Sprintf("ScheduledEventID: %d", scheduledEventID))
|
||||
@@ -4587,7 +4587,7 @@ func (ms *MutableStateImpl) AddWorkflowExecutionCancelRequestedEvent(
|
||||
tag.WorkflowEventID(ms.GetNextEventID()),
|
||||
tag.ErrorTypeInvalidHistoryAction,
|
||||
tag.WorkflowState(ms.executionState.State),
|
||||
tag.Bool(ms.executionInfo.CancelRequested),
|
||||
tag.Bool("cancelRequested", ms.executionInfo.CancelRequested),
|
||||
tag.Key(ms.executionInfo.CancelRequestId),
|
||||
)
|
||||
return nil, ms.createInternalServerError(opTag)
|
||||
@@ -5852,7 +5852,7 @@ func (ms *MutableStateImpl) AddChildWorkflowExecutionStartedEvent(
|
||||
ms.logWarn(mutableStateInvalidHistoryActionMsg, opTag,
|
||||
tag.WorkflowEventID(ms.GetNextEventID()),
|
||||
tag.ErrorTypeInvalidHistoryAction,
|
||||
tag.Bool(ok),
|
||||
tag.Bool("hasChildInfo", ok),
|
||||
tag.WorkflowInitiatedID(initiatedID))
|
||||
return nil, ms.createInternalServerError(opTag)
|
||||
}
|
||||
@@ -5913,7 +5913,7 @@ func (ms *MutableStateImpl) AddStartChildWorkflowExecutionFailedEvent(
|
||||
ms.logWarn(mutableStateInvalidHistoryActionMsg, opTag,
|
||||
tag.WorkflowEventID(ms.GetNextEventID()),
|
||||
tag.ErrorTypeInvalidHistoryAction,
|
||||
tag.Bool(ok),
|
||||
tag.Bool("hasChildInfo", ok),
|
||||
tag.WorkflowInitiatedID(initiatedID))
|
||||
return nil, ms.createInternalServerError(opTag)
|
||||
}
|
||||
@@ -5958,7 +5958,7 @@ func (ms *MutableStateImpl) AddChildWorkflowExecutionCompletedEvent(
|
||||
ms.logWarn(mutableStateInvalidHistoryActionMsg, opTag,
|
||||
tag.WorkflowEventID(ms.GetNextEventID()),
|
||||
tag.ErrorTypeInvalidHistoryAction,
|
||||
tag.Bool(ok),
|
||||
tag.Bool("hasChildInfo", ok),
|
||||
tag.WorkflowInitiatedID(initiatedID))
|
||||
return nil, ms.createInternalServerError(opTag)
|
||||
}
|
||||
@@ -6006,7 +6006,7 @@ func (ms *MutableStateImpl) AddChildWorkflowExecutionFailedEvent(
|
||||
ms.logWarn(mutableStateInvalidHistoryActionMsg,
|
||||
tag.WorkflowEventID(ms.GetNextEventID()),
|
||||
tag.ErrorTypeInvalidHistoryAction,
|
||||
tag.Bool(!ok),
|
||||
tag.Bool("doesntHaveChildInfo", !ok),
|
||||
tag.WorkflowInitiatedID(initiatedID))
|
||||
return nil, ms.createInternalServerError(opTag)
|
||||
}
|
||||
@@ -6055,7 +6055,7 @@ func (ms *MutableStateImpl) AddChildWorkflowExecutionCanceledEvent(
|
||||
ms.logWarn(mutableStateInvalidHistoryActionMsg, opTag,
|
||||
tag.WorkflowEventID(ms.GetNextEventID()),
|
||||
tag.ErrorTypeInvalidHistoryAction,
|
||||
tag.Bool(ok),
|
||||
tag.Bool("hasChildInfo", ok),
|
||||
tag.WorkflowInitiatedID(initiatedID))
|
||||
return nil, ms.createInternalServerError(opTag)
|
||||
}
|
||||
@@ -6102,7 +6102,7 @@ func (ms *MutableStateImpl) AddChildWorkflowExecutionTerminatedEvent(
|
||||
ms.logWarn(mutableStateInvalidHistoryActionMsg, opTag,
|
||||
tag.WorkflowEventID(ms.GetNextEventID()),
|
||||
tag.ErrorTypeInvalidHistoryAction,
|
||||
tag.Bool(ok),
|
||||
tag.Bool("hasChildInfo", ok),
|
||||
tag.WorkflowInitiatedID(initiatedID))
|
||||
return nil, ms.createInternalServerError(opTag)
|
||||
}
|
||||
@@ -6149,7 +6149,7 @@ func (ms *MutableStateImpl) AddChildWorkflowExecutionTimedOutEvent(
|
||||
ms.logWarn(mutableStateInvalidHistoryActionMsg, opTag,
|
||||
tag.WorkflowEventID(ms.GetNextEventID()),
|
||||
tag.ErrorTypeInvalidHistoryAction,
|
||||
tag.Bool(ok),
|
||||
tag.Bool("hasChildInfo", ok),
|
||||
tag.WorkflowInitiatedID(initiatedID))
|
||||
return nil, ms.createInternalServerError(opTag)
|
||||
}
|
||||
@@ -6497,16 +6497,16 @@ func (ms *MutableStateImpl) logReportedProblemsChange(oldPayload, newPayload []s
|
||||
if oldPayload == nil && newPayload != nil {
|
||||
// Adding search attribute
|
||||
ms.logger.Info("TemporalReportedProblems search attribute added",
|
||||
tag.NewStringsTag("reported-problems", newPayload))
|
||||
tag.Strings("reported-problems", newPayload))
|
||||
} else if oldPayload != nil && newPayload == nil {
|
||||
// Removing search attribute
|
||||
ms.logger.Info("TemporalReportedProblems search attribute removed",
|
||||
tag.NewStringsTag("previous-reported-problems", oldPayload))
|
||||
tag.Strings("previous-reported-problems", oldPayload))
|
||||
} else if oldPayload != nil && newPayload != nil {
|
||||
// Updating search attribute
|
||||
ms.logger.Info("TemporalReportedProblems search attribute updated",
|
||||
tag.NewStringsTag("previous-reported-problems", oldPayload),
|
||||
tag.NewStringsTag("reported-problems", newPayload))
|
||||
tag.Strings("previous-reported-problems", oldPayload),
|
||||
tag.Strings("reported-problems", newPayload))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -52,9 +52,9 @@ func (i *instrumentation) countRegistrySizeLimited(updateCount, registrySize, pa
|
||||
i.oneOf(metrics.WorkflowExecutionUpdateRegistrySizeLimited.Name())
|
||||
// TODO: remove log once limit is enforced everywhere
|
||||
i.log.Warn("update registry size limit reached",
|
||||
tag.NewInt("registry-size", registrySize),
|
||||
tag.NewInt("payload-size", payloadSize),
|
||||
tag.NewInt("update-count", updateCount))
|
||||
tag.Int("registry-size", registrySize),
|
||||
tag.Int("payload-size", payloadSize),
|
||||
tag.Int("update-count", updateCount))
|
||||
}
|
||||
|
||||
func (i *instrumentation) countTooMany() {
|
||||
@@ -65,8 +65,8 @@ func (i *instrumentation) countAborted(updateID string, reason AbortReason) {
|
||||
i.metrics.Counter(metrics.WorkflowExecutionUpdateAborted.Name()).
|
||||
Record(1, metrics.ReasonTag(metrics.ReasonString(reason.String())))
|
||||
i.log.Debug("update aborted",
|
||||
tag.NewStringTag("reason", reason.String()),
|
||||
tag.NewStringTag("update-id", updateID),
|
||||
tag.String("reason", reason.String()),
|
||||
tag.String("update-id", updateID),
|
||||
)
|
||||
}
|
||||
|
||||
@@ -84,9 +84,9 @@ func (i *instrumentation) invalidStateTransition(updateID string, msg proto.Mess
|
||||
i.log,
|
||||
"invalid state transition attempted",
|
||||
tag.ComponentWorkflowUpdate,
|
||||
tag.NewStringTag("update-id", updateID),
|
||||
tag.NewStringTag("message", fmt.Sprintf("%T", msg)),
|
||||
tag.NewStringerTag("state", state),
|
||||
tag.String("update-id", updateID),
|
||||
tag.String("message", fmt.Sprintf("%T", msg)),
|
||||
tag.Stringer("state", state),
|
||||
)
|
||||
}
|
||||
|
||||
@@ -102,8 +102,8 @@ func (i *instrumentation) stateChange(updateID string, from, to state) {
|
||||
i.log.Debug(
|
||||
"update state change",
|
||||
tag.ComponentWorkflowUpdate,
|
||||
tag.NewStringTag("update-id", updateID),
|
||||
tag.NewStringerTag("from-state", from),
|
||||
tag.NewStringerTag("to-state", to),
|
||||
tag.String("update-id", updateID),
|
||||
tag.Stringer("from-state", from),
|
||||
tag.Stringer("to-state", to),
|
||||
)
|
||||
}
|
||||
|
||||
@@ -303,9 +303,9 @@ func (db *taskQueueDB) updateAckLevelAndBacklogStats(subqueue subqueueIndex, new
|
||||
if newAckLevel < dbQueue.AckLevel {
|
||||
softassert.Fail(db.logger,
|
||||
"ack level in subqueue should not move backwards",
|
||||
tag.NewInt("subqueue-id", int(subqueue)),
|
||||
tag.NewAnyTag("cur-ack-level", dbQueue.AckLevel),
|
||||
tag.NewAnyTag("new-ack-level", newAckLevel))
|
||||
tag.Int("subqueue-id", int(subqueue)),
|
||||
tag.Any("cur-ack-level", dbQueue.AckLevel),
|
||||
tag.Any("new-ack-level", newAckLevel))
|
||||
}
|
||||
if dbQueue.AckLevel != newAckLevel {
|
||||
db.lastChange = time.Now()
|
||||
@@ -334,9 +334,9 @@ func (db *taskQueueDB) updateFairAckLevel(subqueue subqueueIndex, newAckLevel fa
|
||||
if prev := fairLevelFromProto(dbQueue.FairAckLevel); newAckLevel.less(prev) {
|
||||
softassert.Fail(db.logger,
|
||||
"ack level in subqueue should not move backwards",
|
||||
tag.NewInt("subqueue-id", int(subqueue)),
|
||||
tag.NewAnyTag("cur-ack-level", prev),
|
||||
tag.NewAnyTag("new-ack-level", newAckLevel))
|
||||
tag.Int("subqueue-id", int(subqueue)),
|
||||
tag.Any("cur-ack-level", prev),
|
||||
tag.Any("new-ack-level", newAckLevel))
|
||||
}
|
||||
dbQueue.FairAckLevel = newAckLevel.toProto()
|
||||
|
||||
|
||||
@@ -1901,11 +1901,11 @@ func (s *matchingEngineSuite) TestMultipleEnginesActivitiesRangeStealing() {
|
||||
s.mockHistoryClient.EXPECT().RecordActivityTaskStarted(gomock.Any(), gomock.Any(), gomock.Any()).DoAndReturn(
|
||||
func(ctx context.Context, taskRequest *historyservice.RecordActivityTaskStartedRequest, arg2 ...interface{}) (*historyservice.RecordActivityTaskStartedResponse, error) {
|
||||
if _, ok := startedTasks[taskRequest.GetScheduledEventId()]; ok {
|
||||
s.logger.Debug("From error function Mock Received DUPLICATED RecordActivityTaskStartedRequest", tag.NewInt64("scheduled-event-id", taskRequest.GetScheduledEventId()))
|
||||
s.logger.Debug("From error function Mock Received DUPLICATED RecordActivityTaskStartedRequest", tag.Int64("scheduled-event-id", taskRequest.GetScheduledEventId()))
|
||||
return nil, serviceerror.NewNotFound("already started")
|
||||
}
|
||||
|
||||
s.logger.Debug("Mock Received RecordActivityTaskStartedRequest", tag.NewInt64("scheduled-event-id", taskRequest.GetScheduledEventId()))
|
||||
s.logger.Debug("Mock Received RecordActivityTaskStartedRequest", tag.Int64("scheduled-event-id", taskRequest.GetScheduledEventId()))
|
||||
startedTasks[taskRequest.GetScheduledEventId()] = struct{}{}
|
||||
return &historyservice.RecordActivityTaskStartedResponse{
|
||||
Attempt: 1,
|
||||
@@ -2053,11 +2053,11 @@ func (s *matchingEngineSuite) TestMultipleEnginesWorkflowTasksRangeStealing() {
|
||||
s.mockHistoryClient.EXPECT().RecordWorkflowTaskStarted(gomock.Any(), gomock.Any(), gomock.Any()).DoAndReturn(
|
||||
func(ctx context.Context, taskRequest *historyservice.RecordWorkflowTaskStartedRequest, arg2 ...interface{}) (*historyservice.RecordWorkflowTaskStartedResponse, error) {
|
||||
if _, ok := startedTasks[taskRequest.GetScheduledEventId()]; ok {
|
||||
s.logger.Debug("From error function Mock Received DUPLICATED RecordWorkflowTaskStartedRequest", tag.NewInt64("scheduled-event-id", taskRequest.GetScheduledEventId()))
|
||||
s.logger.Debug("From error function Mock Received DUPLICATED RecordWorkflowTaskStartedRequest", tag.Int64("scheduled-event-id", taskRequest.GetScheduledEventId()))
|
||||
return nil, serviceerrors.NewTaskAlreadyStarted("Workflow")
|
||||
}
|
||||
|
||||
s.logger.Debug("Mock Received RecordWorkflowTaskStartedRequest", tag.NewInt64("scheduled-event-id", taskRequest.GetScheduledEventId()))
|
||||
s.logger.Debug("Mock Received RecordWorkflowTaskStartedRequest", tag.Int64("scheduled-event-id", taskRequest.GetScheduledEventId()))
|
||||
startedTasks[taskRequest.GetScheduledEventId()] = struct{}{}
|
||||
return &historyservice.RecordWorkflowTaskStartedResponse{
|
||||
PreviousStartedEventId: startedEventID,
|
||||
|
||||
@@ -117,11 +117,11 @@ var (
|
||||
errDeploymentVersionNotReady = serviceerror.NewUnavailable("task queue is not ready to process polls from this deployment version, try again shortly")
|
||||
ErrBlackholedQuery = "You are trying to query a closed Workflow that is PINNED to Worker Deployment Version %s, but %s is drained and has no pollers to answer the query. Immediately: You can re-deploy Workers in this Deployment Version to take those queries, or you can workflow update-options to change your workflow to AUTO_UPGRADE. For the future: In your infrastructure, consider waiting longer after the last queried timestamp as reported in Describe Deployment before you sunset Workers. Or mark this workflow as AUTO_UPGRADE."
|
||||
|
||||
backlogTagClassic = tag.NewStringTag("backlog", "classic")
|
||||
backlogTagPriority = tag.NewStringTag("backlog", "priority")
|
||||
backlogTagFairness = tag.NewStringTag("backlog", "fairness")
|
||||
backlogTagPriorityDrain = tag.NewStringTag("backlog", "priority-drain")
|
||||
backlogTagFairnessDrain = tag.NewStringTag("backlog", "fairness-drain")
|
||||
backlogTagClassic = tag.String("backlog", "classic")
|
||||
backlogTagPriority = tag.String("backlog", "priority")
|
||||
backlogTagFairness = tag.String("backlog", "fairness")
|
||||
backlogTagPriorityDrain = tag.String("backlog", "priority-drain")
|
||||
backlogTagFairnessDrain = tag.String("backlog", "fairness-drain")
|
||||
)
|
||||
|
||||
func newPhysicalTaskQueueManager(
|
||||
|
||||
@@ -429,9 +429,9 @@ func (m *userDataManagerImpl) refreshUserDataFromDB(ctx context.Context) error {
|
||||
|
||||
tags := []tag.Tag{
|
||||
tag.UserDataVersion(response.UserData.GetVersion()),
|
||||
tag.NewInt64("expected-user-data-version", m.userData.GetVersion()),
|
||||
tag.Int64("expected-user-data-version", m.userData.GetVersion()),
|
||||
tag.Timestamp(hybrid_logical_clock.UTC(response.UserData.GetData().GetClock())),
|
||||
tag.NewTimeTag("expected-user-data-timestamp", hybrid_logical_clock.UTC(m.userData.GetData().GetClock())),
|
||||
tag.Time("expected-user-data-timestamp", hybrid_logical_clock.UTC(m.userData.GetData().GetClock())),
|
||||
}
|
||||
|
||||
if response.UserData.GetVersion() < m.userData.GetVersion() {
|
||||
@@ -524,7 +524,7 @@ func (m *userDataManagerImpl) updateUserData(
|
||||
return userData, false, err
|
||||
}
|
||||
if err != nil {
|
||||
m.logger.Error("user data update function failed", tag.Error(err), tag.NewStringTag("user-data-update-source", options.Source))
|
||||
m.logger.Error("user data update function failed", tag.Error(err), tag.String("user-data-update-source", options.Source))
|
||||
return nil, false, err
|
||||
}
|
||||
|
||||
@@ -559,7 +559,7 @@ func (m *userDataManagerImpl) updateUserData(
|
||||
}
|
||||
|
||||
updatedVersionedData := &persistencespb.VersionedTaskQueueUserData{Version: preUpdateVersion + 1, Data: updatedUserData}
|
||||
m.logNewUserData("modified user data", updatedVersionedData, tag.NewStringTag("user-data-update-source", options.Source))
|
||||
m.logNewUserData("modified user data", updatedVersionedData, tag.String("user-data-update-source", options.Source))
|
||||
m.setUserDataLocked(updatedVersionedData)
|
||||
|
||||
return updatedVersionedData, shouldReplicate, err
|
||||
@@ -588,7 +588,7 @@ func (m *userDataManagerImpl) HandleGetUserDataRequest(
|
||||
// If we're closing, return a success with no data, as if the request expired. We shouldn't
|
||||
// close due to idleness (because of the MarkAlive above), so we're probably closing due to a
|
||||
// change of ownership. The caller will retry and be redirected to the new owner.
|
||||
m.logger.Debug("returning empty user data (closing)", tag.NewBoolTag("long-poll", req.WaitNewData))
|
||||
m.logger.Debug("returning empty user data (closing)", tag.Bool("long-poll", req.WaitNewData))
|
||||
return &matchingservice.GetTaskQueueUserDataResponse{}, nil
|
||||
} else if err != nil {
|
||||
return nil, err
|
||||
@@ -597,11 +597,11 @@ func (m *userDataManagerImpl) HandleGetUserDataRequest(
|
||||
newEphData := ephData.GetVersion() > lastEphVersion
|
||||
if newUserData || newEphData {
|
||||
m.logger.Info("returning user data",
|
||||
tag.NewBoolTag("long-poll", req.WaitNewData),
|
||||
tag.NewInt64("request-known-version", lastVersion),
|
||||
tag.Bool("long-poll", req.WaitNewData),
|
||||
tag.Int64("request-known-version", lastVersion),
|
||||
tag.UserDataVersion(userData.GetVersion()),
|
||||
tag.NewInt64("request-eph-data-version", lastEphVersion),
|
||||
tag.NewInt64("eph-data-version", ephData.GetVersion()),
|
||||
tag.Int64("request-eph-data-version", lastEphVersion),
|
||||
tag.Int64("eph-data-version", ephData.GetVersion()),
|
||||
)
|
||||
var res matchingservice.GetTaskQueueUserDataResponse
|
||||
if newUserData {
|
||||
@@ -620,7 +620,7 @@ func (m *userDataManagerImpl) HandleGetUserDataRequest(
|
||||
// due to an edge case in during ownership transfer.
|
||||
// We rely on client retries in this case to let the system eventually self-heal.
|
||||
m.logger.Error("requested task queue user data for version greater than known version",
|
||||
tag.NewInt64("request-known-version", lastVersion),
|
||||
tag.Int64("request-known-version", lastVersion),
|
||||
tag.UserDataVersion(userData.Version),
|
||||
)
|
||||
return nil, errRequestedVersionTooLarge
|
||||
@@ -638,7 +638,7 @@ func (m *userDataManagerImpl) HandleGetUserDataRequest(
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
m.logger.Debug("returning empty user data (expired)",
|
||||
tag.NewInt64("request-known-version", lastVersion),
|
||||
tag.Int64("request-known-version", lastVersion),
|
||||
tag.UserDataVersion(userData.GetVersion()),
|
||||
)
|
||||
return &matchingservice.GetTaskQueueUserDataResponse{}, nil
|
||||
|
||||
@@ -190,9 +190,9 @@ func (a *localActivities) GenerateDeletedNamespaceNameActivity(ctx context.Conte
|
||||
})
|
||||
switch err.(type) {
|
||||
case nil:
|
||||
logger.Warn("Regenerate namespace name due to collision.", tag.NewStringTag("wf-new-namespace", newName))
|
||||
logger.Warn("Regenerate namespace name due to collision.", tag.String("wf-new-namespace", newName))
|
||||
case *serviceerror.NamespaceNotFound:
|
||||
logger.Info("Generated new name for deleted namespace.", tag.NewStringTag("wf-new-namespace", newName))
|
||||
logger.Info("Generated new name for deleted namespace.", tag.String("wf-new-namespace", newName))
|
||||
return namespace.Name(newName), nil
|
||||
default:
|
||||
logger.Error("Unable to get namespace details.", tag.Error(err))
|
||||
|
||||
@@ -187,7 +187,7 @@ func DeleteNamespaceWorkflow(ctx workflow.Context, params DeleteNamespaceWorkflo
|
||||
logger.Error("Child workflow error.", tag.Error(err))
|
||||
return result, err
|
||||
}
|
||||
logger.Info("Child workflow executed successfully.", tag.NewStringTag("wf-child-type", reclaimresources.WorkflowName))
|
||||
logger.Info("Child workflow executed successfully.", tag.String("wf-child-type", reclaimresources.WorkflowName))
|
||||
|
||||
logger.Info("Workflow finished successfully.")
|
||||
return result, nil
|
||||
|
||||
@@ -245,17 +245,17 @@ func (a *activities) checkReplicationOnce(ctx context.Context, waitRequest waitR
|
||||
return false, fmt.Errorf("GetReplicationStatus response for shard %d does not contains remote cluster %s", shard.ShardId, waitRequest.RemoteCluster)
|
||||
}
|
||||
a.logger.Info("Wait catchup not ready",
|
||||
tag.NewInt32("ShardId", shard.ShardId),
|
||||
tag.NewStringTag("RemoteCluster", waitRequest.RemoteCluster),
|
||||
tag.NewInt64("AckedTaskId", clusterInfo.AckedTaskId),
|
||||
tag.NewInt64("WaitForTaskId", waitRequest.WaitForTaskIds[shard.ShardId]),
|
||||
tag.NewDurationTag("AllowedLagging", waitRequest.AllowedLagging),
|
||||
tag.NewDurationTag("ActualLagging", shard.MaxReplicationTaskVisibilityTime.AsTime().Sub(clusterInfo.AckedTaskVisibilityTime.AsTime())),
|
||||
tag.NewInt64("MaxReplicationTaskId", shard.MaxReplicationTaskId),
|
||||
tag.NewTimeTag("MaxReplicationTaskVisibilityTime", shard.MaxReplicationTaskVisibilityTime.AsTime()),
|
||||
tag.NewTimeTag("AckedTaskVisibilityTime", clusterInfo.AckedTaskVisibilityTime.AsTime()),
|
||||
tag.NewInt64("AllowedLaggingTasks", waitRequest.AllowedLaggingTasks),
|
||||
tag.NewInt64("ActualLaggingTasks", shard.MaxReplicationTaskId-clusterInfo.AckedTaskId),
|
||||
tag.Int32("ShardId", shard.ShardId),
|
||||
tag.String("RemoteCluster", waitRequest.RemoteCluster),
|
||||
tag.Int64("AckedTaskId", clusterInfo.AckedTaskId),
|
||||
tag.Int64("WaitForTaskId", waitRequest.WaitForTaskIds[shard.ShardId]),
|
||||
tag.Duration("AllowedLagging", waitRequest.AllowedLagging),
|
||||
tag.Duration("ActualLagging", shard.MaxReplicationTaskVisibilityTime.AsTime().Sub(clusterInfo.AckedTaskVisibilityTime.AsTime())),
|
||||
tag.Int64("MaxReplicationTaskId", shard.MaxReplicationTaskId),
|
||||
tag.Time("MaxReplicationTaskVisibilityTime", shard.MaxReplicationTaskVisibilityTime.AsTime()),
|
||||
tag.Time("AckedTaskVisibilityTime", clusterInfo.AckedTaskVisibilityTime.AsTime()),
|
||||
tag.Int64("AllowedLaggingTasks", waitRequest.AllowedLaggingTasks),
|
||||
tag.Int64("ActualLaggingTasks", shard.MaxReplicationTaskId-clusterInfo.AckedTaskId),
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -327,12 +327,12 @@ func (a *activities) checkHandoverOnce(ctx context.Context, waitRequest waitHand
|
||||
a.logger.Info("Wait handover missing handover namespace info", tag.ShardID(shard.ShardId), tag.ClusterName(waitRequest.RemoteCluster), tag.WorkflowNamespace(waitRequest.Namespace))
|
||||
} else {
|
||||
a.logger.Info("Wait handover not ready",
|
||||
tag.NewInt32("ShardId", shard.ShardId),
|
||||
tag.NewInt64("AckedTaskId", clusterInfo.AckedTaskId),
|
||||
tag.NewInt64("HandoverTaskId", handoverInfo.HandoverReplicationTaskId),
|
||||
tag.NewStringTag("Namespace", waitRequest.Namespace),
|
||||
tag.NewStringTag("RemoteCluster", waitRequest.RemoteCluster),
|
||||
tag.NewInt64("MaxReplicationTaskId", shard.MaxReplicationTaskId),
|
||||
tag.Int32("ShardId", shard.ShardId),
|
||||
tag.Int64("AckedTaskId", clusterInfo.AckedTaskId),
|
||||
tag.Int64("HandoverTaskId", handoverInfo.HandoverReplicationTaskId),
|
||||
tag.String("Namespace", waitRequest.Namespace),
|
||||
tag.String("RemoteCluster", waitRequest.RemoteCluster),
|
||||
tag.Int64("MaxReplicationTaskId", shard.MaxReplicationTaskId),
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -345,9 +345,9 @@ func (a *activities) checkHandoverOnce(ctx context.Context, waitRequest waitHand
|
||||
metrics.TargetClusterTag(waitRequest.RemoteCluster),
|
||||
metrics.NamespaceTag(waitRequest.Namespace))
|
||||
a.logger.Info("Wait handover ready shard count.",
|
||||
tag.NewInt("ReadyShards", readyShardCount),
|
||||
tag.NewStringTag("Namespace", waitRequest.Namespace),
|
||||
tag.NewStringTag("RemoteCluster", waitRequest.RemoteCluster))
|
||||
tag.Int("ReadyShards", readyShardCount),
|
||||
tag.String("Namespace", waitRequest.Namespace),
|
||||
tag.String("RemoteCluster", waitRequest.RemoteCluster))
|
||||
|
||||
return readyShardCount == len(resp.Shards), nil
|
||||
}
|
||||
@@ -1035,17 +1035,17 @@ func (a *activities) checkReplicationOnRemoteCluster(ctx context.Context, waitRe
|
||||
}
|
||||
|
||||
a.logger.Info("Wait catchup not ready",
|
||||
tag.NewInt32("ShardId", shard.ShardId),
|
||||
tag.NewInt64("AckedTaskId", clusterInfo.AckedTaskId),
|
||||
tag.NewStringTag("Namespace", waitRequest.Namespace),
|
||||
tag.NewStringTag("CatchupCluster", waitRequest.CatchupCluster),
|
||||
tag.NewStringTag("TargetCluster", waitRequest.TargetCluster),
|
||||
tag.NewInt64("targetAckIDOnShard", targetAckIDOnShard[shard.ShardId]),
|
||||
tag.NewInt64("MaxReplicationTaskId", shard.MaxReplicationTaskId),
|
||||
tag.NewDurationTag("ActualLagging", shard.MaxReplicationTaskVisibilityTime.AsTime().Sub(clusterInfo.AckedTaskVisibilityTime.AsTime())),
|
||||
tag.NewTimeTag("MaxReplicationTaskVisibilityTime", shard.MaxReplicationTaskVisibilityTime.AsTime()),
|
||||
tag.NewTimeTag("AckedTaskVisibilityTime", clusterInfo.AckedTaskVisibilityTime.AsTime()),
|
||||
tag.NewInt64("ActualLaggingTasks", shard.MaxReplicationTaskId-clusterInfo.AckedTaskId),
|
||||
tag.Int32("ShardId", shard.ShardId),
|
||||
tag.Int64("AckedTaskId", clusterInfo.AckedTaskId),
|
||||
tag.String("Namespace", waitRequest.Namespace),
|
||||
tag.String("CatchupCluster", waitRequest.CatchupCluster),
|
||||
tag.String("TargetCluster", waitRequest.TargetCluster),
|
||||
tag.Int64("targetAckIDOnShard", targetAckIDOnShard[shard.ShardId]),
|
||||
tag.Int64("MaxReplicationTaskId", shard.MaxReplicationTaskId),
|
||||
tag.Duration("ActualLagging", shard.MaxReplicationTaskVisibilityTime.AsTime().Sub(clusterInfo.AckedTaskVisibilityTime.AsTime())),
|
||||
tag.Time("MaxReplicationTaskVisibilityTime", shard.MaxReplicationTaskVisibilityTime.AsTime()),
|
||||
tag.Time("AckedTaskVisibilityTime", clusterInfo.AckedTaskVisibilityTime.AsTime()),
|
||||
tag.Int64("ActualLaggingTasks", shard.MaxReplicationTaskId-clusterInfo.AckedTaskId),
|
||||
)
|
||||
|
||||
}
|
||||
|
||||
@@ -354,7 +354,7 @@ func (w *perNamespaceWorker) handleError(err error) {
|
||||
w.logger.Error("Failed to start sdk worker, out of retries", tag.Error(err))
|
||||
return
|
||||
}
|
||||
w.logger.Warn("Failed to start sdk worker", tag.Error(err), tag.NewDurationTag("sleep", sleep))
|
||||
w.logger.Warn("Failed to start sdk worker", tag.Error(err), tag.Duration("sleep", sleep))
|
||||
}
|
||||
|
||||
w.retryTimer = time.AfterFunc(sleep, func() {
|
||||
|
||||
@@ -1219,8 +1219,8 @@ func (d *ClientImpl) convertAndRecordError(operation string, deploymentName stri
|
||||
tag.Error(*retErr),
|
||||
tag.Operation(operation),
|
||||
tag.Deployment(deploymentName),
|
||||
tag.NewDurationTag("elapsed", elapsed),
|
||||
tag.NewAnyTag("args", args),
|
||||
tag.Duration("elapsed", elapsed),
|
||||
tag.Any("args", args),
|
||||
)
|
||||
} else {
|
||||
if isRetryableUpdateError(*retErr) || isRetryableQueryError(*retErr) {
|
||||
@@ -1228,8 +1228,8 @@ func (d *ClientImpl) convertAndRecordError(operation string, deploymentName stri
|
||||
tag.Error(*retErr),
|
||||
tag.Operation(operation),
|
||||
tag.Deployment(deploymentName),
|
||||
tag.NewDurationTag("elapsed", elapsed),
|
||||
tag.NewAnyTag("args", args),
|
||||
tag.Duration("elapsed", elapsed),
|
||||
tag.Any("args", args),
|
||||
)
|
||||
var errResourceExhausted *serviceerror.ResourceExhausted
|
||||
if !errors.As(*retErr, &errResourceExhausted) || errResourceExhausted.Cause != enumspb.RESOURCE_EXHAUSTED_CAUSE_WORKER_DEPLOYMENT_LIMITS {
|
||||
@@ -1250,16 +1250,16 @@ func (d *ClientImpl) convertAndRecordError(operation string, deploymentName stri
|
||||
tag.Error(*retErr),
|
||||
tag.Operation(operation),
|
||||
tag.Deployment(deploymentName),
|
||||
tag.NewDurationTag("elapsed", elapsed),
|
||||
tag.NewAnyTag("args", args),
|
||||
tag.Duration("elapsed", elapsed),
|
||||
tag.Any("args", args),
|
||||
)
|
||||
} else {
|
||||
d.logger.Error("deployment client unexpected error",
|
||||
tag.Error(*retErr),
|
||||
tag.Operation(operation),
|
||||
tag.Deployment(deploymentName),
|
||||
tag.NewDurationTag("elapsed", elapsed),
|
||||
tag.NewAnyTag("args", args),
|
||||
tag.Duration("elapsed", elapsed),
|
||||
tag.Any("args", args),
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -1267,8 +1267,8 @@ func (d *ClientImpl) convertAndRecordError(operation string, deploymentName stri
|
||||
d.logger.Debug("deployment client success",
|
||||
tag.Operation(operation),
|
||||
tag.Deployment(deploymentName),
|
||||
tag.NewDurationTag("elapsed", elapsed),
|
||||
tag.NewAnyTag("args", args),
|
||||
tag.Duration("elapsed", elapsed),
|
||||
tag.Any("args", args),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -552,7 +552,7 @@ func genericFrontendServiceProvider(
|
||||
// extra tag to differentiate.
|
||||
tags := []tag.Tag{tag.Service(primitives.FrontendService)}
|
||||
if serviceName == primitives.InternalFrontendService {
|
||||
tags = append(tags, tag.NewBoolTag("internal-frontend", true))
|
||||
tags = append(tags, tag.Bool("internal-frontend", true))
|
||||
}
|
||||
return log.With(params.Logger, tags...)
|
||||
}),
|
||||
@@ -1096,83 +1096,83 @@ func (l *fxLogAdapter) LogEvent(e fxevent.Event) {
|
||||
case *fxevent.OnStartExecuting:
|
||||
l.logger.Debug("OnStart hook executing",
|
||||
tag.ComponentFX,
|
||||
tag.NewStringTag("callee", e.FunctionName),
|
||||
tag.NewStringTag("caller", e.CallerName),
|
||||
tag.String("callee", e.FunctionName),
|
||||
tag.String("caller", e.CallerName),
|
||||
)
|
||||
case *fxevent.OnStartExecuted:
|
||||
if e.Err != nil {
|
||||
l.logger.Error("OnStart hook failed",
|
||||
tag.ComponentFX,
|
||||
tag.NewStringTag("callee", e.FunctionName),
|
||||
tag.NewStringTag("caller", e.CallerName),
|
||||
tag.String("callee", e.FunctionName),
|
||||
tag.String("caller", e.CallerName),
|
||||
tag.Error(e.Err),
|
||||
)
|
||||
} else {
|
||||
l.logger.Debug("OnStart hook executed",
|
||||
tag.ComponentFX,
|
||||
tag.NewStringTag("callee", e.FunctionName),
|
||||
tag.NewStringTag("caller", e.CallerName),
|
||||
tag.NewStringerTag("runtime", e.Runtime),
|
||||
tag.String("callee", e.FunctionName),
|
||||
tag.String("caller", e.CallerName),
|
||||
tag.Stringer("runtime", e.Runtime),
|
||||
)
|
||||
}
|
||||
case *fxevent.OnStopExecuting:
|
||||
l.logger.Debug("OnStop hook executing",
|
||||
tag.ComponentFX,
|
||||
tag.NewStringTag("callee", e.FunctionName),
|
||||
tag.NewStringTag("caller", e.CallerName),
|
||||
tag.String("callee", e.FunctionName),
|
||||
tag.String("caller", e.CallerName),
|
||||
)
|
||||
case *fxevent.OnStopExecuted:
|
||||
if e.Err != nil {
|
||||
l.logger.Error("OnStop hook failed",
|
||||
tag.ComponentFX,
|
||||
tag.NewStringTag("callee", e.FunctionName),
|
||||
tag.NewStringTag("caller", e.CallerName),
|
||||
tag.String("callee", e.FunctionName),
|
||||
tag.String("caller", e.CallerName),
|
||||
tag.Error(e.Err),
|
||||
)
|
||||
} else {
|
||||
l.logger.Debug("OnStop hook executed",
|
||||
tag.ComponentFX,
|
||||
tag.NewStringTag("callee", e.FunctionName),
|
||||
tag.NewStringTag("caller", e.CallerName),
|
||||
tag.NewStringerTag("runtime", e.Runtime),
|
||||
tag.String("callee", e.FunctionName),
|
||||
tag.String("caller", e.CallerName),
|
||||
tag.Stringer("runtime", e.Runtime),
|
||||
)
|
||||
}
|
||||
case *fxevent.Supplied:
|
||||
if e.Err != nil {
|
||||
l.logger.Error("supplied",
|
||||
tag.ComponentFX,
|
||||
tag.NewStringTag("type", e.TypeName),
|
||||
tag.NewStringTag("module", e.ModuleName),
|
||||
tag.String("type", e.TypeName),
|
||||
tag.String("module", e.ModuleName),
|
||||
tag.Error(e.Err))
|
||||
}
|
||||
case *fxevent.Provided:
|
||||
if e.Err != nil {
|
||||
l.logger.Error("error encountered while applying options",
|
||||
tag.ComponentFX,
|
||||
tag.NewStringTag("module", e.ModuleName),
|
||||
tag.String("module", e.ModuleName),
|
||||
tag.Error(e.Err))
|
||||
}
|
||||
case *fxevent.Replaced:
|
||||
if e.Err != nil {
|
||||
l.logger.Error("error encountered while replacing",
|
||||
tag.ComponentFX,
|
||||
tag.NewStringTag("module", e.ModuleName),
|
||||
tag.String("module", e.ModuleName),
|
||||
tag.Error(e.Err))
|
||||
}
|
||||
case *fxevent.Decorated:
|
||||
if e.Err != nil {
|
||||
l.logger.Error("error encountered while applying options",
|
||||
tag.ComponentFX,
|
||||
tag.NewStringTag("module", e.ModuleName),
|
||||
tag.String("module", e.ModuleName),
|
||||
tag.Error(e.Err))
|
||||
}
|
||||
case *fxevent.Run:
|
||||
if e.Err != nil {
|
||||
l.logger.Error("error returned",
|
||||
tag.ComponentFX,
|
||||
tag.NewStringTag("name", e.Name),
|
||||
tag.NewStringTag("kind", e.Kind),
|
||||
tag.NewStringTag("module", e.ModuleName),
|
||||
tag.String("name", e.Name),
|
||||
tag.String("kind", e.Kind),
|
||||
tag.String("module", e.ModuleName),
|
||||
tag.Error(e.Err),
|
||||
)
|
||||
}
|
||||
@@ -1180,23 +1180,23 @@ func (l *fxLogAdapter) LogEvent(e fxevent.Event) {
|
||||
// Do not log stack as it will make logs hard to read.
|
||||
l.logger.Debug("invoking",
|
||||
tag.ComponentFX,
|
||||
tag.NewStringTag("function", e.FunctionName),
|
||||
tag.NewStringTag("module", e.ModuleName),
|
||||
tag.String("function", e.FunctionName),
|
||||
tag.String("module", e.ModuleName),
|
||||
)
|
||||
case *fxevent.Invoked:
|
||||
if e.Err != nil {
|
||||
l.logger.Error("invoke failed",
|
||||
tag.ComponentFX,
|
||||
tag.Error(e.Err),
|
||||
tag.NewStringTag("stack", e.Trace),
|
||||
tag.NewStringTag("function", e.FunctionName),
|
||||
tag.NewStringTag("module", e.ModuleName),
|
||||
tag.String("stack", e.Trace),
|
||||
tag.String("function", e.FunctionName),
|
||||
tag.String("module", e.ModuleName),
|
||||
)
|
||||
}
|
||||
case *fxevent.Stopping:
|
||||
l.logger.Info("received signal",
|
||||
tag.ComponentFX,
|
||||
tag.NewStringerTag("signal", e.Signal))
|
||||
tag.Stringer("signal", e.Signal))
|
||||
case *fxevent.Stopped:
|
||||
if e.Err != nil {
|
||||
l.logger.Error("stop failed", tag.ComponentFX, tag.Error(e.Err))
|
||||
@@ -1219,14 +1219,14 @@ func (l *fxLogAdapter) LogEvent(e fxevent.Event) {
|
||||
} else {
|
||||
l.logger.Debug("initialized custom fxevent.Logger",
|
||||
tag.ComponentFX,
|
||||
tag.NewStringTag("function", e.ConstructorName))
|
||||
tag.String("function", e.ConstructorName))
|
||||
}
|
||||
case *fxevent.BeforeRun:
|
||||
l.logger.Debug("before run",
|
||||
tag.ComponentFX,
|
||||
tag.NewStringTag("name", e.Name),
|
||||
tag.NewStringTag("kind", e.Kind),
|
||||
tag.NewStringTag("module", e.ModuleName),
|
||||
tag.String("name", e.Name),
|
||||
tag.String("kind", e.Kind),
|
||||
tag.String("module", e.ModuleName),
|
||||
)
|
||||
default:
|
||||
l.logger.Warn("unknown fx log type, update fxLogAdapter",
|
||||
|
||||
@@ -1136,7 +1136,7 @@ func (s *ResetWorkflowTestSuite) TestResetWorkflowWithExternalPayloads() {
|
||||
RequestId: uuid.NewString(),
|
||||
})
|
||||
s.NoError(err)
|
||||
s.Logger.Info("Workflow reset complete", tag.WorkflowRunID(resetResp.GetRunId()), tag.NewInt64("ResetToEventID", resetToEventID))
|
||||
s.Logger.Info("Workflow reset complete", tag.WorkflowRunID(resetResp.GetRunId()), tag.Int64("ResetToEventID", resetToEventID))
|
||||
|
||||
descResp, descErr = s.FrontendClient().DescribeWorkflowExecution(testcore.NewContext(), &workflowservice.DescribeWorkflowExecutionRequest{
|
||||
Namespace: s.Namespace().String(),
|
||||
|
||||
@@ -383,7 +383,7 @@ func setupIndex(esConfig *esclient.Config, logger log.Logger) error {
|
||||
}
|
||||
|
||||
indexTemplateFile := path.Join(testutils.GetRepoRootDirectory(), "schema/elasticsearch/visibility/index_template_v7.json")
|
||||
logger.Info("Creating index template.", tag.NewStringTag("templatePath", indexTemplateFile))
|
||||
logger.Info("Creating index template.", tag.String("templatePath", indexTemplateFile))
|
||||
template, err := os.ReadFile(indexTemplateFile)
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
@@ -2703,7 +2703,7 @@ func TestWorkflowUpdateSuite(t *testing.T) {
|
||||
|
||||
sendUpdateNoError(s, s.Tv())
|
||||
|
||||
s.Logger.Info("Wait for sticky timeout to fire. Sleep poller.StickyScheduleToStartTimeout+ seconds.", tag.NewDurationTag("StickyScheduleToStartTimeout", stickyScheduleToStartTimeout))
|
||||
s.Logger.Info("Wait for sticky timeout to fire. Sleep poller.StickyScheduleToStartTimeout+ seconds.", tag.Duration("StickyScheduleToStartTimeout", stickyScheduleToStartTimeout))
|
||||
time.Sleep(stickyScheduleToStartTimeout + 100*time.Millisecond) //nolint:forbidigo
|
||||
s.Logger.Info("Sleep is done.")
|
||||
|
||||
|
||||
@@ -141,7 +141,7 @@ func (s *WorkflowDeleteExecutionSuite) TestDeleteWorkflowExecution_CompetedWorkf
|
||||
},
|
||||
)
|
||||
if err == nil {
|
||||
s.Logger.Warn("Execution is not deleted yet", tag.NewInt("number", i), tag.WorkflowID(we.WorkflowId), tag.WorkflowRunID(we.RunId))
|
||||
s.Logger.Warn("Execution is not deleted yet", tag.Int("number", i), tag.WorkflowID(we.WorkflowId), tag.WorkflowRunID(we.RunId))
|
||||
return false
|
||||
}
|
||||
var notFoundErr *serviceerror.NotFound
|
||||
@@ -256,7 +256,7 @@ func (s *WorkflowDeleteExecutionSuite) TestDeleteWorkflowExecution_RunningWorkfl
|
||||
},
|
||||
)
|
||||
if err == nil {
|
||||
s.Logger.Warn("Execution is not deleted yet", tag.NewInt("number", i), tag.WorkflowID(we.WorkflowId), tag.WorkflowRunID(we.RunId))
|
||||
s.Logger.Warn("Execution is not deleted yet", tag.Int("number", i), tag.WorkflowID(we.WorkflowId), tag.WorkflowRunID(we.RunId))
|
||||
return false
|
||||
}
|
||||
var notFoundErr *serviceerror.NotFound
|
||||
@@ -364,13 +364,13 @@ func (s *WorkflowDeleteExecutionSuite) TestDeleteWorkflowExecution_JustTerminate
|
||||
WorkflowExecution: we,
|
||||
})
|
||||
s.NoError(err)
|
||||
s.Logger.Warn("Execution is terminated", tag.NewInt("number", i), tag.WorkflowID(we.WorkflowId), tag.WorkflowRunID(we.RunId))
|
||||
s.Logger.Warn("Execution is terminated", tag.Int("number", i), tag.WorkflowID(we.WorkflowId), tag.WorkflowRunID(we.RunId))
|
||||
_, err = s.FrontendClient().DeleteWorkflowExecution(testcore.NewContext(), &workflowservice.DeleteWorkflowExecutionRequest{
|
||||
Namespace: s.Namespace().String(),
|
||||
WorkflowExecution: we,
|
||||
})
|
||||
s.NoError(err)
|
||||
s.Logger.Warn("Execution is scheduled for deletion", tag.NewInt("number", i), tag.WorkflowID(we.WorkflowId), tag.WorkflowRunID(we.RunId))
|
||||
s.Logger.Warn("Execution is scheduled for deletion", tag.Int("number", i), tag.WorkflowID(we.WorkflowId), tag.WorkflowRunID(we.RunId))
|
||||
}
|
||||
|
||||
for i, we := range wes {
|
||||
@@ -385,7 +385,7 @@ func (s *WorkflowDeleteExecutionSuite) TestDeleteWorkflowExecution_JustTerminate
|
||||
},
|
||||
)
|
||||
if err == nil {
|
||||
s.Logger.Warn("Execution is not deleted yet", tag.NewInt("number", i), tag.WorkflowID(we.WorkflowId), tag.WorkflowRunID(we.RunId))
|
||||
s.Logger.Warn("Execution is not deleted yet", tag.Int("number", i), tag.WorkflowID(we.WorkflowId), tag.WorkflowRunID(we.RunId))
|
||||
return false
|
||||
}
|
||||
var notFoundErr *serviceerror.NotFound
|
||||
@@ -423,7 +423,7 @@ func (s *WorkflowDeleteExecutionSuite) TestDeleteWorkflowExecution_JustTerminate
|
||||
)
|
||||
s.NoError(err)
|
||||
if len(visibilityResponse.Executions) != 0 {
|
||||
s.Logger.Warn("Visibility is not deleted yet", tag.NewInt("number", i), tag.WorkflowID(we.WorkflowId), tag.WorkflowRunID(we.RunId))
|
||||
s.Logger.Warn("Visibility is not deleted yet", tag.Int("number", i), tag.WorkflowID(we.WorkflowId), tag.WorkflowRunID(we.RunId))
|
||||
return false
|
||||
}
|
||||
return true
|
||||
|
||||
@@ -1297,22 +1297,22 @@ func (s *WorkflowTestSuite) TestWorkflowTaskAndActivityTaskTimeoutsWorkflow() {
|
||||
dropWorkflowTask := (i%2 == 0)
|
||||
s.Logger.Info(testTag+"iteration starting",
|
||||
tag.Counter(i),
|
||||
tag.NewBoolTag("drop_task", dropWorkflowTask),
|
||||
tag.NewDurationTag("time_since_test_start", time.Since(testStart)),
|
||||
tag.NewDurationTag("time_since_last_drop", time.Since(lastDropTime)))
|
||||
tag.Bool("drop_task", dropWorkflowTask),
|
||||
tag.Duration("time_since_test_start", time.Since(testStart)),
|
||||
tag.Duration("time_since_last_drop", time.Since(lastDropTime)))
|
||||
var err error
|
||||
if dropWorkflowTask {
|
||||
_, err = poller.PollAndProcessWorkflowTask(testcore.WithDumpHistory, testcore.WithDropTask)
|
||||
lastDropTime = time.Now()
|
||||
s.Logger.Info(testTag+"dropped workflow task",
|
||||
tag.Counter(i),
|
||||
tag.NewDurationTag("poll_duration", time.Since(iterStart)))
|
||||
tag.Duration("poll_duration", time.Since(iterStart)))
|
||||
} else {
|
||||
_, err = poller.PollAndProcessWorkflowTask(testcore.WithDumpHistory, testcore.WithExpectedAttemptCount(2))
|
||||
s.Logger.Info(testTag+"processed workflow task (expected attempt=2)",
|
||||
tag.Counter(i),
|
||||
tag.NewDurationTag("poll_duration", time.Since(iterStart)),
|
||||
tag.NewDurationTag("time_since_last_drop", time.Since(lastDropTime)),
|
||||
tag.Duration("poll_duration", time.Since(iterStart)),
|
||||
tag.Duration("time_since_last_drop", time.Since(lastDropTime)),
|
||||
tag.Error(err))
|
||||
}
|
||||
if err != nil {
|
||||
@@ -1328,7 +1328,7 @@ func (s *WorkflowTestSuite) TestWorkflowTaskAndActivityTaskTimeoutsWorkflow() {
|
||||
err = poller.PollAndProcessActivityTask(i%4 == 0)
|
||||
s.Logger.Info(testTag+"activity task poll completed",
|
||||
tag.Counter(i),
|
||||
tag.NewDurationTag("activity_poll_duration", time.Since(activityStart)),
|
||||
tag.Duration("activity_poll_duration", time.Since(activityStart)),
|
||||
tag.Error(err))
|
||||
s.True(err == nil || errors.Is(err, testcore.ErrNoTasks))
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ func NewSetupSchemaTask(db DB, config *SetupConfig, logger log.Logger) *SetupTas
|
||||
// Run executes the task
|
||||
func (task *SetupTask) Run() error {
|
||||
config := task.config
|
||||
task.logger.Info("Starting schema setup", tag.NewAnyTag("config", config))
|
||||
task.logger.Info("Starting schema setup", tag.Any("config", config))
|
||||
|
||||
if config.Overwrite {
|
||||
err := task.db.DropAllTables()
|
||||
@@ -94,7 +94,7 @@ func (task *SetupTask) Run() error {
|
||||
currVerParsed, err := semver.ParseTolerant(currVer)
|
||||
if err != nil {
|
||||
task.logger.Fatal("Unable to parse current version",
|
||||
tag.NewStringTag("current version", currVer),
|
||||
tag.String("current version", currVer),
|
||||
tag.Error(err),
|
||||
)
|
||||
}
|
||||
@@ -102,7 +102,7 @@ func (task *SetupTask) Run() error {
|
||||
initialVersionParsed, err := semver.ParseTolerant(config.InitialVersion)
|
||||
if err != nil {
|
||||
task.logger.Fatal("Unable to parse initial version",
|
||||
tag.NewStringTag("initial version", config.InitialVersion),
|
||||
tag.String("initial version", config.InitialVersion),
|
||||
tag.Error(err),
|
||||
)
|
||||
}
|
||||
|
||||
@@ -77,7 +77,7 @@ func NewUpdateSchemaTask(db DB, config *UpdateConfig, logger log.Logger) *Update
|
||||
func (task *UpdateTask) Run() error {
|
||||
config := task.config
|
||||
|
||||
task.logger.Info("UpdateSchemaTask started", tag.NewAnyTag("config", config))
|
||||
task.logger.Info("UpdateSchemaTask started", tag.Any("config", config))
|
||||
|
||||
if config.IsDryRun {
|
||||
if err := task.setupDryRunDatabase(); err != nil {
|
||||
|
||||
@@ -215,22 +215,22 @@ func dropIndex(cli *cli.Context, logger log.Logger) error {
|
||||
success, err := client.DeleteIndex(context.TODO(), indexName)
|
||||
if err != nil {
|
||||
if !failSilently {
|
||||
logger.Error("Index deletion failed", tag.Error(err), tag.NewStringTag("indexName", indexName))
|
||||
logger.Error("Index deletion failed", tag.Error(err), tag.String("indexName", indexName))
|
||||
return err
|
||||
}
|
||||
logger.Warn("Index deletion failed", tag.Error(err), tag.NewStringTag("indexName", indexName))
|
||||
logger.Warn("Index deletion failed", tag.Error(err), tag.String("indexName", indexName))
|
||||
return nil
|
||||
} else if !success {
|
||||
err := errors.New("acknowledged=false")
|
||||
if !failSilently {
|
||||
logger.Error("Index deletion failed without error", tag.Error(err), tag.NewStringTag("indexName", indexName))
|
||||
logger.Error("Index deletion failed without error", tag.Error(err), tag.String("indexName", indexName))
|
||||
return err
|
||||
}
|
||||
logger.Warn("Index deletion failed without error", tag.Error(err), tag.NewStringTag("indexName", indexName))
|
||||
logger.Warn("Index deletion failed without error", tag.Error(err), tag.String("indexName", indexName))
|
||||
return nil
|
||||
}
|
||||
|
||||
logger.Info("Index deleted successfully", tag.NewStringTag("indexName", indexName))
|
||||
logger.Info("Index deleted successfully", tag.String("indexName", indexName))
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ func (task *SetupTask) setupTemplate() error {
|
||||
return task.handleOperationFailure("template creation failed without error", errors.New("acknowledged=false"))
|
||||
}
|
||||
|
||||
task.logger.Info("Template created successfully", tag.NewStringTag("templateName", templateName))
|
||||
task.logger.Info("Template created successfully", tag.String("templateName", templateName))
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -79,7 +79,7 @@ func (task *SetupTask) setupIndex(ctx context.Context) error {
|
||||
var esErr *elastic.Error
|
||||
if errors.As(err, &esErr) {
|
||||
if esErr.Status == 400 && esErr.Details != nil && esErr.Details.Type == "resource_already_exists_exception" {
|
||||
task.logger.Info("Index already exists, skipping creation", tag.NewStringTag("indexName", config.VisibilityIndex))
|
||||
task.logger.Info("Index already exists, skipping creation", tag.String("indexName", config.VisibilityIndex))
|
||||
return nil
|
||||
}
|
||||
}
|
||||
@@ -88,13 +88,13 @@ func (task *SetupTask) setupIndex(ctx context.Context) error {
|
||||
return task.handleOperationFailure("index creation failed without error", errors.New("acknowledged=false"))
|
||||
}
|
||||
|
||||
task.logger.Info("Index created successfully", tag.NewStringTag("indexName", config.VisibilityIndex))
|
||||
task.logger.Info("Index created successfully", tag.String("indexName", config.VisibilityIndex))
|
||||
return nil
|
||||
}
|
||||
|
||||
// RunSchemaSetup runs only cluster settings and template setup (no index creation)
|
||||
func (task *SetupTask) RunSchemaSetup() error {
|
||||
task.logger.Info("Starting schema setup (cluster settings and template)", tag.NewAnyTag("config", task.config))
|
||||
task.logger.Info("Starting schema setup (cluster settings and template)", tag.Any("config", task.config))
|
||||
|
||||
if err := task.setupClusterSettings(); err != nil {
|
||||
task.logger.Error("Failed to setup cluster settings.", tag.Error(err))
|
||||
@@ -112,7 +112,7 @@ func (task *SetupTask) RunSchemaSetup() error {
|
||||
|
||||
// RunTemplateUpgrade runs only template upgrade
|
||||
func (task *SetupTask) RunTemplateUpgrade() error {
|
||||
task.logger.Info("Starting template upgrade", tag.NewAnyTag("config", task.config))
|
||||
task.logger.Info("Starting template upgrade", tag.Any("config", task.config))
|
||||
|
||||
if err := task.setupTemplate(); err != nil {
|
||||
task.logger.Error("Failed to upgrade template.", tag.Error(err))
|
||||
@@ -125,7 +125,7 @@ func (task *SetupTask) RunTemplateUpgrade() error {
|
||||
|
||||
// RunIndexCreation runs only index creation
|
||||
func (task *SetupTask) RunIndexCreation(ctx context.Context) error {
|
||||
task.logger.Info("Starting index creation", tag.NewAnyTag("config", task.config))
|
||||
task.logger.Info("Starting index creation", tag.Any("config", task.config))
|
||||
|
||||
if err := task.setupIndex(ctx); err != nil {
|
||||
task.logger.Error("Failed to create index.", tag.Error(err))
|
||||
@@ -138,7 +138,7 @@ func (task *SetupTask) RunIndexCreation(ctx context.Context) error {
|
||||
|
||||
// RunIndexUpdate updates the mappings of an existing index
|
||||
func (task *SetupTask) RunIndexUpdate() error {
|
||||
task.logger.Info("Starting index mapping update", tag.NewAnyTag("config", task.config))
|
||||
task.logger.Info("Starting index mapping update", tag.Any("config", task.config))
|
||||
|
||||
if err := task.updateIndexMappings(); err != nil {
|
||||
task.logger.Error("Failed to update index mappings.", tag.Error(err))
|
||||
@@ -195,7 +195,7 @@ func (task *SetupTask) updateIndexMappings() error {
|
||||
return task.handleOperationFailure("index mapping update failed without error", errors.New("acknowledged=false"))
|
||||
}
|
||||
|
||||
task.logger.Info("Index mappings updated successfully", tag.NewStringTag("indexName", indexName))
|
||||
task.logger.Info("Index mappings updated successfully", tag.String("indexName", indexName))
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user