Class WriteOptions
The WriteOptions class holds the configuration for writing data to InfluxDB.
You can configure following options:
- Precision: The default precision to use for the timestamp of points if no precision is specified in the write API call.
- GzipThreshold: The threshold in bytes for gzipping the body. The default value is 1000.
If you want create client with custom options, you can use the following code:
using var client = new InfluxDBClient(new ClientConfig
{
Host = "https://us-east-1-1.aws.cloud2.influxdata.com",
Token = "my-token",
Organization = "my-org",
Database = "my-database",
WriteOptions = new WriteOptions
{
Precision = WritePrecision.S,
GzipThreshold = 4096
}
});
Inheritance
Namespace: InfluxDB3.Client.Config
Assembly: InfluxDB3.Client.dll
Syntax
public class WriteOptions : ICloneable
Properties
DefaultTags
Tags added to each point during writing. If a point already has a tag with the same key, it is left unchanged.
var _client = new InfluxDBClient(new InfluxDBClientConfigs
{
HostUrl = "some-url",
Organization = "org",
Database = "database",
DefaultTags = new Dictionary \<string, string ()
{
{ "rack", "main" },
}
});
// Writes with rack=main tag
await _client.WritePointAsync(PointData
.Measurement("cpu")
.SetField("field", 1)
);
Declaration
public Dictionary<string, string>? DefaultTags { get; set; }
Property Value
Type | Description |
---|---|
System.Nullable<Dictionary<System.String, System.String>> |
GzipThreshold
The threshold in bytes for gzipping the body.
Declaration
public int GzipThreshold { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
Precision
The default precision to use for the timestamp of points if no precision is specified in the write API call.
Declaration
public WritePrecision? Precision { get; set; }
Property Value
Type | Description |
---|---|
System.Nullable<WritePrecision> |
Methods
Clone()
Declaration
public object Clone()
Returns
Type | Description |
---|---|
System.Object |