Skip to content

Commit

Permalink
Add documentation for the exported methods and types
Browse files Browse the repository at this point in the history
Signed-off-by: Antonio Santos <antonio@santosvelasco.com>
  • Loading branch information
antonio committed Oct 23, 2019
1 parent ee78508 commit dc5b4ee
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pkg/tracing/lightstep/lightstep.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"gopkg.in/yaml.v2"
)

// Config - YAML configuration.
type Config struct {
// AccessToken is the unique API key for your LightStep project. It is
// available on your account page at https://app.lightstep.com/account
Expand All @@ -20,18 +21,21 @@ type Config struct {
Collector lightstep.Endpoint `yaml:"collector"`
}

// Tracer wraps the Lightstep tracer and the context.
type Tracer struct {
lightstep.Tracer
ctx context.Context
}

// Close synchronously flushes the Lightstep tracer, then terminates it.
func (t *Tracer) Close() error {
lightstepTracer := t.Tracer
lightstepTracer.Close(t.ctx)

return nil
}

// NewTracer creates a Tracer with the options present in the YAML config.
func NewTracer(ctx context.Context, yamlConfig []byte) (opentracing.Tracer, io.Closer, error) {
config := Config{}
if err := yaml.Unmarshal(yamlConfig, &config); err != nil {
Expand Down

0 comments on commit dc5b4ee

Please sign in to comment.