0

I've found out that X-NewRelic-ID header is not present in my okhttp calls.

Is there any library that provides such interceptors or do I need to implement them manually?

In contrary - iOS version provides such functionality (automatically registers appropriate interceptors)

I wonder if newrelic team provides Android specific interceptors.

pixel
  • 24,905
  • 36
  • 149
  • 251
  • What's wrong with manually adding them to your OkHttp client instance? https://stackoverflow.com/questions/32196424/how-to-add-headers-to-okhttp-request-interceptor – Zun Aug 23 '19 at 10:23
  • @Zun I've read it several times - but it states that there is no integration between okhttp and nerelic, whereas their blog post from 2014 states otherwise... https://blog.newrelic.com/product-news/okhttp/ – pixel Aug 23 '19 at 11:25
  • Newrelic uses reflection to find out that `okHttp` (as well as other common http clients) is present on the classpath then it wraps appropriate methods and adds header to okHttp requests. – pixel Aug 23 '19 at 11:53

1 Answers1

0

It turns out that everything is inside New Relic library. The only thing user needs to do it to enable relevant feature flag:

FeatureFlag.enableFeature(FeatureFlag.DistributedTracing)

Under the covers New Relic uses reflection to find out that OkHttp (as well as other common http clients) is present on the classpath and then wraps appropriate methods and adds its http headers.

It's real shame that such things are not mentioned nor explained in the documentation.

pixel
  • 24,905
  • 36
  • 149
  • 251