applicationhealth-extension.../main
Kevin Lugo 3ec3e5b906
Refactoring Telemetry Package and replacing go-kit Logger for Slog Logger (#88)
This Pull Request refactors the usage of our Telemetry package and
changes the logger from gokit logger. These changes close the gap on the
difference between the v2 in the master branch and the consolidated code
base in the feature/v2/WindowsMigration.
 
 
Important changes: 
- Created new Slog Handler to change the msg tag to event and moved it
to the end of the log message.
- The new Telemetry struct is now a singleton instead of a global
function.

### AI Updates:

------------------------------------------------------------------------------------

Updates to Telemetry:

*
[`internal/telemetry/telemetry.go`](diffhunk://#diff-03a209e90e40142dadb464e0a169c11dae5605db9eaf53106cdac0c56c235b38L4-R21):
The telemetry package was updated with several changes. The `EventLevel`
and `EventTask` constants were renamed for clarity, and the
`TelemetryEventSender` struct was replaced with a `Telemetry` struct.
Several methods were also changed, and new error variables were
introduced for better error handling.
[[1]](diffhunk://#diff-03a209e90e40142dadb464e0a169c11dae5605db9eaf53106cdac0c56c235b38L4-R21)
[[2]](diffhunk://#diff-03a209e90e40142dadb464e0a169c11dae5605db9eaf53106cdac0c56c235b38L34-R121)

*
[`main/cmds.go`](diffhunk://#diff-ace417b47e816a44cf3b6f6248e72453a46d9e6043f19aea9d39212e852cc373R5-R16):
The logging in the `main/cmds.go` file was updated to use the `slog`
package instead of the `log` package. This included changing the type of
the `lg` variable in several functions and updating the telemetry calls
to use the new `SendEvent` method from the updated `telemetry` package.
[[1]](diffhunk://#diff-ace417b47e816a44cf3b6f6248e72453a46d9e6043f19aea9d39212e852cc373R5-R16)
[[2]](diffhunk://#diff-ace417b47e816a44cf3b6f6248e72453a46d9e6043f19aea9d39212e852cc373L44-R68)
[[3]](diffhunk://#diff-ace417b47e816a44cf3b6f6248e72453a46d9e6043f19aea9d39212e852cc373L80-R88)
[[4]](diffhunk://#diff-ace417b47e816a44cf3b6f6248e72453a46d9e6043f19aea9d39212e852cc373L108-R115)
[[5]](diffhunk://#diff-ace417b47e816a44cf3b6f6248e72453a46d9e6043f19aea9d39212e852cc373L137-R142)
[[6]](diffhunk://#diff-ace417b47e816a44cf3b6f6248e72453a46d9e6043f19aea9d39212e852cc373L173-R173)
[[7]](diffhunk://#diff-ace417b47e816a44cf3b6f6248e72453a46d9e6043f19aea9d39212e852cc373L182-R202)
[[8]](diffhunk://#diff-ace417b47e816a44cf3b6f6248e72453a46d9e6043f19aea9d39212e852cc373L225-R225)
[[9]](diffhunk://#diff-ace417b47e816a44cf3b6f6248e72453a46d9e6043f19aea9d39212e852cc373L238-R238)

Updates to Logging:

*
[`main/handlersettings.go`](diffhunk://#diff-f8ae33e4c69620dbc2523794f5240aa34ad618e11e155fec37c03a0c2e8b2b8cR6-L11):
The logging in the `handlersettings.go` file was updated to use the
`slog` package instead of the `log` package. This included updating the
telemetry calls to use the new `SendEvent` method from the updated
`telemetry` package.
[[1]](diffhunk://#diff-f8ae33e4c69620dbc2523794f5240aa34ad618e11e155fec37c03a0c2e8b2b8cR6-L11)
[[2]](diffhunk://#diff-f8ae33e4c69620dbc2523794f5240aa34ad618e11e155fec37c03a0c2e8b2b8cL139-R162)

*
[`main/health.go`](diffhunk://#diff-2422cb6e5f570a2a3eeb5388f7e0fcc644727dfd0d34911de35e83a268f1d2efR8):
The logging in the `health.go` file was updated to use the `slog`
package instead of the `log` package. This included updating the
`evaluate` method in the `HealthProbe` interface.
[[1]](diffhunk://#diff-2422cb6e5f570a2a3eeb5388f7e0fcc644727dfd0d34911de35e83a268f1d2efR8)
[[2]](diffhunk://#diff-2422cb6e5f570a2a3eeb5388f7e0fcc644727dfd0d34911de35e83a268f1d2efL16)
[[3]](diffhunk://#diff-2422cb6e5f570a2a3eeb5388f7e0fcc644727dfd0d34911de35e83a268f1d2efL63-R63)

Addition of a new devcontainer run configuration:

*
[`.vscode/launch.json`](diffhunk://#diff-bd5430ee7c51dc892a67b3f2829d1f5b6d223f0fd48b82322cfd45baf9f5e945R18-R29):
A new devcontainer run configuration named "devcontainer run -
uninstall" was added. This configuration is set up to run the
"uninstall" command in the `applicationhealth-extension` program.
2024-07-01 20:47:09 -07:00
..
cmds.go Refactoring Telemetry Package and replacing go-kit Logger for Slog Logger (#88) 2024-07-01 20:47:09 -07:00
cmds_test.go Refactoring Telemetry Package and replacing go-kit Logger for Slog Logger (#88) 2024-07-01 20:47:09 -07:00
constants.go Passing Extension Version to VMWatch (#52) 2024-01-18 14:02:30 -08:00
handlersettings.go Refactoring Telemetry Package and replacing go-kit Logger for Slog Logger (#88) 2024-07-01 20:47:09 -07:00
handlersettings_test.go Adding Kusto Telemetry to ApplicationHealthLinux v2 (#63) 2024-05-01 23:46:04 -07:00
health.go Refactoring Telemetry Package and replacing go-kit Logger for Slog Logger (#88) 2024-07-01 20:47:09 -07:00
health_test.go App Health Extension v2: Added Support TLS 1.3, added Parallel test execution and updated GitHub Workflow. (#38) 2023-11-15 17:31:45 -08:00
main.go Refactoring Telemetry Package and replacing go-kit Logger for Slog Logger (#88) 2024-07-01 20:47:09 -07:00
probeResponse.go Bump to v2.0.3: Make first substatus backwards compatible with HostGAPlugin (#25) 2022-08-26 15:17:51 -07:00
reportstatus.go Refactoring Telemetry Package and replacing go-kit Logger for Slog Logger (#88) 2024-07-01 20:47:09 -07:00
reportstatus_test.go Refactoring Telemetry Package and replacing go-kit Logger for Slog Logger (#88) 2024-07-01 20:47:09 -07:00
schema.go feedback 2024-02-09 20:27:26 +00:00
schema_test.go feedback 2024-02-09 20:27:26 +00:00
status.go Implementing New Sequence Number Management and Fixing how we get the extension Sequence Number (#83) 2024-06-27 18:13:21 -07:00
version.go Passing Extension Version to VMWatch (#52) 2024-01-18 14:02:30 -08:00
version_test.go Adding extension and tests 2018-06-26 12:45:05 -07:00
vmWatch.go Refactoring Telemetry Package and replacing go-kit Logger for Slog Logger (#88) 2024-07-01 20:47:09 -07:00
vmWatch_test.go Change the commandline used for systemd-run depeding on the installed version 2024-05-06 09:51:49 -07:00