Hello
I have set up a local docker with udp enabled on port 8089.
I use symfony to collect metrics and write points to influxdb. In symfony I have two registered services, one that communicates over the http port 8086, one that communicates over the udp port 8089 (default 4444)
I write data like this:
public function push(Metric $metric): void
{
try {
$point = new Point(
$metric->measurement,
$metric->value,
$metric->tags,
$metric->fields,
$metric->timestamp
);
$this->database->writePoints([$point], Database::PRECISION_MICROSECONDS);
} catch (Exception $e) {
$this->logger->warning('Failed to push metric due to exception', ['exception' => $e]);
}
}
This is how i generate the timestamp:
public static function getCurrentTimestamp(): string
{
[$usec, $sec] = explode(' ', microtime());
return \sprintf('%d%06d', $sec, $usec*1000000);
}
Now here comes the interesting part: When i push this over the http port, i can see the measurements and data appearing in influxdb.
However, if i push this through the udp port, i see the following log entry:
msg="Failed to write point batch to database" log_id=0KJclwVl000 service=udp db_instance=pa error="partial write: points beyond retention policy dropped=1"
which i had before when i selected the wrong timestamp precision.
The data sent is the same as far as i can tell.
The timestamp i actually do write is 1578930816179733
, which if you divide it by 1000 two times results in a regular unix timestamp, which means it is in microseconds. So the timestamp is correct, the precision should be flagged as such everywhere, but still the udp endpoint seems to refuse it. why?
How do i debug this?
Here is my docker-compose.yml service definition:
influxdb:
image: influxdb:1.7
logging:
driver: "json-file"
options:
max-size: "1M"
max-file: "100"
restart: always
environment:
INFLUXDB_DATA_QUERY_LOG_ENABLED: "true"
INFLUXDB_ADMIN_ENABLED: "true"
INFLUXDB_ADMIN_USER: admin
INFLUXDB_ADMIN_PASSWORD: ***
INFLUXDB_USER: user
INFLUXDB_PASSWORD: ***
INFLUXDB_DB: ***
INFLUXDB_REPORTING_DISABLED: "true"
volumes:
- ./docker/influxdb/influxdb.conf:/etc/influxdb/influxdb.conf:ro
Here is my influxdb.conf:
reporting-disabled = false
bind-address = ":8088"
[meta]
dir = "/var/lib/influxdb/meta"
retention-autocreate = true
logging-enabled = true
[data]
dir = "/var/lib/influxdb/data"
wal-dir = "/var/lib/influxdb/wal"
query-log-enabled = true
cache-max-memory-size = 1073741824
cache-snapshot-memory-size = 26214400
cache-snapshot-write-cold-duration = "10m0s"
compact-full-write-cold-duration = "4h0m0s"
max-series-per-database = 1000000
max-values-per-tag = 100000
index-version = "tsi1"
trace-logging-enabled = false
[coordinator]
write-timeout = "10s"
max-concurrent-queries = 0
query-timeout = "0s"
log-queries-after = "0s"
max-select-point = 0
max-select-series = 0
max-select-buckets = 0
[retention]
enabled = true
check-interval = "30m0s"
[shard-precreation]
enabled = true
check-interval = "10m0s"
advance-period = "30m0s"
[monitor]
store-enabled = true
store-database = "_internal"
store-interval = "10s"
[subscriber]
enabled = true
http-timeout = "30s"
insecure-skip-verify = false
ca-certs = ""
write-concurrency = 40
write-buffer-size = 1000
[http]
enabled = true
flux-enabled = true
bind-address = ":8086"
auth-enabled = false
log-enabled = true
write-tracing = false
pprof-enabled = true
https-enabled = false
https-certificate = "/etc/ssl/influxdb.pem"
https-private-key = ""
max-row-limit = 0
max-connection-limit = 0
shared-secret = ""
realm = "InfluxDB"
unix-socket-enabled = false
bind-socket = "/var/run/influxdb.sock"
[[graphite]]
enabled = false
bind-address = ":2003"
database = "graphite"
retention-policy = ""
protocol = "tcp"
batch-size = 5000
batch-pending = 10
batch-timeout = "1s"
consistency-level = "one"
separator = "."
udp-read-buffer = 0
[[collectd]]
enabled = false
bind-address = ":25826"
database = "collectd"
retention-policy = ""
batch-size = 5000
batch-pending = 10
batch-timeout = "10s"
read-buffer = 0
typesdb = "/usr/share/collectd/types.db"
security-level = "none"
auth-file = "/etc/collectd/auth_file"
[[opentsdb]]
enabled = false
bind-address = ":4242"
database = "opentsdb"
retention-policy = ""
consistency-level = "one"
tls-enabled = false
certificate = "/etc/ssl/influxdb.pem"
batch-size = 1000
batch-pending = 5
batch-timeout = "1s"
log-point-errors = true
[[udp]]
enabled = true
bind-address = ":8089"
database = "pa"
retention-policy = ""
batch-size = 5000
batch-pending = 10
read-buffer = 0
batch-timeout = "1s"
precision = ""
[continuous_queries]
log-enabled = true
enabled = true
run-interval = "1s"