Skip to content

Instantly share code, notes, and snippets.

View boris-42's full-sized avatar
:octocat:

Boris Pavlovic boris-42

:octocat:
View GitHub Profile
SLA = 5
FAILED = []
make_positive(ts):
return [t, 1 for t, v in ts]:
for v in time_series:
if v:
if len(FAILED) <= SLA:
send_to_graphite(make_positive(FAILED) + [v])
curl -X GET <ES>/<parsed_log_index>/<parsed_log_type> -d'
{
"aggs": {
"request_per_minute": {
"date_histogram": {
"field": "Timestamp",
"interval": "minute",
"format": "yyyy-MM-dd-hh-mm"
},
"aggs": {
{
"took": 28,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"failed": 0
},
"hits": {
"total": 9999,
curl -X GET <ES_URL>/log*/log/_search?size=5000&from=0 -d '
{
"query": {
"filtered": {
"filter": {
"range": {
"timestamp": {
"gte" : "now-1d/d"
}
}
{
"rsyslog-2016.09.20" : {
"mappings" : {
"rsyslog" : {
"properties" : {
"EnvVersion" : {
"type" : "string"
},
"Hostname" : {
"type" : "string"
"hooks": [
{
"name": "example_hook",
"args": {
"cmd": "bash enable_factor_1"
},
"trigger: {
"name": "event",
"args": {
"unit": "seconds",
import time
from rally import consts
from rally import exceptions
from rally.task import context
@context.configure(name="sleep_context", order=100500)
class SleepContext(context.Context):
"""Dummy context."""
@boris-42
boris-42 / test.py
Last active January 8, 2016 17:46
oslo.utils testing
import time
from oslo_utils import reflection
REPEAT = 1000000
RANGE = range(REPEAT)
class A(object):
{
"total_size": 173,
"start": 0,
"next_collection_link": "https://blueprints.launchpad.net/api/devel/rally/all_specifications?ws.size=75&memo=75&ws.start=75",
"entries": [
{
"starter_link": "https://blueprints.launchpad.net/api/devel/~boris-42",
"linked_branches_collection_link": "https://blueprints.launchpad.net/api/devel/rally/+spec/api-base/linked_branches",
"lifecycle_status": "Started",
"title": "Base for all REST API stuff",
def check_quotes(logical_line):
"""Raise lint error when using ' instead of " """
# if there is no double quote sign there's nothing to do
if not logical_line or logical_line.strip().startswith("#"):
return
in_string = False
single_quotas_are_used = False
i = 0