-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Figure out a way to trace through AsyncIterator #5607
Comments
keyvault-keys and keyvault-secrets currently instrument list* operations, but the parent span ends as soon as the iterator is created, which isn't great, since then child spans can be longer. It looks like appconfiguration maybe does the same. |
Same in keyvault libs |
Lots has changed since this issue was made! Going to list my thoughts and revisit in the new year:
I also noticed that we're just tracing the creation of the iterator which doesn't really trace anything interesting so at the time I just forged ahead with tracing the page fetching operation instead. azure-sdk-for-js/sdk/keyvault/keyvault-keys/src/index.ts Lines 922 to 926 in f31aa42
azure-sdk-for-js/sdk/keyvault/keyvault-keys/src/index.ts Lines 934 to 939 in f31aa42
The downside of this approach is:
for await (const thingy of client.listThings) { ... } And then end up with N spans (depending on number of pages and how many you consume) at the convenience layer called
But it is nice to trace over it, otherwise you'll just end up with some rogue http spans anyway when tracingPolicy runs. And as a consumer you can wrap the iteration in a logical parent span Next step for me would be to see what this looks like in Jaeger when you have 100 secrets or something Going to revisit this and see if this approach makes sense for general guidance... |
By the way, I demo'd this to @lmolkova and she was happy with the direction here. She had a few additional improvements like adding the continuation token as a span attribute. If we are happy with the approach I listed above - @xirzec do you like this approach or not really? Assuming you are good with this - what do we need to close out this issue? Just guidance? Issues open for all packages? Update code for all packages? |
This seems like the most sensible thing we can do, even if the method itself isn't public it's pretty clear what is going on. We could establish a convention for how we name this thing to make it consistent (e.g. always take the list method name and suffix with Page) |
### Packages impacted by this PR @azure/data-tables ### Issues associated with this PR - #20213 - #5607 ### Describe the problem that is addressed by this PR Now that @azure/[email protected] is out, and hopefully the last version before GA, we need to upgrade a few packages in order to dogfood both the upgrade experience and the usage of these packages with the new instrumentation package. My goal was to upgrade one AMQP package and a few HTTP packages in addition to core-rest-pipeline to collect feedback. Upgrading Data Tables now allows us to start using the new APIs in a client package. ### Provide a list of related PRs _(if any)_ - #20240
Today methods that use the AsyncIterator pattern return a
PagedAsyncIterableIterator
. Under the covers, these methods call into a generator that returns the shapeAsyncIterableIterator
that eventually delegate to a method that makes a single request.It's easy to create tracing Spans for the underlying method that performs a request, but it's less clear about what Spans should be created for the iterator itself. Since an iterator may never finish iterating its entire collection, starting a Span at the beginning of iteration might never finish.
The text was updated successfully, but these errors were encountered: