func TracerFromEnvFlag() (Tracer, error) {
	cfg, err := parseDSN(_traceDSN)
	if err != nil {
		return nil, err
	}
	report := newReport(cfg.Network, cfg.Addr, time.Duration(cfg.Timeout), cfg.ProtocolVersion)
	return NewTracer(env.AppID, report, cfg.DisableSample), nil
}
TracerFromEnvFlag new tracer from env and flag
package trace
import (
	"flag"
	"fmt"
	"os"
	"time"
	"github.com/pkg/errors"
	"github.com/mapgoo-lab/atreus/pkg/conf/dsn"
	"github.com/mapgoo-lab/atreus/pkg/conf/env"
	xtime "github.com/mapgoo-lab/atreus/pkg/time"
)
var _traceDSN = "unixgram:///var/run/dapper-collect/dapper-collect.sock"
func init() {
	if v := os.Getenv("TRACE"); v != "" {
		_traceDSN = v
	}
	flag.StringVar(&_traceDSN, "trace", _traceDSN, "trace report dsn, or use TRACE env.")
}
type Config struct {
	Network string `dsn:"network"`
	Addr string `dsn:"address"`
	Timeout xtime.Duration `dsn:"query.timeout,200ms"`
	DisableSample bool `dsn:"query.disable_sample"`
	ProtocolVersion int32 `dsn:"query.protocol_version,1"`
	Probability float32 `dsn:"-"`
}
func parseDSN(rawdsn string) (*Config, error) {
	d, err := dsn.Parse(rawdsn)
	if err != nil {
		return nil, errors.Wrapf(err, "trace: invalid dsn: %s", rawdsn)
	}
	cfg := new(Config)
	if _, err = d.Bind(cfg); err != nil {
		return nil, errors.Wrapf(err, "trace: invalid dsn: %s", rawdsn)
	}
	return cfg, nil
}