Skip to content

Conversation

@kamanavishnu
Copy link
Collaborator

@kamanavishnu kamanavishnu commented Jan 20, 2026

Summary

Fix maintenance_job_triggered metric so that it is emitted in all code paths.

Changes

  • Client-facing API Changes
  • Internal API Changes
  • Bug Fixes
  • New Features
  • Performance Improvements
  • Code Style
  • Refactoring
  • Documentation
  • Tests
  • Observability
    • Edit metrics

Testing Done

Updating metrics, no additional tests changed/ added

@kamanavishnu kamanavishnu marked this pull request as ready for review January 21, 2026 00:01
Comment on lines +189 to +197
Attributes taskAttributes =
Attributes.of(
AttributeKey.stringKey(AppConstants.ENTITY_NAME),
metadata.getEntityName(),
AttributeKey.stringKey(AppConstants.ENTITY_TYPE),
metadata.getClass().getSimpleName().replace("Metadata", ""),
AttributeKey.stringKey(AppConstants.JOB_TYPE),
jobType.getValue());
otelEmitter.count(METRICS_SCOPE, "maintenance_job_triggered", 1, taskAttributes);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not add these metrics in the OperationTask.submitJob that's where actual job submission happens and that is the triggering point. This is basically processing data and data preparation step. This is common for all the job type and some may not be relevant some job type which are not interested. This could also lead to more cardinality. We could also enable metrics emission for on specific job type going forward.

Copy link
Member

@abhisheknath2011 abhisheknath2011 Jan 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also I commented on the other PR and this metric may not be needed to start with. We are emitting the final status and that should capture the status of a triggered job. We can actually avoid this additional metric.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In cases where the maintenance job is skipped, the operationTask is not submitted. This method simply returns an empty Task list without submitting the task. So, operationTask.submitJob is not called at all.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maintenance_job_skipped + maintenance_job_completed should give the total number. We can submit maintenance_job_skipped to get skip count if needed. Skip maintenance is based on config or policy is not present etc.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally, yes. But there is one more code path where the reportJobStatus is not called. In this case, the maintenance_job_completed would not be registered. Given this, I feel like having all the 3 metrics makes debugging easier. Thoughts ?

Copy link
Member

@abhisheknath2011 abhisheknath2011 Jan 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Empty state is rare failure scenario and skipped is returned for that. So we can report SKIPPED. That way we can avoid one additional metric. I am mainly concern on the cardinality and scrapping limit. We can incrementally add additional metrics by observing how it behaves.

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.

2 participants