<commit_before>// Package minitrace contains primitives to support
// propagation of tracing information.
package minitrace

// TODO(jbd): Rename this package to trace and propose it to the standard library.

import (
	"context"
	"net/http"
)

// Span identifies a span globally in a tracing system
// and may contain annotations the span is propagating.
//
// The identification and the formatting of propagated
// annotations might be tracing backend-specific.
type Span []byte

// NewContext returns a context with the given span.
func NewContext(ctx context.Context, s Span) context.Context {
	return context.WithValue(ctx, spanKey, s)
}

// FromContext returns the span from the context.
func FromContext(ctx context.Context) Span {
	return ctx.Value(spanKey).(Span)
}

// HTTPCarrier allows spans to be propagated via HTTP requests.
//
// SpanFromReq returns a span from the incoming HTTP request.
// If the incoming request doesn't contain trace information,
// a nil span is returned with no errors.
//
// SpanToReq mutates the outgoing request with the span, and<commit_msg>add another TODO<commit_after>// Package minitrace contains primitives to support
// propagation of tracing information.
package minitrace

// TODO(jbd): Rename this package to trace and propose it to the standard library.

// TODO(jbd): Rename Span to SpanID? Then, does it represent propagated labels?

import (
	"context"
	"net/http"
)

// Span identifies a span globally in a tracing system
// and may contain annotations the span is propagating.
//
// The identification and the formatting of propagated
// annotations might be tracing backend-specific.
type Span []byte

// NewContext returns a context with the given span.
func NewContext(ctx context.Context, s Span) context.Context {
	return context.WithValue(ctx, spanKey, s)
}

// FromContext returns the span from the context.
func FromContext(ctx context.Context) Span {
	return ctx.Value(spanKey).(Span)
}

// HTTPCarrier allows spans to be propagated via HTTP requests.
//
// SpanFromReq returns a span from the incoming HTTP request.
// If the incoming request doesn't contain trace information,
// a nil span is returned with no errors.
//
// SpanToReq mutates the outgoing request with the span, and
{'fraction_non_alphanumeric': 0.0791111111111111, 'fraction_numerical': 0.0, 'mean_word_length': 3.980088495575221, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1269411', 'n_tokens_mistral': 609, 'n_tokens_neox': 595, 'n_words': 282}