From 67f0c5b1905b831633337939d0494bb36599dc4d Mon Sep 17 00:00:00 2001 From: Lou Knauer Date: Thu, 10 Feb 2022 10:01:30 +0100 Subject: [PATCH] fix panic if sink type does not exist --- sinks/httpSink.md | 20 ++++++++------------ sinks/sinkManager.go | 2 +- 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/sinks/httpSink.md b/sinks/httpSink.md index fe466e8..23203a2 100644 --- a/sinks/httpSink.md +++ b/sinks/httpSink.md @@ -9,25 +9,21 @@ The `http` sink uses POST requests to a HTTP server to submit the metrics in the "": { "type": "http", "meta_as_tags" : true, - "database" : "mymetrics", - "host": "dbhost.example.com", - "port": "4222", - "jwt" : "0x0000q231", - "ssl" : false, + "url" : "https://my-monitoring.example.com:1234/api/write", + "jwt" : "blabla.blabla.blabla", "timeout": "5s", "max_idle_connections" : 10, - "idle_connection_timeout" : "5s" + "idle_connection_timeout" : "5s", + "flush_delay": "2s", } } ``` - `type`: makes the sink an `http` sink - `meta_as_tags`: print all meta information as tags in the output (optional) -- `database`: All metrics are written to this bucket -- `host`: Hostname of the InfluxDB database server -- `port`: Portnumber (as string) of the InfluxDB database server -- `jwt`: JSON web tokens for authentification -- `ssl`: Activate SSL encryption +- `url`: The full URL of the endpoint +- `jwt`: JSON web tokens for authentification (Using the *Bearer* scheme) - `timeout`: General timeout for the HTTP client (default '5s') - `max_idle_connections`: Maximally idle connections (default 10) -- `idle_connection_timeout`: Timeout for idle connections (default '5s') \ No newline at end of file +- `idle_connection_timeout`: Timeout for idle connections (default '5s') +- `flush_delay`: Batch all writes arriving in during this duration (default '1s', batching can be disabled by setting it to 0) diff --git a/sinks/sinkManager.go b/sinks/sinkManager.go index bbff949..ff6e01d 100644 --- a/sinks/sinkManager.go +++ b/sinks/sinkManager.go @@ -133,7 +133,7 @@ func (sm *sinkManager) AddOutput(name string, rawConfig json.RawMessage) error { } } if _, found := AvailableSinks[sinkConfig.Type]; !found { - cclog.ComponentError("SinkManager", "SKIP", name, "unknown sink:", err.Error()) + cclog.ComponentError("SinkManager", "SKIP", name, "unknown sink:", sinkConfig.Type) return err } s := AvailableSinks[sinkConfig.Type]