Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
Alessandro Vermeulen
@spockz
Add a filter in which you inspect the trace context or put a filter sufficiently down the stack to observe the actual headers on the http request
@road21 ^^
Aleksey Troitskiy
@road21
@spockz Thanks! I also found another way - disabling ServerTracingFilter
Is it safe?
Alessandro Vermeulen
@spockz
@road21 ah i was assuming you wanted to change the client. Yes by disabling that filter you won’t get the finagle tracing initialised. Beware that this means you’ll see fictional traces reported in Failures
Why do you want to disable the finagle tracing mechanism instead of proving a different Tracer implementation?
Aleksey Troitskiy
@road21
@spockz I am using typed-schema (https://github.com/TinkoffCreditSystems/typed-schema) with finagle backend
And I can build context of my routes (reader context) only from Request class (see for example https://github.com/TinkoffCreditSystems/typed-schema/blob/master/modules/finagle-zio/src/main/scala/ru/tinkoff/tschema/finagle/routing/ZioRouting.scala)
I want to keep tracing headers in my context (for logging and propagating), that's why I need somehow to extract it from Request
Alessandro Vermeulen
@spockz
In your own context? You could also initialise the tracing context with the data from finagles context and save the new context again when using the finagle client
You can read the current trace (according to finagle context) with something in Trace or Tracing. (Not near a pc right now so don’t have more detailed identifiers). So you don’t necessarily need to parse the B3 headers yourself
Aleksey Troitskiy
@road21
Yep, in my own
Thank you very much for suggestion! I will try it
Liam Williams
@theangrydev
Hi, I have a question - is a thriftmux client able to downgrade to interact with a raw thrift-server?
Moses Nakamura
@mosesn
great question, no, it’s not. however, thriftmux servers are able to downgrade. this means that unfortunately, servers must upgrade first.
mgedigian
@mgedigian
Is it possible in finatra to log the bytes of a thrift request? I would like to capture them for later use in offline testing.
Christopher Coco
@cacoco
@mgedigian yes, you'd use a filter -- see: https://twitter.github.io/finatra/user-guide/thrift/filters.html. We have an access logging filter for Thrift: https://github.com/twitter/finatra/blob/develop/thrift/src/main/scala/com/twitter/finatra/thrift/filters/AccessLoggingFilter.scala. Note that logging the bytes is likely a security hole and we wouldn't recommend doing this but it's up to what you're trying to do. We have other tools and have been kicking around some ideas about how to capture requests for testing but it would be for capturing thrift requests your clients make to other services, not for requests to your thrift service.
mgedigian
@mgedigian
@cacoco thank you!
Alessandro Vermeulen
@spockz
@cacoco aren’t you replaying production traffic for testing on staging environments?
Christopher Coco
@cacoco
@spockz that would be outside of Finatra
mgedigian
@mgedigian
I think Iago docs mention using logs for http, but proxy or network sniffer for thrift
Christopher Coco
@cacoco
Yeah formulating thrift requests is non-trivial. And yes we use tools like Iago
Dermot Haughey
@hderms
what's the "right" way to shut finagle down?
when I kill the server in SBT console, and try to restart it, it is still bound to 0.0.0.0
(along with weird classloader issues throwing warnings)
Moses Nakamura
@mosesn
close the server, or send /quitquitquit to the admin endpoint
Dermot Haughey
@hderms
cool if close on ListeningServer does everything I need then I'm good, thanks @mosesn
Moses Nakamura
@mosesn
I think you can also tell the sbt console to fork the JVM when it starts the REPL so it shuts things down a bit harder when you close the console
Dermot Haughey
@hderms
yeah we were doing that for a while which was helpful for stuff like this, but there is some weirdness where the forked process doesn't inherit the SBT options of the parent (we noticed because it would run out of memory even though the parent was granted a lot). I should look into it again
thanks
[warn] Thread[Service Thread,9,system] loading com.twitter.jvm.Allocations$$anon$1$$anonfun$1 after test or run has completed. This is a likely resource leak
if anyone knows anything about this
Dermot Haughey
@hderms
probably related to the SBT classloader changes
Christopher Coco
@cacoco
FWIW, you can pass JVM Args to the forked process in SBT but it is surprisingly hard.
Dermot Haughey
@hderms
yeah it's one of the dark corners of SBT
I should look into pants one of these days
Alessandro Vermeulen
@spockz
Or Bazel while you are at it
Martijn Hoekstra
@martijnhoekstra
Is passing JVM args to a forked JVM much easier there?
Alessandro Vermeulen
@spockz
@martijnhoekstra, not necessarily. But if you are considering switching build tools it has nice advantages like distributed compilation cache. We are looking at it and for now the missing plugins and significant build rewrite are holding us back. But it is attractive
Dermot Haughey
@hderms
I took the suggestion to use revolver to heart and have found it pretty good so far. Setting JVM options on the revolver instance is seemingly straightforward and I've been using it to ~reStart (compile+run on filesystem changes) my app without issue so far
Moses Nakamura
@mosesn
nice work!
Dermot Haughey
@hderms
@mosesn thanks!
Martijn Janssen
@martijnjanssen
Quick question, it is even possible to send a response body with finagle http? I can't seem to figure it out
Christopher Coco
@cacoco
Set the content of a response....there are multiple ways
As a Buf or as a String
Martijn Janssen
@martijnjanssen
Really? I couldn't find it in the docs
I know it sounds utterly stupid, not being able to find it
Christopher Coco
@cacoco
We perhaps don’t document it but I think there may be examples. We definitely have examples in the Finatra documentation. You may want to just take a look at the Response class.
Martijn Janssen
@martijnjanssen
Ah, I'll take a look there
Christopher Coco
@cacoco
Actually it’s in the super class, Message (which is shared between Request and Response)
Martijn Janssen
@martijnjanssen
Thanks!