chore: wrap long lines in plugins/inputs/[t-z]* (#12218)
This commit is contained in:
parent
b83bdd5eac
commit
b98a76372a
|
|
@ -204,7 +204,8 @@ func TestGrokParseLogFilesWithMultiline(t *testing.T) {
|
||||||
})
|
})
|
||||||
acc.AssertContainsTaggedFields(t, "tail_grok",
|
acc.AssertContainsTaggedFields(t, "tail_grok",
|
||||||
map[string]interface{}{
|
map[string]interface{}{
|
||||||
"message": "HelloExample: Sorry, something wrong! java.lang.ArithmeticException: / by zero\tat com.foo.HelloExample2.divide(HelloExample2.java:24)\tat com.foo.HelloExample2.main(HelloExample2.java:14)",
|
"message": "HelloExample: Sorry, something wrong! java.lang.ArithmeticException: / by zero\t" +
|
||||||
|
"at com.foo.HelloExample2.divide(HelloExample2.java:24)\tat com.foo.HelloExample2.main(HelloExample2.java:14)",
|
||||||
},
|
},
|
||||||
map[string]string{
|
map[string]string{
|
||||||
"path": expectedPath,
|
"path": expectedPath,
|
||||||
|
|
|
||||||
|
|
@ -6,19 +6,54 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/influxdata/telegraf/testutil"
|
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
|
||||||
|
"github.com/influxdata/telegraf/testutil"
|
||||||
)
|
)
|
||||||
|
|
||||||
const welcome = `Welcome to the TeamSpeak 3 ServerQuery interface, type "help" for a list of commands and "help <command>" for information on a specific command.`
|
const welcome = `Welcome to the TeamSpeak 3 ServerQuery interface, type "help" for a list of commands and ` +
|
||||||
|
`"help <command>" for information on a specific command.`
|
||||||
const ok = `error id=0 msg=ok`
|
const ok = `error id=0 msg=ok`
|
||||||
const errorMsg = `error id=256 msg=command\snot\sfound`
|
const errorMsg = `error id=256 msg=command\snot\sfound`
|
||||||
|
|
||||||
var cmd = map[string]string{
|
var cmd = map[string]string{
|
||||||
"login": "",
|
"login": "",
|
||||||
"use": "",
|
"use": "",
|
||||||
"serverinfo": `virtualserver_unique_identifier=a1vn9PLF8CMIU virtualserver_name=Testserver virtualserver_welcomemessage=Test virtualserver_platform=Linux virtualserver_version=3.0.13.8\s[Build:\s1500452811] virtualserver_maxclients=32 virtualserver_password virtualserver_clientsonline=2 virtualserver_channelsonline=1 virtualserver_created=1507400243 virtualserver_uptime=148 virtualserver_codec_encryption_mode=0 virtualserver_hostmessage virtualserver_hostmessage_mode=0 virtualserver_filebase=files\/virtualserver_1 virtualserver_default_server_group=8 virtualserver_default_channel_group=8 virtualserver_flag_password=0 virtualserver_default_channel_admin_group=5 virtualserver_max_download_total_bandwidth=18446744073709551615 virtualserver_max_upload_total_bandwidth=18446744073709551615 virtualserver_hostbanner_url virtualserver_hostbanner_gfx_url virtualserver_hostbanner_gfx_interval=0 virtualserver_complain_autoban_count=5 virtualserver_complain_autoban_time=1200 virtualserver_complain_remove_time=3600 virtualserver_min_clients_in_channel_before_forced_silence=100 virtualserver_priority_speaker_dimm_modificator=-18.0000 virtualserver_id=1 virtualserver_antiflood_points_tick_reduce=5 virtualserver_antiflood_points_needed_command_block=150 virtualserver_antiflood_points_needed_ip_block=250 virtualserver_client_connections=1 virtualserver_query_client_connections=1 virtualserver_hostbutton_tooltip virtualserver_hostbutton_url virtualserver_hostbutton_gfx_url virtualserver_queryclientsonline=1 virtualserver_download_quota=18446744073709551615 virtualserver_upload_quota=18446744073709551615 virtualserver_month_bytes_downloaded=0 virtualserver_month_bytes_uploaded=0 virtualserver_total_bytes_downloaded=0 virtualserver_total_bytes_uploaded=0 virtualserver_port=9987 virtualserver_autostart=1 virtualserver_machine_id virtualserver_needed_identity_security_level=8 virtualserver_log_client=0 virtualserver_log_query=0 virtualserver_log_channel=0 virtualserver_log_permissions=1 virtualserver_log_server=0 virtualserver_log_filetransfer=0 virtualserver_min_client_version=1445512488 virtualserver_name_phonetic virtualserver_icon_id=0 virtualserver_reserved_slots=0 virtualserver_total_packetloss_speech=0.0000 virtualserver_total_packetloss_keepalive=0.0000 virtualserver_total_packetloss_control=0.0000 virtualserver_total_packetloss_total=0.0000 virtualserver_total_ping=1.0000 virtualserver_ip=0.0.0.0,\s:: virtualserver_weblist_enabled=1 virtualserver_ask_for_privilegekey=0 virtualserver_hostbanner_mode=0 virtualserver_channel_temp_delete_delay_default=0 virtualserver_min_android_version=1407159763 virtualserver_min_ios_version=1407159763 virtualserver_status=online connection_filetransfer_bandwidth_sent=0 connection_filetransfer_bandwidth_received=0 connection_filetransfer_bytes_sent_total=0 connection_filetransfer_bytes_received_total=0 connection_packets_sent_speech=0 connection_bytes_sent_speech=0 connection_packets_received_speech=0 connection_bytes_received_speech=0 connection_packets_sent_keepalive=261 connection_bytes_sent_keepalive=10701 connection_packets_received_keepalive=261 connection_bytes_received_keepalive=10961 connection_packets_sent_control=54 connection_bytes_sent_control=15143 connection_packets_received_control=55 connection_bytes_received_control=4239 connection_packets_sent_total=315 connection_bytes_sent_total=25844 connection_packets_received_total=316 connection_bytes_received_total=15200 connection_bandwidth_sent_last_second_total=81 connection_bandwidth_sent_last_minute_total=141 connection_bandwidth_received_last_second_total=83 connection_bandwidth_received_last_minute_total=98`,
|
"serverinfo": `virtualserver_unique_identifier=a1vn9PLF8CMIU virtualserver_name=Testserver ` +
|
||||||
"serverrequestconnectioninfo": `connection_filetransfer_bandwidth_sent=0 connection_filetransfer_bandwidth_received=0 connection_filetransfer_bytes_sent_total=0 connection_filetransfer_bytes_received_total=0 connection_packets_sent_total=369 connection_bytes_sent_total=28058 connection_packets_received_total=370 connection_bytes_received_total=17468 connection_bandwidth_sent_last_second_total=81 connection_bandwidth_sent_last_minute_total=109 connection_bandwidth_received_last_second_total=83 connection_bandwidth_received_last_minute_total=94 connection_connected_time=174 connection_packetloss_total=0.0000 connection_ping=1.0000`,
|
`virtualserver_welcomemessage=Test virtualserver_platform=Linux virtualserver_version=3.0.13.8\s[Build:\s1500452811] ` +
|
||||||
|
`virtualserver_maxclients=32 virtualserver_password virtualserver_clientsonline=2 virtualserver_channelsonline=1 ` +
|
||||||
|
`virtualserver_created=1507400243 virtualserver_uptime=148 virtualserver_codec_encryption_mode=0 virtualserver_hostmessage ` +
|
||||||
|
`virtualserver_hostmessage_mode=0 virtualserver_filebase=files\/virtualserver_1 virtualserver_default_server_group=8 ` +
|
||||||
|
`virtualserver_default_channel_group=8 virtualserver_flag_password=0 virtualserver_default_channel_admin_group=5 ` +
|
||||||
|
`virtualserver_max_download_total_bandwidth=18446744073709551615 virtualserver_max_upload_total_bandwidth=18446744073709551615 ` +
|
||||||
|
`virtualserver_hostbanner_url virtualserver_hostbanner_gfx_url virtualserver_hostbanner_gfx_interval=0 ` +
|
||||||
|
`virtualserver_complain_autoban_count=5 virtualserver_complain_autoban_time=1200 virtualserver_complain_remove_time=3600 ` +
|
||||||
|
`virtualserver_min_clients_in_channel_before_forced_silence=100 virtualserver_priority_speaker_dimm_modificator=-18.0000 ` +
|
||||||
|
`virtualserver_id=1 virtualserver_antiflood_points_tick_reduce=5 virtualserver_antiflood_points_needed_command_block=150 ` +
|
||||||
|
`virtualserver_antiflood_points_needed_ip_block=250 virtualserver_client_connections=1 virtualserver_query_client_connections=1 ` +
|
||||||
|
`virtualserver_hostbutton_tooltip virtualserver_hostbutton_url virtualserver_hostbutton_gfx_url virtualserver_queryclientsonline=1 ` +
|
||||||
|
`virtualserver_download_quota=18446744073709551615 virtualserver_upload_quota=18446744073709551615 virtualserver_month_bytes_downloaded=0 ` +
|
||||||
|
`virtualserver_month_bytes_uploaded=0 virtualserver_total_bytes_downloaded=0 virtualserver_total_bytes_uploaded=0 virtualserver_port=9987 ` +
|
||||||
|
`virtualserver_autostart=1 virtualserver_machine_id virtualserver_needed_identity_security_level=8 virtualserver_log_client=0 ` +
|
||||||
|
`virtualserver_log_query=0 virtualserver_log_channel=0 virtualserver_log_permissions=1 virtualserver_log_server=0 ` +
|
||||||
|
`virtualserver_log_filetransfer=0 virtualserver_min_client_version=1445512488 virtualserver_name_phonetic virtualserver_icon_id=0 ` +
|
||||||
|
`virtualserver_reserved_slots=0 virtualserver_total_packetloss_speech=0.0000 virtualserver_total_packetloss_keepalive=0.0000 ` +
|
||||||
|
`virtualserver_total_packetloss_control=0.0000 virtualserver_total_packetloss_total=0.0000 virtualserver_total_ping=1.0000 ` +
|
||||||
|
`virtualserver_ip=0.0.0.0,\s:: virtualserver_weblist_enabled=1 virtualserver_ask_for_privilegekey=0 virtualserver_hostbanner_mode=0 ` +
|
||||||
|
`virtualserver_channel_temp_delete_delay_default=0 virtualserver_min_android_version=1407159763 virtualserver_min_ios_version=1407159763 ` +
|
||||||
|
`virtualserver_status=online connection_filetransfer_bandwidth_sent=0 connection_filetransfer_bandwidth_received=0 ` +
|
||||||
|
`connection_filetransfer_bytes_sent_total=0 connection_filetransfer_bytes_received_total=0 connection_packets_sent_speech=0 ` +
|
||||||
|
`connection_bytes_sent_speech=0 connection_packets_received_speech=0 connection_bytes_received_speech=0 connection_packets_sent_keepalive=261 ` +
|
||||||
|
`connection_bytes_sent_keepalive=10701 connection_packets_received_keepalive=261 connection_bytes_received_keepalive=10961 ` +
|
||||||
|
`connection_packets_sent_control=54 connection_bytes_sent_control=15143 connection_packets_received_control=55 ` +
|
||||||
|
`connection_bytes_received_control=4239 connection_packets_sent_total=315 connection_bytes_sent_total=25844 connection_packets_received_total=316 ` +
|
||||||
|
`connection_bytes_received_total=15200 connection_bandwidth_sent_last_second_total=81 connection_bandwidth_sent_last_minute_total=141 ` +
|
||||||
|
`connection_bandwidth_received_last_second_total=83 connection_bandwidth_received_last_minute_total=98`,
|
||||||
|
"serverrequestconnectioninfo": `connection_filetransfer_bandwidth_sent=0 connection_filetransfer_bandwidth_received=0 ` +
|
||||||
|
`connection_filetransfer_bytes_sent_total=0 connection_filetransfer_bytes_received_total=0 connection_packets_sent_total=369 ` +
|
||||||
|
`connection_bytes_sent_total=28058 connection_packets_received_total=370 connection_bytes_received_total=17468 ` +
|
||||||
|
`connection_bandwidth_sent_last_second_total=81 connection_bandwidth_sent_last_minute_total=109 connection_bandwidth_received_last_second_total=83 ` +
|
||||||
|
`connection_bandwidth_received_last_minute_total=94 connection_connected_time=174 connection_packetloss_total=0.0000 connection_ping=1.0000`,
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestGather(t *testing.T) {
|
func TestGather(t *testing.T) {
|
||||||
|
|
|
||||||
|
|
@ -6,35 +6,36 @@ import (
|
||||||
"net/http/httptest"
|
"net/http/httptest"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/influxdata/telegraf/testutil"
|
|
||||||
|
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
|
||||||
|
"github.com/influxdata/telegraf/testutil"
|
||||||
)
|
)
|
||||||
|
|
||||||
var tomcatStatus8 = `<?xml version="1.0" encoding="UTF-8"?>
|
var tomcatStatus8 = `<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<?xml-stylesheet type="text/xsl" href="/manager/xform.xsl" ?>
|
<?xml-stylesheet type="text/xsl" href="/manager/xform.xsl" ?>
|
||||||
<status>
|
<status>
|
||||||
<jvm>
|
<jvm>
|
||||||
<memory free='17909336' total='58195968' max='620756992'/>
|
<memory free='17909336' total='58195968' max='620756992'/>
|
||||||
<memorypool name='PS Eden Space' type='Heap memory' usageInit='8912896' usageCommitted='35651584' usageMax='230686720' usageUsed='25591384'/>
|
<memorypool name='PS Eden Space' type='Heap memory' usageInit='8912896' usageCommitted='35651584' usageMax='230686720' usageUsed='25591384'/>
|
||||||
<memorypool name='PS Old Gen' type='Heap memory' usageInit='21495808' usageCommitted='21495808' usageMax='465567744' usageUsed='13663040'/>
|
<memorypool name='PS Old Gen' type='Heap memory' usageInit='21495808' usageCommitted='21495808' usageMax='465567744' usageUsed='13663040'/>
|
||||||
<memorypool name='PS Survivor Space' type='Heap memory' usageInit='1048576' usageCommitted='1048576' usageMax='1048576' usageUsed='1032208'/>
|
<memorypool name='PS Survivor Space' type='Heap memory' usageInit='1048576' usageCommitted='1048576' usageMax='1048576' usageUsed='1032208'/>
|
||||||
<memorypool name='Code Cache' type='Non-heap memory' usageInit='2555904' usageCommitted='2555904' usageMax='50331648' usageUsed='1220096'/>
|
<memorypool name='Code Cache' type='Non-heap memory' usageInit='2555904' usageCommitted='2555904' usageMax='50331648' usageUsed='1220096'/>
|
||||||
<memorypool name='PS Perm Gen' type='Non-heap memory' usageInit='22020096' usageCommitted='22020096' usageMax='174063616' usageUsed='17533952'/>
|
<memorypool name='PS Perm Gen' type='Non-heap memory' usageInit='22020096' usageCommitted='22020096' usageMax='174063616' usageUsed='17533952'/>
|
||||||
</jvm>
|
</jvm>
|
||||||
<connector name='"ajp-apr-8009"'>
|
<connector name='"ajp-apr-8009"'>
|
||||||
<threadInfo maxThreads="200" currentThreadCount="0" currentThreadsBusy="0"/>
|
<threadInfo maxThreads="200" currentThreadCount="0" currentThreadsBusy="0"/>
|
||||||
<requestInfo maxTime="0" processingTime="0" requestCount="0" errorCount="0" bytesReceived="0" bytesSent="0"/>
|
<requestInfo maxTime="0" processingTime="0" requestCount="0" errorCount="0" bytesReceived="0" bytesSent="0"/>
|
||||||
<workers>
|
<workers>
|
||||||
</workers>
|
</workers>
|
||||||
</connector>
|
</connector>
|
||||||
<connector name='"http-apr-8080"'>
|
<connector name='"http-apr-8080"'>
|
||||||
<threadInfo maxThreads="200" currentThreadCount="5" currentThreadsBusy="1"/>
|
<threadInfo maxThreads="200" currentThreadCount="5" currentThreadsBusy="1"/>
|
||||||
<requestInfo maxTime="68" processingTime="88" requestCount="2" errorCount="1" bytesReceived="0" bytesSent="9286"/>
|
<requestInfo maxTime="68" processingTime="88" requestCount="2" errorCount="1" bytesReceived="0" bytesSent="9286"/>
|
||||||
<workers>
|
<workers>
|
||||||
<worker stage="S" requestProcessingTime="4" requestBytesSent="0" requestBytesReceived="0" remoteAddr="127.0.0.1" virtualHost="127.0.0.1" method="GET" currentUri="/manager/status/all" currentQueryString="XML=true" protocol="HTTP/1.1"/>
|
<worker stage="S" requestProcessingTime="4" requestBytesSent="0" requestBytesReceived="0" remoteAddr="127.0.0.1" virtualHost="127.0.0.1"
|
||||||
</workers>
|
method="GET" currentUri="/manager/status/all" currentQueryString="XML=true" protocol="HTTP/1.1"/>
|
||||||
</connector>
|
</workers>
|
||||||
|
</connector>
|
||||||
</status>`
|
</status>`
|
||||||
|
|
||||||
func TestHTTPTomcat8(t *testing.T) {
|
func TestHTTPTomcat8(t *testing.T) {
|
||||||
|
|
@ -107,17 +108,19 @@ func TestHTTPTomcat8(t *testing.T) {
|
||||||
var tomcatStatus6 = `<?xml version="1.0" encoding="utf-8"?>
|
var tomcatStatus6 = `<?xml version="1.0" encoding="utf-8"?>
|
||||||
<?xml-stylesheet type="text/xsl" href="xform.xsl" ?>
|
<?xml-stylesheet type="text/xsl" href="xform.xsl" ?>
|
||||||
<status>
|
<status>
|
||||||
<jvm>
|
<jvm>
|
||||||
<memory free="1942681600" total="2040070144" max="2040070144"/>
|
<memory free="1942681600" total="2040070144" max="2040070144"/>
|
||||||
</jvm>
|
</jvm>
|
||||||
<connector name="http-8080">
|
<connector name="http-8080">
|
||||||
<threadInfo maxThreads="150" currentThreadCount="2" currentThreadsBusy="2"/>
|
<threadInfo maxThreads="150" currentThreadCount="2" currentThreadsBusy="2"/>
|
||||||
<requestInfo maxTime="1005" processingTime="2465" requestCount="436" errorCount="16" bytesReceived="0" bytesSent="550196"/>
|
<requestInfo maxTime="1005" processingTime="2465" requestCount="436" errorCount="16" bytesReceived="0" bytesSent="550196"/>
|
||||||
<workers>
|
<workers>
|
||||||
<worker stage="K" requestProcessingTime="526" requestBytesSent="0" requestBytesReceived="0" remoteAddr="127.0.0.1" virtualHost="?" method="?" currentUri="?" currentQueryString="?" protocol="?"/>
|
<worker stage="K" requestProcessingTime="526" requestBytesSent="0" requestBytesReceived="0" remoteAddr="127.0.0.1" virtualHost="?" method="?"
|
||||||
<worker stage="S" requestProcessingTime="1" requestBytesSent="0" requestBytesReceived="0" remoteAddr="127.0.0.1" virtualHost="127.0.0.1" method="GET" currentUri="/manager/status/all" currentQueryString="XML=true" protocol="HTTP/1.1"/>
|
currentUri="?" currentQueryString="?" protocol="?"/>
|
||||||
</workers>
|
<worker stage="S" requestProcessingTime="1" requestBytesSent="0" requestBytesReceived="0" remoteAddr="127.0.0.1" virtualHost="127.0.0.1"
|
||||||
</connector>
|
method="GET" currentUri="/manager/status/all" currentQueryString="XML=true" protocol="HTTP/1.1"/>
|
||||||
|
</workers>
|
||||||
|
</connector>
|
||||||
</status>`
|
</status>`
|
||||||
|
|
||||||
func TestHTTPTomcat6(t *testing.T) {
|
func TestHTTPTomcat6(t *testing.T) {
|
||||||
|
|
|
||||||
|
|
@ -36,8 +36,11 @@ var (
|
||||||
//vcl name and backend restriction regexp [A-Za-z][A-Za-z0-9_-]*
|
//vcl name and backend restriction regexp [A-Za-z][A-Za-z0-9_-]*
|
||||||
defaultRegexps = []*regexp.Regexp{
|
defaultRegexps = []*regexp.Regexp{
|
||||||
//dynamic backends
|
//dynamic backends
|
||||||
|
//nolint:lll,revive // conditionally long line allowed to have a better understanding of following regexp
|
||||||
//VBE.VCL_xxxx_xxx_VOD_SHIELD_Vxxxxxxxxxxxxx_xxxxxxxxxxxxx.goto.000007c8.(xx.xx.xxx.xx).(http://xxxxxxx-xxxxx-xxxxx-xxxxxx-xx-xxxx-x-xxxx.xx-xx-xxxx-x.amazonaws.com:80).(ttl:5.000000).fail_eaddrnotavail
|
//VBE.VCL_xxxx_xxx_VOD_SHIELD_Vxxxxxxxxxxxxx_xxxxxxxxxxxxx.goto.000007c8.(xx.xx.xxx.xx).(http://xxxxxxx-xxxxx-xxxxx-xxxxxx-xx-xxxx-x-xxxx.xx-xx-xxxx-x.amazonaws.com:80).(ttl:5.000000).fail_eaddrnotavail
|
||||||
regexp.MustCompile(`^VBE\.(?P<_vcl>[\w\-]*)\.goto\.[[:alnum:]]+\.\((?P<backend>\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})\)\.\((?P<server>.*)\)\.\(ttl:\d*\.\d*.*\)`),
|
regexp.MustCompile(
|
||||||
|
`^VBE\.(?P<_vcl>[\w\-]*)\.goto\.[[:alnum:]]+\.\((?P<backend>\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})\)\.\((?P<server>.*)\)\.\(ttl:\d*\.\d*.*\)`,
|
||||||
|
),
|
||||||
|
|
||||||
//VBE.reload_20210622_153544_23757.default.unhealthy
|
//VBE.reload_20210622_153544_23757.default.unhealthy
|
||||||
regexp.MustCompile(`^VBE\.(?P<_vcl>[\w\-]*)\.(?P<backend>[\w\-]*)\.([\w\-]*)`),
|
regexp.MustCompile(`^VBE\.(?P<_vcl>[\w\-]*)\.(?P<backend>[\w\-]*)\.([\w\-]*)`),
|
||||||
|
|
|
||||||
|
|
@ -507,13 +507,17 @@ func TestV2ParseVarnishNames(t *testing.T) {
|
||||||
activeVcl: "1111",
|
activeVcl: "1111",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
vName: "VBE.VCL_1023_DIS_VOD_SHIELD_V1629295401194_1629295437531.goto.00000000.(111.112.113.114).(http://abc-ede.xyz.yyy.com:80).(ttl:3600.000000).is_healthy",
|
vName: "VBE.VCL_1023_DIS_VOD_SHIELD_V1629295401194_1629295437531.goto.00000000.(111.112.113.114)." +
|
||||||
tags: map[string]string{"section": "VBE", "serial_1": "0", "backend_1": "111.112.113.114", "server_1": "http://abc-ede.xyz.yyy.com:80", "ttl": "3600.000000"},
|
"(http://abc-ede.xyz.yyy.com:80).(ttl:3600.000000).is_healthy",
|
||||||
|
tags: map[string]string{"section": "VBE", "serial_1": "0", "backend_1": "111.112.113.114",
|
||||||
|
"server_1": "http://abc-ede.xyz.yyy.com:80", "ttl": "3600.000000"},
|
||||||
field: "is_healthy",
|
field: "is_healthy",
|
||||||
activeVcl: "VCL_1023_DIS_VOD_SHIELD_V1629295401194_1629295437531",
|
activeVcl: "VCL_1023_DIS_VOD_SHIELD_V1629295401194_1629295437531",
|
||||||
customRegexps: []string{
|
customRegexps: []string{
|
||||||
`^VBE\.(?P<_vcl>[\w\-]*)\.goto\.(?P<serial_1>[[:alnum:]])+\.\((?P<backend_1>\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})\)\.\((?P<server_1>.*)\)\.\(ttl:(?P<ttl>\d*\.\d*.)*\)`,
|
`^VBE\.(?P<_vcl>[\w\-]*)\.goto\.(?P<serial_1>[[:alnum:]])+\.` +
|
||||||
`^VBE\.(?P<_vcl>[\w\-]*)\.goto\.(?P<serial_2>[[:alnum:]])+\.\((?P<backend_2>\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})\)\.\((?P<server_2>.*)\)\.\(ttl:(?P<ttl>\d*\.\d*.)*\)`,
|
`\((?P<backend_1>\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})\)\.\((?P<server_1>.*)\)\.\(ttl:(?P<ttl>\d*\.\d*.)*\)`,
|
||||||
|
`^VBE\.(?P<_vcl>[\w\-]*)\.goto\.(?P<serial_2>[[:alnum:]])+\.` +
|
||||||
|
`\((?P<backend_2>\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})\)\.\((?P<server_2>.*)\)\.\(ttl:(?P<ttl>\d*\.\d*.)*\)`,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
} {
|
} {
|
||||||
|
|
|
||||||
|
|
@ -14,12 +14,12 @@ import (
|
||||||
"sync/atomic"
|
"sync/atomic"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/influxdata/telegraf"
|
|
||||||
"github.com/vmware/govmomi/object"
|
"github.com/vmware/govmomi/object"
|
||||||
"github.com/vmware/govmomi/performance"
|
"github.com/vmware/govmomi/performance"
|
||||||
"github.com/vmware/govmomi/vim25/mo"
|
"github.com/vmware/govmomi/vim25/mo"
|
||||||
"github.com/vmware/govmomi/vim25/types"
|
"github.com/vmware/govmomi/vim25/types"
|
||||||
|
|
||||||
|
"github.com/influxdata/telegraf"
|
||||||
"github.com/influxdata/telegraf/filter"
|
"github.com/influxdata/telegraf/filter"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -369,7 +369,13 @@ func (e *Endpoint) getDatacenterName(ctx context.Context, client *Client, cache
|
||||||
return e.getAncestorName(ctx, client, "Datacenter", cache, r)
|
return e.getAncestorName(ctx, client, "Datacenter", cache, r)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (e *Endpoint) getAncestorName(ctx context.Context, client *Client, resourceType string, cache map[string]string, r types.ManagedObjectReference) (string, bool) {
|
func (e *Endpoint) getAncestorName(
|
||||||
|
ctx context.Context,
|
||||||
|
client *Client,
|
||||||
|
resourceType string,
|
||||||
|
cache map[string]string,
|
||||||
|
r types.ManagedObjectReference,
|
||||||
|
) (string, bool) {
|
||||||
path := make([]string, 0)
|
path := make([]string, 0)
|
||||||
returnVal := ""
|
returnVal := ""
|
||||||
here := r
|
here := r
|
||||||
|
|
@ -1139,7 +1145,13 @@ func (e *Endpoint) alignSamples(info []types.PerfSampleInfo, values []int64, int
|
||||||
return rInfo, rValues
|
return rInfo, rValues
|
||||||
}
|
}
|
||||||
|
|
||||||
func (e *Endpoint) collectChunk(ctx context.Context, pqs queryChunk, res *resourceKind, acc telegraf.Accumulator, interval time.Duration) (int, time.Time, error) {
|
func (e *Endpoint) collectChunk(
|
||||||
|
ctx context.Context,
|
||||||
|
pqs queryChunk,
|
||||||
|
res *resourceKind,
|
||||||
|
acc telegraf.Accumulator,
|
||||||
|
interval time.Duration,
|
||||||
|
) (int, time.Time, error) {
|
||||||
e.log.Debugf("Query for %s has %d QuerySpecs", res.name, len(pqs))
|
e.log.Debugf("Query for %s has %d QuerySpecs", res.name, len(pqs))
|
||||||
latestSample := time.Time{}
|
latestSample := time.Time{}
|
||||||
count := 0
|
count := 0
|
||||||
|
|
|
||||||
|
|
@ -136,7 +136,13 @@ func TestDestinationDeleteFailedEvent(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestEventWithSignatureSuccess(t *testing.T) {
|
func TestEventWithSignatureSuccess(t *testing.T) {
|
||||||
ArtifactoryWebhookRequestWithSignature("watch", ArtifactDeployedEventJSON(), t, generateSignature("signature", []byte(ArtifactDeployedEventJSON())), http.StatusOK)
|
ArtifactoryWebhookRequestWithSignature(
|
||||||
|
"watch",
|
||||||
|
ArtifactDeployedEventJSON(),
|
||||||
|
t,
|
||||||
|
generateSignature("signature", []byte(ArtifactDeployedEventJSON())),
|
||||||
|
http.StatusOK,
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestCheckSignatureSuccess(t *testing.T) {
|
func TestCheckSignatureSuccess(t *testing.T) {
|
||||||
|
|
|
||||||
|
|
@ -1,110 +0,0 @@
|
||||||
package filestack
|
|
||||||
|
|
||||||
func DialogOpenJSON() string {
|
|
||||||
return `{
|
|
||||||
"action": "fp.dialog",
|
|
||||||
"timestamp": 1435584646,
|
|
||||||
"id": 102,
|
|
||||||
"text": {
|
|
||||||
"mimetypes": ["*/*"],
|
|
||||||
"iframe": false,
|
|
||||||
"language": "en",
|
|
||||||
"id": "1435584650723",
|
|
||||||
"mobile": false,
|
|
||||||
"app":{
|
|
||||||
"upsell": "false",
|
|
||||||
"apikey": "YOUR_API_KEY",
|
|
||||||
"customization":{
|
|
||||||
"saveas_subheader": "Save it down to your local device or onto the Cloud",
|
|
||||||
"folder_subheader": "Choose a folder to share with this application",
|
|
||||||
"open_subheader": "Choose from the files on your local device or the ones you have online",
|
|
||||||
"folder_header": "Select a folder",
|
|
||||||
"help_text": "",
|
|
||||||
"saveas_header": "Save your file",
|
|
||||||
"open_header": "Upload a file"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"dialogType": "open",
|
|
||||||
"auth": false,
|
|
||||||
"welcome_header": "Upload a file",
|
|
||||||
"welcome_subheader": "Choose from the files on your local device or the ones you have online",
|
|
||||||
"help_text": "",
|
|
||||||
"recent_path": "/",
|
|
||||||
"extensions": null,
|
|
||||||
"maxSize": 0,
|
|
||||||
"signature": null,
|
|
||||||
"policy": null,
|
|
||||||
"custom_providers": "imgur,cloudapp",
|
|
||||||
"intra": false
|
|
||||||
}
|
|
||||||
}`
|
|
||||||
}
|
|
||||||
|
|
||||||
func UploadJSON() string {
|
|
||||||
return `{
|
|
||||||
"action":"fp.upload",
|
|
||||||
"timestamp":1443444905,
|
|
||||||
"id":100946,
|
|
||||||
"text":{
|
|
||||||
"url":"https://www.filestackapi.com/api/file/WAunDTTqQfCNWwUUyf6n",
|
|
||||||
"client":"Facebook",
|
|
||||||
"type":"image/jpeg",
|
|
||||||
"filename":"1579337399020824.jpg",
|
|
||||||
"size":139154
|
|
||||||
}
|
|
||||||
}`
|
|
||||||
}
|
|
||||||
|
|
||||||
func VideoConversionJSON() string {
|
|
||||||
return `{
|
|
||||||
"status":"completed",
|
|
||||||
"message":"Done",
|
|
||||||
"data":{
|
|
||||||
"thumb":"https://cdn.filestackcontent.com/f1e8V88QDuxzOvtOAq1W",
|
|
||||||
"thumb100x100":"https://process.filestackapi.com/AhTgLagciQByzXpFGRI0Az/resize=w:100,h:100,f:crop/output=f:jpg,q:66/https://cdn.filestackcontent.com/f1e8V88QDuxzOvtOAq1W",
|
|
||||||
"thumb200x200":"https://process.filestackapi.com/AhTgLagciQByzXpFGRI0Az/resize=w:200,h:200,f:crop/output=f:jpg,q:66/https://cdn.filestackcontent.com/f1e8V88QDuxzOvtOAq1W",
|
|
||||||
"thumb300x300":"https://process.filestackapi.com/AhTgLagciQByzXpFGRI0Az/resize=w:300,h:300,f:crop/output=f:jpg,q:66/https://cdn.filestackcontent.com/f1e8V88QDuxzOvtOAq1W",
|
|
||||||
"url":"https://cdn.filestackcontent.com/VgvFVdvvTkml0WXPIoGn"
|
|
||||||
},
|
|
||||||
"metadata":{
|
|
||||||
"result":{
|
|
||||||
"audio_channels":2,
|
|
||||||
"audio_codec":"vorbis",
|
|
||||||
"audio_sample_rate":44100,
|
|
||||||
"created_at":"2015/12/21 20:45:19 +0000",
|
|
||||||
"duration":10587,
|
|
||||||
"encoding_progress":100,
|
|
||||||
"encoding_time":8,
|
|
||||||
"extname":".webm",
|
|
||||||
"file_size":293459,
|
|
||||||
"fps":24,
|
|
||||||
"height":260,
|
|
||||||
"mime_type":"video/webm",
|
|
||||||
"started_encoding_at":"2015/12/21 20:45:22 +0000",
|
|
||||||
"updated_at":"2015/12/21 20:45:32 +0000",
|
|
||||||
"video_bitrate":221,
|
|
||||||
"video_codec":"vp8",
|
|
||||||
"width":300
|
|
||||||
},
|
|
||||||
"source":{
|
|
||||||
"audio_bitrate":125,
|
|
||||||
"audio_channels":2,
|
|
||||||
"audio_codec":"aac",
|
|
||||||
"audio_sample_rate":44100,
|
|
||||||
"created_at":"2015/12/21 20:45:19 +0000",
|
|
||||||
"duration":10564,
|
|
||||||
"extname":".mp4",
|
|
||||||
"file_size":875797,
|
|
||||||
"fps":24,
|
|
||||||
"height":360,
|
|
||||||
"mime_type":"video/mp4",
|
|
||||||
"updated_at":"2015/12/21 20:45:32 +0000",
|
|
||||||
"video_bitrate":196,
|
|
||||||
"video_codec":"h264",
|
|
||||||
"width":480
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"timestamp":"1453850583",
|
|
||||||
"uuid":"638311d89d2bc849563a674a45809b7c"
|
|
||||||
}`
|
|
||||||
}
|
|
||||||
|
|
@ -1,16 +1,20 @@
|
||||||
package filestack
|
package filestack
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/influxdata/telegraf/testutil"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/http/httptest"
|
"net/http/httptest"
|
||||||
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
"github.com/stretchr/testify/require"
|
||||||
|
|
||||||
|
"github.com/influxdata/telegraf/testutil"
|
||||||
)
|
)
|
||||||
|
|
||||||
func postWebhooks(md *FilestackWebhook, eventBody string) *httptest.ResponseRecorder {
|
func postWebhooks(md *FilestackWebhook, eventBodyFile io.Reader) *httptest.ResponseRecorder {
|
||||||
req, _ := http.NewRequest("POST", "/filestack", strings.NewReader(eventBody))
|
req, _ := http.NewRequest("POST", "/filestack", eventBodyFile)
|
||||||
w := httptest.NewRecorder()
|
w := httptest.NewRecorder()
|
||||||
|
|
||||||
md.eventHandler(w, req)
|
md.eventHandler(w, req)
|
||||||
|
|
@ -21,7 +25,7 @@ func postWebhooks(md *FilestackWebhook, eventBody string) *httptest.ResponseReco
|
||||||
func TestDialogEvent(t *testing.T) {
|
func TestDialogEvent(t *testing.T) {
|
||||||
var acc testutil.Accumulator
|
var acc testutil.Accumulator
|
||||||
fs := &FilestackWebhook{Path: "/filestack", acc: &acc}
|
fs := &FilestackWebhook{Path: "/filestack", acc: &acc}
|
||||||
resp := postWebhooks(fs, DialogOpenJSON())
|
resp := postWebhooks(fs, getFile(t, "testdata/dialog_open.json"))
|
||||||
if resp.Code != http.StatusOK {
|
if resp.Code != http.StatusOK {
|
||||||
t.Errorf("POST returned HTTP status code %v.\nExpected %v", resp.Code, http.StatusOK)
|
t.Errorf("POST returned HTTP status code %v.\nExpected %v", resp.Code, http.StatusOK)
|
||||||
}
|
}
|
||||||
|
|
@ -39,7 +43,7 @@ func TestDialogEvent(t *testing.T) {
|
||||||
|
|
||||||
func TestParseError(t *testing.T) {
|
func TestParseError(t *testing.T) {
|
||||||
fs := &FilestackWebhook{Path: "/filestack"}
|
fs := &FilestackWebhook{Path: "/filestack"}
|
||||||
resp := postWebhooks(fs, "")
|
resp := postWebhooks(fs, strings.NewReader(""))
|
||||||
if resp.Code != http.StatusBadRequest {
|
if resp.Code != http.StatusBadRequest {
|
||||||
t.Errorf("POST returned HTTP status code %v.\nExpected %v", resp.Code, http.StatusBadRequest)
|
t.Errorf("POST returned HTTP status code %v.\nExpected %v", resp.Code, http.StatusBadRequest)
|
||||||
}
|
}
|
||||||
|
|
@ -48,7 +52,7 @@ func TestParseError(t *testing.T) {
|
||||||
func TestUploadEvent(t *testing.T) {
|
func TestUploadEvent(t *testing.T) {
|
||||||
var acc testutil.Accumulator
|
var acc testutil.Accumulator
|
||||||
fs := &FilestackWebhook{Path: "/filestack", acc: &acc}
|
fs := &FilestackWebhook{Path: "/filestack", acc: &acc}
|
||||||
resp := postWebhooks(fs, UploadJSON())
|
resp := postWebhooks(fs, getFile(t, "testdata/upload.json"))
|
||||||
if resp.Code != http.StatusOK {
|
if resp.Code != http.StatusOK {
|
||||||
t.Errorf("POST returned HTTP status code %v.\nExpected %v", resp.Code, http.StatusOK)
|
t.Errorf("POST returned HTTP status code %v.\nExpected %v", resp.Code, http.StatusOK)
|
||||||
}
|
}
|
||||||
|
|
@ -67,8 +71,15 @@ func TestUploadEvent(t *testing.T) {
|
||||||
func TestVideoConversionEvent(t *testing.T) {
|
func TestVideoConversionEvent(t *testing.T) {
|
||||||
var acc testutil.Accumulator
|
var acc testutil.Accumulator
|
||||||
fs := &FilestackWebhook{Path: "/filestack", acc: &acc}
|
fs := &FilestackWebhook{Path: "/filestack", acc: &acc}
|
||||||
resp := postWebhooks(fs, VideoConversionJSON())
|
resp := postWebhooks(fs, getFile(t, "testdata/video_conversion.json"))
|
||||||
if resp.Code != http.StatusBadRequest {
|
if resp.Code != http.StatusBadRequest {
|
||||||
t.Errorf("POST returned HTTP status code %v.\nExpected %v", resp.Code, http.StatusBadRequest)
|
t.Errorf("POST returned HTTP status code %v.\nExpected %v", resp.Code, http.StatusBadRequest)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func getFile(t *testing.T, filePath string) io.Reader {
|
||||||
|
file, err := os.Open(filePath)
|
||||||
|
require.NoErrorf(t, err, "could not read from file %s", filePath)
|
||||||
|
|
||||||
|
return file
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,39 @@
|
||||||
|
{
|
||||||
|
"action": "fp.dialog",
|
||||||
|
"timestamp": 1435584646,
|
||||||
|
"id": 102,
|
||||||
|
"text": {
|
||||||
|
"mimetypes": [
|
||||||
|
"*/*"
|
||||||
|
],
|
||||||
|
"iframe": false,
|
||||||
|
"language": "en",
|
||||||
|
"id": "1435584650723",
|
||||||
|
"mobile": false,
|
||||||
|
"app": {
|
||||||
|
"upsell": "false",
|
||||||
|
"apikey": "YOUR_API_KEY",
|
||||||
|
"customization": {
|
||||||
|
"saveas_subheader": "Save it down to your local device or onto the Cloud",
|
||||||
|
"folder_subheader": "Choose a folder to share with this application",
|
||||||
|
"open_subheader": "Choose from the files on your local device or the ones you have online",
|
||||||
|
"folder_header": "Select a folder",
|
||||||
|
"help_text": "",
|
||||||
|
"saveas_header": "Save your file",
|
||||||
|
"open_header": "Upload a file"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"dialogType": "open",
|
||||||
|
"auth": false,
|
||||||
|
"welcome_header": "Upload a file",
|
||||||
|
"welcome_subheader": "Choose from the files on your local device or the ones you have online",
|
||||||
|
"help_text": "",
|
||||||
|
"recent_path": "/",
|
||||||
|
"extensions": null,
|
||||||
|
"maxSize": 0,
|
||||||
|
"signature": null,
|
||||||
|
"policy": null,
|
||||||
|
"custom_providers": "imgur,cloudapp",
|
||||||
|
"intra": false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,12 @@
|
||||||
|
{
|
||||||
|
"action": "fp.upload",
|
||||||
|
"timestamp": 1443444905,
|
||||||
|
"id": 100946,
|
||||||
|
"text": {
|
||||||
|
"url": "https://www.filestackapi.com/api/file/WAunDTTqQfCNWwUUyf6n",
|
||||||
|
"client": "Facebook",
|
||||||
|
"type": "image/jpeg",
|
||||||
|
"filename": "1579337399020824.jpg",
|
||||||
|
"size": 139154
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,51 @@
|
||||||
|
{
|
||||||
|
"status":"completed",
|
||||||
|
"message":"Done",
|
||||||
|
"data":{
|
||||||
|
"thumb":"https://cdn.filestackcontent.com/f1e8V88QDuxzOvtOAq1W",
|
||||||
|
"thumb100x100":"https://process.filestackapi.com/AhTgLagciQByzXpFGRI0Az/resize=w:100,h:100,f:crop/output=f:jpg,q:66/https://cdn.filestackcontent.com/f1e8V88QDuxzOvtOAq1W",
|
||||||
|
"thumb200x200":"https://process.filestackapi.com/AhTgLagciQByzXpFGRI0Az/resize=w:200,h:200,f:crop/output=f:jpg,q:66/https://cdn.filestackcontent.com/f1e8V88QDuxzOvtOAq1W",
|
||||||
|
"thumb300x300":"https://process.filestackapi.com/AhTgLagciQByzXpFGRI0Az/resize=w:300,h:300,f:crop/output=f:jpg,q:66/https://cdn.filestackcontent.com/f1e8V88QDuxzOvtOAq1W",
|
||||||
|
"url":"https://cdn.filestackcontent.com/VgvFVdvvTkml0WXPIoGn"
|
||||||
|
},
|
||||||
|
"metadata":{
|
||||||
|
"result":{
|
||||||
|
"audio_channels":2,
|
||||||
|
"audio_codec":"vorbis",
|
||||||
|
"audio_sample_rate":44100,
|
||||||
|
"created_at":"2015/12/21 20:45:19 +0000",
|
||||||
|
"duration":10587,
|
||||||
|
"encoding_progress":100,
|
||||||
|
"encoding_time":8,
|
||||||
|
"extname":".webm",
|
||||||
|
"file_size":293459,
|
||||||
|
"fps":24,
|
||||||
|
"height":260,
|
||||||
|
"mime_type":"video/webm",
|
||||||
|
"started_encoding_at":"2015/12/21 20:45:22 +0000",
|
||||||
|
"updated_at":"2015/12/21 20:45:32 +0000",
|
||||||
|
"video_bitrate":221,
|
||||||
|
"video_codec":"vp8",
|
||||||
|
"width":300
|
||||||
|
},
|
||||||
|
"source":{
|
||||||
|
"audio_bitrate":125,
|
||||||
|
"audio_channels":2,
|
||||||
|
"audio_codec":"aac",
|
||||||
|
"audio_sample_rate":44100,
|
||||||
|
"created_at":"2015/12/21 20:45:19 +0000",
|
||||||
|
"duration":10564,
|
||||||
|
"extname":".mp4",
|
||||||
|
"file_size":875797,
|
||||||
|
"fps":24,
|
||||||
|
"height":360,
|
||||||
|
"mime_type":"video/mp4",
|
||||||
|
"updated_at":"2015/12/21 20:45:32 +0000",
|
||||||
|
"video_bitrate":196,
|
||||||
|
"video_codec":"h264",
|
||||||
|
"width":480
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"timestamp":"1453850583",
|
||||||
|
"uuid":"638311d89d2bc849563a674a45809b7c"
|
||||||
|
}
|
||||||
|
|
@ -1,58 +0,0 @@
|
||||||
package mandrill
|
|
||||||
|
|
||||||
func SendEventJSON() string {
|
|
||||||
return `
|
|
||||||
{
|
|
||||||
"event": "send",
|
|
||||||
"msg": {
|
|
||||||
"ts": 1365109999,
|
|
||||||
"subject": "This an example webhook message",
|
|
||||||
"email": "example.webhook@mandrillapp.com",
|
|
||||||
"sender": "example.sender@mandrillapp.com",
|
|
||||||
"tags": [
|
|
||||||
"webhook-example"
|
|
||||||
],
|
|
||||||
"opens": [
|
|
||||||
|
|
||||||
],
|
|
||||||
"clicks": [
|
|
||||||
|
|
||||||
],
|
|
||||||
"state": "sent",
|
|
||||||
"metadata": {
|
|
||||||
"user_id": 111
|
|
||||||
},
|
|
||||||
"_id": "exampleaaaaaaaaaaaaaaaaaaaaaaaaa",
|
|
||||||
"_version": "exampleaaaaaaaaaaaaaaa"
|
|
||||||
},
|
|
||||||
"_id": "id1",
|
|
||||||
"ts": 1384954004
|
|
||||||
}`
|
|
||||||
}
|
|
||||||
|
|
||||||
func HardBounceEventJSON() string {
|
|
||||||
return `
|
|
||||||
{
|
|
||||||
"event": "hard_bounce",
|
|
||||||
"msg": {
|
|
||||||
"ts": 1365109999,
|
|
||||||
"subject": "This an example webhook message",
|
|
||||||
"email": "example.webhook@mandrillapp.com",
|
|
||||||
"sender": "example.sender@mandrillapp.com",
|
|
||||||
"tags": [
|
|
||||||
"webhook-example"
|
|
||||||
],
|
|
||||||
"state": "bounced",
|
|
||||||
"metadata": {
|
|
||||||
"user_id": 111
|
|
||||||
},
|
|
||||||
"_id": "exampleaaaaaaaaaaaaaaaaaaaaaaaaa2",
|
|
||||||
"_version": "exampleaaaaaaaaaaaaaaa",
|
|
||||||
"bounce_description": "bad_mailbox",
|
|
||||||
"bgtools_code": 10,
|
|
||||||
"diag": "smtp;550 5.1.1 The email account that you tried to reach does not exist. Please try double-checking the recipient's email address for typos or unnecessary spaces."
|
|
||||||
},
|
|
||||||
"_id": "id2",
|
|
||||||
"ts": 1384954004
|
|
||||||
}`
|
|
||||||
}
|
|
||||||
|
|
@ -1,12 +1,16 @@
|
||||||
package mandrill
|
package mandrill
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/influxdata/telegraf/testutil"
|
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/http/httptest"
|
"net/http/httptest"
|
||||||
"net/url"
|
"net/url"
|
||||||
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
"github.com/stretchr/testify/require"
|
||||||
|
|
||||||
|
"github.com/influxdata/telegraf/testutil"
|
||||||
)
|
)
|
||||||
|
|
||||||
func postWebhooks(md *MandrillWebhook, eventBody string) *httptest.ResponseRecorder {
|
func postWebhooks(md *MandrillWebhook, eventBody string) *httptest.ResponseRecorder {
|
||||||
|
|
@ -40,7 +44,7 @@ func TestHead(t *testing.T) {
|
||||||
func TestSendEvent(t *testing.T) {
|
func TestSendEvent(t *testing.T) {
|
||||||
var acc testutil.Accumulator
|
var acc testutil.Accumulator
|
||||||
md := &MandrillWebhook{Path: "/mandrill", acc: &acc}
|
md := &MandrillWebhook{Path: "/mandrill", acc: &acc}
|
||||||
resp := postWebhooks(md, "["+SendEventJSON()+"]")
|
resp := postWebhooks(md, "["+readFile(t, "testdata/send_event.json")+"]")
|
||||||
if resp.Code != http.StatusOK {
|
if resp.Code != http.StatusOK {
|
||||||
t.Errorf("POST send returned HTTP status code %v.\nExpected %v", resp.Code, http.StatusOK)
|
t.Errorf("POST send returned HTTP status code %v.\nExpected %v", resp.Code, http.StatusOK)
|
||||||
}
|
}
|
||||||
|
|
@ -59,7 +63,7 @@ func TestSendEvent(t *testing.T) {
|
||||||
func TestMultipleEvents(t *testing.T) {
|
func TestMultipleEvents(t *testing.T) {
|
||||||
var acc testutil.Accumulator
|
var acc testutil.Accumulator
|
||||||
md := &MandrillWebhook{Path: "/mandrill", acc: &acc}
|
md := &MandrillWebhook{Path: "/mandrill", acc: &acc}
|
||||||
resp := postWebhooks(md, "["+SendEventJSON()+","+HardBounceEventJSON()+"]")
|
resp := postWebhooks(md, "["+readFile(t, "testdata/send_event.json")+","+readFile(t, "testdata/hard_bounce_event.json")+"]")
|
||||||
if resp.Code != http.StatusOK {
|
if resp.Code != http.StatusOK {
|
||||||
t.Errorf("POST send returned HTTP status code %v.\nExpected %v", resp.Code, http.StatusOK)
|
t.Errorf("POST send returned HTTP status code %v.\nExpected %v", resp.Code, http.StatusOK)
|
||||||
}
|
}
|
||||||
|
|
@ -83,3 +87,10 @@ func TestMultipleEvents(t *testing.T) {
|
||||||
}
|
}
|
||||||
acc.AssertContainsTaggedFields(t, "mandrill_webhooks", fields, tags)
|
acc.AssertContainsTaggedFields(t, "mandrill_webhooks", fields, tags)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func readFile(t *testing.T, filePath string) string {
|
||||||
|
data, err := os.ReadFile(filePath)
|
||||||
|
require.NoErrorf(t, err, "could not read from file %s", filePath)
|
||||||
|
|
||||||
|
return string(data)
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,23 @@
|
||||||
|
{
|
||||||
|
"event": "hard_bounce",
|
||||||
|
"msg": {
|
||||||
|
"ts": 1365109999,
|
||||||
|
"subject": "This an example webhook message",
|
||||||
|
"email": "example.webhook@mandrillapp.com",
|
||||||
|
"sender": "example.sender@mandrillapp.com",
|
||||||
|
"tags": [
|
||||||
|
"webhook-example"
|
||||||
|
],
|
||||||
|
"state": "bounced",
|
||||||
|
"metadata": {
|
||||||
|
"user_id": 111
|
||||||
|
},
|
||||||
|
"_id": "exampleaaaaaaaaaaaaaaaaaaaaaaaaa2",
|
||||||
|
"_version": "exampleaaaaaaaaaaaaaaa",
|
||||||
|
"bounce_description": "bad_mailbox",
|
||||||
|
"bgtools_code": 10,
|
||||||
|
"diag": "smtp;550 5.1.1 The email account that you tried to reach does not exist. Please try double-checking the recipient's email address for typos or unnecessary spaces."
|
||||||
|
},
|
||||||
|
"_id": "id2",
|
||||||
|
"ts": 1384954004
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,26 @@
|
||||||
|
{
|
||||||
|
"event": "send",
|
||||||
|
"msg": {
|
||||||
|
"ts": 1365109999,
|
||||||
|
"subject": "This an example webhook message",
|
||||||
|
"email": "example.webhook@mandrillapp.com",
|
||||||
|
"sender": "example.sender@mandrillapp.com",
|
||||||
|
"tags": [
|
||||||
|
"webhook-example"
|
||||||
|
],
|
||||||
|
"opens": [
|
||||||
|
|
||||||
|
],
|
||||||
|
"clicks": [
|
||||||
|
|
||||||
|
],
|
||||||
|
"state": "sent",
|
||||||
|
"metadata": {
|
||||||
|
"user_id": 111
|
||||||
|
},
|
||||||
|
"_id": "exampleaaaaaaaaaaaaaaaaaaaaaaaaa",
|
||||||
|
"_version": "exampleaaaaaaaaaaaaaaa"
|
||||||
|
},
|
||||||
|
"_id": "id1",
|
||||||
|
"ts": 1384954004
|
||||||
|
}
|
||||||
|
|
@ -77,8 +77,29 @@ var (
|
||||||
procEvtOpenPublisherMetadata = modwevtapi.NewProc("EvtOpenPublisherMetadata")
|
procEvtOpenPublisherMetadata = modwevtapi.NewProc("EvtOpenPublisherMetadata")
|
||||||
)
|
)
|
||||||
|
|
||||||
func _EvtSubscribe(session EvtHandle, signalEvent uintptr, channelPath *uint16, query *uint16, bookmark EvtHandle, context uintptr, callback syscall.Handle, flags EvtSubscribeFlag) (handle EvtHandle, err error) {
|
func _EvtSubscribe(
|
||||||
r0, _, e1 := syscall.Syscall9(procEvtSubscribe.Addr(), 8, uintptr(session), uintptr(signalEvent), uintptr(unsafe.Pointer(channelPath)), uintptr(unsafe.Pointer(query)), uintptr(bookmark), uintptr(context), uintptr(callback), uintptr(flags), 0)
|
session EvtHandle,
|
||||||
|
signalEvent uintptr,
|
||||||
|
channelPath *uint16,
|
||||||
|
query *uint16,
|
||||||
|
bookmark EvtHandle,
|
||||||
|
context uintptr,
|
||||||
|
callback syscall.Handle,
|
||||||
|
flags EvtSubscribeFlag,
|
||||||
|
) (handle EvtHandle, err error) {
|
||||||
|
r0, _, e1 := syscall.Syscall9(
|
||||||
|
procEvtSubscribe.Addr(),
|
||||||
|
8,
|
||||||
|
uintptr(session),
|
||||||
|
uintptr(signalEvent),
|
||||||
|
uintptr(unsafe.Pointer(channelPath)),
|
||||||
|
uintptr(unsafe.Pointer(query)),
|
||||||
|
uintptr(bookmark),
|
||||||
|
uintptr(context),
|
||||||
|
uintptr(callback),
|
||||||
|
uintptr(flags),
|
||||||
|
0,
|
||||||
|
)
|
||||||
handle = EvtHandle(r0)
|
handle = EvtHandle(r0)
|
||||||
if handle == 0 {
|
if handle == 0 {
|
||||||
if e1 != 0 {
|
if e1 != 0 {
|
||||||
|
|
@ -90,8 +111,28 @@ func _EvtSubscribe(session EvtHandle, signalEvent uintptr, channelPath *uint16,
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func _EvtRender(context EvtHandle, fragment EvtHandle, flags EvtRenderFlag, bufferSize uint32, buffer *byte, bufferUsed *uint32, propertyCount *uint32) (err error) {
|
func _EvtRender(
|
||||||
r1, _, e1 := syscall.Syscall9(procEvtRender.Addr(), 7, uintptr(context), uintptr(fragment), uintptr(flags), uintptr(bufferSize), uintptr(unsafe.Pointer(buffer)), uintptr(unsafe.Pointer(bufferUsed)), uintptr(unsafe.Pointer(propertyCount)), 0, 0)
|
context EvtHandle,
|
||||||
|
fragment EvtHandle,
|
||||||
|
flags EvtRenderFlag,
|
||||||
|
bufferSize uint32,
|
||||||
|
buffer *byte,
|
||||||
|
bufferUsed *uint32,
|
||||||
|
propertyCount *uint32,
|
||||||
|
) (err error) {
|
||||||
|
r1, _, e1 := syscall.Syscall9(
|
||||||
|
procEvtRender.Addr(),
|
||||||
|
7,
|
||||||
|
uintptr(context),
|
||||||
|
uintptr(fragment),
|
||||||
|
uintptr(flags),
|
||||||
|
uintptr(bufferSize),
|
||||||
|
uintptr(unsafe.Pointer(buffer)),
|
||||||
|
uintptr(unsafe.Pointer(bufferUsed)),
|
||||||
|
uintptr(unsafe.Pointer(propertyCount)),
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
)
|
||||||
if r1 == 0 {
|
if r1 == 0 {
|
||||||
if e1 != 0 {
|
if e1 != 0 {
|
||||||
err = errnoErr(e1)
|
err = errnoErr(e1)
|
||||||
|
|
@ -115,7 +156,16 @@ func _EvtClose(object EvtHandle) (err error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func _EvtNext(resultSet EvtHandle, eventArraySize uint32, eventArray *EvtHandle, timeout uint32, flags uint32, numReturned *uint32) (err error) {
|
func _EvtNext(resultSet EvtHandle, eventArraySize uint32, eventArray *EvtHandle, timeout uint32, flags uint32, numReturned *uint32) (err error) {
|
||||||
r1, _, e1 := syscall.Syscall6(procEvtNext.Addr(), 6, uintptr(resultSet), uintptr(eventArraySize), uintptr(unsafe.Pointer(eventArray)), uintptr(timeout), uintptr(flags), uintptr(unsafe.Pointer(numReturned)))
|
r1, _, e1 := syscall.Syscall6(
|
||||||
|
procEvtNext.Addr(),
|
||||||
|
6,
|
||||||
|
uintptr(resultSet),
|
||||||
|
uintptr(eventArraySize),
|
||||||
|
uintptr(unsafe.Pointer(eventArray)),
|
||||||
|
uintptr(timeout),
|
||||||
|
uintptr(flags),
|
||||||
|
uintptr(unsafe.Pointer(numReturned)),
|
||||||
|
)
|
||||||
if r1 == 0 {
|
if r1 == 0 {
|
||||||
if e1 != 0 {
|
if e1 != 0 {
|
||||||
err = errnoErr(e1)
|
err = errnoErr(e1)
|
||||||
|
|
@ -126,8 +176,30 @@ func _EvtNext(resultSet EvtHandle, eventArraySize uint32, eventArray *EvtHandle,
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func _EvtFormatMessage(publisherMetadata EvtHandle, event EvtHandle, messageID uint32, valueCount uint32, values uintptr, flags EvtFormatMessageFlag, bufferSize uint32, buffer *byte, bufferUsed *uint32) (err error) {
|
func _EvtFormatMessage(
|
||||||
r1, _, e1 := syscall.Syscall9(procEvtFormatMessage.Addr(), 9, uintptr(publisherMetadata), uintptr(event), uintptr(messageID), uintptr(valueCount), uintptr(values), uintptr(flags), uintptr(bufferSize), uintptr(unsafe.Pointer(buffer)), uintptr(unsafe.Pointer(bufferUsed)))
|
publisherMetadata EvtHandle,
|
||||||
|
event EvtHandle,
|
||||||
|
messageID uint32,
|
||||||
|
valueCount uint32,
|
||||||
|
values uintptr,
|
||||||
|
flags EvtFormatMessageFlag,
|
||||||
|
bufferSize uint32,
|
||||||
|
buffer *byte,
|
||||||
|
bufferUsed *uint32,
|
||||||
|
) (err error) {
|
||||||
|
r1, _, e1 := syscall.Syscall9(
|
||||||
|
procEvtFormatMessage.Addr(),
|
||||||
|
9,
|
||||||
|
uintptr(publisherMetadata),
|
||||||
|
uintptr(event),
|
||||||
|
uintptr(messageID),
|
||||||
|
uintptr(valueCount),
|
||||||
|
uintptr(values),
|
||||||
|
uintptr(flags),
|
||||||
|
uintptr(bufferSize),
|
||||||
|
uintptr(unsafe.Pointer(buffer)),
|
||||||
|
uintptr(unsafe.Pointer(bufferUsed)),
|
||||||
|
)
|
||||||
if r1 == 0 {
|
if r1 == 0 {
|
||||||
if e1 != 0 {
|
if e1 != 0 {
|
||||||
err = errnoErr(e1)
|
err = errnoErr(e1)
|
||||||
|
|
@ -139,7 +211,16 @@ func _EvtFormatMessage(publisherMetadata EvtHandle, event EvtHandle, messageID u
|
||||||
}
|
}
|
||||||
|
|
||||||
func _EvtOpenPublisherMetadata(session EvtHandle, publisherIdentity *uint16, logFilePath *uint16, locale uint32, flags uint32) (handle EvtHandle, err error) {
|
func _EvtOpenPublisherMetadata(session EvtHandle, publisherIdentity *uint16, logFilePath *uint16, locale uint32, flags uint32) (handle EvtHandle, err error) {
|
||||||
r0, _, e1 := syscall.Syscall6(procEvtOpenPublisherMetadata.Addr(), 5, uintptr(session), uintptr(unsafe.Pointer(publisherIdentity)), uintptr(unsafe.Pointer(logFilePath)), uintptr(locale), uintptr(flags), 0)
|
r0, _, e1 := syscall.Syscall6(
|
||||||
|
procEvtOpenPublisherMetadata.Addr(),
|
||||||
|
5,
|
||||||
|
uintptr(session),
|
||||||
|
uintptr(unsafe.Pointer(publisherIdentity)),
|
||||||
|
uintptr(unsafe.Pointer(logFilePath)),
|
||||||
|
uintptr(locale),
|
||||||
|
uintptr(flags),
|
||||||
|
0,
|
||||||
|
)
|
||||||
handle = EvtHandle(r0)
|
handle = EvtHandle(r0)
|
||||||
if handle == 0 {
|
if handle == 0 {
|
||||||
if e1 != 0 {
|
if e1 != 0 {
|
||||||
|
|
|
||||||
|
|
@ -120,7 +120,16 @@ func extractCounterInfoFromCounterPath(counterPath string) (object string, insta
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func newCounter(counterHandle PDH_HCOUNTER, counterPath string, objectName string, instance string, counterName string, measurement string, includeTotal bool, useRawValue bool) *counter {
|
func newCounter(
|
||||||
|
counterHandle PDH_HCOUNTER,
|
||||||
|
counterPath string,
|
||||||
|
objectName string,
|
||||||
|
instance string,
|
||||||
|
counterName string,
|
||||||
|
measurement string,
|
||||||
|
includeTotal bool,
|
||||||
|
useRawValue bool,
|
||||||
|
) *counter {
|
||||||
measurementName := sanitizedChars.Replace(measurement)
|
measurementName := sanitizedChars.Replace(measurement)
|
||||||
if measurementName == "" {
|
if measurementName == "" {
|
||||||
measurementName = "win_perf_counters"
|
measurementName = "win_perf_counters"
|
||||||
|
|
@ -137,7 +146,15 @@ func (*Win_PerfCounters) SampleConfig() string {
|
||||||
return sampleConfig
|
return sampleConfig
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *Win_PerfCounters) AddItem(counterPath string, objectName string, instance string, counterName string, measurement string, includeTotal bool, useRawValue bool) error {
|
func (m *Win_PerfCounters) AddItem(
|
||||||
|
counterPath string,
|
||||||
|
objectName string,
|
||||||
|
instance string,
|
||||||
|
counterName string,
|
||||||
|
measurement string,
|
||||||
|
includeTotal bool,
|
||||||
|
useRawValue bool,
|
||||||
|
) error {
|
||||||
origCounterPath := counterPath
|
origCounterPath := counterPath
|
||||||
var err error
|
var err error
|
||||||
var counterHandle PDH_HCOUNTER
|
var counterHandle PDH_HCOUNTER
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,6 @@ package win_perf_counters
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/stretchr/testify/assert"
|
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
|
@ -910,7 +909,11 @@ func TestGatherRefreshingWithoutExpansion(t *testing.T) {
|
||||||
//test finding new instance
|
//test finding new instance
|
||||||
cps2 := []string{"\\O(I1)\\C1", "\\O(I1)\\C2", "\\O(I2)\\C1", "\\O(I2)\\C2", "\\O(I3)\\C1", "\\O(I3)\\C2"}
|
cps2 := []string{"\\O(I1)\\C1", "\\O(I1)\\C2", "\\O(I2)\\C1", "\\O(I2)\\C2", "\\O(I3)\\C1", "\\O(I3)\\C2"}
|
||||||
fpm = &FakePerformanceQuery{
|
fpm = &FakePerformanceQuery{
|
||||||
counters: createCounterMap(append([]string{"\\O(*)\\C1", "\\O(*)\\C2"}, cps2...), []float64{0, 0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6}, []uint32{0, 0, 0, 0, 0, 0, 0, 0}),
|
counters: createCounterMap(
|
||||||
|
append([]string{"\\O(*)\\C1", "\\O(*)\\C2"}, cps2...),
|
||||||
|
[]float64{0, 0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6},
|
||||||
|
[]uint32{0, 0, 0, 0, 0, 0, 0, 0},
|
||||||
|
),
|
||||||
expandPaths: map[string][]string{
|
expandPaths: map[string][]string{
|
||||||
"\\O(*)\\C1": {cps2[0], cps2[2], cps2[4]},
|
"\\O(*)\\C1": {cps2[0], cps2[2], cps2[4]},
|
||||||
"\\O(*)\\C2": {cps2[1], cps2[3], cps2[5]},
|
"\\O(*)\\C2": {cps2[1], cps2[3], cps2[5]},
|
||||||
|
|
@ -943,7 +946,11 @@ func TestGatherRefreshingWithoutExpansion(t *testing.T) {
|
||||||
perfObjects = createPerfObject(measurement, "O", []string{"*"}, []string{"C1", "C2", "C3"}, true, false, false)
|
perfObjects = createPerfObject(measurement, "O", []string{"*"}, []string{"C1", "C2", "C3"}, true, false, false)
|
||||||
cps3 := []string{"\\O(I1)\\C1", "\\O(I1)\\C2", "\\O(I1)\\C3", "\\O(I2)\\C1", "\\O(I2)\\C2", "\\O(I2)\\C3"}
|
cps3 := []string{"\\O(I1)\\C1", "\\O(I1)\\C2", "\\O(I1)\\C3", "\\O(I2)\\C1", "\\O(I2)\\C2", "\\O(I2)\\C3"}
|
||||||
fpm = &FakePerformanceQuery{
|
fpm = &FakePerformanceQuery{
|
||||||
counters: createCounterMap(append([]string{"\\O(*)\\C1", "\\O(*)\\C2", "\\O(*)\\C3"}, cps3...), []float64{0, 0, 0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6}, []uint32{0, 0, 0, 0, 0, 0, 0, 0, 0}),
|
counters: createCounterMap(
|
||||||
|
append([]string{"\\O(*)\\C1", "\\O(*)\\C2", "\\O(*)\\C3"}, cps3...),
|
||||||
|
[]float64{0, 0, 0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6},
|
||||||
|
[]uint32{0, 0, 0, 0, 0, 0, 0, 0, 0},
|
||||||
|
),
|
||||||
expandPaths: map[string][]string{
|
expandPaths: map[string][]string{
|
||||||
"\\O(*)\\C1": {cps3[0], cps3[3]},
|
"\\O(*)\\C1": {cps3[0], cps3[3]},
|
||||||
"\\O(*)\\C2": {cps3[1], cps3[4]},
|
"\\O(*)\\C2": {cps3[1], cps3[4]},
|
||||||
|
|
@ -1072,8 +1079,8 @@ func TestGatherRaw(t *testing.T) {
|
||||||
var acc1 testutil.Accumulator
|
var acc1 testutil.Accumulator
|
||||||
err = m.Gather(&acc1)
|
err = m.Gather(&acc1)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
assert.Len(t, m.counters, 2)
|
require.Len(t, m.counters, 2)
|
||||||
assert.Len(t, acc1.Metrics, 2)
|
require.Len(t, acc1.Metrics, 2)
|
||||||
fields1 := map[string]interface{}{
|
fields1 := map[string]interface{}{
|
||||||
"C1_Raw": int64(1),
|
"C1_Raw": int64(1),
|
||||||
"C2_Raw": int64(2),
|
"C2_Raw": int64(2),
|
||||||
|
|
@ -1101,8 +1108,8 @@ func TestGatherRaw(t *testing.T) {
|
||||||
var acc2 testutil.Accumulator
|
var acc2 testutil.Accumulator
|
||||||
err = m.Gather(&acc2)
|
err = m.Gather(&acc2)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
assert.Len(t, m.counters, 4) //expanded counters
|
require.Len(t, m.counters, 4) //expanded counters
|
||||||
assert.Len(t, acc2.Metrics, 2)
|
require.Len(t, acc2.Metrics, 2)
|
||||||
|
|
||||||
acc2.AssertContainsTaggedFields(t, measurement, fields1, tags1)
|
acc2.AssertContainsTaggedFields(t, measurement, fields1, tags1)
|
||||||
|
|
||||||
|
|
@ -1110,9 +1117,19 @@ func TestGatherRaw(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// list of nul terminated strings from WinAPI
|
// list of nul terminated strings from WinAPI
|
||||||
var unicodeStringListWithEnglishChars = []uint16{0x5c, 0x5c, 0x54, 0x34, 0x38, 0x30, 0x5c, 0x50, 0x68, 0x79, 0x73, 0x69, 0x63, 0x61, 0x6c, 0x44, 0x69, 0x73, 0x6b, 0x28, 0x30, 0x20, 0x43, 0x3a, 0x29, 0x5c, 0x43, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x20, 0x44, 0x69, 0x73, 0x6b, 0x20, 0x51, 0x75, 0x65, 0x75, 0x65, 0x20, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x0, 0x5c, 0x5c, 0x54, 0x34, 0x38, 0x30, 0x5c, 0x50, 0x68, 0x79, 0x73, 0x69, 0x63, 0x61, 0x6c, 0x44, 0x69, 0x73, 0x6b, 0x28, 0x5f, 0x54, 0x6f, 0x74, 0x61, 0x6c, 0x29, 0x5c, 0x43, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x20, 0x44, 0x69, 0x73, 0x6b, 0x20, 0x51, 0x75, 0x65, 0x75, 0x65, 0x20, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x0, 0x0}
|
var unicodeStringListWithEnglishChars = []uint16{0x5c, 0x5c, 0x54, 0x34, 0x38, 0x30, 0x5c, 0x50, 0x68, 0x79, 0x73, 0x69, 0x63, 0x61, 0x6c, 0x44, 0x69, 0x73,
|
||||||
var unicodeStringListWithCzechChars = []uint16{0x5c, 0x5c, 0x54, 0x34, 0x38, 0x30, 0x5c, 0x46, 0x79, 0x7a, 0x69, 0x63, 0x6b, 0xfd, 0x20, 0x64, 0x69, 0x73, 0x6b, 0x28, 0x30, 0x20, 0x43, 0x3a, 0x29, 0x5c, 0x41, 0x6b, 0x74, 0x75, 0xe1, 0x6c, 0x6e, 0xed, 0x20, 0x64, 0xe9, 0x6c, 0x6b, 0x61, 0x20, 0x66, 0x72, 0x6f, 0x6e, 0x74, 0x79, 0x20, 0x64, 0x69, 0x73, 0x6b, 0x75, 0x0, 0x5c, 0x5c, 0x54, 0x34, 0x38, 0x30, 0x5c, 0x46, 0x79, 0x7a, 0x69, 0x63, 0x6b, 0xfd, 0x20, 0x64, 0x69, 0x73, 0x6b, 0x28, 0x5f, 0x54, 0x6f, 0x74, 0x61, 0x6c, 0x29, 0x5c, 0x41, 0x6b, 0x74, 0x75, 0xe1, 0x6c, 0x6e, 0xed, 0x20, 0x64, 0xe9, 0x6c, 0x6b, 0x61, 0x20, 0x66, 0x72, 0x6f, 0x6e, 0x74, 0x79, 0x20, 0x64, 0x69, 0x73, 0x6b, 0x75, 0x0, 0x0}
|
0x6b, 0x28, 0x30, 0x20, 0x43, 0x3a, 0x29, 0x5c, 0x43, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x20, 0x44, 0x69, 0x73, 0x6b, 0x20, 0x51, 0x75, 0x65, 0x75,
|
||||||
var unicodeStringListSingleItem = []uint16{0x5c, 0x5c, 0x54, 0x34, 0x38, 0x30, 0x5c, 0x50, 0x68, 0x79, 0x73, 0x69, 0x63, 0x61, 0x6c, 0x44, 0x69, 0x73, 0x6b, 0x28, 0x30, 0x20, 0x43, 0x3a, 0x29, 0x5c, 0x43, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x20, 0x44, 0x69, 0x73, 0x6b, 0x20, 0x51, 0x75, 0x65, 0x75, 0x65, 0x20, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x0, 0x0}
|
0x65, 0x20, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x0, 0x5c, 0x5c, 0x54, 0x34, 0x38, 0x30, 0x5c, 0x50, 0x68, 0x79, 0x73, 0x69, 0x63, 0x61, 0x6c, 0x44,
|
||||||
|
0x69, 0x73, 0x6b, 0x28, 0x5f, 0x54, 0x6f, 0x74, 0x61, 0x6c, 0x29, 0x5c, 0x43, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x20, 0x44, 0x69, 0x73, 0x6b, 0x20,
|
||||||
|
0x51, 0x75, 0x65, 0x75, 0x65, 0x20, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x0, 0x0}
|
||||||
|
var unicodeStringListWithCzechChars = []uint16{0x5c, 0x5c, 0x54, 0x34, 0x38, 0x30, 0x5c, 0x46, 0x79, 0x7a, 0x69, 0x63, 0x6b, 0xfd, 0x20, 0x64, 0x69, 0x73,
|
||||||
|
0x6b, 0x28, 0x30, 0x20, 0x43, 0x3a, 0x29, 0x5c, 0x41, 0x6b, 0x74, 0x75, 0xe1, 0x6c, 0x6e, 0xed, 0x20, 0x64, 0xe9, 0x6c, 0x6b, 0x61, 0x20, 0x66, 0x72,
|
||||||
|
0x6f, 0x6e, 0x74, 0x79, 0x20, 0x64, 0x69, 0x73, 0x6b, 0x75, 0x0, 0x5c, 0x5c, 0x54, 0x34, 0x38, 0x30, 0x5c, 0x46, 0x79, 0x7a, 0x69, 0x63, 0x6b, 0xfd,
|
||||||
|
0x20, 0x64, 0x69, 0x73, 0x6b, 0x28, 0x5f, 0x54, 0x6f, 0x74, 0x61, 0x6c, 0x29, 0x5c, 0x41, 0x6b, 0x74, 0x75, 0xe1, 0x6c, 0x6e, 0xed, 0x20, 0x64, 0xe9,
|
||||||
|
0x6c, 0x6b, 0x61, 0x20, 0x66, 0x72, 0x6f, 0x6e, 0x74, 0x79, 0x20, 0x64, 0x69, 0x73, 0x6b, 0x75, 0x0, 0x0}
|
||||||
|
var unicodeStringListSingleItem = []uint16{0x5c, 0x5c, 0x54, 0x34, 0x38, 0x30, 0x5c, 0x50, 0x68, 0x79, 0x73, 0x69, 0x63, 0x61, 0x6c, 0x44, 0x69, 0x73, 0x6b,
|
||||||
|
0x28, 0x30, 0x20, 0x43, 0x3a, 0x29, 0x5c, 0x43, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x20, 0x44, 0x69, 0x73, 0x6b, 0x20, 0x51, 0x75, 0x65, 0x75, 0x65, 0x20,
|
||||||
|
0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x0, 0x0}
|
||||||
var unicodeStringListNoItem = []uint16{0x0}
|
var unicodeStringListNoItem = []uint16{0x0}
|
||||||
|
|
||||||
var stringArrayWithEnglishChars = []string{
|
var stringArrayWithEnglishChars = []string{
|
||||||
|
|
|
||||||
|
|
@ -383,8 +383,14 @@ func TestGatherCertMustNotTimeoutIntegration(t *testing.T) {
|
||||||
|
|
||||||
func TestSourcesToURLs(t *testing.T) {
|
func TestSourcesToURLs(t *testing.T) {
|
||||||
m := &X509Cert{
|
m := &X509Cert{
|
||||||
Sources: []string{"https://www.influxdata.com:443", "tcp://influxdata.com:443", "smtp://influxdata.com:25", "file:///dummy_test_path_file.pem", "/tmp/dummy_test_path_glob*.pem"},
|
Sources: []string{
|
||||||
Log: testutil.Logger{},
|
"https://www.influxdata.com:443",
|
||||||
|
"tcp://influxdata.com:443",
|
||||||
|
"smtp://influxdata.com:25",
|
||||||
|
"file:///dummy_test_path_file.pem",
|
||||||
|
"/tmp/dummy_test_path_glob*.pem",
|
||||||
|
},
|
||||||
|
Log: testutil.Logger{},
|
||||||
}
|
}
|
||||||
require.NoError(t, m.Init())
|
require.NoError(t, m.Init())
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,11 +5,13 @@ parameters which dictate batch size and flush timeout.
|
||||||
|
|
||||||
Usage as follows:
|
Usage as follows:
|
||||||
|
|
||||||
`./stress_test_write -batch_size=<batch_size> -max_backlog=<max_span_buffer_backlog> -batch_interval=<batch_interval_in_seconds> -span_count<number_of_spans_to_write> -zipkin_host=<zipkin_service_hostname>`
|
`./stress_test_write -batch_size=<batch_size> -max_backlog=<max_span_buffer_backlog> -batch_interval=<batch_interval_in_seconds> \
|
||||||
|
-span_count<number_of_spans_to_write> -zipkin_host=<zipkin_service_hostname>`
|
||||||
|
|
||||||
Or with a timer:
|
Or with a timer:
|
||||||
|
|
||||||
`time ./stress_test_write -batch_size=<batch_size> -max_backlog=<max_span_buffer_backlog> -batch_interval=<batch_interval_in_seconds> -span_count<number_of_spans_to_write> -zipkin_host=<zipkin_service_hostname>`
|
`time ./stress_test_write -batch_size=<batch_size> -max_backlog=<max_span_buffer_backlog> -batch_interval=<batch_interval_in_seconds> \
|
||||||
|
-span_count<number_of_spans_to_write> -zipkin_host=<zipkin_service_hostname>`
|
||||||
|
|
||||||
However, the flag defaults work just fine for a good write stress test (and are what
|
However, the flag defaults work just fine for a good write stress test (and are what
|
||||||
this tool has mainly been tested with), so there shouldn't be much need to
|
this tool has mainly been tested with), so there shouldn't be much need to
|
||||||
|
|
|
||||||
|
|
@ -615,7 +615,9 @@ func TestZipkinPlugin(t *testing.T) {
|
||||||
if err := postThriftData(tt.datafile, z.address, tt.contentType); err != nil {
|
if err := postThriftData(tt.datafile, z.address, tt.contentType); err != nil {
|
||||||
t.Fatalf("Posting data to http endpoint /api/v1/spans failed. Error: %s\n", err)
|
t.Fatalf("Posting data to http endpoint /api/v1/spans failed. Error: %s\n", err)
|
||||||
}
|
}
|
||||||
mockAcc.Wait(len(tt.want)) //Since the server is running concurrently, we need to wait for the number of data points we want to test to be added to the Accumulator.
|
mockAcc.Wait(
|
||||||
|
len(tt.want),
|
||||||
|
) //Since the server is running concurrently, we need to wait for the number of data points we want to test to be added to the Accumulator.
|
||||||
if len(mockAcc.Errors) > 0 != tt.wantErr {
|
if len(mockAcc.Errors) > 0 != tt.wantErr {
|
||||||
t.Fatalf("Got unexpected errors. want error = %v, errors = %v\n", tt.wantErr, mockAcc.Errors)
|
t.Fatalf("Got unexpected errors. want error = %v, errors = %v\n", tt.wantErr, mockAcc.Errors)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue