added debugging to servertracing
MODIFY
_hardcoded/tracing.go
_hardcoded/tracing.go
@@ -11,6 +11,7 @@ import (
"time"
"github.com/Clever/kayvee-go/v7/logger"
+ "github.com/davecgh/go-spew/spew"
"go.opentelemetry.io/contrib/instrumentation/github.com/gorilla/mux/otelmux"
"go.opentelemetry.io/otel"
"go.opentelemetry.io/otel/exporters/otlp/otlptrace"
@@ -81,7 +82,8 @@ func newTracerProvider(exporter sdktrace.SpanExporter, samplingProbability float
// We use the default ID generator. In order for sampling to work (at least with this sampler)
// the ID generator must generate trace IDs uniformly at random from the entire space of uint64.
// For example, the default x-ray ID generator does not do this.
- sdktrace.WithSampler(sdktrace.ParentBased(sdktrace.TraceIDRatioBased(samplingProbability))),
+ sdktrace.WithSampler(sdktrace.AlwaysSample()),
+ // sdktrace.WithSampler(sdktrace.ParentBased(sdktrace.TraceIDRatioBased(samplingProbability))),
// These maximums are to guard against something going wrong and sending a ton of data unexpectedly
sdktrace.WithSpanLimits(sdktrace.SpanLimits{
AttributeCountLimit: 100,
@@ -115,7 +117,10 @@ func MuxServerMiddleware(serviceName string) func(http.Handler) http.Handler {
return func(h http.Handler) http.Handler {
return otlmux(http.HandlerFunc(func(rw http.ResponseWriter, r *http.Request) {
// otelmux has extracted the span. now put it into the ctx-specific logger
+
s := trace.SpanFromContext(r.Context())
+ fmt.Println("Got this span:")
+ spew.Dump(s)
if sc := s.SpanContext(); sc.HasTraceID() {
spanID, traceID := sc.SpanID().String(), sc.TraceID().String()
// datadog converts hex strings to uint64 IDs, so log those so that correlating logs and traces works

MODIFY
hardcoded/hardcoded.go
hardcoded/hardcoded.go
// sources:
// ../_hardcoded/doer.go (10.342kB)
// ../_hardcoded/middleware.go (1.685kB)
-// ../_hardcoded/tracing.go (6.039kB)
+// ../_hardcoded/tracing.go (6.177kB)
package hardcoded
@@ -111,7 +111,7 @@ func _hardcodedMiddlewareGo() (*asset, error) {
return a, nil
}
-var __hardcodedTracingGo = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x9c\x58\xdd\x6f\xdb\x46\x12\x7f\x16\xff\x8a\x29\x81\x34\x64\x40\x93\x76\x93\xa6\x3d\x15\x7e\x70\x6c\xa7\x11\xce\x76\x04\xdb\x45\x71\x38\x1c\x8c\x35\x39\x24\x17\x26\x77\x79\xbb\x4b\x7d\x20\xf0\xff\x7e\x98\xe1\x87\x24\x5b\xf6\x35\xd5\x83\x40\xee\xce\xce\xce\xe7\x6f\x66\xd8\x88\xf4\x41\x14\x08\x16\xcd\x02\x8d\x33\x22\x95\xaa\xf0\x3c\x59\x37\xda\x38\x08\xbc\x89\x9f\x6a\xe5\x70\xe5\x7c\x6f\xe2\xa3\x4a\x75\x26\x55\x91\xdc\x4b\x25\xcc\x7a\x67\xa9\xc4\x15\xbd\xe7\x35\x53\x2a\x74\x49\xe9\x5c\x43\xcf\xda\xd2\xbf\x75\x26\xd5\x6a\x41\x8f\x4e\xd6\xe8\x7b\xde\xc4\x2f\xa4\x2b\xdb\xfb\x38\xd5\x75\x72\x5a\xe1\x02\x4d\xf2\x20\xd6\x0b\xc4\x83\x42\x27\x8b\x5f\x92\x4a\x17\x05\x1a\x3a\x51\xe8\x58\x37\xa8\x1c\x56\x58\xa3\x33\xeb\x58\xea\x84\xe4\x32\xf2\x3e\x91\xca\x3a\xd3\xd6\xa8\x9c\x70\x52\xab\x64\x8b\x69\xa1\x8d\xac\x2a\x91\xd4\xed\x2a\xd1\x0e\xab\xba\x5d\xbd\xc4\x8d\xb6\x5f\xdb\x4b\x70\x45\x16\x41\x63\x13\xed\xaa\x86\xff\xc8\x5a\xf8\xb7\x0e\x6d\x9e\x0a\xd3\xa4\xaf\xb2\x68\x8c\x6e\x44\xc1\xaa\xbd\x4a\x67\xb3\x87\xc4\xa0\xd5\xad\x61\x99\x6c\xf6\xc0\xfc\xe1\xf5\x13\xff\x5f\x85\x91\xaa\xfb\x77\x68\xc9\xc1\x16\x6b\xf2\xe6\x6b\xdc\x3b\x8a\x64\x71\x14\xff\x23\x3e\x7c\xf5\x8a\x5e\x88\xd0\xf3\x16\xc2\x40\x86\xb9\x68\x2b\x77\xaa\xab\x0a\x53\xa7\xcd\x17\x6d\x1d\x58\x67\xa4\x2a\xe0\x18\xfc\x4a\xa7\xa2\x2a\x35\x49\xb1\x8f\x7a\x4e\x61\xdb\x4a\xe5\x8e\x3e\xc2\x31\x7c\x78\x7f\xf4\x8b\xe7\x25\x09\x0c\x56\xd4\x06\x9c\x86\xd6\x62\xcc\xa7\xb7\x96\xb7\xec\x1c\xdf\xe2\xca\x5d\x8a\x66\xbe\xd9\x3d\xde\xdd\x27\x81\x4f\xbb\xbc\xf8\xf6\x08\x49\x02\xac\x42\x23\x0c\x2a\x07\x25\x8a\x0c\x8d\x97\xb7\x2a\x85\x1b\x74\x6d\xf3\x7b\xa5\xef\x45\xc5\x87\xe6\x46\x2f\x64\x86\xe6\x44\x65\xe7\x7d\x6c\x04\xa9\x5b\x41\x9f\x64\x71\xcf\x34\x84\x60\x70\x60\x7c\xd3\x08\x35\xd0\x46\xf0\x6e\x5c\x67\x7e\x66\x60\x18\x01\x1a\xa3\x4d\x08\xdf\xbc\x49\x92\xc0\x51\x0c\x16\x1d\xb4\x0d\x0c\x21\xc8\xcb\x3f\x8d\xcb\xcc\x83\xb5\xe6\xe3\xbc\xfb\x3e\x06\x61\xad\x2c\x14\x14\x2c\xf1\x33\x22\xa6\x9a\xe5\xb0\xc4\xb7\x06\xc1\xb4\x4a\x91\x53\xd8\x23\xd5\x3a\x02\x57\xa2\x02\xd7\x1a\x05\x3a\xcf\xc1\x8a\xba\xa9\xa4\x2a\x62\xf8\xea\x4a\x34\x4b\x69\xb1\x5b\xc3\x4e\xc2\x37\xa0\x0d\x2c\x4b\xe1\x28\xf1\xe1\xf6\xfa\xe4\x74\x76\xf5\xfb\xdd\xcd\xc9\xe5\xfc\x82\x1e\xe6\xd7\x5f\x3f\x9d\x7c\x9a\x5d\xcc\x6e\xff\x05\xb6\xc1\x54\xe6\x12\x6d\xec\x4d\x06\xb6\x73\xa3\xef\xc5\xbd\xac\xa4\x5b\xc3\xf4\x18\x0e\xe3\xc3\x23\x6f\x22\xed\x05\x09\x43\x0b\xda\xc6\xbf\xa3\x43\xb5\x08\xfc\xbb\xd9\xcd\xdd\xc5\xd7\xd3\x93\x0b\x3f\x84\xe3\x63\xf0\x9d\x69\x29\xe6\x65\x0e\x03\xfd\x37\x6f\xb2\x97\xf1\x31\x1c\xc5\x87\xde\xe4\x11\xb0\xb2\x08\x32\x87\xc5\x13\xd6\xaf\x89\xed\x87\xbf\xc1\x02\x7e\x38\x06\xdf\x7f\xe9\x82\xcf\x46\xd7\xe7\x6a\xc1\xce\x23\xce\x3d\x48\xc6\x73\x61\x2c\x7e\xae\xb4\x70\xc1\x22\x82\x8f\x1f\x42\x6f\x42\xe2\x12\xd5\x0f\xc7\xa0\x64\x27\xf1\xc4\x20\x5b\x5b\xc9\x2a\xea\xfe\xf2\xda\xc5\xe7\x14\x07\x79\xe0\xa7\xba\xad\x32\x50\xda\x41\x43\xdc\xe0\xed\x1b\xfb\x96\x82\x3f\x27\xb6\x7e\x04\x0b\x62\xfa\xf8\xa2\xe2\x2f\x4b\xeb\xd1\x29\xba\x69\x6e\xa4\x72\x95\x0a\xfc\xde\x8c\x53\x3f\x1a\x2c\x1a\x7a\xde\x44\x64\x19\x2b\x45\xa4\x37\x0d\xd1\xe6\x81\xff\xc6\x4e\xdf\x64\x7e\xb4\x37\xcb\x9f\xaf\x52\x36\x87\x5d\xd8\x9d\x2f\xd0\xac\xe1\xe8\x67\xb0\x98\x6a\x95\x59\x0a\xc2\x8a\x42\x74\x4d\x4a\xa5\x5a\x29\x4c\x1d\x3d\xee\x60\x0c\xa4\x03\x2b\x10\x8e\xf9\xb8\x12\x87\x6b\x38\x72\x29\xa1\x41\xe7\x30\xe2\xca\x94\x41\x83\x48\xff\xa4\x78\x1e\xa2\x5c\x2a\xca\x83\xac\x4d\xf9\x80\x2b\xa5\x05\x69\x41\x80\x95\x19\xa6\xc2\x44\x20\x54\x06\xcb\xad\x13\xcc\xa2\xcf\x8d\x2d\xfa\x61\x65\xe0\xab\x1b\x1c\xa5\x3d\x18\xa5\x8d\xbd\x09\x95\x88\xd3\x4a\x12\xa2\x50\xcc\x6d\x17\x8c\xf8\x0a\x97\xdd\x56\xe0\x4d\x26\xbb\x5b\x7f\x4a\x57\x5e\x63\x6f\x0f\xa9\xd5\x1c\x8d\xd4\x59\x70\xf4\xf3\x3b\x2a\xbb\xf1\x0d\x5b\x2f\x8c\xf6\x9e\x3b\x57\x59\xa3\xa5\x72\x01\xb9\xee\x05\x9a\x99\xb2\x98\xb6\x06\x03\xda\x0f\xbd\x89\xdd\x81\xa7\x3e\x8e\xc7\x63\x24\x29\x01\x5c\x04\x1b\x75\xc2\x27\xd1\x33\x9c\x86\x53\x83\xc2\x61\xe6\x87\xde\x9e\x60\x7f\x35\xd6\x19\xfb\x20\xa5\xf3\x64\xd3\x01\xf3\xa6\xf0\x66\xe1\xb3\x50\x21\x05\xad\x37\x71\x0d\x49\xa7\x70\xb9\x0b\x9e\xc1\xae\x12\x7b\x42\x3f\xa2\x43\xd7\x7d\x79\x0d\xc2\x90\xdc\x83\x55\x7c\x83\xee\x09\x27\xd7\x3c\x55\xaf\x23\x80\x81\x62\x4b\x4b\x6f\xd2\x75\x38\x31\x25\x56\x8f\xfc\x64\xac\x30\x9e\xa9\x5c\x9f\x05\xbe\x75\xc2\x90\x42\x07\x1d\x10\xfb\x11\xf4\x07\x2e\xc9\x22\x3e\x79\x09\xad\xf5\xa7\xd0\xfd\xe8\x9d\x9c\xe6\x0f\x0a\x1c\x18\xe1\xd0\x9f\xee\x55\xc8\x9b\x3c\x86\xde\x60\xd5\x5d\xfd\x5d\xc3\x26\xf6\x1e\xbd\xae\x88\x3d\xb7\xd7\x60\x60\x78\xa1\x4a\xed\x83\x14\xc6\x9d\x8f\x1f\x22\x18\xba\x14\x78\x37\x3c\xc5\x83\x65\xc3\x17\xeb\x1b\xc5\xc0\x20\xec\x40\x71\xf5\x4c\x2e\x6f\xc2\x79\x8b\x54\xe1\x77\x32\x7d\x76\x06\x05\x2a\x34\x54\xcc\x63\x98\x29\xd0\x86\x98\xe6\xda\x8c\xb2\x12\x76\x2c\xb5\x79\x80\x40\x38\xa8\x50\x58\x07\x4b\xe9\xca\x2e\x75\xbb\xc2\x45\x61\x34\x60\xc8\x36\x47\xa8\x5b\xeb\x86\x57\xec\xca\x26\xcc\xce\x2c\xb4\x4a\xe6\xda\xd4\xd5\x1a\x84\x03\x23\x54\xa6\x6b\xc8\x8d\xae\x99\x03\x2a\x27\x0d\x92\xed\x53\x24\x04\xa2\xae\xe5\xe3\x87\xb8\xbb\xe2\xb3\x36\x80\x2b\xbe\x35\xda\xd1\x64\x75\x60\xc4\x7a\xf7\xf6\x4c\xa3\x65\xa0\xcf\x34\x4b\x4b\x2c\x46\x23\x51\xce\xde\x74\xd2\x6f\x7a\x8a\x39\x77\x2a\x9f\x84\xc5\x2c\xd8\x35\xf8\xec\xec\x9a\x20\xb1\xdf\x7a\xee\xc6\x30\x64\x5c\x48\x12\xb8\x2d\xd1\x22\xd4\x62\x25\xeb\xb6\xb6\x20\x0c\x92\x05\x8b\x56\x98\x0c\x44\x21\xa8\x2d\x07\xab\x6b\x74\x25\x19\xb7\xd0\xf4\xbf\x34\x5a\x15\x8c\x94\x16\x15\x8d\x0d\x20\xc0\x75\xf8\x9b\x09\x27\xa0\x55\xb8\x6a\x30\x75\x98\x55\xeb\x67\x4a\x34\x42\x5d\xc8\x5a\x3a\xbb\xdb\x1b\x75\x6b\x5c\x0f\x4f\x1c\x4d\x04\xad\xc3\x53\xdd\x2a\xc7\x1b\x53\x38\x3a\x3c\x24\x89\x27\xe7\x0b\x54\x6e\x7b\x83\x7e\xc3\xe6\x85\x54\x0f\x4f\xf7\x86\xcd\xc7\x5e\xe3\x4f\xc2\xa5\x25\x1a\x82\xf1\x5a\x1b\x04\xcc\x73\x99\x12\xa0\x45\x60\x97\xd2\xa5\x25\xe9\x2f\x1d\x88\x9c\x32\x83\x1a\x65\xae\x02\x4f\xb4\x58\xab\x74\x2b\x81\x7a\xd6\x3b\x24\xfd\x3d\x4f\x69\xbe\x88\x05\x5b\x38\x97\x45\x6b\x10\x74\xeb\xa0\xd4\x4b\x98\xbd\xad\x7b\xe3\x92\xf5\xc7\x10\xa4\xa0\x1d\x13\x2d\x97\xc6\xba\x67\x51\x31\xc2\xd9\x40\xd7\x21\xfa\x23\x37\xcc\x7f\xa1\x71\xfd\xac\xcd\x2d\x5a\xc7\xf6\x40\xa1\xb8\xf8\xde\x73\xea\x65\x54\x2d\x5b\x25\xdd\x60\x85\x88\x58\x92\xdb\x6b\x49\x48\x6d\x39\xa2\x2d\x5d\x01\xe2\x5e\x2f\x90\x13\x51\xb7\x8e\x8a\x29\xa7\xc2\xd6\xd9\x18\x66\x0e\xba\xd4\xb7\x20\x14\x48\x75\x50\x63\xad\xcd\x9a\x78\x8e\x40\x94\xf7\xf9\x22\xb9\xa8\x0e\x76\xc8\x18\xd9\x6c\xfc\x97\x9b\xf1\x5e\xa7\x20\x84\xe0\xdd\x38\xef\xc4\x33\x75\xc9\x37\x7e\x5f\x1b\x3e\xca\x36\x3d\x86\x0d\xaf\x2b\x5c\x3e\x65\x17\x84\x2f\x57\x26\x1c\xaf\x3c\x8a\x0f\xbf\xaf\x0a\xf5\x70\x89\xfb\x70\x3d\x49\xe0\xb2\x5d\xdd\xf0\xd0\x7f\x29\xb3\xac\xc2\x25\x25\xf0\x60\xe6\x7a\xb3\xe4\x4a\xe1\xc0\x96\xdc\x4c\xde\x23\x08\xe7\x44\x5a\x62\x46\xce\x16\xb0\x35\x60\xf7\x5f\x10\x62\x62\x3d\x73\x1d\x26\xb9\x25\x03\x92\x2a\xec\x14\xb8\x96\xd9\xce\x1f\x5d\xb3\x24\xb2\xac\x7b\xef\x06\x40\x90\x2a\xd7\xc4\x96\x62\xc3\xe0\x7f\x5b\xb4\xee\xa0\xef\xfc\xd3\xa1\xf0\x11\xf7\x6b\x59\x94\x0e\x94\x5e\xc2\x12\x41\xab\x6a\x0d\xb6\x6d\xf8\x73\x05\x11\x91\xfb\x09\x7a\xa5\x62\x46\x04\xbf\xc2\x75\x5a\x9c\x09\x27\x32\xcd\xed\x01\xa6\x6e\x88\x8a\x3d\x76\x08\x48\x17\x99\xe2\x95\xa8\xb1\x1f\x3d\x43\x20\xe2\xa0\x74\xae\x89\xbf\x08\x95\x51\x31\x80\xed\x37\xf2\xb8\x76\x15\x59\x82\x1b\x20\xfe\xda\x10\xef\xe7\x19\x8d\xfb\x94\x87\x9b\x31\xd3\x06\x9b\x81\x34\x7c\xda\x47\x9c\x64\x0c\x98\x1b\x53\x6f\x79\xc9\xdf\xb8\xbb\x13\x13\x5e\x17\x74\x20\xee\x04\xde\xd1\xea\x33\x9d\x67\x26\x66\xd9\x9d\xbb\x46\xdb\x68\x65\xf1\x4f\x23\x39\x8c\x0c\xbc\xeb\xd7\xd9\x47\x61\x37\x8b\x24\xc9\xa0\x14\x94\xc2\x02\xae\xc8\xa9\x94\x81\x9c\xea\x8d\x50\x31\xbb\xac\x69\x1d\x61\xa4\x54\xbd\xa3\x53\xb7\x7a\xea\x64\xe2\x66\xc7\xa4\x61\x8c\xdf\x6e\x90\xcc\x30\x24\x73\x02\xf0\x5c\x64\x53\x1e\x9e\x98\x74\xdc\xfc\x0d\x6c\x1a\x7f\x11\xb6\x2f\x6b\x41\x2f\x27\x37\xac\xb3\xb3\xa8\xe3\x3e\x3b\xe3\x93\x29\x1f\x25\xa2\xf8\x86\xdd\x1d\x84\x11\xad\x8e\x67\xc7\x65\x66\x91\x24\x5c\xae\x28\x96\x68\x5c\x43\x0a\xec\x12\x57\x7d\xa8\x58\xfe\xc4\xc0\xc5\x9c\x22\x31\x02\xab\x49\x33\x70\xa5\xa6\x11\x58\x77\xc1\x98\x6a\x63\xb0\xea\xfa\xd5\x4a\x17\x96\x53\x82\x65\xb2\xdc\x86\x58\xbe\x49\xe6\x50\xa1\x0a\x7a\x59\x79\x7c\x7d\xff\x13\xfc\xf8\x23\xaf\x76\x9a\xf0\xe2\xd1\x47\xf8\x06\xe4\x82\x9d\xe1\xa7\x0b\xfe\x29\xed\xde\xaf\x1d\x42\xf0\xfe\xa7\x83\xb4\x14\x86\x84\x0d\x23\xf8\xb5\x5f\x3d\xfa\xb8\x59\xed\x9b\x17\x2e\xd1\x0d\xa1\x6d\xd6\x09\x32\xe9\x45\xf8\x64\x23\xb8\x23\x9b\x95\xb8\x8a\xcf\x30\xd5\x19\xf6\xa6\x19\x64\xec\xc8\xf7\x74\xb6\xdb\x8e\x8b\x4f\xb2\x6c\x78\xf3\xf9\xe4\x9d\xcc\xfc\xa8\x3b\x3b\xd9\x9d\x18\x69\x5c\xec\x3e\x38\xc6\x9f\x64\x71\xae\x32\x29\x54\xfc\x07\xdb\x37\x18\xa5\xfa\xf7\xaf\xd3\xff\x84\x61\x7f\x79\x67\x98\x97\x45\xed\x0d\xf7\xfd\x92\xd2\xc1\xbf\x27\xe8\x20\xd2\x20\x23\x0d\xde\xdd\x5f\x19\x33\xfc\x7c\xb9\xbd\x9d\x07\x66\x19\x01\x37\x99\x8f\x21\x4f\x2c\x1d\x52\x6f\x81\xfe\xa6\x10\x6e\xaa\x7b\x86\x36\x35\xf2\x9e\x5b\x00\x2a\xfb\xa2\x69\x2a\xd9\x0d\xb6\x8c\x97\x7f\x50\x41\xe6\x4e\x17\x1d\x87\xdb\x9e\xcf\x3f\x43\x9f\xbf\x29\x2e\x7b\xba\x73\x4a\xa0\x85\x30\x74\xc1\x16\x32\x3e\x81\xa9\xd3\x61\x08\x1b\x4e\xf5\xe3\xdc\xf6\xf7\x98\xf9\xd7\xb3\xbb\xd9\x99\x1f\x6e\x7d\x1c\x19\x78\xee\x7e\xb8\x39\x99\xcf\xef\xae\x4e\x2e\xcf\x89\xc7\xe6\x23\xcc\x16\xc5\x5f\xe5\xb4\xc3\xc8\x9b\x98\x3e\x32\x46\x15\x2f\xd1\x14\x18\x30\x30\xf6\x2b\x67\x5d\xbf\xcd\x63\xee\x66\xf5\x0a\x97\x04\xd9\x63\xa3\x69\x03\x46\xab\xee\x5b\x67\x7c\x93\x96\x58\x8b\x3f\xae\x2f\xa2\x9d\xd5\x0d\xf0\xff\x13\xd7\x03\x92\xf4\x62\x32\xfb\x7e\x94\xee\x41\xd9\x78\x8f\xde\xff\x02\x00\x00\xff\xff\x97\x2e\x0b\x52\x97\x17\x00\x00")
+var __hardcodedTracingGo = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x9c\x58\x6d\x6f\xdb\xc6\x93\x7f\x2d\x7e\x8a\x29\x81\x34\x64\x40\x93\x56\x93\xa6\x85\x0a\xbf\x70\x6c\x27\x11\xce\x76\x04\xdb\x45\x71\x38\x1c\x8c\x35\x39\x24\x17\x21\x77\x79\xbb\x4b\x3d\x20\xf0\x77\x3f\xcc\xf0\x41\x92\x2d\xfb\xdf\x56\x2f\x08\x71\x77\x76\x76\x1e\x7f\x33\xc3\x46\xa4\xdf\x45\x81\x60\xd1\x2c\xd1\x38\x23\x52\xa9\x0a\xcf\x93\x75\xa3\x8d\x83\xc0\x9b\xf8\xa9\x56\x0e\xd7\xce\xf7\x26\x3e\xaa\x54\x67\x52\x15\xc9\x83\x54\xc2\x6c\xf6\x96\x4a\x5c\xd3\x7b\x5e\x33\xa5\x42\x97\x94\xce\x35\xf4\x5f\x5b\x7a\x5a\x67\x52\xad\x96\xf4\xd7\xc9\x1a\x7d\xcf\x9b\xf8\x85\x74\x65\xfb\x10\xa7\xba\x4e\xce\x2a\x5c\xa2\x49\xbe\x8b\xcd\x12\xf1\xa8\xd0\xc9\xf2\xb7\xa4\xd2\x45\x81\xc6\xdf\x27\xcc\xc4\x12\xd3\xa2\x4c\x0a\x7d\x64\x1b\x5c\x25\xf4\x60\x12\x1d\xeb\x06\x95\xc3\x0a\x6b\x74\x66\x13\x4b\x9d\x90\xe8\x46\x3e\x24\x52\x59\x67\xda\x1a\x95\x13\x4e\x6a\x95\xec\xb0\x2b\xb4\x91\x55\x25\x92\xba\x5d\x27\xda\x61\x55\xb7\xeb\x97\xb8\xd1\xf6\x6b\x7b\x09\xae\xc9\x68\x68\x6c\xa2\x5d\xd5\xf0\x83\x0c\x8a\xff\xea\xd0\xf6\x5f\x61\x9a\xf4\x55\x16\x8d\xd1\x8d\x28\x58\xb5\x57\xe9\x6c\xf6\x3d\x31\x68\x75\x6b\x58\x26\x9b\x7d\x67\xfe\xf0\xfa\x89\xff\xac\xc2\x48\xd5\x3d\x1d\x5a\x8a\x01\x8b\x35\x39\xfc\x35\xee\x1d\x45\xb2\x9c\xc6\xd3\xe3\xf8\xf8\xd5\x3b\x7a\x29\x42\xcf\x5b\x0a\x03\x19\xe6\xa2\xad\xdc\x99\xae\x2a\x4c\x9d\x36\x5f\xb5\x75\x60\x9d\x91\xaa\x80\x13\xf0\x2b\x9d\x8a\xaa\xd4\x24\xc6\x21\xea\x05\x85\x76\x2b\x95\x9b\x7e\x84\x13\xf8\xf0\x7e\xfa\x9b\xe7\x25\x09\x0c\x66\xd4\x06\x9c\x86\xd6\x62\xcc\xa7\x77\x96\x77\x0c\x1d\xdf\xe1\xda\x5d\x89\x66\xb1\xdd\x3d\xd9\xdf\x27\x81\xcf\xba\xdc\xf9\xf1\x08\x49\x02\xac\x42\x23\x0c\x2a\x07\x25\x8a\x0c\x8d\x97\xb7\x2a\x85\x5b\x74\x6d\xf3\xa5\xd2\x0f\xa2\xe2\x43\x0b\xa3\x97\x32\x43\x73\xaa\xb2\x8b\x3e\x38\x82\xd4\xad\xa1\x4f\xc4\xb8\x67\x1a\x42\x30\x78\x30\xbe\x6d\x84\x1a\x68\x23\x78\x37\xae\x33\x3f\x33\x30\x8c\x00\x8d\xd1\x26\x84\x1f\xde\x24\x49\x60\x1a\x83\x45\x07\x6d\x03\x43\x0c\xf2\xf2\x2f\xe3\x32\xf3\x60\xad\xf9\x38\xef\xbe\x8f\x41\x58\x2b\x0b\x05\x05\x4b\xfc\x8c\x88\xa9\xe6\x39\xac\xf0\xad\x41\x30\xad\x52\xe4\x14\xf6\x48\xb5\x89\xc0\x95\xa8\xc0\xb5\x46\x81\xce\x73\xb0\xa2\x6e\x2a\xa9\x8a\x18\xbe\xb9\x12\xcd\x4a\x5a\xec\xd6\xb0\x93\xf0\x0d\x68\x03\xab\x52\x38\x02\x07\xb8\xbb\x39\x3d\x9b\x5f\x7f\xb9\xbf\x3d\xbd\x5a\x5c\xd2\x9f\xc5\xcd\xb7\x4f\xa7\x9f\xe6\x97\xf3\xbb\xff\x06\xdb\x60\x2a\x73\x89\x36\xf6\x26\x03\xdb\x85\xd1\x0f\xe2\x41\x56\xd2\x6d\x60\x76\x02\xc7\xf1\xf1\xd4\x9b\x48\x7b\x49\xc2\xd0\x82\xb6\xf1\x17\x74\xa8\x96\x81\x7f\x3f\xbf\xbd\xbf\xfc\x76\x76\x7a\xe9\x87\x70\x72\x02\xbe\x33\x2d\x05\xbd\xcc\x61\xa0\xff\xe1\x4d\x0e\x32\x3e\x81\x69\x7c\xec\x4d\x1e\x01\x2b\x8b\x20\x73\x58\x3e\x61\xfd\x9a\xd8\x7e\xf8\x07\x2c\xe1\xa7\x13\xf0\xfd\x97\x2e\xf8\x6c\x74\x7d\xa1\x96\xec\x3c\xe2\xdc\x03\x69\xbc\x10\xc6\xe2\xe7\x4a\x0b\x17\x2c\x23\xf8\xf8\x21\xf4\x26\x24\x2e\x51\xfd\x74\x02\x4a\x76\x12\x4f\x0c\xb2\xb5\x95\xac\xa2\xee\x91\xd7\x2e\xbe\xa0\x38\xc8\x03\x3f\xd5\x6d\x95\x81\xd2\x0e\x1a\xe2\x06\x6f\xdf\xd8\xb7\x14\xfc\x39\xb1\xf5\x23\x58\x12\xd3\xc7\x17\x15\x7f\x59\x5a\x8f\x4e\xd1\x4d\x0b\x23\x95\xab\x54\xe0\xf7\x66\x9c\xf9\xd1\x60\xd1\xd0\xf3\x26\x22\xcb\x58\x29\x22\xbd\x6d\x88\x36\x0f\xfc\x37\x76\xf6\x26\xf3\xa3\x83\x59\xfe\x7c\x95\xb2\x39\xec\xc2\xee\x62\x89\x66\x03\xd3\x5f\xc1\x62\xaa\x55\x66\x29\x08\x2b\x0a\xd1\x0d\x29\x95\x6a\xa5\x30\x75\xf4\x77\x0f\x63\x20\x1d\x58\x81\x70\xcc\xc7\x95\x38\x5c\xc3\x91\x4b\x09\x0d\x3a\x87\x11\x57\x66\x0c\x1a\x44\xfa\x17\xc5\xf3\x10\xe5\x52\x51\x1e\x64\x6d\xca\x07\x5c\x29\x2d\x48\x0b\x02\xac\xcc\x30\x15\x26\x02\xa1\x32\x58\xed\x9c\x60\x16\x7d\x6e\xec\xd0\x0f\x2b\x03\x5f\xdd\xe0\x28\xed\xd1\x28\x6d\xec\x4d\xa8\x46\x9c\x55\x92\x10\x85\x62\x6e\xb7\x62\xc4\xd7\xb8\xea\xb6\x02\x6f\x32\xd9\xdf\xfa\x4b\xba\xf2\x06\x7b\x7b\x48\xad\x16\x68\xa4\xce\x82\xe9\xaf\xef\xa8\x34\xc7\xb7\x6c\xbd\x30\x3a\x78\xee\x42\x65\x8d\x96\xca\x05\xe4\xba\x17\x68\xe6\xca\x62\xda\x1a\x0c\x68\x3f\xf4\x26\x76\x0f\x9e\xfa\x38\x1e\x8f\x91\xa4\x04\x70\x11\x6c\xd5\x09\x9f\x44\xcf\x70\x1a\xce\x0c\x0a\x87\x99\x1f\x7a\x07\x82\xfd\xd5\x58\x67\xec\x83\x94\xce\x93\x4d\x07\xcc\x9b\xc1\x9b\xa5\xcf\x42\x85\x14\xb4\xde\xc4\x35\x24\x9d\xc2\xd5\x3e\x78\x06\xfb\x4a\x1c\x08\xfd\x88\x0e\xdd\xf4\xf5\x35\x08\x43\x72\x0f\x56\xf1\x2d\xba\x27\x9c\x5c\xf3\x54\xbd\x8e\x00\x06\x8a\x1d\x2d\xbd\x49\xd7\x05\xc5\x94\x58\x3d\xf2\x93\xb1\xc2\x78\xae\x72\x7d\x1e\xf8\xd6\x09\x43\x0a\x1d\x75\x40\xec\x47\xd0\x1f\xb8\x22\x8b\xf8\xe4\x25\xb4\xd6\x9f\x41\xf7\xa3\x77\x72\x9a\x3f\x28\x70\x64\x84\x43\x7f\x76\x50\x21\x6f\xf2\x18\x7a\x83\x55\xf7\xf5\x77\x0d\x9b\xd8\x7b\xf4\xba\x22\xf6\xdc\x5e\x83\x81\xe1\x85\x2a\x75\x08\x52\x18\x77\x3e\x7e\x88\x60\x68\x53\xe0\xdd\xf0\x2f\x1e\x2c\x1b\xbe\x58\xdf\x28\x06\x06\x61\x07\x8a\xeb\x67\x72\x79\x13\xce\x5b\xa4\x0a\xbf\x97\xe9\xf3\x73\x28\x50\xa1\xa1\x62\x1e\xc3\x5c\x81\x36\xc4\x34\xd7\x66\x94\x95\xb0\x63\xa5\xcd\x77\x08\x84\x83\x0a\x85\x75\xb0\x92\xae\xec\x52\xb7\x2b\x5c\x14\x46\x03\x86\xec\x72\x84\xba\xb5\x6e\x78\xc5\xae\x6c\xc2\xfc\xdc\x42\xab\x64\xae\x4d\x5d\x6d\x40\x38\x30\x42\x65\xba\x86\xdc\xe8\x9a\x39\xa0\x72\xd2\x20\xd9\x3e\x45\x42\x20\xea\x5a\x3e\x7e\x88\xbb\x2b\x3e\x6b\x03\xb8\xe6\x5b\xa3\x3d\x4d\xd6\x47\x46\x6c\xf6\x6f\xcf\x34\x5a\x06\xfa\x4c\xb3\xb4\xc4\x62\x34\x12\xe5\xec\x6d\x27\xfd\xb6\xa7\x38\xad\x56\x62\x63\xbb\xe5\x20\xe4\x4c\x4f\x12\x78\xfd\xcc\x82\xbb\x9b\x4f\xc2\x62\x16\xec\x3b\x69\x7e\x7e\x43\x30\xda\x6f\x3d\x77\x7d\x38\xde\x70\x57\xa2\x45\xa8\xc5\x5a\xd6\x6d\x6d\x41\x18\x24\xab\x17\xad\x30\x19\x88\x42\x50\x2f\x0f\x56\xd7\xe8\x4a\x72\x48\xa1\xe9\xb9\x32\x5a\x15\x8c\xae\x16\x15\x8d\x23\x20\xc0\x75\x98\x9d\x09\x27\xa0\x55\xb8\x6e\x30\x75\x98\x55\x9b\x67\x8a\x37\x42\x5d\xca\x5a\x3a\xbb\xdf\x4f\x75\x6b\x5c\x43\x4f\x1d\x8d\x11\xad\xc3\x33\xdd\x2a\xc7\x1b\x33\x98\x1e\x1f\x93\xc4\x93\x8b\x25\x2a\xb7\xbb\x41\xbf\x61\xf3\x52\xaa\xef\x4f\xf7\x86\xcd\xc7\x5e\xe3\x4f\xc2\xa5\x25\x1a\x82\xfe\x5a\x1b\x04\xcc\x73\x99\x12\x08\x46\x60\x57\xd2\xa5\x25\xe9\x2f\x1d\x88\x9c\xb2\x89\xba\x6b\xae\x1c\x4f\xb4\xd8\xa8\x74\x27\xe9\x7a\xd6\x7b\x24\xfd\x3d\x4f\x69\xbe\x8a\x25\x5b\x38\x97\x45\x6b\x10\x74\xeb\xa0\xd4\x2b\x98\xbf\xad\x7b\xe3\x92\xf5\xc7\xb0\xa5\x40\x1f\x93\x33\x97\xc6\xba\x67\x91\x34\x42\xe0\x40\xd7\x55\x81\x47\x6e\xb2\xff\x46\xb3\xfb\x59\x9b\x3b\xb4\x8e\xed\x81\x42\x71\xc1\x7e\xe0\x74\xcd\xa8\xc2\xb6\x4a\xba\xc1\x0a\x11\xb1\x24\xb7\xd7\x92\xd0\xdd\x72\x16\x58\xba\x02\xc4\x83\x5e\x22\x27\xaf\x6e\x1d\x15\x60\x4e\x9f\x9d\xb3\x31\xcc\x1d\x74\x70\x61\x41\x28\x90\xea\xa8\xc6\x5a\x9b\x0d\xf1\x1c\xc1\x2b\xef\x73\x4c\x72\x21\x1e\xec\x90\x31\x1a\xda\xf8\x6f\x37\xf0\xbd\x4e\x41\x08\xc1\xbb\x71\x48\x8a\xe7\xea\x8a\x6f\xfc\x67\xad\xfb\x28\xdb\xec\x04\xb6\xbc\xae\x71\xf5\x94\x5d\x10\xbe\x5c\xcd\x70\xbc\x72\x1a\x1f\xff\xb3\xca\xd5\x43\x2c\x1e\xaa\x05\x49\x02\x57\xed\xfa\x96\x3f\x26\x5c\xc9\x2c\xab\x70\x45\x09\x3c\x98\xb9\xde\x2e\xb9\x52\x38\xb0\x25\x37\xa0\x0f\x08\xc2\x39\x91\x96\x98\x91\xb3\x05\xec\x4c\xe5\xfd\x97\x89\x98\x58\xcf\x5d\x87\x63\x6e\xc5\x20\xa6\x0a\x3b\x03\xae\x7f\xb6\xf3\x47\xd7\x60\x89\x2c\xeb\xde\xbb\xa1\x11\xa4\xca\x35\xb1\xa5\xd8\x30\xf8\x7f\x2d\x5a\x77\xd4\x4f\x0b\xe9\x50\x2c\x89\xfb\x8d\x2c\x4a\x07\x4a\xaf\x60\x85\xa0\x55\xb5\x01\xdb\x36\xfc\x19\x84\x88\xc8\xfd\x04\xd7\x52\x31\x23\x82\x6c\xe1\x3a\x2d\xce\x85\x13\x99\xe6\x96\x02\x53\x37\x44\xc5\x01\x3b\x04\xa4\x8b\x4c\xf1\x5a\xd4\xd8\x8f\xab\x21\x10\x71\x50\x3a\xd7\xc4\x5f\x85\xca\xa8\x80\xc0\xee\x1b\x79\x5c\xbb\x8a\x2c\xc1\x4d\x13\x7f\xa2\x88\x0f\xf3\x8c\xc6\x7d\xca\xc3\xed\x68\x6a\x83\xed\x10\x1b\x3e\xed\x3d\x4e\x33\x06\xcc\xad\xa9\x77\xbc\xe4\x6f\xdd\xdd\x89\x09\xaf\x0b\x3a\x10\x77\x02\xef\x69\xf5\x99\xce\x33\x13\xb3\xea\xce\xdd\xa0\x6d\xb4\xb2\xf8\x97\x91\x1c\x46\x06\xde\xf5\xeb\xec\xa3\xb0\x9b\x5f\x92\x64\x50\x0a\x4a\x61\x01\xd7\xe4\x54\xca\x40\x4e\xf5\x46\xa8\x98\x5d\xd6\xb4\x8e\x30\x52\xaa\xde\xd1\xa9\x5b\x3f\x75\xb2\x47\xec\xec\x98\x35\x0c\xf2\xbb\x5d\x95\x19\x26\x6b\xce\x80\xc9\xbe\x95\xbe\x68\xd7\x57\xf9\x46\xa8\x99\xcf\x04\xb6\xc1\x55\x7c\xde\xd6\x4d\x60\xf9\x5d\xe6\x60\x53\x1e\xd1\x98\xf7\xc8\xed\x0f\xb0\x69\xfc\x55\xd8\xbe\x10\x06\xbd\x66\xdc\x16\xcf\xcf\xa3\x4e\x9c\xf9\x39\x9f\x4c\xf9\x28\x11\xc5\xb7\x1c\x20\x41\x18\xd1\xea\x78\x76\x5c\x66\x16\x49\xc2\x05\x8e\xa2\x8f\x86\x42\xa4\x54\x28\x71\xdd\x07\x97\xe5\x0f\x19\xdc\x32\x50\xec\x46\x60\x35\xd9\x02\x5c\xa9\x69\xd0\xd6\x5d\xf8\xa6\xda\x18\xac\xba\xae\xb8\xd2\x85\xe5\x24\x62\x99\x2c\x37\x3b\x96\x6f\x92\x39\x54\xa8\x82\x5e\x56\x1e\x92\xdf\xff\x02\x3f\xff\xcc\xab\x9d\x26\xbc\x38\xfd\x08\x3f\x80\x9c\xb6\x37\x62\x75\xe9\x32\xa3\xdd\x87\x8d\x43\x08\xde\xff\x72\x94\x96\xc2\x90\xb0\x61\x04\xbf\xf7\xab\xd3\x8f\xdb\xd5\xbe\x45\xe2\xa2\xde\x10\x3e\x67\x9d\x20\x93\x5e\x84\x4f\x36\x82\x7b\xb2\x59\x89\xeb\xf8\x1c\x53\x9d\x61\x6f\x9a\x41\xc6\x8e\xfc\x40\xff\xbc\xeb\xe9\xf8\x34\xcb\x86\x37\x9f\x4f\xde\xcb\xcc\x8f\xba\xb3\x93\xfd\xb9\x94\x86\xd2\xee\xd3\x67\xfc\x49\x16\x17\x2a\x93\x42\xc5\x7f\xb2\x7d\x83\x51\xaa\xff\xf9\x7d\xf6\xbf\x61\xd8\x5f\xde\x19\xe6\x65\x51\x7b\xc3\xfd\x73\x49\xe9\xe0\xbf\x13\x74\x10\x69\x90\x91\xc6\xfb\xee\x51\xc6\x0c\x58\x5f\xef\xee\x16\x81\x59\x45\xc0\xad\xec\x63\xc8\x73\x51\x87\xed\x3b\x65\x62\x5b\x3a\xb7\xfd\x40\x86\x36\x35\xf2\x81\x9b\x06\xca\x15\xd1\x34\x95\xec\xc6\x67\x46\xd8\x3f\xa9\x84\x73\x3f\x8d\x8e\xc3\xed\xc0\x47\xa6\x61\x9a\xd8\x96\xa3\x03\x33\x00\x25\xd0\x52\x18\xba\x60\x07\x4b\x9f\x00\xdb\xd9\x30\xea\x0d\xa7\xfa\xa1\x71\xf7\xab\xcf\xe2\xdb\xf9\xfd\xfc\xdc\x0f\x77\x3e\xc1\x0c\x3c\xf7\x3f\x0f\x9d\x2e\x16\xf7\xd7\xa7\x57\x17\xc4\x63\xfb\xa9\x67\x87\xe2\xef\x72\xda\x63\xe4\x4d\x4c\x1f\x19\xa3\x8a\x57\x68\x0a\x0c\x18\x4a\xfb\x95\xf3\xae\xab\xe7\x61\x7a\xbb\x7a\x8d\x2b\x02\xf9\xb1\x35\xb5\x01\x43\x52\xf7\x49\x35\xbe\x4d\x4b\xac\xc5\x9f\x37\x97\xd1\xde\xea\xb6\x54\xfc\x17\x6e\x06\x24\xe9\xc5\x64\xf6\xfd\xc0\xde\xc3\xb8\xf1\x1e\xbd\xff\x0f\x00\x00\xff\xff\x0f\x03\x1b\xbe\x21\x18\x00\x00")
func _hardcodedTracingGoBytes() ([]byte, error) {
return bindataRead(
@@ -127,7 +127,7 @@ func _hardcodedTracingGo() (*asset, error) {
}
info := bindataFileInfo{name: "../_hardcoded/tracing.go", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)}
- a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x9e, 0x84, 0x7b, 0xd4, 0x66, 0xff, 0x3f, 0xf, 0x72, 0x81, 0xce, 0x35, 0x6c, 0xf3, 0x82, 0xd9, 0xe6, 0xe, 0xfd, 0x76, 0xc3, 0xa1, 0xfa, 0x59, 0x3d, 0x6a, 0xd2, 0x59, 0x4f, 0xca, 0x49, 0xc6}}
+ a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x63, 0xda, 0xa, 0x4c, 0xfd, 0x33, 0xfb, 0xb4, 0xde, 0x32, 0x4, 0xf0, 0x61, 0xa9, 0xd7, 0x25, 0x87, 0xd4, 0x7a, 0x99, 0xf9, 0x3a, 0xa6, 0xdb, 0x5d, 0xb1, 0xb4, 0x3, 0x80, 0x6d, 0x9d, 0x3d}}
return a, nil
}

MODIFY
samples/gen-go-blog/servertracing/tracing.go
samples/gen-go-blog/servertracing/tracing.go
@@ -11,6 +11,7 @@ import (
"time"
"github.com/Clever/kayvee-go/v7/logger"
+ "github.com/davecgh/go-spew/spew"
"go.opentelemetry.io/contrib/instrumentation/github.com/gorilla/mux/otelmux"
"go.opentelemetry.io/otel"
"go.opentelemetry.io/otel/exporters/otlp/otlptrace"
@@ -19,7 +20,7 @@ import (
"go.opentelemetry.io/otel/sdk/resource"
sdktrace "go.opentelemetry.io/otel/sdk/trace"
"go.opentelemetry.io/otel/sdk/trace/tracetest"
- semconv "go.opentelemetry.io/otel/semconv/v1.9.0"
+ semconv "go.opentelemetry.io/otel/semconv/v1.10.0"
"go.opentelemetry.io/otel/trace"
)
@@ -81,7 +82,8 @@ func newTracerProvider(exporter sdktrace.SpanExporter, samplingProbability float
// We use the default ID generator. In order for sampling to work (at least with this sampler)
// the ID generator must generate trace IDs uniformly at random from the entire space of uint64.
// For example, the default x-ray ID generator does not do this.
- sdktrace.WithSampler(sdktrace.ParentBased(sdktrace.TraceIDRatioBased(samplingProbability))),
+ sdktrace.WithSampler(sdktrace.AlwaysSample()),
+ // sdktrace.WithSampler(sdktrace.ParentBased(sdktrace.TraceIDRatioBased(samplingProbability))),
// These maximums are to guard against something going wrong and sending a ton of data unexpectedly
sdktrace.WithSpanLimits(sdktrace.SpanLimits{
AttributeCountLimit: 100,
@@ -115,7 +117,10 @@ func MuxServerMiddleware(serviceName string) func(http.Handler) http.Handler {
return func(h http.Handler) http.Handler {
return otlmux(http.HandlerFunc(func(rw http.ResponseWriter, r *http.Request) {
// otelmux has extracted the span. now put it into the ctx-specific logger
+
s := trace.SpanFromContext(r.Context())
+ fmt.Println("Got this span:")
+ spew.Dump(s)
if sc := s.SpanContext(); sc.HasTraceID() {
spanID, traceID := sc.SpanID().String(), sc.TraceID().String()
// datadog converts hex strings to uint64 IDs, so log those so that correlating logs and traces works

MODIFY
samples/gen-go-client-only/servertracing/tracing.go
samples/gen-go-client-only/servertracing/tracing.go
@@ -11,6 +11,7 @@ import (
"time"
"github.com/Clever/kayvee-go/v7/logger"
+ "github.com/davecgh/go-spew/spew"
"go.opentelemetry.io/contrib/instrumentation/github.com/gorilla/mux/otelmux"
"go.opentelemetry.io/otel"
"go.opentelemetry.io/otel/exporters/otlp/otlptrace"
@@ -19,7 +20,7 @@ import (
"go.opentelemetry.io/otel/sdk/resource"
sdktrace "go.opentelemetry.io/otel/sdk/trace"
"go.opentelemetry.io/otel/sdk/trace/tracetest"
- semconv "go.opentelemetry.io/otel/semconv/v1.9.0"
+ semconv "go.opentelemetry.io/otel/semconv/v1.10.0"
"go.opentelemetry.io/otel/trace"
)
@@ -81,7 +82,8 @@ func newTracerProvider(exporter sdktrace.SpanExporter, samplingProbability float
// We use the default ID generator. In order for sampling to work (at least with this sampler)
// the ID generator must generate trace IDs uniformly at random from the entire space of uint64.
// For example, the default x-ray ID generator does not do this.
- sdktrace.WithSampler(sdktrace.ParentBased(sdktrace.TraceIDRatioBased(samplingProbability))),
+ sdktrace.WithSampler(sdktrace.AlwaysSample()),
+ // sdktrace.WithSampler(sdktrace.ParentBased(sdktrace.TraceIDRatioBased(samplingProbability))),
// These maximums are to guard against something going wrong and sending a ton of data unexpectedly
sdktrace.WithSpanLimits(sdktrace.SpanLimits{
AttributeCountLimit: 100,
@@ -115,7 +117,10 @@ func MuxServerMiddleware(serviceName string) func(http.Handler) http.Handler {
return func(h http.Handler) http.Handler {
return otlmux(http.HandlerFunc(func(rw http.ResponseWriter, r *http.Request) {
// otelmux has extracted the span. now put it into the ctx-specific logger
+
s := trace.SpanFromContext(r.Context())
+ fmt.Println("Got this span:")
+ spew.Dump(s)
if sc := s.SpanContext(); sc.HasTraceID() {
spanID, traceID := sc.SpanID().String(), sc.TraceID().String()
// datadog converts hex strings to uint64 IDs, so log those so that correlating logs and traces works

MODIFY
samples/gen-go-db-custom-path/servertracing/tracing.go
samples/gen-go-db-custom-path/servertracing/tracing.go
@@ -11,6 +11,7 @@ import (
"time"
"github.com/Clever/kayvee-go/v7/logger"
+ "github.com/davecgh/go-spew/spew"
"go.opentelemetry.io/contrib/instrumentation/github.com/gorilla/mux/otelmux"
"go.opentelemetry.io/otel"
"go.opentelemetry.io/otel/exporters/otlp/otlptrace"
@@ -19,7 +20,7 @@ import (
"go.opentelemetry.io/otel/sdk/resource"
sdktrace "go.opentelemetry.io/otel/sdk/trace"
"go.opentelemetry.io/otel/sdk/trace/tracetest"
- semconv "go.opentelemetry.io/otel/semconv/v1.9.0"
+ semconv "go.opentelemetry.io/otel/semconv/v1.10.0"
"go.opentelemetry.io/otel/trace"
)
@@ -81,7 +82,8 @@ func newTracerProvider(exporter sdktrace.SpanExporter, samplingProbability float
// We use the default ID generator. In order for sampling to work (at least with this sampler)
// the ID generator must generate trace IDs uniformly at random from the entire space of uint64.
// For example, the default x-ray ID generator does not do this.
- sdktrace.WithSampler(sdktrace.ParentBased(sdktrace.TraceIDRatioBased(samplingProbability))),
+ sdktrace.WithSampler(sdktrace.AlwaysSample()),
+ // sdktrace.WithSampler(sdktrace.ParentBased(sdktrace.TraceIDRatioBased(samplingProbability))),
// These maximums are to guard against something going wrong and sending a ton of data unexpectedly
sdktrace.WithSpanLimits(sdktrace.SpanLimits{
AttributeCountLimit: 100,
@@ -115,7 +117,10 @@ func MuxServerMiddleware(serviceName string) func(http.Handler) http.Handler {
return func(h http.Handler) http.Handler {
return otlmux(http.HandlerFunc(func(rw http.ResponseWriter, r *http.Request) {
// otelmux has extracted the span. now put it into the ctx-specific logger
+
s := trace.SpanFromContext(r.Context())
+ fmt.Println("Got this span:")
+ spew.Dump(s)
if sc := s.SpanContext(); sc.HasTraceID() {
spanID, traceID := sc.SpanID().String(), sc.TraceID().String()
// datadog converts hex strings to uint64 IDs, so log those so that correlating logs and traces works

MODIFY
samples/gen-go-db/servertracing/tracing.go
samples/gen-go-db/servertracing/tracing.go
@@ -11,6 +11,7 @@ import (
"time"
"github.com/Clever/kayvee-go/v7/logger"
+ "github.com/davecgh/go-spew/spew"
"go.opentelemetry.io/contrib/instrumentation/github.com/gorilla/mux/otelmux"
"go.opentelemetry.io/otel"
"go.opentelemetry.io/otel/exporters/otlp/otlptrace"
@@ -19,7 +20,7 @@ import (
"go.opentelemetry.io/otel/sdk/resource"
sdktrace "go.opentelemetry.io/otel/sdk/trace"
"go.opentelemetry.io/otel/sdk/trace/tracetest"
- semconv "go.opentelemetry.io/otel/semconv/v1.9.0"
+ semconv "go.opentelemetry.io/otel/semconv/v1.10.0"
"go.opentelemetry.io/otel/trace"
)
@@ -81,7 +82,8 @@ func newTracerProvider(exporter sdktrace.SpanExporter, samplingProbability float
// We use the default ID generator. In order for sampling to work (at least with this sampler)
// the ID generator must generate trace IDs uniformly at random from the entire space of uint64.
// For example, the default x-ray ID generator does not do this.
- sdktrace.WithSampler(sdktrace.ParentBased(sdktrace.TraceIDRatioBased(samplingProbability))),
+ sdktrace.WithSampler(sdktrace.AlwaysSample()),
+ // sdktrace.WithSampler(sdktrace.ParentBased(sdktrace.TraceIDRatioBased(samplingProbability))),
// These maximums are to guard against something going wrong and sending a ton of data unexpectedly
sdktrace.WithSpanLimits(sdktrace.SpanLimits{
AttributeCountLimit: 100,
@@ -115,7 +117,10 @@ func MuxServerMiddleware(serviceName string) func(http.Handler) http.Handler {
return func(h http.Handler) http.Handler {
return otlmux(http.HandlerFunc(func(rw http.ResponseWriter, r *http.Request) {
// otelmux has extracted the span. now put it into the ctx-specific logger
+
s := trace.SpanFromContext(r.Context())
+ fmt.Println("Got this span:")
+ spew.Dump(s)
if sc := s.SpanContext(); sc.HasTraceID() {
spanID, traceID := sc.SpanID().String(), sc.TraceID().String()
// datadog converts hex strings to uint64 IDs, so log those so that correlating logs and traces works

MODIFY
samples/gen-go-deprecated/servertracing/tracing.go
samples/gen-go-deprecated/servertracing/tracing.go
@@ -11,6 +11,7 @@ import (
"time"
"github.com/Clever/kayvee-go/v7/logger"
+ "github.com/davecgh/go-spew/spew"
"go.opentelemetry.io/contrib/instrumentation/github.com/gorilla/mux/otelmux"
"go.opentelemetry.io/otel"
"go.opentelemetry.io/otel/exporters/otlp/otlptrace"
@@ -19,7 +20,7 @@ import (
"go.opentelemetry.io/otel/sdk/resource"
sdktrace "go.opentelemetry.io/otel/sdk/trace"
"go.opentelemetry.io/otel/sdk/trace/tracetest"
- semconv "go.opentelemetry.io/otel/semconv/v1.9.0"
+ semconv "go.opentelemetry.io/otel/semconv/v1.10.0"
"go.opentelemetry.io/otel/trace"
)
@@ -81,7 +82,8 @@ func newTracerProvider(exporter sdktrace.SpanExporter, samplingProbability float
// We use the default ID generator. In order for sampling to work (at least with this sampler)
// the ID generator must generate trace IDs uniformly at random from the entire space of uint64.
// For example, the default x-ray ID generator does not do this.
- sdktrace.WithSampler(sdktrace.ParentBased(sdktrace.TraceIDRatioBased(samplingProbability))),
+ sdktrace.WithSampler(sdktrace.AlwaysSample()),
+ // sdktrace.WithSampler(sdktrace.ParentBased(sdktrace.TraceIDRatioBased(samplingProbability))),
// These maximums are to guard against something going wrong and sending a ton of data unexpectedly
sdktrace.WithSpanLimits(sdktrace.SpanLimits{
AttributeCountLimit: 100,
@@ -115,7 +117,10 @@ func MuxServerMiddleware(serviceName string) func(http.Handler) http.Handler {
return func(h http.Handler) http.Handler {
return otlmux(http.HandlerFunc(func(rw http.ResponseWriter, r *http.Request) {
// otelmux has extracted the span. now put it into the ctx-specific logger
+
s := trace.SpanFromContext(r.Context())
+ fmt.Println("Got this span:")
+ spew.Dump(s)
if sc := s.SpanContext(); sc.HasTraceID() {
spanID, traceID := sc.SpanID().String(), sc.TraceID().String()
// datadog converts hex strings to uint64 IDs, so log those so that correlating logs and traces works

MODIFY
samples/gen-go-errors/servertracing/tracing.go
samples/gen-go-errors/servertracing/tracing.go
@@ -11,6 +11,7 @@ import (
"time"
"github.com/Clever/kayvee-go/v7/logger"
+ "github.com/davecgh/go-spew/spew"
"go.opentelemetry.io/contrib/instrumentation/github.com/gorilla/mux/otelmux"
"go.opentelemetry.io/otel"
"go.opentelemetry.io/otel/exporters/otlp/otlptrace"
@@ -19,7 +20,7 @@ import (
"go.opentelemetry.io/otel/sdk/resource"
sdktrace "go.opentelemetry.io/otel/sdk/trace"
"go.opentelemetry.io/otel/sdk/trace/tracetest"
- semconv "go.opentelemetry.io/otel/semconv/v1.9.0"
+ semconv "go.opentelemetry.io/otel/semconv/v1.10.0"
"go.opentelemetry.io/otel/trace"
)
@@ -81,7 +82,8 @@ func newTracerProvider(exporter sdktrace.SpanExporter, samplingProbability float
// We use the default ID generator. In order for sampling to work (at least with this sampler)
// the ID generator must generate trace IDs uniformly at random from the entire space of uint64.
// For example, the default x-ray ID generator does not do this.
- sdktrace.WithSampler(sdktrace.ParentBased(sdktrace.TraceIDRatioBased(samplingProbability))),
+ sdktrace.WithSampler(sdktrace.AlwaysSample()),
+ // sdktrace.WithSampler(sdktrace.ParentBased(sdktrace.TraceIDRatioBased(samplingProbability))),
// These maximums are to guard against something going wrong and sending a ton of data unexpectedly
sdktrace.WithSpanLimits(sdktrace.SpanLimits{
AttributeCountLimit: 100,
@@ -115,7 +117,10 @@ func MuxServerMiddleware(serviceName string) func(http.Handler) http.Handler {
return func(h http.Handler) http.Handler {
return otlmux(http.HandlerFunc(func(rw http.ResponseWriter, r *http.Request) {
// otelmux has extracted the span. now put it into the ctx-specific logger
+
s := trace.SpanFromContext(r.Context())
+ fmt.Println("Got this span:")
+ spew.Dump(s)
if sc := s.SpanContext(); sc.HasTraceID() {
spanID, traceID := sc.SpanID().String(), sc.TraceID().String()
// datadog converts hex strings to uint64 IDs, so log those so that correlating logs and traces works

MODIFY
samples/gen-go-nils/servertracing/tracing.go
samples/gen-go-nils/servertracing/tracing.go
@@ -11,6 +11,7 @@ import (
"time"
"github.com/Clever/kayvee-go/v7/logger"
+ "github.com/davecgh/go-spew/spew"
"go.opentelemetry.io/contrib/instrumentation/github.com/gorilla/mux/otelmux"
"go.opentelemetry.io/otel"
"go.opentelemetry.io/otel/exporters/otlp/otlptrace"
@@ -19,7 +20,7 @@ import (
"go.opentelemetry.io/otel/sdk/resource"
sdktrace "go.opentelemetry.io/otel/sdk/trace"
"go.opentelemetry.io/otel/sdk/trace/tracetest"
- semconv "go.opentelemetry.io/otel/semconv/v1.9.0"
+ semconv "go.opentelemetry.io/otel/semconv/v1.10.0"
"go.opentelemetry.io/otel/trace"
)
@@ -81,7 +82,8 @@ func newTracerProvider(exporter sdktrace.SpanExporter, samplingProbability float
// We use the default ID generator. In order for sampling to work (at least with this sampler)
// the ID generator must generate trace IDs uniformly at random from the entire space of uint64.
// For example, the default x-ray ID generator does not do this.
- sdktrace.WithSampler(sdktrace.ParentBased(sdktrace.TraceIDRatioBased(samplingProbability))),
+ sdktrace.WithSampler(sdktrace.AlwaysSample()),
+ // sdktrace.WithSampler(sdktrace.ParentBased(sdktrace.TraceIDRatioBased(samplingProbability))),
// These maximums are to guard against something going wrong and sending a ton of data unexpectedly
sdktrace.WithSpanLimits(sdktrace.SpanLimits{
AttributeCountLimit: 100,
@@ -115,7 +117,10 @@ func MuxServerMiddleware(serviceName string) func(http.Handler) http.Handler {
return func(h http.Handler) http.Handler {
return otlmux(http.HandlerFunc(func(rw http.ResponseWriter, r *http.Request) {
// otelmux has extracted the span. now put it into the ctx-specific logger
+
s := trace.SpanFromContext(r.Context())
+ fmt.Println("Got this span:")
+ spew.Dump(s)
if sc := s.SpanContext(); sc.HasTraceID() {
spanID, traceID := sc.SpanID().String(), sc.TraceID().String()
// datadog converts hex strings to uint64 IDs, so log those so that correlating logs and traces works

MODIFY
samples/gen-go/servertracing/tracing.go
samples/gen-go/servertracing/tracing.go
@@ -11,6 +11,7 @@ import (
"time"
"github.com/Clever/kayvee-go/v7/logger"
+ "github.com/davecgh/go-spew/spew"
"go.opentelemetry.io/contrib/instrumentation/github.com/gorilla/mux/otelmux"
"go.opentelemetry.io/otel"
"go.opentelemetry.io/otel/exporters/otlp/otlptrace"
@@ -19,7 +20,7 @@ import (
"go.opentelemetry.io/otel/sdk/resource"
sdktrace "go.opentelemetry.io/otel/sdk/trace"
"go.opentelemetry.io/otel/sdk/trace/tracetest"
- semconv "go.opentelemetry.io/otel/semconv/v1.9.0"
+ semconv "go.opentelemetry.io/otel/semconv/v1.10.0"
"go.opentelemetry.io/otel/trace"
)
@@ -81,7 +82,8 @@ func newTracerProvider(exporter sdktrace.SpanExporter, samplingProbability float
// We use the default ID generator. In order for sampling to work (at least with this sampler)
// the ID generator must generate trace IDs uniformly at random from the entire space of uint64.
// For example, the default x-ray ID generator does not do this.
- sdktrace.WithSampler(sdktrace.ParentBased(sdktrace.TraceIDRatioBased(samplingProbability))),
+ sdktrace.WithSampler(sdktrace.AlwaysSample()),
+ // sdktrace.WithSampler(sdktrace.ParentBased(sdktrace.TraceIDRatioBased(samplingProbability))),
// These maximums are to guard against something going wrong and sending a ton of data unexpectedly
sdktrace.WithSpanLimits(sdktrace.SpanLimits{
AttributeCountLimit: 100,
@@ -115,7 +117,10 @@ func MuxServerMiddleware(serviceName string) func(http.Handler) http.Handler {
return func(h http.Handler) http.Handler {
return otlmux(http.HandlerFunc(func(rw http.ResponseWriter, r *http.Request) {
// otelmux has extracted the span. now put it into the ctx-specific logger
+
s := trace.SpanFromContext(r.Context())
+ fmt.Println("Got this span:")
+ spew.Dump(s)
if sc := s.SpanContext(); sc.HasTraceID() {
spanID, traceID := sc.SpanID().String(), sc.TraceID().String()
// datadog converts hex strings to uint64 IDs, so log those so that correlating logs and traces works

MODIFY
wag
wag
Binary files a/wag and b/wag differ

added debugging to servertracing