Skip to content

Instantly share code, notes, and snippets.

View kolobaev's full-sized avatar

Vladimir Kolobaev kolobaev

View GitHub Profile
/* global _ */
/*
* Complex scripted dashboard
* This script generates a dashboard object that Grafana can load. It also takes a number of user
* supplied URL parameters (in the ARGS variable)
*
* Return a dashboard object, or a function
*
* For async scripts, return a function, this function must take a single callback function as argument,
@transaction.atomic()
def save(self, device, full=True):
manufacturer_id = self._get_manufacturer_id(device.manufacturer)
device_type_id = self._get_device_type_id(device.model, manufacturer_id)
key = dict(
site_id=AVITO_SITE_ID,
device_type_id=device_type_id,
device_role_id=self._get_device_role_id('server'),
)
@kolobaev
kolobaev / escalation.go
Last active August 14, 2019 11:39
moira/notifier/escalations/escalation.go
package escalations
import (
"fmt"
"sync"
"time"
"gopkg.in/tomb.v2"
"github.com/moira-alert/moira"
@kolobaev
kolobaev / escalation.go
Created August 14, 2019 11:41
database/redis/escalation.go
package redis
import (
"encoding/json"
"fmt"
"github.com/garyburd/redigo/redis"
"github.com/moira-alert/moira"
"github.com/moira-alert/moira/database/redis/reply"
package seriesList
import (
"fmt"
"math"
"strconv"
"github.com/go-graphite/carbonapi/expr/helper"
"github.com/go-graphite/carbonapi/expr/interfaces"
"github.com/go-graphite/carbonapi/expr/types"
SELECT *
FROM system.mutations
WHERE is_done = 0
Row 1:
──────
database: graphite
table: series
mutation_id: 0000000067
command: DELETE WHERE Path LIKE 'complex.delete_me._avi-http01.%'
2020.04.01 17:39:33.666337 [ 26205 ] {} <Warning> graphite.series (ReplicatedMergeTreePartCheckThread): Checking part 20191201_20191228_962857_1623700_316_1909195
2020.04.01 17:39:33.666465 [ 26179 ] {} <Error> graphite.series: DB::StorageReplicatedMergeTree::queueTask()::<lambda(DB::StorageReplicatedMergeTree::LogEntryPtr&)>: Code: 246, e.displayText() = DB::Exception: Bad size of marks file '/var/lib/clickhouse/data/graphite/series/20191201_20191228_962857_1623700_316_1909195/Path.mrk': 504048, must be: 336032, Stack trace (when copying this message, always include the lines below):
0. Poco::Exception::Exception(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, int) @ 0x102e0d8c in /usr/bin/clickhouse
1. DB::Exception::Exception(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, int) @ 0x8f2d989 in /usr/bin/clickhouse
2. ? @ 0xd884474 in /usr/bin/clickhouse
3. std::__1::pair<std::__1::shared_ptr<DB::MarksInCompressedFile
2020.04.01 18:01:15.942147 [ 26174 ] {} <Warning> graphite.series (ReplicatedMergeTreeQueue): Mutation with version 1909196 not found in partition ID 201912 (trying to mutate part 20191201_20191228_962857_1623700_316_1909195)
2020.04.01 18:01:15.946294 [ 26174 ] {} <Error> graphite.series: DB::StorageReplicatedMergeTree::queueTask()::<lambda(DB::StorageReplicatedMergeTree::LogEntryPtr&)>: Code: 33, e.displayText() = DB::Exception: Cannot read all data. Bytes read: 0. Bytes expected: 4., Stack trace (when copying this message, always include the lines below):
0. Poco::Exception::Exception(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, int) @ 0x102e0d8c in /usr/bin/clickhouse
1. DB::Exception::Exception(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, int) @ 0x8f2d989 in /usr/bin/clickhouse
2. DB::ReadBuffer::readStrict(char*, unsigned long) @ 0x8f662af in /usr/bin/clickhouse
3. DB::DataTypeNumberBase<unsigned int>::des
{
"annotations": {
"list": [
{
"builtIn": 1,
"datasource": "-- Grafana --",
"enable": true,
"hide": true,
"iconColor": "rgba(0, 211, 255, 1)",
"name": "Annotations & Alerts",
@kolobaev
kolobaev / gist:f388077c40a1940588a1ec8075df922e
Created November 10, 2020 13:32
ClickHouse 20.10.3.30 crashed
2020.11.10 16:28:38.136660 [ 62863 ] {} <Warning> graphite.data2: Removing temporary directory /var/lib/clickhouse/data/graphite/data2/tmp_merge_20201107_20201110_49353_75824_23/
2020.11.10 16:28:38.645842 [ 62832 ] {} <Warning> graphite.series2: Tried to commit obsolete part 20201110_20201110_759029_759158_70 covered by 20201110_20201110_759029_759185_78 (state Committed)
2020.11.10 16:28:50.510349 [ 66015 ] {} <Warning> TCPHandler: Client has not sent any data.
2020.11.10 16:28:50.519333 [ 66015 ] {} <Error> ServerErrorHandler: Code: 101, e.displayText() = DB::NetException: Unexpected packet from client, Stack trace (when copying this message, always include the lines below):
0. DB::TCPHandler::receiveHello() @ 0xe56c988 in /usr/bin/clickhouse
1. DB::TCPHandler::runImpl() @ 0xe568299 in /usr/bin/clickhouse
2. DB::TCPHandler::run() @ 0xe575ca7 in /usr/bin/clickhouse
3. Poco::Net::TCPServerConnection::start() @ 0x10d4dd6f in /usr/bin/clickhouse
4. Poco::Net::TCPServerDispatcher::run() @ 0x10d4f77e in /usr/bi