graphite-project / carbon

Carbon is one of the components of Graphite, and is responsible for receiving metrics over the network and writing them down to disk using a storage backend.
http://graphite.readthedocs.org/
Apache License 2.0
1.5k stars 490 forks source link

[Q]unicode unwanted characters #927

Closed Trolls closed 2 years ago

Trolls commented 2 years ago

Hello,

i tried to insert values, but i got some error in /var/log/go-carbon/go-carbon.log:

[2022-01-02T20:41:58.627+0100] INFO [pickle] can't parse message {"data": "]q\u0000((X9\u0000\u0000\u0000perf.model.serial.Pool.1.00:0F:00.capacityGBq\u0001citertools\nizip\nq\u0002(c__builtin__\niter\nq\u0003(]q\u0004(X\u0001\u0000\u0000\u00001q\u0005X\u0001\u0000\u0000\u00006q\u0006X\u0001\u0000\u0000\u00003q\u0007X\u0001\u0000\u0000\u00009q\u0008h\u0007h\u0008h\u0007X\u0001\u0000\u0000\u00005q\tX\u0001\u0000\u0000\u00000q\nh\netq\u000bRq\u000cK\u0000bh\u0003(]q\r(h\u0005h\nX\u0001\u0000\u0000\u00002q\u000eX\u0001\u0000\u0000\u00004q\u000fetq\u0010Rq\u0011K\u0000btq\u0012Rq\u0013tq\u0014(X9\u0000\u0000\u0000hds.perf.....

I tried to correct it with str, decode(utf-8) without success...

               for myline in newline:
                  myline = str(myline)
                  #newcap = newcap.decode(utf-8)
                  value = (myline,newcap)
                  tuples.append((f"perf.{type}.{serial}.Pool.{newpool}.{ldev}.{metric}",value))

value in tuples dict:

('perf.mymodel.12345.Pool.1.00:0F:00.capacityGB', ('1639479480', '1024')) ...

What's wrong? when i set manually, it works well...

Many thanks for any help

deniszh commented 2 years ago

Hi @Trolls

It's better to not use pickle for data import, try to use line protocol instead

Trolls commented 2 years ago

Hi Deniszh,

Thank you for your reply. I got a lot of values to insert, it's too slow otherwise :)

deniszh commented 2 years ago

hi @Trolls contrary to popular belief pickle is not faster then line. Try to spawn more carbon processes to use more CPU cores (if you have them of course) Or use go-carbon instead.

Trolls commented 2 years ago

Hi Deniszh,

Excatly, i'm using go-carbon. I successed to insert with the plain text protocol, thank you!

I will test and compare the execute time between the plaintext and pickle protocol :)