diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 00000000..5eb84b0f --- /dev/null +++ b/.gitattributes @@ -0,0 +1,18 @@ +*.zzzgo linguist-language=Go +doc.go linguist-documentation +*.md linguist-documentation +basegroup.go linguist-generated +line.go linguist-generated +seed.go linguist-generated +span.go linguist-generated +sub.go linguist-generated +internal/enumer_test.go linguist-generated +trace/hexbytes.go linguist-generated +xopat/attributes.go linguist-generated +xopbase/base.go linguist-generated +xopjson/attributes.go linguist-generated +xopjson/jsonlogger.go linguist-generated +xopotel/otel.go linguist-generated +xoptest/testlogger.go linguist-generated +xoputil/skip.go linguist-generated +xoptest/xoptestutil/enums.go linguist-generated diff --git a/Makefile b/Makefile index c2832725..5dc924ba 100644 --- a/Makefile +++ b/Makefile @@ -8,10 +8,16 @@ ZZZGENERATED = $(patsubst %.zzzgo, %.go, $(ZZZGO)) TOOLS = ${GOBIN}/gofumpt ${GOBIN}/goimports ${GOBIN}/enumer TEST_ONLY =? -all: $(ZZZGENERATED) +all: $(ZZZGENERATED) .gitattributes go generate ./... go build ./... +.gitattributes: $(ZZZGENERATED) + echo '*.zzzgo linguist-language=Go' > $@ + echo 'doc.go linguist-documentation' >> $@ + echo '*.md linguist-documentation' >> $@ + for i in $(ZZZGENERATED); do echo "$$i linguist-generated" >> $@; done + test: $(ZZZGENERATED) testadjuster go generate ./... go test -v ./xopjson/... -run TestASingleLine @@ -87,4 +93,3 @@ OTEL_TAG="v1.12.0" otel-generate: ../opentelemetry-specification ../opentelemetry-go cd ../opentelemetry-specification && git pull && git checkout tags/$(OTEL_TAG) - diff --git a/TODO.md b/TODO.md index cd184c85..06a90545 100644 --- a/TODO.md +++ b/TODO.md @@ -1,6 +1,32 @@ +# required before ready to use in production + +- documentation + + - rewrite README.md + +- test + + - xopotel.BaseLogger() + - actually feed xopotel traces into Jaeger + - redact functions + - propogation + +- xopjson + + - change request.ver -> span.ver + +- drop rest/ or finish it + +- integrations + + - resty + - remove dependency on mux in middleware + # Ideas to ponder +- could we drop xopbase.Logger.ID() in favor of using pointers? or change ID sequential integers? Add Name()? + - is Attribute.ExampleValue() useful? It's not enforcable at compile time for Any. - rename LogLine/Line to Entry? @@ -52,21 +78,7 @@ # Just do it (build ready) -- redaction - - - add log setting for redacting Any types. - - `type RedactAnyFunc(*Log, key string, value interface{}) interface{}` - - The idea being that it can log an additional thing if it wants - - - add log setting for redacting string types. - - `type RedactAnyFunc(*Log, key string, value string) string` - - The idea being that it can log an additional thing if it wants - - - add redaction option to pre-registering attributes. +- make deepcopy function configurable - dictionary support @@ -104,6 +116,13 @@ - Pre-encoded data - Add Object(func(*BaseType)) - Add Pairs(k, v, k, v, ...) + - URLs + +- Round out the types of attributes + + - uint + - table + - url - Write panic trappers. Should log the panic and flush. @@ -196,6 +215,8 @@ - can *Sub be Sub instead? Would that have better performance? + - preallocate blocks of Attributes + - Standard tracing - figure out a way to modify trace State diff --git a/line.go b/line.go index f6a37352..945516fe 100644 --- a/line.go +++ b/line.go @@ -52,10 +52,6 @@ func (line *Line) Any(k string, v interface{}) *Line { return line } -// TODO: func (l *Log) Guage(name string, value float64, ) -// TODO: func (l *Log) AdjustCounter(name string, value float64, ) -// TODO: func (l *Log) Event - func (line *Line) Float32(k string, v float32) *Line { line.line.Float64(k, float64(v), xopbase.Float32DataType) return line diff --git a/line.zzzgo b/line.zzzgo index ac1cdaa4..f298ad9a 100644 --- a/line.zzzgo +++ b/line.zzzgo @@ -46,10 +46,6 @@ func (line *Line) Any(k string, v interface{}) *Line { return line } -// TODO: func (l *Log) Guage(name string, value float64, ) -// TODO: func (l *Log) AdjustCounter(name string, value float64, ) -// TODO: func (l *Log) Event - func (line *Line) Float32(k string, v float32) *Line { line.line.Float64(k, float64(v), xopbase.Float32DataType) return line diff --git a/logger.go b/logger.go index 88ddf91c..a61533c9 100644 --- a/logger.go +++ b/logger.go @@ -53,7 +53,7 @@ type shared struct { FlushTimer *time.Timer FlushDelay time.Duration FlushActive int32 // 1 == timer is running, 0 = timer is not running - Flushers map[string]xopbase.Request // key is xopbase.Logger.ID() // TODO: change key to int? + Flushers map[string]xopbase.Request // key is xopbase.Logger.ID() Description string LogCount int32 ActiveDetached map[int32]*Log diff --git a/xopat/attributes.go b/xopat/attributes.go index aadc95bb..320c230c 100644 --- a/xopat/attributes.go +++ b/xopat/attributes.go @@ -13,11 +13,6 @@ import ( "github.com/muir/xop-go/trace" ) -// TODO: PERFORMANCE: pre-allocate blocks of 128 Attributes to provide better locality of reference when using these -// TODO: UintAttribute? -// TODO: TableAttribute? -// TODO: URLAttribute? - // Attribute is the base type for the keys that are used to add // key/value metadata to spans. The actual keys are matched to the // values to provide compile-time type checking on the metadata calls. diff --git a/xopat/attributes.zzzgo b/xopat/attributes.zzzgo index 1c5ed593..a64a5c54 100644 --- a/xopat/attributes.zzzgo +++ b/xopat/attributes.zzzgo @@ -11,11 +11,6 @@ import ( "github.com/muir/xop-go/trace" ) -// TODO: PERFORMANCE: pre-allocate blocks of 128 Attributes to provide better locality of reference when using these -// TODO: UintAttribute? -// TODO: TableAttribute? -// TODO: URLAttribute? - // Attribute is the base type for the keys that are used to add // key/value metadata to spans. The actual keys are matched to the // values to provide compile-time type checking on the metadata calls. diff --git a/xopjson/jsonlogger_test.go b/xopjson/jsonlogger_test.go index 51d97488..b794bdee 100644 --- a/xopjson/jsonlogger_test.go +++ b/xopjson/jsonlogger_test.go @@ -53,7 +53,7 @@ type supersetObject struct { RequestID string `json:"request.id"` State string `json:"trace.state"` Baggage string `json:"trace.baggage"` - RequestVersion int `json:"request.ver"` // TODO: change to span.ver? + RequestVersion int `json:"request.ver"` // spans diff --git a/xopjson/models.go b/xopjson/models.go index 4fd0fddb..129ed62a 100644 --- a/xopjson/models.go +++ b/xopjson/models.go @@ -58,7 +58,6 @@ type Logger struct { stackLineRewrite func(string) string timeFormatter TimeFormatter activeRequests sync.WaitGroup - // TODO: withGoroutine bool } type request struct { diff --git a/xopotel/otel.go b/xopotel/otel.go index c0666a60..8081cdee 100644 --- a/xopotel/otel.go +++ b/xopotel/otel.go @@ -75,7 +75,6 @@ func SpanLog(ctx context.Context, name string, extraModifiers ...xop.SeedModifie // BaseLogger provides SeedModifiers to set up an OTEL Tracer as a xopbase.Logger // so that xop logs are output through the OTEL Tracer. -// TODO: test this func BaseLogger(ctx context.Context, tracer oteltrace.Tracer, doLogging bool) xop.SeedModifier { return xop.CombineSeedModifiers( xop.WithBase(&logger{ diff --git a/xopotel/otel.zzzgo b/xopotel/otel.zzzgo index 5b0633a6..910ce1d2 100644 --- a/xopotel/otel.zzzgo +++ b/xopotel/otel.zzzgo @@ -72,7 +72,6 @@ func SpanLog(ctx context.Context, name string, extraModifiers ...xop.SeedModifie // BaseLogger provides SeedModifiers to set up an OTEL Tracer as a xopbase.Logger // so that xop logs are output through the OTEL Tracer. -// TODO: test this func BaseLogger(ctx context.Context, tracer oteltrace.Tracer, doLogging bool) xop.SeedModifier { return xop.CombineSeedModifiers( xop.WithBase(&logger{