Skip to content

Latest commit

 

History

History
41 lines (27 loc) · 1.54 KB

README.md

File metadata and controls

41 lines (27 loc) · 1.54 KB

stellate-strawberry

This package integrates your Strawberry GraphQL API with Stellate. It does so by providing you with an Extension that you can add to your schema with one line of code.

Installation

Simply install the package using pip:

pip install stellate-strawberry

Set Up

Before you can make use of this library, you need to set up a Stellate service and create a logging token.

After that, add the Stellate extension when initializing your strawberry.Schema object in order to add Stellate Metrics Logging:

from stellate_strawberry import create_stellate_extension

service_name = "my-service"  # The name of your Stellate service
token = "stl8_xyz"           # The logging token for above service

schema = strawberry.Schema(
    query=Query,
    extensions=[create_stellate_extension(service_name, token)]
)

Stellate GraphQL Metrics are even more powerful if Stellate knows about your GraphQL schema. Set up automatic schema synchronization like so:

from stellate_strawberry import sync_schema_to_stellate

service_name = "my-service"  # The name of your Stellate service
token = "stl8_xyz"           # The logging token for above service

schema = strawberry.Schema(query=Query)
sync_schema_to_stellate(schema, service_name, token)