pada57 / serilog-sinks-influxdb

Serilog Sinks for InfluxDB
MIT License
10 stars 9 forks source link

Fix #18: Tags must not be quoted strings #19

Closed tom-englert closed 1 year ago

tom-englert commented 1 year ago

Fix #18: Using extended tags corrupts database

pada57 commented 1 year ago

@tom-englert can you elaborate bit more. This part was added "recently" do you mean adding a string as ExtendedTags which contains any special characters including double quotes are causing issues ?

then could we use StripSpecialCharacter like https://github.com/pada57/serilog-sinks-influxdb/blob/main/Serilog.Sinks.InfluxDB/Sinks/InfluxDB/InfluxDBSink.cs#L162

to avoid changing the original content of the tag ?

tom-englert commented 1 year ago

No, special characters don't seem to be the problem, just the quotes (see the screenshot in the issue description)

tom-englert commented 1 year ago

The quotes aren't part of the original string, they are added by the property serializer when calling Property.ToString() https://github.com/pada57/serilog-sinks-influxdb/blob/f2e8ba82ddb0c91f8aab0df77df5d77ac3b9a675/Serilog.Sinks.InfluxDB/Sinks/InfluxDB/PointExtensions.cs#L14

tom-englert commented 1 year ago

So removing the quotes just restores the original string.

tom-englert commented 1 year ago

See also the original test. Input is  "Stored Value", but output was "\"Stored Value\"" https://github.com/pada57/serilog-sinks-influxdb/blob/f2e8ba82ddb0c91f8aab0df77df5d77ac3b9a675/Tests/Serilog.Sinks.InfluxDB.Tests/PointExtensionsTest.cs#L55 https://github.com/pada57/serilog-sinks-influxdb/blob/f2e8ba82ddb0c91f8aab0df77df5d77ac3b9a675/Tests/Serilog.Sinks.InfluxDB.Tests/PointExtensionsTest.cs#L73

tom-englert commented 1 year ago

Superseded by #22