Replies: 2 comments 4 replies
-
thanks for posting, patrick! it was nice chatting with you after the talk i think there's something here, especially regarding your design decision to define schemas in code. something feels philosophically similar to how we handle certain logic. as for the current state of the python library, i tried seeing how it would play with strawberry (code here). it was a fun experiment! i used the strawberry fastapi integration. i was able to decorate a resolver when it was defined as a method on the class, but we'd need to think through how to support the syntax of the only thing that came to mind right now, aside from decorating the resolver itself before it was passed to @strawberry.type
class Query:
books: typing.List[Book] = strawberry.field(resolver=get_books)
# NOTE - `@autometrics` broke unless it was the first decorator on top of the resolver
# i think this is because @strawberry.field does not return a function that can in turn be decorated
#
@strawberry.field
@autometrics
def last_book(self) -> Book:
return get_books()[-1] as for wrapping subcalls to, for instance, |
Beta Was this translation helpful? Give feedback.
-
by the way, the way you handle integrations with frameworks inspired me to file an issue on our python repo! autometrics-dev/autometrics-py#91 |
Beta Was this translation helpful? Give feedback.
-
Hi there! I'm the maintainer of Strawberry GraphQL, I just saw the talk about autometrics at PyCon UK (thanks @brettimus) and I was wondering if there could be a place for adding support for GraphQL queries.
Here's an example of GraphQL API using Strawberry:
and here's a query:
This query would (in a simplified way) result to 3 function calls:
I wonder if there's maybe a place for automatically instrumenting GraphQL queries (instead of instrumenting the resolvers directly?), or maybe we can add instrumenting for top level fields (like the user field).
Beta Was this translation helpful? Give feedback.
All reactions