Skip to content

Replacing trace.StartSpan with oc.StartSpan#1378

Draft
helsaawy wants to merge 2 commits intomicrosoft:mainfrom
helsaawy:he/trace-oc-span
Draft

Replacing trace.StartSpan with oc.StartSpan#1378
helsaawy wants to merge 2 commits intomicrosoft:mainfrom
helsaawy:he/trace-oc-span

Conversation

@helsaawy
Copy link
Copy Markdown
Contributor

No description provided.

helsaawy added 2 commits May 9, 2022 11:16
Added logrus hook that intercepts entries headed for ETW or stdout (for
the Linux GCS case). Hook allows formatting structs, maps, arrays, etc.
as JSON strings, as well formatting `time.Time` and `time.Duration`
consistently.
Added hook to shim and Linux GCS.

Updated span export to:
* include span kind
* include status code
* format time as string
* log if span attributes were dropped

Added helper `log.Format*` functions to format Time and other structs
to JSON. This is done by the logging hook, but allows spans to also
format their attributes consistently, since they must be converted to
strings.

Added `log.S()` to set the log entry stored in the context with
provided fields. `log.G()` now checks the context for a stored context.

Added `log.Copy()` to add log entry and trace span from source context
to destination, allowing for duplicating contexts but not cancellation.

Added `log.U()` to update the context an entry (in the context) points
to, allowing it to reference the latest span and other information.

Added `oc.StartSpan[WithRemoteParent]` to set the context for log entries
to reference the newly created context.

Signed-off-by: Hamza El-Saawy <hamzaelsaawy@microsoft.com>
Replaced `trace.StartSpan[WithRemoteParent]` to use `oc.`.
Use `log.Format*` in span attributes and to format specific objects.

Use `log.G()` or `log.L` instead of `logrus.*`.

Signed-off-by: Hamza El-Saawy <hamzaelsaawy@microsoft.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant