Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add Context.with_current to handle context nesting * Update active span tracking to use Context * Rename Context#update -> Context.set * Add Context#clear method * Introduce baggage context * Introduce basic Context object * Implement Context#attach and Context#detach * Rename set->update; freeze entries * Handle detach when parent is nil * Context propagation prototype * Comment out failing tests after rebase * Appease the cop with todos for missing docs * Move baggage implementation to SDK * Use method names from API keep implicit (block) form, for now * Update baggage to use explicit context * Use context keys for baggage and current span * Align Context methods more closely with Java prototype * Add baggage_manager accessor to OpenTelemetry Module This seems like the right thing to do so that different implementations can be specified. We might also want to consider making Baggage::Manager a class rather than a module. * Convert tests for distributed_context_manager to correlation_context_manager * Add minimal CorrelationContextManager implementation * Add constructor and test for Label * Cleanup context in an after block rather than before * Initial implementation of SDK correlation context * Simplify label The spec specifies that there should be Label::Key and Label::Value classes. Each wraps a string, which is a little heavyweight and cumbersome to use. This commit changes Key and Value to simple strings instead. * Initial implementation of SDK::CorrelationContextManager * Add initial Propagation API * Move SpanContext related propagation to Trace namespace * Add HttpTraceContextInjector/Extractor For simplicity, these are based off of the TextFormat class. Ultimately, we'll probably end up with HttpInjector/Extractor classes extracted from the TextFormat class. * Add global injectors and extractors * Make Baggage::Manager a class instead of a module * Add Tracer#current_span_context * Add Context.with_values * Use Context.with_values in Tracer#with_span * Implement HttpTraceContextExtractor / Injector directly * Remove TextFormat and references * Remove reference to binary format in TracerFactory * Remove references to CorrelationContext (temporarily) CorrelationContext has been left out of the current OTEP. It's likely to be back and we have an initial implementation. This commit removes references from the API and SDK, but leaves the files intact until we know what should be done with them in the long term. * Add tests for context on multiple threads * Use alternative context implementation We should still do some benchmarking, but I think this is going to be a better implementation, so I'm preemptively using it for the purpose of the initial PR. * Provide default key names for HttpTraceContext / Injector extractor * Standardize naming for Baggage and DistributedContext injector / extractors * Add readers for injectors / extractors to TracerFactory * Remove distributed context * Move Baggage -> CorrelationContext * Prefer current span over extracted span context as implicit parent * Propagate remote span context if there is not a current span * Rename remote_span_context_key -> extracted_span_context_key * Move propagator references from TracerFactory to global Propagation * Happy path correlation context extractor * Ignore correlation context properties OTel may use properties in the future for metadata. For now, we'll ignore them when extracting. * Initial HttpCorrelationContextInjector implmentation * Manage CorrelationContext values as Strings * Accept explicit context object in Tracer#start_span * Use Correlation-Context as the default key This is subject to change, but we'll use the key as it's spec'd today. * Add HttpCorrelationContextExtractor/Injectors to Propagation * Extract default getter / setters into modules * Log warning for non matching Context attach / detach * Fix @todo docs * Remove explicit block parameters in Context * Provide defaults for Propagation#inject and Propagation#extract This commit improves the ergonomics of Propagation#inject and Propagation#extract by providing defaults arguments where possible. For both methods, carrier is the only required argument. Context defaults to Context.current and the http_injectors / extractors default to those registered globally. * Add implicit context to CorrelationContext::Manager methods * Introduce Builder to facilitate multiple modifications to CorrelationContext This commit adds a builder to faciliate making multiple modifications to CorrelationContext without creating multiple, intermediary contexts. Manager#build_context should be used when making multiple modifications to the correlation context. When making a single modification, all other methods should be used. Some may object to the builder and might recommend a single method with kwargs, but I think this makes for a more fluent API. * Reorganize accessors for injector / extractors * Rename HttpCorrelationContextInjector/Extractor -> HttpInjector/Extractor * Cleanup ContextKeys * Remove Context#attach and Context#detach * Cleanup correlations * Remove with_context from Tracer#start_span, redefine with_parent_context This commit replaces with_context with with_parent_context and removes with_context. * Return original context if parsing TraceContext fails * Revert "Remove Context#attach and Context#detach" This reverts commit 88138ea66627f7d3153c4d668ed228a481f24e05. * Document Context#attach and Context#detach to be private * Introduce Context::Key for indexing and retrieving values from a Context * Return to Hash based context There are perf concerns about the linked list approach. * Don't test implementation details * Update docs * Fix unnecessary cop after rebase * Return original context on failed Correlation Context extraction * Update Faraday and Sinatra adapters to use OpenTelemetry.propagation * Rename OpenTelemetry.correlation_context_manager -> OpenTelemetry.correlations Co-authored-by: Francis Bogsanyi <[email protected]>
- Loading branch information