mirror of
https://github.com/fnproject/fn.git
synced 2022-10-28 21:29:17 +03:00
add jaeger support, link hot container & req span (#840)
* add jaeger support, link hot container & req span * adds jaeger support now with FN_JAEGER_URL, there's a simple tutorial in the operating/metrics.md file now and it's pretty easy to get up and running. * links a hot request span to a hot container span. when we change this to sample at a lower ratio we'll need to finagle the hot container span to always sample or something, otherwise we'll hide that info. at least, since we're sampling at 100% for now if this is flipped on, can see freeze/unfreeze etc. if they hit. this is useful for debugging. note that zipkin's exporter does not follow the link at all, hence jaeger... and they're backed by the Cloud Empire now (CNCF) so we'll probably use it anyway. * vendor: add thrift for jaeger
This commit is contained in:
@@ -492,11 +492,12 @@ func (s *coldSlot) Close(ctx context.Context) error {
|
||||
|
||||
// implements Slot
|
||||
type hotSlot struct {
|
||||
done chan struct{} // signal we are done with slot
|
||||
errC <-chan error // container error
|
||||
container *container // TODO mask this
|
||||
maxRespSize uint64 // TODO boo.
|
||||
fatalErr error
|
||||
done chan struct{} // signal we are done with slot
|
||||
errC <-chan error // container error
|
||||
container *container // TODO mask this
|
||||
maxRespSize uint64 // TODO boo.
|
||||
fatalErr error
|
||||
containerSpan trace.SpanContext
|
||||
}
|
||||
|
||||
func (s *hotSlot) Close(ctx context.Context) error {
|
||||
@@ -523,6 +524,13 @@ func (s *hotSlot) exec(ctx context.Context, call *call) error {
|
||||
// link the container id and id in the logs [for us!]
|
||||
common.Logger(ctx).WithField("container_id", s.container.id).Info("starting call")
|
||||
|
||||
// link the container span to ours for additional context (start/freeze/etc.)
|
||||
span.AddLink(trace.Link{
|
||||
TraceID: s.containerSpan.TraceID,
|
||||
SpanID: s.containerSpan.SpanID,
|
||||
Type: trace.LinkTypeChild,
|
||||
})
|
||||
|
||||
// swap in fresh pipes & stat accumulator to not interlace with other calls that used this slot [and timed out]
|
||||
stdinRead, stdinWrite := io.Pipe()
|
||||
stdoutRead, stdoutWritePipe := io.Pipe()
|
||||
@@ -663,7 +671,13 @@ func (a *agent) runHot(ctx context.Context, call *call, tok ResourceToken, state
|
||||
default: // ok
|
||||
}
|
||||
|
||||
slot := &hotSlot{done: make(chan struct{}), errC: errC, container: container, maxRespSize: a.cfg.MaxResponseSize}
|
||||
slot := &hotSlot{
|
||||
done: make(chan struct{}),
|
||||
errC: errC,
|
||||
container: container,
|
||||
maxRespSize: a.cfg.MaxResponseSize,
|
||||
containerSpan: trace.FromContext(ctx).SpanContext(),
|
||||
}
|
||||
if !a.runHotReq(ctx, call, state, logger, cookie, slot) {
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user