You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We tend to use as a lot of async iterables in our codebase. So we often have functions that look like
async *paginateFollowers(channelID: string): AsyncIterator<Follower[]> {
for await (const dbFollowers of await this.db.queryFollowers(channelID)) {
yield dbFollowers.map(x => convertFromDBToDomainObject(x));
}
}
But what we've noticed is that this makes it so when we wrap these functions in trace, they the span ends immediately as the async iterator is returned immediately before any work happens.
To be fair, I'm not sure how tracing would work with any function that yields to it's caller, but I'm wondering if there is any best practices so that the DB calls that happen within this generator are associated with this span rather than the span only lasting nano seconds. Or is that just not a good idea in the first place?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi there,
We tend to use as a lot of async iterables in our codebase. So we often have functions that look like
But what we've noticed is that this makes it so when we wrap these functions in trace, they the span ends immediately as the async iterator is returned immediately before any work happens.
To be fair, I'm not sure how tracing would work with any function that yields to it's caller, but I'm wondering if there is any best practices so that the DB calls that happen within this generator are associated with this span rather than the span only lasting nano seconds. Or is that just not a good idea in the first place?
Beta Was this translation helpful? Give feedback.
All reactions