varnish / zipnish

Other
127 stars 9 forks source link

No Data In Database #16

Closed enmatt closed 8 years ago

enmatt commented 8 years ago

I've been trying to get Zipnish up and running these past few days.

I've gotten log-reader running on our Varnish 4.0.3 instance, and on a separate machine the UI is up and running.

Requests are now sent with the x-varnish-parent and x-varnish-trace headers.

Nothing is showing up in the MySQL database, however. Is there anything I could be missing?

enmatt commented 8 years ago

This is the only occasional error in the log-reader log:

2016-04-22 14:34:50,150 ERROR: invalid literal for int() with base 10: 'apis' [in /opt/zipnish/log-reader/app.py:109]

mariusmagureanu commented 8 years ago

Hi Matt,

Does your database contain two tables, zipnish_spans and zipnish_annotations? If not, then that is a bug that I've also encountered a couple of times. I'll file a bug to have this handled either way.

enmatt commented 8 years ago

Those tables are there. With the appropriate columns as well. Just nothing actually in them.

mariusmagureanu commented 8 years ago

@enmatt That could be related to #9 Try using 127.0.0.1 instead of localhost

enmatt commented 8 years ago

Okay that worked. 👍 Thanks!

All of our requests would come via DNS host names and not IP addresses though.

Got a new error to work on now:

2016-04-22 14:55:41,502 ERROR: (1452, 'Cannot add or update a child row: a foreign key constraint fails (microservices.zipnish_annotations, CONSTRAINT zipnish_annotations_ibfk_1 FOREIGN KEY (span_id) REFERENCES zipnish_spans (span_id) ON DELETE CASCADE)') [in /opt/zipnish/log-reader/app.py:109]

mariusmagureanu commented 8 years ago

I'd suspect some inconsistencies triggered by the previous error, try clearing those two tables manually.

enmatt commented 8 years ago

Cleared those tables out and even recreated the database but I am seeing the same error.

I can see the spans in the spans database just fine, just no annotations being written.

misiek08 commented 8 years ago

Your data in database got corrupted. First try to flush all data from those tables and if it won't help then remove tables and create them again with all foreign keys.

enmatt commented 8 years ago

Just tried recreating the RDS instance entirely to no avail. :/

mariusmagureanu commented 8 years ago

@enmatt Are there any other errors logged? I'll have a look into this issue and any extra info would be helpful.

enmatt commented 8 years ago

The only other error that I'm getting now is "ERROR: list index out of range"

enmatt commented 8 years ago

/usr/local/lib/python2.7/site-packages/simplemysql/simplemysql.py:180: Warning: Data truncated for column 'span_id' at row 1 self.cur.execute(sql, params) Query failed

enmatt commented 8 years ago

@mariusmagureanu I seem to have finally tracked it down. It seems the span_id is the x-varnish value, but when those requests are cached the x-varnish value is two numbers "xxxxxx xxxxxx", the second value I'm guessing is the cached result's x-varnish. As soon as I switched test routes to return(pass), there are no issues creating the annotations as the x-varnish value is now one number.

Is there another method besides what's documented for using this with caching?

mariusmagureanu commented 8 years ago

@enmatt Nice catch, I've been able to reproduce it as well so I'll have a fix coming soon.

enmatt commented 8 years ago

@mariusmagureanu Do you know how long it might take for a fix? I'll also be able to help test any potential fixes in our staging environment if you'd like.

mariusmagureanu commented 8 years ago

@enmatt The fix should already be available in master, by friday I'll have zipnish uploaded in Pypi, if you could have a quick look and see if you run into any issues it would really be great.Thx