[ https://issues.apache.org/jira/browse/BEAM-3545?focusedWorklogId=223018&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-223018 ]
ASF GitHub Bot logged work on BEAM-3545: ---------------------------------------- Author: ASF GitHub Bot Created on: 04/Apr/19 14:54 Start Date: 04/Apr/19 14:54 Worklog Time Spent: 10m Work Description: lostluck commented on pull request #8218: [BEAM-3545] Support Metrics in Go SDK CombineFns URL: https://github.com/apache/beam/pull/8218#discussion_r272220652 ########## File path: sdks/go/pkg/beam/core/metrics/metrics.go ########## @@ -82,15 +82,19 @@ func (ctx *beamCtx) Value(key interface{}) interface{} { switch key { case bundleKey: if ctx.bundleID == "" { - if id := ctx.Value(key); id != nil { + if id := ctx.Context.Value(key); id != nil { Review comment: This is where the infinite recursion was happening, using ctx.Context.Value is the fix! Value is a method on the context.Context interface which is ordinarily promoted to beamCtx via embedding. But we're overriding it on beamCtx. In other words, the Value being called was the one we're looking at, instead of the embedded Context's Value. In short, if the value didn't exist, it would recursively call itself forever. As you've noted, calling ctx.Context.Value makes it explicit we want the embedded types implementation, rather than the beamCtx.Value. There's no benefit in this case to call beamCtx.Value since we already know this level doesn't have the bundleID (or ptransformID). ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org Issue Time Tracking ------------------- Worklog Id: (was: 223018) Time Spent: 10h 10m (was: 10h) > Fn API metrics in Go SDK harness > -------------------------------- > > Key: BEAM-3545 > URL: https://issues.apache.org/jira/browse/BEAM-3545 > Project: Beam > Issue Type: Sub-task > Components: sdk-go > Reporter: Kenneth Knowles > Priority: Major > Labels: portability, triaged > Time Spent: 10h 10m > Remaining Estimate: 0h > -- This message was sent by Atlassian JIRA (v7.6.3#76005)