Skip to content

Allow overriding RESTDataSource.trace #2009

@christianrondeau

Description

@christianrondeau

I'm currently adding Application Insights' dependency tracking into an Apollo server, and I'd like to track the time it takes to call dependencies from within Apollo. Good news, there's a trace method that does exactly what I need! Bad news, it's private and only logs to console...

I'd like to simply be able to receive the trace context (url, duration, method) and log that information myself.

I'm happy to provide a PR if that makes sense.

  1. New boolean property RESTDataSource.traceEnabled (by default, process && process.env && process.env.NODE_ENV === 'development')
  2. Change RESTDataSource.trace to receive individual properties options.method || 'GET' and url
  3. New protected function RESTDataSource.log, which by default logs to the console like it does now, but that can be overriden.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions