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

Logging and Telemetry should be combined #117

Open
krschau opened this issue Mar 27, 2023 · 5 comments
Open

Logging and Telemetry should be combined #117

krschau opened this issue Mar 27, 2023 · 5 comments
Labels
Area-Build Pertains to the build system, CI, infrastructure Issue-Feature New feature or request

Comments

@krschau
Copy link
Contributor

krschau commented Mar 27, 2023

Description of the new feature / enhancement

Having two ILoggers is ambiguous.

Scenario when this would be used?

No response

Supporting information

No response

@krschau krschau added the Issue-Feature New feature or request label Mar 27, 2023
@microsoft-github-policy-service microsoft-github-policy-service bot added the Needs-Triage New issue that the core contributors need to triage label Mar 27, 2023
@AmelBawa-msft
Copy link
Contributor

AmelBawa-msft commented Mar 27, 2023

Suggestion:

  1. Rename current ILogger to ITelemetry
  2. Register both ITelemetry and (the new) ILogger to the Application container
  3. Inject ITelemetry into (the new) ILogger since the latter is super set of the former
  4. Update (the new) ILogger API to allow log telemetry as argument (e.g. LogError(...., telemetry: None (default) / Local / Info /...))

Challenges that needs to be solved:

  • How can we register (the new) ILogger to the Application container while still maintaining the logging namespace (e.g. Dashboard, SetupFlow, etc....).

For example:

public SetupFlowService(ILogger logger)
{
    logger.Info("Hello world"); // [SetupFlow] Hello world
}

public DashboardService(ILogger logger)
{
    logger.Info("Hello world"); // [Dashboard] Hello world
}

CC: @krschau @dkbennett @ujjwalchadha @jamespik @asklar

@krschau krschau mentioned this issue Mar 28, 2023
3 tasks
@florelis
Copy link
Member

florelis commented Apr 3, 2023

How can we register (the new) ILogger to the Application container while still maintaining the logging namespace (e.g. Dashboard, SetupFlow, etc....).

I don't think we need DI for this. If I understand correctly the benefits are being able to mock it which I don't think we need for these, and some help with getting the instances where we need them, which can be solved with a singleton like it's currently done for the dashboard.

Logging and Telemetry should be combined

Why not keep them separate? The data needed for the two of them seems quite different. For logging we ultimately want a readable string, whereas for telemetry we want a identifier string plus an object with related data.

@AmelBawa-msft
Copy link
Contributor

Discussed offline, after we have a working PoC of a logger in the SetupFlow, I will think of a way to add it to the DI container so it gets injected into the resolved types constructors.

Related work:

@cinnamon-msft cinnamon-msft added Area-Build Pertains to the build system, CI, infrastructure and removed Needs-Triage New issue that the core contributors need to triage labels May 20, 2023
@dhoehna
Copy link
Contributor

dhoehna commented Jun 28, 2023

@florelis or @AmelBawa-msft can this issue be closed?

@AmelBawa-msft
Copy link
Contributor

I suggest keeping this issue open for now. Telemetry and logging will potentially remain separate, but I still need to look into making the logger available from the container instead of a Log.cs implementations in each project.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Build Pertains to the build system, CI, infrastructure Issue-Feature New feature or request
Projects
None yet
Development

No branches or pull requests

5 participants