Closed driv3r closed 7 years ago
This is going to take me some time to review. I've only ever had bad experiences using tools like VCR (in rails) and I would have to think very hard before leaning into one for this, especially when testing against a closed source API. With that said, I understand the benefits and relative ease of use of that kind of tool. I'll have to think about it.
Couple of questions:
ApiAdapter
or should we just default to new one?ApiServer
, so far I know just vcr for this kind of stuff in elixir (in ruby land I don't use it either ;)btw. Tomorrow I will do some testing and check how it works compared to synchronous version.
So, for configuration, what we should do is store the configuration in a gen_server or an agent, but use Confex to get it originally. Then, when someone starts a trace, we ask the gen_server for the starting config, and store that in the process dictionary with the other trace data. @driv3r what are your thoughts on that?
@zachdaniel I think it makes sense then each trace have a copy of config for its lifespan, so even if ENV var will change during runtime, all spans that started before will get finished.
One more questions needs to be answered before I could finish this up, do we leave or remove ApiAdapter?
maybe instead of swapping the ApiAdapter
we could swap just the HTTPoison
?
I like the ApiAdapter. It exists to fill the same niche that VCR fills, but in a simpler way (IMO). I'm actually curious, with the TestApiAdapter, what requests were being made that had to be mocked with VCR?
vcr was used in order to test ApiServer
, and full path from creation of span to http put. We can ditch tests for ApiServer
and use TestApiAdapter
in full path instead although then it doesn't make sense for full path :)
@driv3r This looks good. I should have added a test for it, but I was in a bit of a hurry. Thanks, also for moving away from VCR.
Application
fromSpandex
toSpandex.Application
for cleaner setupSpandex.Datadog.ApiServer
as a new implementation and drop in replacement forSpandex.Datadog.ApiAdapter
ref: #11We can compare now sync vs async, although it's probably better to just get rid of old API adapter.
Also one more thing, it's probably better to improve a structure a bit, and move everything under
lib/spandex/
as it's encouraged when you create new mix app.