Fixes https://github.com/LukeMathWalker/tracing-actix-web/issues/50
The `root_span!` macro included some feature flag checks. However, the
`root_span!` macro might end up being used in other crates consuming
`tracing-actix-web`, and those feature flag checks would be copied in
verbatim. The result is that the feature flag checks for things like
`opentelemetry_0_14` would actually check the consuming crates flags
rather than the flags for `tracing-actix-web`.
This commit moves those feature flag checks out of the macro, so they
are always resolved against `tracing-actix-web`.
* Allow root_span to wrap the full middlware chain, not just the output future
* Build error string outside of span.record
This is a workaround for https://github.com/tokio-rs/tracing/issues/1565
* Reference issue being worked-around as comment
* Support updated OT 0.14 / tracing-OT 0.12 crate versions
Add support for opentelemetry 0.14 and tracing-opentelemetry 0.13.
Make corresponding changes to the features, docs, and examples.
Due to the use of two different versions of the same packages, some
reorganization had to be done for the internal modules.
Addresses issue #22.
* Re-export versioned set_otel_parent `fn`s for use in macro
Add two new error types implementing ResponseError, as required, for our extractors.
Add public docs for new errors.
Co-authored-by: LukeMathWalker <rust@lpalmieri.com>
* Add http.route.
* Align all fields with OpenTelemetry's semantic conventions.
* Add span kind.
* Emit event for errors.
Add OTEL status code.
* Create otel.status_code field as empty.
* Fix errors.
* Add (feature-gated) support for OpenTelemetry span propagation.
* Capture the trace id as an attribute on the span.
* Change message.
* Log the newly-generated trace id if there is no parent context.
* Define a root_span macro as a stepping stone to allow crate users to add their own fields to the root span.
* Add comments.
* mut is no longer necessary.
* Allow users to customise generation of the root span. Split recording fields on span end from emission of log record. Make log record on error optional via feature flag.
* Provide constructor + default implementation.
* Explode into multiple modules.
Fix various paths/private imports in root_span.
* Rename module to root_span_macro.
* Add a new extractor to retrieve the root span.
* Document crate.
* Docs!
* Add section on OTEL.
* Mention actix-web-opentelemetry.
* Add OpenTelemetry example.
* Improve readme.
* Add custom root span example.
Co-authored-by: LukeMathWalker <contact@palmieri.com>