Code Monkey home page Code Monkey logo

async_graphql_apollo_studio_extension's Introduction

async-graphql

a high-performance graphql server library that's fully specification compliant

Book中文文档DocsGitHub repositoryCargo package


ci status code coverage Unsafe Rust forbidden Crates.io version docs.rs docs downloads PRs Welcome

This crate uses #![forbid(unsafe_code)] to ensure everything is implemented in 100% safe Rust.

Static schema

use std::error::Error;

use async_graphql::{http::GraphiQLSource, EmptyMutation, EmptySubscription, Object, Schema};
use async_graphql_poem::*;
use poem::{listener::TcpListener, web::Html, *};

struct Query;

#[Object]
impl Query {
    async fn howdy(&self) -> &'static str {
        "partner"
    }
}

#[handler]
async fn graphiql() -> impl IntoResponse {
    Html(GraphiQLSource::build().finish())
}

#[tokio::main]
async fn main() -> Result<(), Box<dyn Error>> {
    // create the schema
    let schema = Schema::build(Query, EmptyMutation, EmptySubscription).finish();

    // start the http server
    let app = Route::new().at("/", get(graphiql).post(GraphQL::new(schema)));
    println!("GraphiQL: http://localhost:8000");
    Server::new(TcpListener::bind("0.0.0.0:8000"))
        .run(app)
        .await?;
    Ok(())
}

Dynamic schema

Requires the dynamic-schema feature to be enabled.

use std::error::Error;

use async_graphql::{dynamic::*, http::GraphiQLSource};
use async_graphql_poem::*;
use poem::{listener::TcpListener, web::Html, *};

#[handler]
async fn graphiql() -> impl IntoResponse {
    Html(GraphiQLSource::build().finish())
}

#[tokio::main]
async fn main() -> Result<(), Box<dyn Error>> {
    let query = Object::new("Query").field(Field::new(
        "howdy",
        TypeRef::named_nn(TypeRef::STRING),
        |_| FieldFuture::new(async { "partner" }),
    ));

    // create the schema
    let schema = Schema::build(query, None, None).register(query).finish()?;

    // start the http server
    let app = Route::new().at("/", get(graphiql).post(GraphQL::new(schema)));
    println!("GraphiQL: http://localhost:8000");
    Server::new(TcpListener::bind("0.0.0.0:8000"))
        .run(app)
        .await?;
    Ok(())
}

Features

  • Static and dynamic schemas are fully supported
  • Fully supports async/await
  • Type safety
  • Rustfmt friendly (Procedural Macro)
  • Custom scalars
  • Minimal overhead
  • Easy integration (poem, axum, actix-web, tide, warp, rocket ...)
  • Upload files (Multipart request)
  • Subscriptions (WebSocket transport)
  • Custom extensions
  • Error extensions
  • Limit query complexity/depth
  • Batch queries
  • Apollo Persisted Queries
  • Apollo Tracing extension
  • Apollo Federation(v2)

Note: Minimum supported Rust version: 1.75.0 or later

Examples

All examples are in the sub-repository, located in the examples directory.

git submodule update # update the examples repo
cd examples && cargo run --bin [name]

For more information, see the sub-repository README.md.

Integrations

Integrations are what glue async-graphql with your web server, here are provided ones, or you can build your own!

Crate features

This crate offers the following features. Most are not activated by default, except the integrations of GraphiQL (graphiql) and GraphQL Playground (playground):

feature enables
apollo_tracing Enable the Apollo tracing extension.
apollo_persisted_queries Enable the Apollo persisted queries extension.
log Enable the Logger extension.
tracing Enable the Tracing extension.
opentelemetry Enable the OpenTelemetry extension.
unblock Support Asynchronous reader for Upload
bson Integrate with the bson crate.
chrono Integrate with the chrono crate.
chrono-tz Integrate with the chrono-tz crate.
url Integrate with the url crate.
uuid Integrate with the uuid crate.
string_number Enable the StringNumber.
dataloader Support DataLoader.
secrecy Integrate with the secrecy crate.
decimal Integrate with the rust_decimal crate.
bigdecimal Integrate with the bigdecimal crate.
cbor Support for serde_cbor.
smol_str Integrate with the smol_str crate.
hashbrown Integrate with the hashbrown crate.
time Integrate with the time crate.
tokio-sync Integrate with the tokio::sync::RwLock and tokio::sync::Mutex.
fast_chemail Integrate with the fast_chemail crate.
tempfile Save the uploaded content in the temporary file.
dynamic-schema Support dynamic schema
graphiql Enables the GraphiQL IDE integration
playground Enables the GraphQL playground IDE integration

Observability

One of the tools used to monitor your graphql server in production is Apollo Studio. Apollo Studio is a cloud platform that helps you build, monitor, validate, and secure your organization's data graph. Add the extension crate async_graphql_apollo_studio_extension to make this avaliable.

Who's using async-graphql in production?

Community Showcase

  • rust-actix-graphql-sqlx-postgresql Using GraphQL with Rust and Apollo Federation
  • entity-rs A simplistic framework based on TAO, Facebook's distributed database for Social Graph.
  • vimwiki-server Provides graphql server to inspect and manipulate vimwiki files.
  • Diana Diana is a GraphQL system for Rust that's designed to work as simply as possible out of the box, without sacrificing configuration ability.
  • cindythink
  • sudograph

Blog Posts

References

License

Licensed under either of

async_graphql_apollo_studio_extension's People

Contributors

dependabot[bot] avatar github-actions[bot] avatar miaxos avatar mikroskeem avatar shashitnak avatar sunli829 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

async_graphql_apollo_studio_extension's Issues

RUSTSEC-2021-0124: Data race when sending and receiving after closing a `oneshot` channel

Data race when sending and receiving after closing a oneshot channel

Details
Package tokio
Version 0.1.22
URL tokio-rs/tokio#4225
Date 2021-11-16
Patched versions >=1.8.4, <1.9.0,>=1.13.1
Unaffected versions <0.1.14

If a tokio::sync::oneshot channel is closed (via the
oneshot::Receiver::close method), a data race may occur if the
oneshot::Sender::send method is called while the corresponding
oneshot::Receiver is awaited or calling try_recv.

When these methods are called concurrently on a closed channel, the two halves
of the channel can concurrently access a shared memory location, resulting in a
data race. This has been observed to cause memory corruption.

Note that the race only occurs when both halves of the channel are used
after the Receiver half has called close. Code where close is not used, or where the
Receiver is not awaited and try_recv is not called after calling close,
is not affected.

See tokio#4225 for more details.

See advisory page for additional details.

Add wasm support

Trying to compile the library for wasm fails with the following error

error[E0432]: unresolved import `crate::sys::IoSourceState`
  --> /Users/shashikant/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mio-0.8.11/src/io_source.rs:12:5
   |
12 | use crate::sys::IoSourceState;
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^ no `IoSourceState` in `sys`

error[E0432]: unresolved import `crate::sys::tcp`
  --> /Users/shashikant/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mio-0.8.11/src/net/tcp/listener.rs:15:17
   |
15 | use crate::sys::tcp::{bind, listen, new_for_addr};
   |                 ^^^ could not find `tcp` in `sys`

error[E0432]: unresolved import `crate::sys::tcp`
  --> /Users/shashikant/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mio-0.8.11/src/net/tcp/stream.rs:13:17
   |
13 | use crate::sys::tcp::{connect, new_for_addr};
   |                 ^^^ could not find `tcp` in `sys`

error[E0433]: failed to resolve: could not find `Selector` in `sys`
   --> /Users/shashikant/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mio-0.8.11/src/poll.rs:312:18
    |
312 |             sys::Selector::new().map(|selector| Poll {
    |                  ^^^^^^^^ could not find `Selector` in `sys`

error[E0433]: failed to resolve: could not find `event` in `sys`
  --> /Users/shashikant/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mio-0.8.11/src/event/event.rs:24:14
   |
24 |         sys::event::token(&self.inner)
   |              ^^^^^ could not find `event` in `sys`

error[E0433]: failed to resolve: could not find `event` in `sys`
  --> /Users/shashikant/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mio-0.8.11/src/event/event.rs:38:14
   |
38 |         sys::event::is_readable(&self.inner)
   |              ^^^^^ could not find `event` in `sys`

error[E0433]: failed to resolve: could not find `event` in `sys`
  --> /Users/shashikant/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mio-0.8.11/src/event/event.rs:43:14
   |
43 |         sys::event::is_writable(&self.inner)
   |              ^^^^^ could not find `event` in `sys`

error[E0433]: failed to resolve: could not find `event` in `sys`
  --> /Users/shashikant/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mio-0.8.11/src/event/event.rs:68:14
   |
68 |         sys::event::is_error(&self.inner)
   |              ^^^^^ could not find `event` in `sys`

error[E0433]: failed to resolve: could not find `event` in `sys`
  --> /Users/shashikant/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mio-0.8.11/src/event/event.rs:99:14
   |
99 |         sys::event::is_read_closed(&self.inner)
   |              ^^^^^ could not find `event` in `sys`

error[E0433]: failed to resolve: could not find `event` in `sys`
   --> /Users/shashikant/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mio-0.8.11/src/event/event.rs:129:14
    |
129 |         sys::event::is_write_closed(&self.inner)
    |              ^^^^^ could not find `event` in `sys`

error[E0433]: failed to resolve: could not find `event` in `sys`
   --> /Users/shashikant/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mio-0.8.11/src/event/event.rs:151:14
    |
151 |         sys::event::is_priority(&self.inner)
    |              ^^^^^ could not find `event` in `sys`

error[E0433]: failed to resolve: could not find `event` in `sys`
   --> /Users/shashikant/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mio-0.8.11/src/event/event.rs:173:14
    |
173 |         sys::event::is_aio(&self.inner)
    |              ^^^^^ could not find `event` in `sys`

error[E0433]: failed to resolve: could not find `event` in `sys`
   --> /Users/shashikant/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mio-0.8.11/src/event/event.rs:183:14
    |
183 |         sys::event::is_lio(&self.inner)
    |              ^^^^^ could not find `event` in `sys`

error[E0433]: failed to resolve: could not find `event` in `sys`
   --> /Users/shashikant/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mio-0.8.11/src/event/event.rs:221:26
    |
221 |                     sys::event::debug_details(f, self.0)
    |                          ^^^^^ could not find `event` in `sys`

error[E0433]: failed to resolve: could not find `tcp` in `sys`
   --> /Users/shashikant/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mio-0.8.11/src/net/tcp/listener.rs:103:18
    |
103 |             sys::tcp::accept(inner).map(|(stream, addr)| (TcpStream::from_std(stream), addr))
    |                  ^^^ could not find `tcp` in `sys`

error[E0433]: failed to resolve: could not find `udp` in `sys`
   --> /Users/shashikant/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mio-0.8.11/src/net/udp.rs:122:14
    |
122 |         sys::udp::bind(addr).map(UdpSocket::from_std)
    |              ^^^ could not find `udp` in `sys`

error[E0433]: failed to resolve: could not find `udp` in `sys`
   --> /Users/shashikant/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mio-0.8.11/src/net/udp.rs:544:14
    |
544 |         sys::udp::only_v6(&self.inner)
    |              ^^^ could not find `udp` in `sys`

error[E0412]: cannot find type `Selector` in module `sys`
   --> /Users/shashikant/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mio-0.8.11/src/poll.rs:263:20
    |
263 |     selector: sys::Selector,
    |                    ^^^^^^^^ not found in `sys`

error[E0412]: cannot find type `Selector` in module `sys`
   --> /Users/shashikant/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mio-0.8.11/src/poll.rs:710:44
    |
710 |     pub(crate) fn selector(&self) -> &sys::Selector {
    |                                            ^^^^^^^^ not found in `sys`

error[E0412]: cannot find type `Waker` in module `sys`
  --> /Users/shashikant/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mio-0.8.11/src/waker.rs:79:17
   |
79 |     inner: sys::Waker,
   |                 ^^^^^ not found in `sys`
   |
help: consider importing one of these items
   |
1  + use core::task::Waker;
   |
1  + use crate::Waker;
   |
1  + use std::task::Waker;
   |
help: if you import `Waker`, refer to it directly
   |
79 -     inner: sys::Waker,
79 +     inner: Waker,
   |

error[E0433]: failed to resolve: could not find `Waker` in `sys`
  --> /Users/shashikant/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mio-0.8.11/src/waker.rs:87:14
   |
87 |         sys::Waker::new(registry.selector(), token).map(|inner| Waker { inner })
   |              ^^^^^ could not find `Waker` in `sys`
   |
help: consider importing one of these items
   |
1  + use core::task::Waker;
   |
1  + use crate::Waker;
   |
1  + use std::task::Waker;
   |
help: if you import `Waker`, refer to it directly
   |
87 -         sys::Waker::new(registry.selector(), token).map(|inner| Waker { inner })
87 +         Waker::new(registry.selector(), token).map(|inner| Waker { inner })
   |

error[E0412]: cannot find type `Event` in module `sys`
  --> /Users/shashikant/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mio-0.8.11/src/event/event.rs:18:17
   |
18 |     inner: sys::Event,
   |                 ^^^^^ not found in `sys`
   |
help: consider importing this struct through its public re-export
   |
1  + use crate::event::Event;
   |
help: if you import `Event`, refer to it directly
   |
18 -     inner: sys::Event,
18 +     inner: Event,
   |

error[E0412]: cannot find type `Event` in module `sys`
   --> /Users/shashikant/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mio-0.8.11/src/event/event.rs:187:55
    |
187 |     pub(crate) fn from_sys_event_ref(sys_event: &sys::Event) -> &Event {
    |                                                       ^^^^^ not found in `sys`
    |
help: consider importing this struct through its public re-export
    |
1   + use crate::event::Event;
    |
help: if you import `Event`, refer to it directly
    |
187 -     pub(crate) fn from_sys_event_ref(sys_event: &sys::Event) -> &Event {
187 +     pub(crate) fn from_sys_event_ref(sys_event: &Event) -> &Event {
    |

error[E0412]: cannot find type `Event` in module `sys`
   --> /Users/shashikant/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mio-0.8.11/src/event/event.rs:191:41
    |
191 |             &*(sys_event as *const sys::Event as *const Event)
    |                                         ^^^^^ not found in `sys`
    |
help: consider importing this struct through its public re-export
    |
1   + use crate::event::Event;
    |
help: if you import `Event`, refer to it directly
    |
191 -             &*(sys_event as *const sys::Event as *const Event)
191 +             &*(sys_event as *const Event as *const Event)
    |

error[E0412]: cannot find type `Event` in module `sys`
   --> /Users/shashikant/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mio-0.8.11/src/event/event.rs:217:46
    |
217 |             struct EventDetails<'a>(&'a sys::Event);
    |                                              ^^^^^ not found in `sys`
    |
help: consider importing this struct through its public re-export
    |
1   + use crate::event::Event;
    |
help: if you import `Event`, refer to it directly
    |
217 -             struct EventDetails<'a>(&'a sys::Event);
217 +             struct EventDetails<'a>(&'a Event);
    |

error[E0412]: cannot find type `Events` in module `sys`
  --> /Users/shashikant/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mio-0.8.11/src/event/events.rs:43:17
   |
43 |     inner: sys::Events,
   |                 ^^^^^^ not found in `sys`
   |
help: consider importing this struct through its public re-export
   |
1  + use crate::Events;
   |
help: if you import `Events`, refer to it directly
   |
43 -     inner: sys::Events,
43 +     inner: Events,
   |

error[E0433]: failed to resolve: could not find `Events` in `sys`
  --> /Users/shashikant/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mio-0.8.11/src/event/events.rs:94:25
   |
94 |             inner: sys::Events::with_capacity(capacity),
   |                         ^^^^^^ could not find `Events` in `sys`
   |
help: consider importing this struct through its public re-export
   |
1  + use crate::Events;
   |
help: if you import `Events`, refer to it directly
   |
94 -             inner: sys::Events::with_capacity(capacity),
94 +             inner: Events::with_capacity(capacity),
   |

error[E0412]: cannot find type `Events` in module `sys`
   --> /Users/shashikant/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mio-0.8.11/src/event/events.rs:189:47
    |
189 |     pub(crate) fn sys(&mut self) -> &mut sys::Events {
    |                                               ^^^^^^ not found in `sys`
    |
help: consider importing this struct through its public re-export
    |
1   + use crate::Events;
    |
help: if you import `Events`, refer to it directly
    |
189 -     pub(crate) fn sys(&mut self) -> &mut sys::Events {
189 +     pub(crate) fn sys(&mut self) -> &mut Events {
    |

error[E0425]: cannot find value `listener` in this scope
  --> /Users/shashikant/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mio-0.8.11/src/net/tcp/listener.rs:74:24
   |
74 |         set_reuseaddr(&listener.inner, true)?;
   |                        ^^^^^^^^ not found in this scope

error[E0425]: cannot find value `listener` in this scope
  --> /Users/shashikant/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mio-0.8.11/src/net/tcp/listener.rs:76:15
   |
76 |         bind(&listener.inner, addr)?;
   |               ^^^^^^^^ not found in this scope

error[E0425]: cannot find value `listener` in this scope
  --> /Users/shashikant/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mio-0.8.11/src/net/tcp/listener.rs:77:17
   |
77 |         listen(&listener.inner, 1024)?;
   |                 ^^^^^^^^ not found in this scope

error[E0425]: cannot find value `listener` in this scope
  --> /Users/shashikant/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mio-0.8.11/src/net/tcp/listener.rs:78:12
   |
78 |         Ok(listener)
   |            ^^^^^^^^ not found in this scope

error[E0425]: cannot find value `stream` in this scope
  --> /Users/shashikant/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mio-0.8.11/src/net/tcp/stream.rs:90:18
   |
90 |         connect(&stream.inner, addr)?;
   |                  ^^^^^^ not found in this scope

error[E0425]: cannot find value `stream` in this scope
  --> /Users/shashikant/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mio-0.8.11/src/net/tcp/stream.rs:91:12
   |
91 |         Ok(stream)
   |            ^^^^^^ not found in this scope

error[E0425]: cannot find function `set_reuseaddr` in this scope
  --> /Users/shashikant/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mio-0.8.11/src/net/tcp/listener.rs:74:9
   |
74 |         set_reuseaddr(&listener.inner, true)?;
   |         ^^^^^^^^^^^^^ not found in this scope

error[E0599]: no method named `register` found for struct `IoSource<std::net::TcpListener>` in the current scope
   --> /Users/shashikant/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mio-0.8.11/src/net/tcp/listener.rs:146:20
    |
146 |         self.inner.register(registry, token, interests)
    |                    ^^^^^^^^ method not found in `IoSource<TcpListener>`
    |
   ::: /Users/shashikant/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mio-0.8.11/src/io_source.rs:62:1
    |
62  | pub struct IoSource<T> {
    | ---------------------- method `register` not found for this struct
    |
    = help: items from traits can only be used if the trait is implemented and in scope
note: `Source` defines an item `register`, perhaps you need to implement it
   --> /Users/shashikant/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mio-0.8.11/src/event/source.rs:75:1
    |
75  | pub trait Source {
    | ^^^^^^^^^^^^^^^^

error[E0599]: no method named `reregister` found for struct `IoSource<std::net::TcpListener>` in the current scope
   --> /Users/shashikant/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mio-0.8.11/src/net/tcp/listener.rs:155:20
    |
155 |         self.inner.reregister(registry, token, interests)
    |                    ^^^^^^^^^^ method not found in `IoSource<TcpListener>`
    |
   ::: /Users/shashikant/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mio-0.8.11/src/io_source.rs:62:1
    |
62  | pub struct IoSource<T> {
    | ---------------------- method `reregister` not found for this struct
    |
    = help: items from traits can only be used if the trait is implemented and in scope
note: `Source` defines an item `reregister`, perhaps you need to implement it
   --> /Users/shashikant/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mio-0.8.11/src/event/source.rs:75:1
    |
75  | pub trait Source {
    | ^^^^^^^^^^^^^^^^

error[E0599]: no method named `deregister` found for struct `IoSource<std::net::TcpListener>` in the current scope
   --> /Users/shashikant/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mio-0.8.11/src/net/tcp/listener.rs:159:20
    |
159 |         self.inner.deregister(registry)
    |                    ^^^^^^^^^^ method not found in `IoSource<TcpListener>`
    |
   ::: /Users/shashikant/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mio-0.8.11/src/io_source.rs:62:1
    |
62  | pub struct IoSource<T> {
    | ---------------------- method `deregister` not found for this struct
    |
    = help: items from traits can only be used if the trait is implemented and in scope
note: `Source` defines an item `deregister`, perhaps you need to implement it
   --> /Users/shashikant/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mio-0.8.11/src/event/source.rs:75:1
    |
75  | pub trait Source {
    | ^^^^^^^^^^^^^^^^

error[E0599]: no method named `register` found for struct `IoSource<std::net::TcpStream>` in the current scope
   --> /Users/shashikant/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mio-0.8.11/src/net/tcp/stream.rs:325:20
    |
325 |         self.inner.register(registry, token, interests)
    |                    ^^^^^^^^ method not found in `IoSource<TcpStream>`
    |
   ::: /Users/shashikant/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mio-0.8.11/src/io_source.rs:62:1
    |
62  | pub struct IoSource<T> {
    | ---------------------- method `register` not found for this struct
    |
    = help: items from traits can only be used if the trait is implemented and in scope
note: `Source` defines an item `register`, perhaps you need to implement it
   --> /Users/shashikant/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mio-0.8.11/src/event/source.rs:75:1
    |
75  | pub trait Source {
    | ^^^^^^^^^^^^^^^^

error[E0599]: no method named `reregister` found for struct `IoSource<std::net::TcpStream>` in the current scope
   --> /Users/shashikant/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mio-0.8.11/src/net/tcp/stream.rs:334:20
    |
334 |         self.inner.reregister(registry, token, interests)
    |                    ^^^^^^^^^^ method not found in `IoSource<TcpStream>`
    |
   ::: /Users/shashikant/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mio-0.8.11/src/io_source.rs:62:1
    |
62  | pub struct IoSource<T> {
    | ---------------------- method `reregister` not found for this struct
    |
    = help: items from traits can only be used if the trait is implemented and in scope
note: `Source` defines an item `reregister`, perhaps you need to implement it
   --> /Users/shashikant/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mio-0.8.11/src/event/source.rs:75:1
    |
75  | pub trait Source {
    | ^^^^^^^^^^^^^^^^

error[E0599]: no method named `deregister` found for struct `IoSource<std::net::TcpStream>` in the current scope
   --> /Users/shashikant/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mio-0.8.11/src/net/tcp/stream.rs:338:20
    |
338 |         self.inner.deregister(registry)
    |                    ^^^^^^^^^^ method not found in `IoSource<TcpStream>`
    |
   ::: /Users/shashikant/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mio-0.8.11/src/io_source.rs:62:1
    |
62  | pub struct IoSource<T> {
    | ---------------------- method `deregister` not found for this struct
    |
    = help: items from traits can only be used if the trait is implemented and in scope
note: `Source` defines an item `deregister`, perhaps you need to implement it
   --> /Users/shashikant/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mio-0.8.11/src/event/source.rs:75:1
    |
75  | pub trait Source {
    | ^^^^^^^^^^^^^^^^

error[E0599]: no method named `register` found for struct `IoSource<std::net::UdpSocket>` in the current scope
   --> /Users/shashikant/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mio-0.8.11/src/net/udp.rs:622:20
    |
622 |         self.inner.register(registry, token, interests)
    |                    ^^^^^^^^ method not found in `IoSource<UdpSocket>`
    |
   ::: /Users/shashikant/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mio-0.8.11/src/io_source.rs:62:1
    |
62  | pub struct IoSource<T> {
    | ---------------------- method `register` not found for this struct
    |
    = help: items from traits can only be used if the trait is implemented and in scope
note: `Source` defines an item `register`, perhaps you need to implement it
   --> /Users/shashikant/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mio-0.8.11/src/event/source.rs:75:1
    |
75  | pub trait Source {
    | ^^^^^^^^^^^^^^^^

error[E0599]: no method named `reregister` found for struct `IoSource<std::net::UdpSocket>` in the current scope
   --> /Users/shashikant/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mio-0.8.11/src/net/udp.rs:631:20
    |
631 |         self.inner.reregister(registry, token, interests)
    |                    ^^^^^^^^^^ method not found in `IoSource<UdpSocket>`
    |
   ::: /Users/shashikant/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mio-0.8.11/src/io_source.rs:62:1
    |
62  | pub struct IoSource<T> {
    | ---------------------- method `reregister` not found for this struct
    |
    = help: items from traits can only be used if the trait is implemented and in scope
note: `Source` defines an item `reregister`, perhaps you need to implement it
   --> /Users/shashikant/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mio-0.8.11/src/event/source.rs:75:1
    |
75  | pub trait Source {
    | ^^^^^^^^^^^^^^^^

error[E0599]: no method named `deregister` found for struct `IoSource<std::net::UdpSocket>` in the current scope
   --> /Users/shashikant/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mio-0.8.11/src/net/udp.rs:635:20
    |
635 |         self.inner.deregister(registry)
    |                    ^^^^^^^^^^ method not found in `IoSource<UdpSocket>`
    |
   ::: /Users/shashikant/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mio-0.8.11/src/io_source.rs:62:1
    |
62  | pub struct IoSource<T> {
    | ---------------------- method `deregister` not found for this struct
    |
    = help: items from traits can only be used if the trait is implemented and in scope
note: `Source` defines an item `deregister`, perhaps you need to implement it
   --> /Users/shashikant/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mio-0.8.11/src/event/source.rs:75:1
    |
75  | pub trait Source {
    | ^^^^^^^^^^^^^^^^

Some errors have detailed explanations: E0412, E0425, E0432, E0433, E0599.
For more information about an error, try `rustc --explain E0412`.
error: could not compile `mio` (lib) due to 44 previous errors
warning: build failed, waiting for other jobs to finish...

async-graphql 4.x.x compat issues

Looks like this package no longer works with 4.x.x versions of async-graphql. Is this package deprecated?

Get the following

error[E0277]: the trait bound `ApolloTracing: ExtensionFactory` is not satisfied
   --> datastore/src/main.rs:78:20
    |
78  |           .extension(ApolloTracing::new(
    |  __________---------_^
    | |          |
    | |          required by a bound introduced by this call
79  | |             "token".into(),
80  | |             "https://yourdomain.ltd".into(),
81  | |             "graph@current".into(),
82  | |             "v1.0.0".into(),
83  | |             10,
84  | |         ))
    | |_________^ the trait `ExtensionFactory` is not implemented for `ApolloTracing`
    |
note: required by a bound in `async_graphql::SchemaBuilder::<Query, Mutation, Subscription>::extension`
   --> /Users/billy/.cargo/registry/src/github.com-1ecc6299db9ec823/async-graphql-4.0.2/src/schema.rs:134:48
    |
134 |     pub fn extension(mut self, extension: impl ExtensionFactory) -> Self {
    |                                                ^^^^^^^^^^^^^^^^ required by this bound in `async_graphql::SchemaBuilder::<Query, Mutation, Subscription>::extension`

For more information about this error, try `rustc --explain E0277`.
warning: `datastore` (bin "datastore") generated 2 warnings
error: could not compile `datastore` due to previous error; 2 warnings emitted

RUSTSEC-2020-0071: Potential segfault in the time crate

Potential segfault in the time crate

Details
Package time
Version 0.1.43
URL time-rs/time#293
Date 2020-11-18
Patched versions >=0.2.23
Unaffected versions =0.2.0,=0.2.1,=0.2.2,=0.2.3,=0.2.4,=0.2.5,=0.2.6

Impact

Unix-like operating systems may segfault due to dereferencing a dangling pointer in specific circumstances. This requires an environment variable to be set in a different thread than the affected functions. This may occur without the user's knowledge, notably in a third-party library.

The affected functions from time 0.2.7 through 0.2.22 are:

  • time::UtcOffset::local_offset_at
  • time::UtcOffset::try_local_offset_at
  • time::UtcOffset::current_local_offset
  • time::UtcOffset::try_current_local_offset
  • time::OffsetDateTime::now_local
  • time::OffsetDateTime::try_now_local

The affected functions in time 0.1 (all versions) are:

  • at
  • at_utc

Non-Unix targets (including Windows and wasm) are unaffected.

Patches

Pending a proper fix, the internal method that determines the local offset has been modified to always return None on the affected operating systems. This has the effect of returning an Err on the try_* methods and UTC on the non-try_* methods.

Users and library authors with time in their dependency tree should perform cargo update, which will pull in the updated, unaffected code.

Users of time 0.1 do not have a patch and should upgrade to an unaffected version: time 0.2.23 or greater or the 0.3. series.

Workarounds

No workarounds are known.

References

time-rs/time#293

See advisory page for additional details.

Extension sending invalid queries to Apollo studio

It appears that using fragment queries with this extension attaches an extra } to the end of the fragment portion when sending to Apollo Studio, causing parse errors for the vast majority of my queries. Here's an example of what I see in Apollo Studio:

image

And the query in question:

fragment missingCaps on MissingCapabilities {
  __typename
  message
  required
  oneof
}
fragment pilot on Pilot {
  id
  name
}

fragment catchAll on Error {
  __typename
  message
}
query pilotList {
  operatorList(role: ROLE_PILOT) {
    ... on SpecificOperatorConnection {
      edges {
        node {
          __typename
          ...pilot
        }
        __typename
      }
      __typename
    }
    ...missingCaps
    ...catchAll
    __typename
  }
}

And what Apollo Studio sees:

fragment missingCaps on MissingCapabilities{ __typename message required oneof }} fragment pilot on Pilot{ id name }} fragment catchAll on Error{ __typename message }} query pilotList { operatorList(role: ROLE_PILOT) { ... on SpecificOperatorConnection { edges { node { __typename ... pilot } __typename } __typename } ... missingCaps ... catchAll __typename } }

Every fragment has a } added into it causing the issue.

Issues in windows targets

Build fails with the following error for windows targets

LINK : warning LNK4098: defaultlib 'libcmt.lib' conflicts with use of other libs; use /NODEFAULTLIB:library

          tailcall.async_graphql_extension_apollo_tracing-ce9437ca2ee8ff19.async_graphql_extension_apollo_tracing.5fb2c400a3a597c5-cgu.0.rcgu.o.rcgu.o : error LNK2019: unresolved external symbol uname referenced in function _ZN38async_graphql_extension_apollo_tracing13ApolloTracing3new17h4e037035a3d99524E

          D:\a\tailcall\tailcall\target\x86_64-pc-windows-msvc\release\deps\tailcall.exe : fatal error LNK1120: 1 unresolved externals

          

error: could not compile `tailcall` (bin "tailcall") due to previous error
Error: Process completed with exit code 123.

More detail about the build is present here https://github.com/tailcallhq/tailcall/actions/runs/8246693029/job/22554065856?pr=1380

Problem occurs in the following targets:

  • win32-x64-msvc
  • win32-x64-gnu
  • win32-arm64-msvc
  • win32-ia32-gnu

Example of tracing using poem and federation

I am working on a POC to use async-graphql with a managed graph and need to enable tracing.
I have followed the example from warp as best I can but am not seeing the tracing in my studio account.
can you please provide an example of setting up tracing with poem and federation

Extreme slowdown with larger query results

I've hit an issue in production, where I have larger data sets, when using this plugin.

My response times from my API were increasing linearly with the size of the return value, and when I started having 2MB+ returns, it was taking over 5 minutes to return a result. This seemed pretty crazy, and after a lot of digging I disabled this extension and results went back to normal.

I think there's an issue here where the plugin is getting stuck analyzing data to send to Apollo, and blocking a timely response as a consequence. I'm not sure if it's sending response data off to Apollo Studio, but even after disabling the per-request portion of the extension I still had this issue. It wasn't until completely unregistering it from the schema that response times went back to normal.

More examples (poem)

Would you mind creating an example of how to use this extension with poem?

I'm not very familiar with tracing and apollo studio, it would be helpful to have some more information on how to get a basic example working locally.

When setting up a new graph on apollo studio they give you this screen:
image

How can I get this to auto-detect my schema?

Here's some more info that might be helpful:

Versions from Cargo.toml

async-graphql = { version = "4.0.13", features = ["chrono", "uuid", "dataloader", "apollo_tracing"] }
async-graphql-extension-apollo-tracing = { version = "3.0.1", features = ["tokio-comp", "compression"] }

WIP attempt at creating a new ApolloTracing extension

let apollo_tracing = ApolloTracing::new(
            "service:My-Graph-8sf1w:wmwfq3rgbhMJjHJGz8WuTw".into(),
            "https://localhost:3000".into(),
            "My-Graph-8sf1w@current".into(),
            "v1.0.0".into(),
            10,
        );

How do these expected values map to what apollo studio gives me?
image

Thanks in advance for any help / suggestions you can provide!

RUSTSEC-2020-0159: Potential segfault in `localtime_r` invocations

Potential segfault in localtime_r invocations

Details
Package chrono
Version 0.4.19
URL chronotope/chrono#499
Date 2020-11-10

Impact

Unix-like operating systems may segfault due to dereferencing a dangling pointer in specific circumstances. This requires an environment variable to be set in a different thread than the affected functions. This may occur without the user's knowledge, notably in a third-party library.

Workarounds

No workarounds are known.

References

See advisory page for additional details.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.