Code Monkey home page Code Monkey logo

Comments (11)

rmosolgo avatar rmosolgo commented on September 26, 2024

Hey @layerssss, thanks for reporting this issue.

I see you spotted the difference in the Service: name. Were you able to find data in DataDog under the new service name? (I'm not sure how that's surfaced inside DataDog, but I'm wondering whether there's really no data going to DataDog, or whether data is still going there, but it's in a new place.)

Judging by the diff in that PR, it looks like you could set the Service back to ruby-graphql by passing it as an option, for example:

trace_with GraphQL::Tracing::DataDogTrace, service: "ruby-graphql" 

What happens if you add that option to your setup?

from graphql-ruby.

layerssss avatar layerssss commented on September 26, 2024

Hi @rmosolgo I think you are right, the data is sent to DataDog under the new service name rails. But it didn't get processed because I assume the records won't "fit" into the "rails" APM. Here is a screenshot inside the DataDog rails APM. There are no additional entries related to GraphQL. (without specifying service: option)

image

Adding service: "ruby-graphql" does workaround the issue though. (The ruby-graphql APM did get populated)

from graphql-ruby.

rmosolgo avatar rmosolgo commented on September 26, 2024

cc @TonyCTHsu @vpellan is this intended behavior? Should the GraphQL-Ruby plugin still be providing ruby-graphql as the default service name?

from graphql-ruby.

TonyCTHsu avatar TonyCTHsu commented on September 26, 2024

👋 @layerssss @rmosolgo Thanks for reporting.

service is a field defined to be a entity that groups together endpoints, queries, or jobs for the purposes of building your application.

Generally speaking, it is your application.

Historically, it was abused for other reasons. Assigning it incorrectly would break other features such as Service Catalog.

GraphQL should be considered as internal to your application without explicitly defining it as a different service other than your application. The service for GraphQL spans will be labelled as your service definition from your configuration.

Datadog.configure do |c|
  c.service = "..."
end

I would highly recommend to NOT provide the default service ruby-graphql, because eventually this field will be deprecated from Datadog's API.

from graphql-ruby.

layerssss avatar layerssss commented on September 26, 2024

@TonyCTHsu Thanks for referring to the documentation. But if I remove the service: option. I could no longer find any stats for each executed GraphQL query in the APM section in DataDog.

It's not inside the rails service as my above screenshot. Where should I look for it?

from graphql-ruby.

layerssss avatar layerssss commented on September 26, 2024

@TonyCTHsu I've tried setting a default service option for the whole application.

Now the whole configuration becomes:

Datadog.configure do |c|
  c.service = "another-rails-app"
  c.tracing.contrib.global_default_service_name.enabled = true
  if ENV["DD_ENV"].present?
    c.tracing.instrument :active_model_serializers
    c.tracing.instrument :active_support
    c.tracing.instrument :aws
    c.tracing.instrument :excon
    c.tracing.instrument :faraday
    c.tracing.instrument :http
    c.tracing.instrument :httpclient
    c.tracing.instrument :rails
    c.tracing.instrument :redis
    c.tracing.instrument :sidekiq

    c.profiling.enabled = true if Rails.env.production?
  else
    c.tracing.enabled = false
  end
end

graphql/???_schema.rb has

  trace_with GraphQL::Tracing::DataDogTrace

(we have 2 schemas)

I've also removed require: "ddtrace/auto_instrument" from Gemfile just in case.

This does result all integrations ended up nicely under the new "service" (another-rails-app). But GraphQL seems to be the only one missing here.

image image

When I changed trace_with GraphQL::Tracing::DataDogTrace to trace_with GraphQL::Tracing::DataDogTrace, service: "another-graphql-app", GraphQL stats appeared (under the new service name).

image

from graphql-ruby.

marcotc avatar marcotc commented on September 26, 2024

Hey @layerssss, is there any information in the execute.graphql span that you cannot get from the rack.request, scoped to your Rails controller that handles GraphQL requests in your application?

from graphql-ruby.

layerssss avatar layerssss commented on September 26, 2024

In execute.graphql (when it works), each resource is the name of GraphQL query (passed by operation_name from ruby-graphql). Showing me execution span for each different query corresponding to different React component it was triggered from.

In rack.request each resource is the name of the controller. Showing span of each different controllers. All GraphQL requests are within one controller GraphqlController. e.g. I won't be able to tell which React component is triggering a slow GraphQL query.

from graphql-ruby.

layerssss avatar layerssss commented on September 26, 2024

@marcotc

from graphql-ruby.

rmosolgo avatar rmosolgo commented on September 26, 2024

@layerssss, glad to hear that using service: ... makes the data show up again.

@marcotc or @TonyCTHsu, can either of you provide a screenshot of how GraphQL data should look in the DataDog UI? I want to make sure our default plugin makes data appear somewhere, because as @layerssss mentioned, it contains information that other spans don't have.

from graphql-ruby.

rmosolgo avatar rmosolgo commented on September 26, 2024

I don't know what else needs to happen in GraphQL-Ruby here, so I'll close this out.

from graphql-ruby.

Related Issues (20)

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.