Commit b7b2b7b
authored
Cleanup old trace files on system (#372)
# Description
Summary of changes:
This pull request includes several changes to the `src/SdnDiagnostics`
and `src/modules/SdnDiag.Utilities` files, focusing on improving the
handling of working directories and trace output files. The most
important changes include adding a new function to get the working
directory, updating the trace output file handling to include cleanup of
stale files, and modifying the data collection process to use the new
working directory function.
Enhancements to working directory and trace file handling:
*
[`src/SdnDiagnostics.psd1`](diffhunk://#diff-17aaaa968cc894449c79b449c228b28d8a8990bde4000e59bcf24d8189671ee1R119):
Added `Get-SdnWorkingDirectory` to the list of exported functions.
*
[`src/modules/SdnDiag.Utilities.psm1`](diffhunk://#diff-9e50bcf150b088e2c4df3d0768d8dcad4abf1338de3498749997682448a07bdcR1243-R1252):
Added `Get-SdnWorkingDirectory` function to return the working directory
used for storing logs and other artifacts.
*
[`src/modules/SdnDiag.Utilities.psm1`](diffhunk://#diff-9e50bcf150b088e2c4df3d0768d8dcad4abf1338de3498749997682448a07bdcR1785-R1789):
Updated `New-TraceOutputFile` function to clean up stale trace files and
changed the trace file naming convention to include the process ID.
[[1]](diffhunk://#diff-9e50bcf150b088e2c4df3d0768d8dcad4abf1338de3498749997682448a07bdcR1785-R1789)
[[2]](diffhunk://#diff-9e50bcf150b088e2c4df3d0768d8dcad4abf1338de3498749997682448a07bdcR1800-R1818)
*
[`src/modules/SdnDiag.Utilities.psm1`](diffhunk://#diff-9e50bcf150b088e2c4df3d0768d8dcad4abf1338de3498749997682448a07bdcR2161-R2180):
Modified `Trace-Output` function to include error handling and ensure
the mutex is always released.
Improvements to data collection:
*
[`src/SdnDiagnostics.psm1`](diffhunk://#diff-490865628c61b2e97c50f45b37d7086647c70b2444cbfb9c60cc8c682801356eL1156-R1156):
Updated `Start-SdnDataCollection` function to use the new working
directory function for copying trace output files.
# Change type
- [x] Bug fix (non-breaking change)
- [ ] Code style update (formatting, local variables)
- [ ] New Feature (non-breaking change that adds new functionality
without impacting existing)
- [ ] Breaking change (fix or feature that may cause functionality
impact)
- [ ] Other
# Checklist:
- [x] My code follows the style and contribution guidelines of this
project.
- [x] I have tested and validated my code changes.1 parent f7b4419 commit b7b2b7b
File tree
3 files changed
+51
-10
lines changed- src
- modules
3 files changed
+51
-10
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
120 | 120 | | |
121 | 121 | | |
122 | 122 | | |
| 123 | + | |
123 | 124 | | |
124 | 125 | | |
125 | 126 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1150 | 1150 | | |
1151 | 1151 | | |
1152 | 1152 | | |
1153 | | - | |
| 1153 | + | |
1154 | 1154 | | |
1155 | 1155 | | |
1156 | 1156 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1264 | 1264 | | |
1265 | 1265 | | |
1266 | 1266 | | |
| 1267 | + | |
| 1268 | + | |
| 1269 | + | |
| 1270 | + | |
| 1271 | + | |
| 1272 | + | |
| 1273 | + | |
| 1274 | + | |
| 1275 | + | |
| 1276 | + | |
1267 | 1277 | | |
1268 | 1278 | | |
1269 | 1279 | | |
| |||
1796 | 1806 | | |
1797 | 1807 | | |
1798 | 1808 | | |
| 1809 | + | |
| 1810 | + | |
| 1811 | + | |
1799 | 1812 | | |
1800 | | - | |
| 1813 | + | |
1801 | 1814 | | |
1802 | 1815 | | |
1803 | 1816 | | |
| |||
1808 | 1821 | | |
1809 | 1822 | | |
1810 | 1823 | | |
| 1824 | + | |
| 1825 | + | |
| 1826 | + | |
| 1827 | + | |
| 1828 | + | |
| 1829 | + | |
| 1830 | + | |
| 1831 | + | |
| 1832 | + | |
| 1833 | + | |
| 1834 | + | |
| 1835 | + | |
| 1836 | + | |
| 1837 | + | |
| 1838 | + | |
| 1839 | + | |
| 1840 | + | |
| 1841 | + | |
| 1842 | + | |
1811 | 1843 | | |
1812 | 1844 | | |
1813 | 1845 | | |
| |||
1822 | 1854 | | |
1823 | 1855 | | |
1824 | 1856 | | |
1825 | | - | |
| 1857 | + | |
1826 | 1858 | | |
1827 | 1859 | | |
1828 | 1860 | | |
| |||
2150 | 2182 | | |
2151 | 2183 | | |
2152 | 2184 | | |
2153 | | - | |
2154 | | - | |
2155 | | - | |
2156 | | - | |
| 2185 | + | |
| 2186 | + | |
| 2187 | + | |
| 2188 | + | |
| 2189 | + | |
| 2190 | + | |
| 2191 | + | |
| 2192 | + | |
| 2193 | + | |
| 2194 | + | |
| 2195 | + | |
| 2196 | + | |
| 2197 | + | |
| 2198 | + | |
2157 | 2199 | | |
2158 | 2200 | | |
2159 | 2201 | | |
2160 | | - | |
2161 | | - | |
2162 | | - | |
| 2202 | + | |
2163 | 2203 | | |
2164 | 2204 | | |
2165 | 2205 | | |
| |||
0 commit comments