-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Major refactoring to support tokio/rs-tracing (#8)
* Major refactoring to support tokio/rs-tracing Removed manual activation of tracing and instead use rust tracing events to instrument and send datadog tracing evens as a subscriber. Also reimplemented log with support for trace-id and span-id. Use thread local storage to account for current trace and span IDs so that new spans get the appropriate parents. * Added events for errors, http, and tags Added handling of event!() macros. To cause error metadata, the event!() must contain the key "error_msg", "error_stack", and/or "error_type". If any are present, error will be set to true for the span, and error metadata will be added for the values of the keys (missing keys will have "" values added). Likewise, if "http_url", "http_status_code", and/or "http_method" will have HTTP metadata attached (and likewise, missing keys will use "" values). Any tags not for http or error will be considered "custom tags" and added to the meta data as the key/value pair given. Events can be sent as one large event, or split into multiple. The last event will take precendence if any key/values overwrite previous key/values. Lastly, cleaned up warnings, and formatted code. * Add "get_thread_trace_id" to get thread-local trace ID * Change sending pattern to require event User must send a "send_trace" event with a true value (true, "true", 1, "1", "TRUE", etc.) to cause the trace to send to datadog. This allows more flexibility about WHEN the trace gets sent. * Add test to make sure event outside of span still sends * Make sure highest level for traces is "INFO" This makes sure that even with Error and Warn logs, we can still process "INFO" traces, as this is what the send_trace will likely go out as. * Update README * Don't panic if global sub is set, just warn and return
- Loading branch information
1 parent
6df48aa
commit 79defa8
Showing
6 changed files
with
573 additions
and
206 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.