Skip to content

fix callback err not return#6856

Closed
NameHaibinZhang wants to merge 1 commit intoopen-telemetry:mainfrom
NameHaibinZhang:main
Closed

fix callback err not return#6856
NameHaibinZhang wants to merge 1 commit intoopen-telemetry:mainfrom
NameHaibinZhang:main

Conversation

@NameHaibinZhang
Copy link
Copy Markdown
Member

for _, c := range p.callbacks {
	// TODO make the callbacks parallel. ( #3034 )
	if e := c(ctx); e != nil {
		err = errors.Join(err, e)
	}
	if err := ctx.Err(); err != nil {
		rm.Resource = nil
		clear(rm.ScopeMetrics) // Erase elements to let GC collect objects.
		rm.ScopeMetrics = rm.ScopeMetrics[:0]
		return err
	}
}
for e := p.multiCallbacks.Front(); e != nil; e = e.Next() {
	// TODO make the callbacks parallel. ( #3034 )
	f := e.Value.(multiCallback)
	if e := f(ctx); e != nil {
		err = errors.Join(err, e)
	}
	if err := ctx.Err(); err != nil {
		// This means the context expired before we finished running callbacks.
		rm.Resource = nil
		clear(rm.ScopeMetrics) // Erase elements to let GC collect objects.
		rm.ScopeMetrics = rm.ScopeMetrics[:0]
		return err
	}
}

if ctx.Err() is not nil, the c(ctx) err is not return

@linux-foundation-easycla
Copy link
Copy Markdown

linux-foundation-easycla Bot commented May 30, 2025

CLA Signed

The committers listed above are authorized under a signed CLA.

  • ✅ login: NameHaibinZhang / name: Zhanghaibin (9e8fd14)

@pellared
Copy link
Copy Markdown
Member

pellared commented May 30, 2025

Thank you for the PR.

Can you add a changelog entry and add a unit tests to cover these cases?

@NameHaibinZhang
Copy link
Copy Markdown
Member Author

Thank you for the PR.

Can you add a changelog entry and add a unit tests to cover these cases?

ok,i will add test

@pellared pellared added this to the Subsequent v1.37.0 milestone Jun 12, 2025
@pellared
Copy link
Copy Markdown
Member

@NameHaibinZhang, are you able to work on this PR?

@MrAlias
Copy link
Copy Markdown
Contributor

MrAlias commented Jul 31, 2025

Superseded by #6914.

@MrAlias MrAlias closed this Jul 31, 2025
@MrAlias MrAlias removed this from the v1.38.0 milestone Aug 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants