579
580
// metricsHandler returns a metrics handler enriched with nexus operation tags.
581
>
func (o *Operation) metricsHandler(ctx chasm.Context) metrics.Handler {
operation.go
582
>
namespaceName := ctx.NamespaceEntry().Name().String()
583
>
584
>
wftt := standaloneOperationWorkflowTypeName
585
>
if store, ok := o.Store.TryGet(ctx); ok {
586
wftt = store.WorkflowTypeName()
587
}
589
>
metrics.NamespaceTag(namespaceName),
590
>
metrics.NexusEndpointTag(o.GetEndpoint()),
591
>
metrics.WorkflowTypeTag(wftt),
592
>
}
593
>
594
>
opCtx, ok := ctx.Value(OperationContextKey).(*OperationContext)
595
>
if !ok {
596
softassert.Fail(ctx.Logger(), "operation context missing")
598
>
conf := opCtx.MetricTagConfig()
599
>
if conf.IncludeServiceTag {
600
tags = append(tags, metrics.NexusServiceTag(o.GetService()))
601
}
603
tags = append(tags, metrics.NexusOperationTag(o.GetOperation()))
604
}
605
}
606
607
>
return ctx.MetricsHandler().WithTags(tags...)
operation.go
608
}
609