influxdata / influxdb-csharp

A .NET library for efficiently sending points to InfluxDB 1.x
Apache License 2.0
199 stars 60 forks source link

DNS does not update #91

Open bladefist opened 4 years ago

bladefist commented 4 years ago

Pretty simple report, if you use collector.example.com and you change that dns to point to another IP, the collector will not update until you cycle the app.

russorat commented 4 years ago

@bladefist thanks for the issue. In other client libs you've used, is this option configurable or always on?

bladefist commented 4 years ago

I'm not sure as I would never cheat on this repository. I will say this is an issue that has come up before when using HttpClient (I assume this repo uses it). There are some easy fixes. If you're using a singleton it can be re-instated periodically. There are other solutions but I will admit I'm not an expert on it. thanks!

bednar commented 4 years ago

Hi @bladefist,

I've been investigate how to fix it and it is a little bit complicated than it looks like. As you assume we are using a singleton: https://github.com/influxdata/influxdb-csharp/blob/fe041d744b39766475d2f3cf6300d76dfbe10b30/src/InfluxDB.LineProtocol/Client/LineProtocolClient.cs#L36 so re-instated periodically is possible but it seems to me a too tricky 😄.

The next option is use a ServicePoint.ConnectionLeaseTimeout but it looks that it isn't supported on all platforms.

Regards

sgtfrankieboy commented 4 years ago

Starting from .NET Core 2.1 its possible to use IHttpClientFactory to handle the creation and recycling of the HttpClient/HttpMessageHandler, solving the DNS issue. An issue is that its coupled with Microsoft.Extensions.DependencyInjection.

wbaldoumas commented 3 years ago

Any updates on this issue? We ran into this exact problem on my team yesterday and it bit us pretty hard. We're using v1.1.0.