forked from pyr/cyanite
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
567 additions
and
95 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
carbon: | ||
host: "127.0.0.1" | ||
port: 2003 | ||
readtimeout: 30 | ||
rollups: | ||
- period: 60480 | ||
rollup: 10 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<jmeterTestPlan version="1.2" properties="2.5" jmeter="2.10 r1533061"> | ||
<hashTree> | ||
<TestPlan guiclass="TestPlanGui" testclass="TestPlan" testname="Test Plan" enabled="true"> | ||
<stringProp name="TestPlan.comments"></stringProp> | ||
<boolProp name="TestPlan.functional_mode">false</boolProp> | ||
<boolProp name="TestPlan.serialize_threadgroups">false</boolProp> | ||
<elementProp name="TestPlan.user_defined_variables" elementType="Arguments" guiclass="ArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true"> | ||
<collectionProp name="Arguments.arguments"/> | ||
</elementProp> | ||
<stringProp name="TestPlan.user_define_classpath"></stringProp> | ||
</TestPlan> | ||
<hashTree> | ||
<ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="Thread Group" enabled="true"> | ||
<stringProp name="ThreadGroup.on_sample_error">continue</stringProp> | ||
<elementProp name="ThreadGroup.main_controller" elementType="LoopController" guiclass="LoopControlPanel" testclass="LoopController" testname="Loop Controller" enabled="true"> | ||
<boolProp name="LoopController.continue_forever">false</boolProp> | ||
<stringProp name="LoopController.loops">1</stringProp> | ||
</elementProp> | ||
<stringProp name="ThreadGroup.num_threads">5</stringProp> | ||
<stringProp name="ThreadGroup.ramp_time">1</stringProp> | ||
<longProp name="ThreadGroup.start_time">1400616222000</longProp> | ||
<longProp name="ThreadGroup.end_time">1400616222000</longProp> | ||
<boolProp name="ThreadGroup.scheduler">false</boolProp> | ||
<stringProp name="ThreadGroup.duration"></stringProp> | ||
<stringProp name="ThreadGroup.delay"></stringProp> | ||
</ThreadGroup> | ||
<hashTree> | ||
<RandomVariableConfig guiclass="TestBeanGUI" testclass="RandomVariableConfig" testname="Random Variable" enabled="true"> | ||
<stringProp name="maximumValue">1</stringProp> | ||
<stringProp name="minimumValue">1</stringProp> | ||
<stringProp name="outputFormat"></stringProp> | ||
<boolProp name="perThread">true</boolProp> | ||
<stringProp name="randomSeed"></stringProp> | ||
<stringProp name="variableName">randy</stringProp> | ||
</RandomVariableConfig> | ||
<hashTree/> | ||
<TCPSampler guiclass="TCPSamplerGui" testclass="TCPSampler" testname="TCP Sampler" enabled="true"> | ||
<stringProp name="TCPSampler.classname">TCPClientImpl</stringProp> | ||
<stringProp name="TCPSampler.server">localhost</stringProp> | ||
<boolProp name="TCPSampler.reUseConnection">true</boolProp> | ||
<stringProp name="TCPSampler.port">2003</stringProp> | ||
<boolProp name="TCPSampler.nodelay">false</boolProp> | ||
<stringProp name="TCPSampler.timeout">1</stringProp> | ||
<stringProp name="TCPSampler.ctimeout">1000</stringProp> | ||
<stringProp name="TCPSampler.request">foo.bar.baz.${randy} 1 1400616260 | ||
foo.bar.bazz.${randy} 1 1400616260 | ||
foo.bar.bazz2.${randy} 1 1400616260 | ||
foo.bar.bazz3.${randy} 1 1400616260 | ||
foo.bar.bazz4.${randy} 1 1400616260 | ||
foo.bar.bazz5.${randy} 1 1400616260 | ||
foo1.bar.bazz.${randy} 1 1400616260 | ||
foo2.bar.bazz2.${randy} 1 1400616260 | ||
foo3.bar.bazz3.${randy} 1 1400616260 | ||
foo4.bar.bazz4.${randy} 1 1400616260 | ||
foo5.bar.bazz5.${randy} 1 1400616260 | ||
</stringProp> | ||
<boolProp name="TCPSampler.closeConnection">false</boolProp> | ||
<stringProp name="TCPSampler.EolByte">0A</stringProp> | ||
<stringProp name="ConfigTestElement.username"></stringProp> | ||
<stringProp name="ConfigTestElement.password"></stringProp> | ||
</TCPSampler> | ||
<hashTree> | ||
<ResultCollector guiclass="SummaryReport" testclass="ResultCollector" testname="Summary Report" enabled="true"> | ||
<boolProp name="ResultCollector.error_logging">false</boolProp> | ||
<objProp> | ||
<name>saveConfig</name> | ||
<value class="SampleSaveConfiguration"> | ||
<time>true</time> | ||
<latency>true</latency> | ||
<timestamp>true</timestamp> | ||
<success>true</success> | ||
<label>true</label> | ||
<code>true</code> | ||
<message>true</message> | ||
<threadName>true</threadName> | ||
<dataType>true</dataType> | ||
<encoding>false</encoding> | ||
<assertions>true</assertions> | ||
<subresults>true</subresults> | ||
<responseData>false</responseData> | ||
<samplerData>false</samplerData> | ||
<xml>false</xml> | ||
<fieldNames>false</fieldNames> | ||
<responseHeaders>false</responseHeaders> | ||
<requestHeaders>false</requestHeaders> | ||
<responseDataOnError>false</responseDataOnError> | ||
<saveAssertionResultsFailureMessage>false</saveAssertionResultsFailureMessage> | ||
<assertionsResultsToSave>0</assertionsResultsToSave> | ||
<bytes>true</bytes> | ||
</value> | ||
</objProp> | ||
<stringProp name="filename"></stringProp> | ||
</ResultCollector> | ||
<hashTree/> | ||
</hashTree> | ||
</hashTree> | ||
</hashTree> | ||
</hashTree> | ||
</jmeterTestPlan> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#!/usr/bin/env python | ||
|
||
import sys, os, time | ||
from socket import socket | ||
from random import random | ||
|
||
try: | ||
host = sys.argv[1] | ||
port = int(sys.argv[2]) | ||
mpm = int(sys.argv[3]) | ||
except: | ||
print 'Usage: %s host port metrics-per-minute' % os.path.basename(sys.argv[0]) | ||
sys.exit(1) | ||
|
||
s = socket() | ||
s.connect( (host,port) ) | ||
now = int( time.time() ) | ||
now -= now % 60 | ||
|
||
while True: | ||
start = time.time() | ||
count = 0 | ||
for i in xrange(0, mpm): | ||
metric = 'TEST.%d' % i | ||
value = random() | ||
s.sendall('%s %s %s\n' % (metric, value, now)) | ||
count += 1 | ||
|
||
print 'sent %d metrics in %.3f seconds' % (count, time.time() - start) | ||
now += 60 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
(ns org.spootnik.cyanite.es-client | ||
"Hacks of elastich to use async http-kit" | ||
(:require [clojurewerkz.elastisch.rest.document :as esrd] | ||
[clojurewerkz.elastisch.rest.bulk :as esrb] | ||
[clojurewerkz.elastisch.rest :as rest] | ||
[clojurewerkz.elastisch.arguments :as ar] | ||
[clojure.string :as str] | ||
[org.httpkit.client :as http] | ||
[cheshire.core :as json] | ||
[clojure.tools.logging :refer [error info debug]]) | ||
(:import clojurewerkz.elastisch.rest.Connection)) | ||
|
||
(defn multi-get | ||
[^Connection conn index mapping-type query func] | ||
(http/post | ||
(rest/index-mget-url conn index mapping-type) | ||
{:body (json/encode {:docs query})} | ||
#(if (= 200 (:status %)) | ||
(let [bod (json/decode (:body %) true)] | ||
(func (filter :found (:docs bod)))) | ||
(error "ES responded with non-200: " %)))) | ||
|
||
(comment "Note: i've ditched the optional args to ES, refer to orignal elastich code for how they should return") | ||
|
||
(defn bulk-with-url | ||
[url operations func] | ||
(let [bulk-json (map json/encode operations) | ||
bulk-json (-> bulk-json | ||
(interleave (repeat "\n")) | ||
(str/join))] | ||
(http/post url | ||
{:body bulk-json} | ||
#(let [status (:status %)] | ||
(when (not= 200 status) | ||
(func %)))))) | ||
|
||
(defn remove-ids-from-docs | ||
[op-or-doc] | ||
(if (:tenant op-or-doc) | ||
(dissoc op-or-doc :_id) | ||
op-or-doc)) | ||
|
||
(defn multi-update | ||
[^Connection conn index mapping-type docs func] | ||
(bulk-with-url (rest/bulk-url conn index mapping-type) | ||
(map | ||
remove-ids-from-docs | ||
(esrb/bulk-index (map #(assoc % :_id (:path %) | ||
:_index index | ||
:_type mapping-type) docs))) | ||
func)) |
Oops, something went wrong.