Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

trace2: add error event #1156

Merged
merged 9 commits into from
Mar 21, 2023
Merged

Conversation

ldennington
Copy link
Contributor

@ldennington ldennington commented Mar 17, 2023

This series adds the TRACE2 error event.

The first two commits are opportunistic fixes that remove unnecessary components of Trace2 messages. The next four commits add Trace2 as a dependency to certain classes where exceptions are thrown in order to capture those exceptions with the new error event. The seventh commit adds the error event, and eighth adds special exceptions that write to Trace2. Finally, the ninth commit adds error tracing exceptions and messages throughout the GCM codebase.

@jeffhostetler
Copy link

This looks good. I did have a few comments. Sorry that it causes so much churn in the code to squeeze it in.

@jeffhostetler
Copy link

Oh, I did find it a little odd that the Windows terminal didn't need to be updated, but that's more of a curiosity than a question.

@jeffhostetler
Copy link

And yes, you mentioned somewhere about not getting every error/exception because of excess churn, and that is fine.

TRACE2 convention does not require file names to be lowercase. Remove the
ToLower() call when setting messages' FileName properties, as it it
unnecessary.
@ldennington
Copy link
Contributor Author

Oh, I did find it a little odd that the Windows terminal didn't need to be updated, but that's more of a curiosity than a question.

I just didn't want to pass it an extra parameter that was unused, since that class doesn't have any exceptions.

@ldennington ldennington force-pushed the error-event branch 3 times, most recently from 894c2f1 to 19d031d Compare March 20, 2023 22:52
@jeffhostetler
Copy link

I looked thru the entire series. I had a few comments, but it all looks good.

Order was originally included for each TRACE2 json property to ensure
alignment with Git's TRACE2 json property ordering. However, given that
the json output is meant for consumption only by tooling (e.g. the OTel
Collector) andi that the order requirement adds overhead with each new
message, this change removes it.
Pass instance of Trace2 to OAuth2Client in preparation for capturing
exceptions, which will be added in a future commit. Note that this also
removes the unused instance of Trace in GCM's OAuth2 infrastructure.
Pass instance of Trace2 to Git in preparation for capturing exceptions,
which will be added in a future commit.
Pass instance of Trace2 to terminal classes in preparation for capturing
exceptions, which will be added in a future commit.
Pass instance of Trace2 to Gpg in preparation for capturing exceptions,
which will be added in a future commit.
Add error event, which will capture exceptions, to Trace2 tracing system.
Add exceptions for which TRACE2 tracing can optionally be used. We choose
to add these exceptions to ease the experience of writing TRACE2 error
information - instead of having to add a call to Trace2's WriteError()
message before every exception of interest, one can instead just use the
appropriate Trace2 exception.
@jeffhostetler
Copy link

this looks good. thanks!

@ldennington
Copy link
Contributor Author

this looks good. thanks!

Thank you! I will plan to clean up the test failures and merge!

@ldennington ldennington force-pushed the error-event branch 2 times, most recently from 06fec95 to 23196d7 Compare March 21, 2023 17:20
Add TRACE2 error tracing statements throughout GCM codebase. Note that
this is a best effort - there are certain places (most notably certain
static and unsafe methods) where statements were purposefully not added
because it is either not safe or was deemed to much lift/churn to do so.

Note that there are some instances in which a "parameterized" message is
passed to TRACE2. This is used only when PII information could be passed
into the message (e.g. through a path or remote URI) and should be
redacted for collection purposes.

Finally, there are certain instances in which we write an error with no
exception thrown. These align with the places where we are currently
writing to GCM Trace without throwing an error for the purposes of parity.
@ldennington ldennington merged commit 784e7c7 into git-ecosystem:main Mar 21, 2023
mjcheetham added a commit that referenced this pull request May 2, 2023
**Changes:**

- Support ports in URL-scoped config (#825)
- Support URL-scoped enterprise default settings (#1149)
- Add support for client TLS certificates (#1152)
- Add TRACE2 support(#1131, #1151, #1156, #1162)
- Better browser detection inside of WSL (#1148)
- Handle expired OAuth refresh token for generic auth (#1196)
- Target *-latest runner images in CI workflow (#1178)
- Various bug fixes:
  - Ensure we create a WindowsProcessManager on Windows (#1146)
  - Ensure we start child processes created with ProcessManager (#1177)
  - Fix app path name of Windows dropping file extension (#1181)
  - Ensure we init IEnvironment before SessionManager (#1167)
  - git: consistently read from stdout before exit wait (#1136)
  - trace2: guard against null pipe client in dispose (#1135)
- Make Avalonia UI the default Windows and move to in-process (#1207)
- Add Git configuration options for trace & debug (#1228)
- Transition from Nerdbank.GitVersioning to a version file (#1231)
- Add support for using the current Windows user for WAM on DevBox
(#1197)
- Various documentation updates:
  - org-rename: update references to GitCredentialManager (#1141)
  - issue templates: remove core suffix (#1180)
  - readme: add link to project roadmap (#1204)
  - docs: add bitbucket app password requirements (#1213)
  - .net tool: clarify install instructions (#1126)
  - docs: call out different GCM install paths in WSL docs (#1168)
  - docs: add trace2 to config/env documentation (#1230)
@ldennington ldennington deleted the error-event branch July 12, 2023 18:26
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.

None yet

2 participants