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; }

        [Column("LoggedState")]
        public GeneralLoggedState LoggedState { get; set; }

        [Column("PreviousStateDateTime")]
        public DateTime? PreviousStateDateTime { get; set; }

        [Column("SequenceNumber")]
        public int SequenceNumber { get; set; }

        [Column("SequenceID")]
        public int SequenceID
        {
            get
            {
                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.
                    break;
                }
            }

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:

Regards

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.

Thanks