InfluxOSS writing data to bucket with retention period doesn't write data

Aperta
#567 3 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
45/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
csharp
Ambito
databases

Direzione di ricerca

Inizia riproducendo la discrepanza con WritePointsAsyncWithIRestResponse e WriteRecordsAsyncWithIRestResponse utilizzando la configurazione Docker di Influx OSS indicata, quindi confrontali con la richiesta diretta /api/v2/write. Verifica lo stato restituito e se i dati compaiono nel bucket configurato con il relativo periodo di conservazione. Il lavoro è completato quando i metodi del client persistono gli stessi record della richiesta diretta oppure indicano chiaramente perché non lo fanno.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

I am attempting to write data to a bucket running in Influx OSS that is running inside docker (Macbook M2 Pro, Docker version: 24.0.5, Influx OSS Image Version: 2.7.1).

The WriteXXXAsyncWithIRestReponse() methods return a result that has the IsSuccessful returning True, but the status code is actually NoContent with no data actually written to the database.

Using a consistent inlux client and api configuration:

                using var influxClient = new InfluxDBClient(
                    new InfluxDBClientOptions(configuration.Url)
                    {
                        Bucket = configuration.Bucket,
                        Org = configuration.Organisation,
                        Token = configuration.Token,
                        PointSettings = { DefaultTags = configuration.DefaultTags},
                    }
                );

                var api = influxClient.GetWriteApiAsync();

The first snippet is using the WritePointsAsyncWithIRestResponse which returns NoContent, but no data is written as below:

                var response = await api.WritePointsAsyncWithIRestResponse(
                    metrics.Select(x => pointDataConverter(x, PointData.Measurement(configuration.MeasurementName)))
                        .ToList(),
                    configuration.Bucket,
                    configuration.Organisation
                );

The second snippet is using the WriteRecordsAsyncWithIRestResponse with also returns NoContent, but no data is written as below:

                var response = await api.WriteRecordsAsyncWithIRestResponse(
                    metrics.Select(x => pointDataConverter(x, PointData.Measurement(configuration.MeasurementName)))
                        .Select(x => x.ToLineProtocol()),
                    WritePrecision.Ms,
                    configuration.Bucket,
                    configuration.Organisation
                );

To try and understand what was going wrong, I thought I would put togther a quick harness that calls the API using HTTP calls directly using Flurl, which returns NoContent but the data is correctly written to the bucket:

                var request = configuration
                    .Url
                    .WithHeader("Authorization", $"Token {configuration.Token}")
                    .WithHeader("Content-Type", "text/plain; charset=utf-8")
                    .WithHeader("Accept", "application/json")
                    .AppendPathSegment("/api/v2/write")
                    .SetQueryParam("org", configuration.Organisation)
                    .SetQueryParam("bucket", configuration.Bucket)
                    .SetQueryParam("precision", "ms");

                using var response = await request.PostStringAsync(
                    string.Join("\n",
                        metrics
                            .Select(x => pointDataConverter(x, PointData.Measurement(configuration.MeasurementName)).ToLineProtocol()))
                );

Through all three different scenarios the data that is been generated is not changing (the same callback is used to convert from my internal data structure to the influx PointData structure), but only the third case actually persists data.

I would have expected that the second and third scenarios would have the same outcome given they are both writing line protocol directly, but this is not the case.

Lingua principale
C#
Stelle
377
Fork
93
Merge medio
9g 2h
PR unite (30g)
1

Preparare l'ambiente

  • Nessun Dockerfile né file Docker Compose
  • Ha un modello di pull request
  • Nessuna guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di influxdata/influxdb-client-csharp

Tutte le issue di influxdata/influxdb-client-csharp

Issue simili

Altre issue su C#

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.