I don't use Google's platform, but from what I can tell: 1. Their platform adds in the header "X_CLOUD_TRACE_CONTEXT" 2. There are middleware tools for aggregating logs based on that 3. I don't know if the software you linked is using the middleware, but the popular libraries seem to be:
* https://github.com/salrashid123/flask-gcp-log-groups * https://github.com/christophski/django-gcp-log-groups I could be wrong. IMHO, for a variety of reasons `get_current_request` is the wrong approach here. If you need to create the header - and it's not part of google's platform - then you'd be best off writing middleware or a tween to add header using a UUID. BUT it looks like your best option would be to fork the flask/django middleware project and adapt it to Pyramid. On Sunday, November 8, 2020 at 10:55:12 PM UTC-5 jdavi...@gmail.com wrote: > Using get_current_request, it does seem to end up working, sort of. > > I still get a duplicate, I imagined to somehow get it down to just 1: > > [image: chrome_P3YiTNWlNu.png] > > I'm not getting the root log entry to show the log level though, which > makes filtering by error or warning certainly a nightmare. Part of that, I > think, is that it's emitting a log entry on each call to `logging`, rather > than pooling them and emitting at the end of the request. Clicking that > parent log entry, there are no children entries, but after about a second, > that one^ pops in, as if it's querying for any matching trace IDs. This > isn't how appengine Standard appears to work. Child log entries seem to > exist on the parent as a whole/no querying needed. > > Given that I am able to "group" these, maybe this is less a Pyramid issue > and more a google one. Looking further into get_current_request, it seems > to do basically the same thing as django and flask so I suppose for the > purposes of logging, it's good enough? > On Sunday, November 8, 2020 at 9:36:10 PM UTC-6 jdavi...@gmail.com wrote: > >> Trying to get appengine logging working under Pyramid. >> >> Log entries are appearing, but they aren't grouped in the same request. >> Not only are they not grouped in the same request, but I'm getting a >> duplicate as well. >> >> [image: chrome_hZKb2p0Zdr.png] >> >> For those that aren't familiar with googles Logging system, the top line >> should have the blue icon indicating the request contains an INFO log, and >> clicking on it should expand to show all of the logging calls that were >> made during that request. For example: >> >> [image: chrome_LiowoZYVa5.png] >> >> As you can see there, that particular request contains 2 logging entries, >> so we see them there when that line is expanded. >> >> In order for log entries to be grouped together, the api needs to know >> what request its a part of. Both django and flask appear to have methods >> available to determine what the current request is, and look for a >> particular header within that request. >> >> Here is the place where I think needs an addition for Pyramid to be >> supported here. >> >> >> https://github.com/googleapis/python-logging/blob/master/google/cloud/logging/handlers/_helpers.py#L49-L65 >> >> I see that pyramid has "pyramid.threadlocal.get_current_request()" but >> the documentation seems to indicate that that maybe shouldn't be used. >> >> Can anyone point me in the right direction? >> > -- You received this message because you are subscribed to the Google Groups "pylons-discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to pylons-discuss+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/pylons-discuss/076d8fc4-168f-4f20-a8e9-e1f87172b05dn%40googlegroups.com.