Skip to content

Commit c1f5125

Browse files
committed
internal/spanlog: copies spanlog into the internal directory
This is the first in a series of patches which include an effort to refactor how the cmd/coordinator is structured. In order to move buildlet pools into their own package, it would facilitate the move to have spanlog in it's own internal package. This CL will be followed by one which removes cmd/coordinator/spanlog and changes the path of the package for all the callers. Updates golang/go#36841 Change-Id: Ic310a38f807a3099815e0bdb988edc42b2ca5c85 Reviewed-on: https://go-review.googlesource.com/c/build/+/226843 Run-TryBot: Carlos Amedee <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Alexander Rakoczy <[email protected]>
1 parent 818a910 commit c1f5125

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

internal/spanlog/spanlog.go

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// Copyright 2020 The Go Authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style
3+
// license that can be found in the LICENSE file.
4+
5+
// Package spanlog provides span and event logger interfaces.
6+
package spanlog
7+
8+
// SpanLogger is something that has the CreateSpan method, which
9+
// creates a event spanning some duration which will eventually be
10+
// logged and visualized.
11+
type Logger interface {
12+
// CreateSpan logs the start of an event.
13+
// optText is 0 or 1 strings.
14+
CreateSpan(event string, optText ...string) Span
15+
}
16+
17+
// Span is a handle that can eventually be closed.
18+
// Typical usage:
19+
//
20+
// sp := sl.CreateSpan("slow_operation")
21+
// result, err := doSlowOperation()
22+
// sp.Done(err)
23+
// // do something with result, err
24+
type Span interface {
25+
// Done marks a span as done.
26+
// The err is returned unmodified for convenience at callsites.
27+
Done(err error) error
28+
}

0 commit comments

Comments
 (0)