etsy / skyline

It'll detect your anomalies! Part of the Kale stack.
http://codeascraft.com/2013/06/11/introducing-kale/
Other
2.14k stars 336 forks source link

Uncaught Exceptions in algorithms.py #84

Closed Crapworks closed 10 years ago

Crapworks commented 10 years ago

Hi all,

I had a look at Skyline for a few days now and only can get it to work partially. The most annoying thing are the hundreds of Tracebacks in the analyzer logfile like this one

ERROR:root:Algorithm error: Traceback (most recent call last):
  File "/home/christian/Source/git/github/skyline/src/analyzer/algorithms.py", line 289, in run_selected_algorithm
    ensemble = [globals()[algorithm](timeseries) for algorithm in ALGORITHMS]
  File "/home/christian/Source/git/github/skyline/src/analyzer/algorithms.py", line 103, in first_hour_average
    t = tail_avg(timeseries)
  File "/home/christian/Source/git/github/skyline/src/analyzer/algorithms.py", line 45, in tail_avg
    t = (timeseries[-1][1] + timeseries[-2][1] + timeseries[-3][1]) / 3
TypeError: unsupported operand type(s) for /: 'str' and 'int'

Can someone give me a hint whats going wrong? Because I have no idea what to do at this point.

astanway commented 10 years ago

What's in your Redis for data?

Sent from not my laptop abe.is

On May 6, 2014, at 6:42 AM, Christian Eichelmann notifications@github.com wrote:

Hi all,

I had a look at Skyline for a few days now and only can get it to work partially. The most annoying thing are the hundreds of Tracebacks in the analyzer logfile like this one

ERROR:root:Algorithm error: Traceback (most recent call last): File "/home/christian/Source/git/github/skyline/src/analyzer/algorithms.py", line 289, in run_selected_algorithm ensemble = [globals()algorithm for algorithm in ALGORITHMS] File "/home/christian/Source/git/github/skyline/src/analyzer/algorithms.py", line 103, in first_hour_average t = tail_avg(timeseries) File "/home/christian/Source/git/github/skyline/src/analyzer/algorithms.py", line 45, in tail_avg t = (timeseries[-1][1] + timeseries[-2][1] + timeseries[-3][1]) / 3 TypeError: unsupported operand type(s) for /: 'str' and 'int' Can someone give me a hint whats going wrong? Because I have no idea what to do at this point.

— Reply to this email directly or view it on GitHub.

Crapworks commented 10 years ago

For Example:

redis 127.0.0.1:6379> GET metrics.removed_hostname.interface-eth6.if_errors.rx
"\x92\xcbA\xd4\xda8Ke\xc2\x8f\xa10\x92\xcbA\xd4\xda8Ze\xc2\x8f\xa10\x92\xcbA\xd4\xda8ie\xc2\x8f\xa10\x92\xcbA\xd4\xda8xe\xc2\x8f\xa10\x92\xcbA\xd4\xda8\x87e\xc2\x8f\xa10\x92\xcbA\xd4\xda8\x96e\xc2\x8f\xa10\x92\xcbA\xd4\xda8\xa5e\xc2\x8f\xa10\x92\xcbA\xd4\xda8\xb4e\xc2\x8f\xa10\x92\xcbA\xd4\xda8\xc3e\xc2\x8f\xa10\x92\xcbA\xd4\xda8\xd2e\xc2\x8f\xa10\x92\xcbA\xd4\xda8\xe1e\xc2\x8f\xa10\x92\xcbA\xd4\xda8\xf0e\xc2\x8f\xa10\x92\xcbA\xd4\xda8\xffe\xc2\x8f\xa10\x92\xcbA\xd4\xda9\x0ee\xc2\x8f\xa10\x92\xcbA\xd4\xda9\x1de\xc2\x8f\xa10\x92\xcbA\xd4\xda9,e\xc2\x8f\xa10\x92\xcbA\xd4\xda9;e\xc2\x8f\xa10\x92\xcbA\xd4\xda9Je\xc2\x8f\xa10\x92\xcbA\xd4\xda9Ye\xc2\x8f\xa10\x92\xcbA\xd4\xda9he\xc2\x8f\xa10\x92\xcbA\xd4\xda9we\xc2\x8f\xa10\x92\xcbA\xd4\xda9\x86e\xc2\x8f\xa10\x92\xcbA\xd4\xda9\x95e\xc2\x8f\xa10\x92\xcbA\xd4\xda9\xa4e\xc2\x8f\xa10\x92\xcbA\xd4\xda9\xb3e\xc2\x8f\xa10\x92\xcbA\xd4\xda9\xc2e\xc2\x8f\xa10\x92\xcbA\xd4\xda9\xd1e\xc2\x8f\xa10\x92\xcbA\xd4\xda9\xe0e\xc2\x8f\xa10\x92\xcbA\xd4\xda9\xefe\xc2\x8f\xa10\x92\xcbA\xd4\xda9\xfee\xc2\x8f\xa10\x92\xcbA\xd4\xda:\re\xc2\x8f\xa10\x92\xcbA\xd4\xda:\x1ce\xc2\x8f\xa10\x92\xcbA\xd4\xda:+e\xc2\x8f\xa10\x92\xcbA\xd4\xda::e\xc2\x8f\xa10\x92\xcbA\xd4\xda:Ie\xc2\x8f\xa10\x92\xcbA\xd4\xda:Xe\xc2\x8f\xa10\x92\xcbA\xd4\xda:ge\xc2\x8f\xa10\x92\xcbA\xd4\xda:ve\xc2\x8f\xa10\x92\xcbA\xd4\xda:\x85e\xc2\x8f\xa10"
astanway commented 10 years ago

Can you unpack the MessagePack for me please?

Sent from not my laptop abe.is

On May 6, 2014, at 6:58 AM, Christian Eichelmann notifications@github.com wrote:

For Example:

redis 127.0.0.1:6379> GET metrics.removed_hostname.interface-eth6.if_errors.rx "\x92\xcbA\xd4\xda8Ke\xc2\x8f\xa10\x92\xcbA\xd4\xda8Ze\xc2\x8f\xa10\x92\xcbA\xd4\xda8ie\xc2\x8f\xa10\x92\xcbA\xd4\xda8xe\xc2\x8f\xa10\x92\xcbA\xd4\xda8\x87e\xc2\x8f\xa10\x92\xcbA\xd4\xda8\x96e\xc2\x8f\xa10\x92\xcbA\xd4\xda8\xa5e\xc2\x8f\xa10\x92\xcbA\xd4\xda8\xb4e\xc2\x8f\xa10\x92\xcbA\xd4\xda8\xc3e\xc2\x8f\xa10\x92\xcbA\xd4\xda8\xd2e\xc2\x8f\xa10\x92\xcbA\xd4\xda8\xe1e\xc2\x8f\xa10\x92\xcbA\xd4\xda8\xf0e\xc2\x8f\xa10\x92\xcbA\xd4\xda8\xffe\xc2\x8f\xa10\x92\xcbA\xd4\xda9\x0ee\xc2\x8f\xa10\x92\xcbA\xd4\xda9\x1de\xc2\x8f\xa10\x92\xcbA\xd4\xda9,e\xc2\x8f\xa10\x92\xcbA\xd4\xda9;e\xc2\x8f\xa10\x92\xcbA\xd4\xda9Je\xc2\x8f\xa10\x92\xcbA\xd4\xda9Ye\xc2\x8f\xa10\x92\xcbA\xd4\xda9he\xc2\x8f\xa10\x92\xcbA\xd4\xda9we\xc2\x8f\xa10\x92\xcbA\xd4\xda9\x86e\xc2\x8f\xa10\x92\xcbA\xd4\xda9\x95e\xc2\x8f\xa10\x92\xcbA\xd4\xda9\xa4e\xc2\x8f\xa10\x92\xcbA\xd4\xda9\xb3e\xc2\x8f\xa10\x92\xcbA\xd4\xda9\xc2e\xc2\x8f\xa10\x92\xcbA\xd4\xda9\xd1e\xc2\x8f\xa10\x92\xcbA\xd4\xda9\xe0e\xc2\x8f\xa10\x92\xcbA\xd4\xda9\ xefe\xc2\x8f\xa10\x92\xcbA\xd4\xda9\xfee\xc2\x8f\xa10\x92\xcbA\xd4\xda:\re\xc2\x8f\xa10\x92\xcbA\xd4\xda:\x1ce\xc2\x8f\xa10\x92\xcbA\xd4\xda:+e\xc2\x8f\xa10\x92\xcbA\xd4\xda::e\xc2\x8f\xa10\x92\xcbA\xd4\xda:Ie\xc2\x8f\xa10\x92\xcbA\xd4\xda:Xe\xc2\x8f\xa10\x92\xcbA\xd4\xda:ge\xc2\x8f\xa10\x92\xcbA\xd4\xda:ve\xc2\x8f\xa10\x92\xcbA\xd4\xda:\x85e\xc2\x8f\xa10" — Reply to this email directly or view it on GitHub.

Crapworks commented 10 years ago

Sure :)

(1399382317.59, '0')
Crapworks commented 10 years ago

btw.: I'm using horizons udp receiver and the data gets send by a tool written by me. Maybe I'm formating the data wrong?

This is the data that is send via udp:

    def encode(self, data):
        return [
            packb((
                self.metric.format(**self._transform(item)),
                (
                    (float(self.time.format(**item)), 
                    self.value.format(**item))
                )                                                                                                                                                                                                    
            )) for item in data
        ]
astanway commented 10 years ago

Your '0' is a string, so you're formatting it wrong. Maybe I should add a type check for the ingest...

Sent from not my laptop abe.is

On May 6, 2014, at 7:15 AM, Christian Eichelmann notifications@github.com wrote:

Sure :)

(1399382317.59, '0') — Reply to this email directly or view it on GitHub.

Crapworks commented 10 years ago

If I cast the value to an int and it lands as a integer in redis I get a couple of other errors, saying that int and str can't be concatenated ...

astanway commented 10 years ago

I don't know really know what's going on in your horizon dispatcher, but it should reflect the logic here: https://github.com/etsy/skyline/blob/master/utils/seed_data.py#L43

Can you run seed_data.py successfully?

Sent from not my laptop abe.is

On May 6, 2014, at 7:43 AM, Christian Eichelmann notifications@github.com wrote:

If I cast the value to an int and it lands as a integer in redis I get a couple of other errors, saying that int and str can't be concatenated ...

— Reply to this email directly or view it on GitHub.

Crapworks commented 10 years ago

Hi,

I found the error in my own code. It was a combination of an additional pair of parantheses and the fact that value and timestamp has to be casted to a float (graphite seems to be more tolerant when using the pickle protocol). Now everything is working without exceptions! Thanks for your help!