influxdata / influxdb-csharp

A .NET library for efficiently sending points to InfluxDB 1.x

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Request: Add method to get a formated string

antonkolb opened this issue · comments

I would like to request a simple feature:
It should be possible to transform a point into a string, which follows the line protocol '
e.g. "cpu,dev=cpu0 temp=4,var1="bla",var2="miep" 1540900454326481400"

Our situation: We are communicating with Telegraf and use currently the Line Protocol. We generate the string ourselves including the handling of special characters. I hoped, that with this library we could save the additional work, as you guys have to generate an Inline String somewhere in the process eventually anyway.

You can use the LineProtocolWriter to help write out correct line protocol.

See LineProtocolWriterTests for usage examples.

Does this help you at all?

This could be, what I was looking for. Let me try it later and I will come back you!

Yes! It escapes and generates the string.
Merci!

Sorry for the bother, but I couldn't read the information out of the documentation and find a method that returns string, so I assumed what I want doesn't exist.

Yeah, I wrote it as I was wanted something that would produce valid line protocol without having to allocation lots of objects.
I created the pull request to get it merged in here, as it seamed the most appropriate place, but I never got round to writing any documentation.

Anyways I'm glad you are able to use it to do what you need to do.