Newbie - WriteMeasurent doesn't seem to write anything

Hi there,

I hope you can help because I’m out of ideas.
I’ve deployed an InfluxDB in my kubernetes and the UI is working fine.

I’ve wrote a small C# program to test the insertion of a record. My model looks like this:

    public class AgentLoggedState
        [Column("UTCOperationDate", IsTimestamp =true)]
        public DateTime UTCOperationDate { get; set; }

        [Column("AgentID", IsTag = true)]
        public int AgentID { get; set; }

        public GeneralLoggedState LoggedState { get; set; }

        public DateTime? PreviousStateDateTime { get; set; }

        public int SequenceNumber { get; set; }

        public int SequenceID
                return 100000004 + AgentID;

I’m initing the client and then writing the event with this:

            using (var writeApi = client.GetWriteApi())
                foreach (var evt in listEvents)
                    writeApi.WriteMeasurement(bucket, org, WritePrecision.Ns, evt);
                    // I have the break just to insert 1 record.

I’ve tried with .Flush after .WriteMeasurement but the result is always the same. Any simples query like

from(bucket: "loggedState") |> range(start: 0)

simples return nothing :frowning:

What am I missing? Do I need to configure something else in InfluxDB?

Thanks in advance

Hi @Nuno_Centeio,

thanks for using our client.

The WriteApi is suppose to run as long live singleton with batching at background thread. If you would like to write just simple record just use: WriteApiAsync.

Following example shows how to use WriteApiAsync to write Line Protocol, Data Point or your custom Domain Object:


During the night I’ve tried to switch to async and it worked. I was getting an exception because my DateTime wasn’t UTC but with WriteMeasurememt this exception was not thrown.