influxdb-1.9.3.2: InfluxDB client library for Haskell
Safe HaskellSafe-Inferred
LanguageHaskell2010

Database.InfluxDB.Write.UDP

Synopsis

Documentation

This module is desined to be used with the network package and be imported qualified.

>>> :set -XOverloadedStrings -XNoOverloadedLists
>>> import qualified Data.Map as Map
>>> import Data.Time
>>> import Network.Socket
>>> import Database.InfluxDB
>>> import qualified Database.InfluxDB.Write.UDP as UDP
>>> sock <- Network.Socket.socket AF_INET Datagram defaultProtocol
>>> let localhost = tupleToHostAddress (127, 0, 0, 1)
>>> let params = UDP.writeParams sock $ SockAddrInet 8089 localhost
>>> UDP.write params $ Line "measurement1" Map.empty (Map.fromList [("value", FieldInt 42)]) (Nothing :: Maybe UTCTime)
>>> close sock

Make sure that the UDP service is enabled in the InfluxDB config. This API doesn't tell you if any error occurs. See the official doc for details.

Writers

write :: Timestamp time => WriteParams -> Line time -> IO () Source #

Write a Line

writeBatch :: (Timestamp time, Foldable f) => WriteParams -> f (Line time) -> IO () Source #

Write Lines in a batch

This is more efficient than write.

Writer parameters

data WriteParams Source #

The full set of parameters for the UDP writer.

Instances

Instances details
HasPrecision 'WriteRequest WriteParams Source #

Timestamp precision.

In the UDP API, all timestamps are sent in nanosecond but you can specify lower precision. The writer just rounds timestamps to the specified precision.

Instance details

Defined in Database.InfluxDB.Write.UDP

writeParams :: Socket -> SockAddr -> WriteParams Source #

Smart constructor for WriteParams

Default parameters:

precision
Nanosecond

sockAddr :: Lens' WriteParams SockAddr Source #

UDP endopoint of the database

precision :: HasPrecision ty a => Lens' a (Precision ty) Source #

Time precision parameter.