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

Ability to enable or disable self monitoring #518

Closed
MedMaalej opened this issue Dec 11, 2024 · 2 comments · Fixed by #522
Closed

Ability to enable or disable self monitoring #518

MedMaalej opened this issue Dec 11, 2024 · 2 comments · Fixed by #522
Assignees
Labels
enhancement New feature or request no_release_notes
Milestone

Comments

@MedMaalej
Copy link
Contributor

MedMaalej commented Dec 11, 2024

Job Duration Metrics Configuration

Summary

Enable users to configure the display of job duration metrics.

Description

Scenario 1: Job duration reporting is enabled (default or by configuration)

Given: A user has either enabled job duration reporting in the configuration or left the configuration unchanged (default setting).
When: Job duration reporting is active.
Then: The engine will compute and report job duration metrics to the OpenTelemetry Collector.

Scenario 2: Job duration reporting is explicitly disabled

Given: A user has explicitly disabled job duration reporting in the configuration.
When: Job duration reporting is inactive.
Then: The engine will not compute and report job duration metrics to the OpenTelemetry Collector.

Acceptance Criteria

Configuration for Job Duration Reporting

  • The job duration metrics should be configurable in the metricshub.yaml file in the resource level or the resource group level or the configuration file root level:
  • Field: enableSelfMonitoring
    • Default value: true

Behavior When Enabled (Default Behavior)

  • The job duration metrics should show up on each monitor type, for each job type and each connector.
  • Configuration: enableSelfMonitoring: true

Behavior When Disabled

  • The job duration metrics should not show up at all.
  • Configuration: enableSelfMonitoring: false

Testing and Validation

  • All scenarios (enabled, disabled, and no configuration) with all possible cases (existence or non-existence of global configuration, existence or non-existence of resource group configuration, existence or non-existence of resource configuration) must be tested and validated using:
    • Unit tests
    • Functional tests (e.g., Prometheus, Grafana)

Technical Specifications

MetricsHub Agent:

  • Global Configuration: This applies the enableSelfMonitoring setting to all resources defined in metricshub.yaml, regardless of whether they belong to a resource group.

Add a private primitive boolean variable enableSelfMonitoring = "true"

  • Resource Group Configuration: When configured for a specific resource group, the enableSelfMonitoring setting applies to all resources within that group. (It overrides the global configuration)

Add a private Boolean Object variable enableSelfMonitoring

  • Specific Resource Configuration: When set for a particular resource, the enableSelfMonitoring setting applies only to that resource (It overrides the resource group configuration)

Add a private Boolean Object variable enableSelfMonitoring

  • In ConfigHelper, set enableSelfMonitoring as follow in normalizeResourceGroupConfig method using the value of enableSelfMonitoring in agentConfig:
if (resourceGroupConfig.getEnableSelfMonitoring() == null) {
    resourceGroupConfig.setEnableSelfMonitoring(agentConfig.isEnableSelfMonitoring());
}
  • In ConfigHelper, set enableSelfMonitoring as follow in normalizeResourceConfig method using the value of enableSelfMonitoring in resourceGroupConfig:
if (resourceConfig.getEnableSelfMonitoring() == null) {
    resourceConfig.setEnableSelfMonitoring(resourceGroupConfig.getEnableSelfMonitoring());
}
  • Set enableSelfMonitoring in buildHostConfiguration method in ConfigHelper class:
	return HostConfiguration
	    .builder()
	    ......
	    .enableSelfMonitoring(Boolean.TRUE.equals(resourceConfig.getEnableSelfMonitoring()))
                         .......
	    .build();

Metricshub engine:

Add a check in AbstractAllAtOnceStrategy , CollectStrategy, BeforeAllStrategy and AfterAllStrategy before calling setJobDurationMetricInHostMonitor:

if (telemetryManager.getHostConfiguration().isEnableSelfMonitoring()){
    setJobDurationMetricInHostMonitor(...);
}
@MedMaalej MedMaalej added the enhancement New feature or request label Dec 11, 2024
@MedMaalej MedMaalej self-assigned this Dec 11, 2024
@NassimBtk
Copy link
Member

NassimBtk commented Dec 11, 2024

I would name the configuration property enableSelfMonitoring. This setting will be useful in the future when we introduce support for traces and logs. Specialized options like enableSelfMonitoringMetrics or enableSelfMonitoringTraces can be added as needed, but for now, there's no immediate requirement for them.

@NassimBtk
Copy link
Member

We need to clarify where the enableSelfMonitoring setting should be configured in metricshub.yaml:

  • Global Configuration: This applies the enableSelfMonitoring setting to all resources defined in metricshub.yaml, regardless of whether they belong to a resource group.

  • Resource Group Configuration: When configured for a specific resource group, the enableSelfMonitoring setting applies to all resources within that group.

  • Specific Resource Configuration: When set for a particular resource, the enableSelfMonitoring setting applies only to that resource.

@NassimBtk NassimBtk changed the title Job Duration Metrics Configuration Ability to enable or disable self monitoring metrics Dec 11, 2024
@NassimBtk NassimBtk changed the title Ability to enable or disable self monitoring metrics Ability to enable or disable self monitoring Dec 11, 2024
MedMaalej added a commit that referenced this issue Dec 16, 2024
* Add enableSelfMonitoring in AgentConfig, ResourceConfiguration and ResourceGroupConfiguration
* Transfer the new flag to HostConfiguration in Agent configuration helper
* Add the flag to HostConfiguration
* Update agent and engine tests
* Refactor the method setJobDurationMetricInHostMonitor to include the new flag value check
MedMaalej added a commit that referenced this issue Dec 17, 2024
MedMaalej added a commit that referenced this issue Dec 18, 2024
* Change enableSelfMonitoring from Boolean.TRUE to true
NassimBtk added a commit that referenced this issue Dec 18, 2024
…Job-duration-metric-configuration

Issue #518: Enable job duration metric reporting through MetricsHub configuration
@NassimBtk NassimBtk added this to the 0.9.09 milestone Dec 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request no_release_notes
Projects
None yet
3 participants