Coder Social home page Coder Social logo

apollo-tracing-elixir's People

Contributors

athal7 avatar benwilson512 avatar sikanhe avatar smaximov avatar stephenmoloney avatar yobilat 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  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  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  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

apollo-tracing-elixir's Issues

cache info not fetched by apollo engine?

hello there :)

i setup apollo ltracing then add meta to my schema:

image

but the cache hint is always empty:

image

also the apollo-engine seems not receive the cache info

image

image

Why isn't this caching anything?

Bump Jason dep?

Hello! Curious if it would be possible to bump this dep as it's locked into a very specific version and freazing our dep update effort.

Thank you!

Failed to use "jason" (version 1.2.1) because
  apollo_tracing (version 0.4.3) requires ~> 1.1.2

support Jason.Encoder

hi there ~

when i use jason as json_codec, an error broke the test:

defmodule GroupherServerWeb.Router do
  @moduledoc false
 
 #  ...
  scope "/graphiql" do
    pipe_through(:api)

    forward(
      "/",
      Absinthe.Plug.GraphiQL,
      schema: GroupherServerWeb.Schema,
      json_codec: Jason,
      pipeline: {ApolloTracing.Pipeline, :plug},
      interface: :playground,
      context: %{pubsub: GroupherServerWeb.Endpoint}
    )
  end
end
** (Protocol.UndefinedError) protocol Jason.Encoder not implemented for %ApolloTracing.Schema{duration: nil, endTime: nil, execution: %ApolloTracing.Schema.Execution{resolvers: []}, startTime: "2019-07-11T13:40:41.969305Z", version: 1} of type ApolloTracing.Schema (a struct), Jason.Encoder protocol must always be explicitly implemented.

     If you own the struct, you can derive the implementation specifying which fields should be encoded to JSON:

         @derive {Jason.Encoder, only: [....]}
         defstruct ...

     It is also possible to encode all fields, although this should be used carefully to avoid accidentally leaking private information when new fields are added:

         @derive Jason.Encoder
         defstruct ...

     Finally, if you don't own the struct you want to encode to JSON, you may use Protocol.derive/3 placed outside of any module:

         Protocol.derive(Jason.Encoder, NameOfTheStruct, only: [...])
         Protocol.derive(Jason.Encoder, NameOfTheStruct)
     . This protocol is implemented for the following type(s): Ecto.Association.NotLoaded, Ecto.Schema.Metadata, Date, BitString, Jason.Fragment, Any, Map, NaiveDateTime, List, Integer, Time, DateTime, Decimal, Atom, Float

is jason not supported ?


to work around, i had to add those two line according to the error hint

Protocol.derive(Jason.Encoder, ApolloTracing.Schema)
Protocol.derive(Jason.Encoder, ApolloTracing.Schema.Execution)

Conditional Tracing

Because tracing shows up in the return value, there should probably be a good way to tracing on or off. If you're testing your API for example you don't want to have to be dropping the extensions key from the result all the time.

It may also be a valuable production flag if for some reason things are going weirdly and tracing is causing a performance issue. It may be enough to add a simple application environment variable.

:resolution not found in: %Absinthe.Blueprint

Not entirely sure if this due to apollo-tracing, but I'm receiving this :resolution not found in: %Absinthe.Blueprint error. Here are my GraphQL related deps:

{:absinthe, "~> 1.4.0-rc.3", override: true},
{:absinthe_plug, "~> 1.4.0-rc.1"},
{:absinthe_ecto, "~> 0.1.2"},
{:absinthe_phoenix, github: "absinthe-graphql/absinthe_phoenix"},
{:apollo_tracing, git: "https://github.com/sikanhe/apollo-tracing-elixir.git"},

If I remove tracing from the pipeline, no errors (which makes me think the error originates from this module). It can be hard to track down since I'm a little fuzzy on how all the related modules interrelate. Also note, I'm using sockets as well (which don't pass through tracing), and that works.

I believe I had this working with a previous version of absinthe and/or absinthe_plug, but I'd rather keep up with the core module versions as tracing isn't mission critical.

Thoughts?

Bit of confusion regarding middleware vs plug pipeline

If I only add tracing to the absinthe pipeline, it works. If I add tracing to the absinthe pipeline and add use ApolloTracing to my schema, I get the error below:

** (BadStructError) expected a struct named ApolloTracing.Schema.Execution.Resolver, got: %{duration: 4000, ...

My Absinthe related deps are:

{:absinthe, "~> 1.4.0-beta.3", override: true},
{:absinthe_plug, "~> 1.4.0-beta.2"},
{:absinthe_ecto, "~> 0.1.2"},
{:apollo_tracing, git: "https://github.com/sikanhe/apollo-tracing-elixir.git"}

Maybe worth noting, I couldn't get apollo_tracing to install without referencing the github repo directly. The absinthe override is to due absinthe_ecto

Runtime errors in a distillery release

Problem:
absinthe_plug is a project dependency and the following error occurs during runtime making a request in a distillery release.

Description:

Request: POST /api
** (exit) an exception was raised:
    ** (RuntimeError)   You don't have Plug loaded, please use
  ApolloTracing.Pipeline.default(absinthe_schema, pipeline_opts)
  to produce a pipeline without Plug specific phases

        (apollo_tracing) lib/apollo_tracing/pipeline.ex:16: ApolloTracing.Pipeline.plug/2
        (absinthe_plug) lib/absinthe/plug/request/query.ex:75: Absinthe.Plug.Request.Query.add_pipeline/3

It seems to be because Distillery doesn't find the Absinthe.Plug module...

  if Code.ensure_loaded?(Absinthe.Plug) do
    def plug(config, pipeline_opts \\ []) do
      config
      |> Absinthe.Plug.default_pipeline(pipeline_opts)
      |> add_phases()
    end
  else
    def plug(_, _ \\ []) do
      raise RuntimeError, """
        You don't have Plug loaded, please use
        ApolloTracing.Pipeline.default(absinthe_schema, pipeline_opts)
        to produce a pipeline without Plug specific phases
      """
    end
  end

One Possible Solution:
Relates to PR

Support Absinthe Subscription Tests

Absinthe 1.4 added support for GraphQL subscriptions, as well as a support module for testing them. This module primes absinthe to load eagerly by running the schema with the default pipeline, so that subscription tests with a short timeout can pass. Unfortunately this does not allow apollo_tracing to add its metadata, so the middleware fails to successfully pattern match when called (https://github.com/sikanhe/apollo-tracing-elixir/blob/master/lib/apollo_tracing/middleware.ex#L10)

cc @benwilson512

Figure out Path

Currently we use path info inside Resolution for "path", but the spec requires indexes for items inside a list.

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.