@@ -109,14 +109,15 @@ private void emitSrcIdDstIdToReleaseStagesMetric(final UUID srcId, final UUID ds
109
109
@ Override
110
110
public AttemptCreationOutput createNewAttempt (final AttemptCreationInput input ) throws RetryableException {
111
111
try {
112
- final Job createdJob = jobPersistence .getJob (input .getJobId ());
112
+ final long jobId = input .getJobId ();
113
+ final Job createdJob = jobPersistence .getJob (jobId );
113
114
114
115
final WorkerRun workerRun = temporalWorkerRunFactory .create (createdJob );
115
116
final Path logFilePath = workerRun .getJobRoot ().resolve (LogClientSingleton .LOG_FILENAME );
116
- final int persistedAttemptId = jobPersistence .createAttempt (input .getJobId (), logFilePath );
117
+ final int persistedAttemptId = jobPersistence .createAttempt (jobId , logFilePath );
118
+ emitJobIdToReleaseStagesMetric (MetricsRegistry .ATTEMPT_CREATED_BY_RELEASE_STAGE , jobId );
117
119
118
120
LogClientSingleton .getInstance ().setJobMdc (workerEnvironment , logConfigs , workerRun .getJobRoot ());
119
-
120
121
return new AttemptCreationOutput (persistedAttemptId );
121
122
} catch (final IOException e ) {
122
123
throw new RetryableException (e );
@@ -136,6 +137,7 @@ public void jobSuccess(final JobSuccessInput input) {
136
137
log .warn ("The job {} doesn't have any output for the attempt {}" , jobId , attemptId );
137
138
}
138
139
jobPersistence .succeedAttempt (jobId , attemptId );
140
+ emitJobIdToReleaseStagesMetric (MetricsRegistry .ATTEMPT_SUCCEEDED_BY_RELEASE_STAGE , jobId );
139
141
final Job job = jobPersistence .getJob (jobId );
140
142
141
143
jobNotifier .successJob (job );
@@ -164,14 +166,18 @@ public void jobFailure(final JobFailureInput input) {
164
166
@ Override
165
167
public void attemptFailure (final AttemptFailureInput input ) {
166
168
try {
167
- jobPersistence .failAttempt (input .getJobId (), input .getAttemptId ());
168
- jobPersistence .writeAttemptFailureSummary (input .getJobId (), input .getAttemptId (), input .getAttemptFailureSummary ());
169
+ final int attemptId = input .getAttemptId ();
170
+ final long jobId = input .getJobId ();
171
+
172
+ jobPersistence .failAttempt (jobId , attemptId );
173
+ jobPersistence .writeAttemptFailureSummary (jobId , attemptId , input .getAttemptFailureSummary ());
169
174
170
175
if (input .getStandardSyncOutput () != null ) {
171
176
final JobOutput jobOutput = new JobOutput ().withSync (input .getStandardSyncOutput ());
172
- jobPersistence .writeOutput (input . getJobId (), input . getAttemptId () , jobOutput );
177
+ jobPersistence .writeOutput (jobId , attemptId , jobOutput );
173
178
}
174
179
180
+ emitJobIdToReleaseStagesMetric (MetricsRegistry .ATTEMPT_FAILED_BY_RELEASE_STAGE , jobId );
175
181
} catch (final IOException e ) {
176
182
throw new RetryableException (e );
177
183
}
0 commit comments