|
7 | 7 |
|
8 | 8 | import io.javaoperatorsdk.operator.api.monitoring.Metrics;
|
9 | 9 | import io.javaoperatorsdk.operator.api.reconciler.RetryInfo;
|
10 |
| -import io.javaoperatorsdk.operator.processing.event.CustomResourceID; |
11 | 10 | import io.javaoperatorsdk.operator.processing.event.Event;
|
| 11 | +import io.javaoperatorsdk.operator.processing.event.ResourceID; |
12 | 12 | import io.micrometer.core.instrument.MeterRegistry;
|
13 | 13 | import io.micrometer.core.instrument.Timer;
|
14 | 14 |
|
@@ -53,38 +53,38 @@ public void receivedEvent(Event event) {
|
53 | 53 | }
|
54 | 54 |
|
55 | 55 | @Override
|
56 |
| - public void cleanupDoneFor(CustomResourceID customResourceUid) { |
| 56 | + public void cleanupDoneFor(ResourceID customResourceUid) { |
57 | 57 | incrementCounter(customResourceUid, "events.delete");
|
58 | 58 | }
|
59 | 59 |
|
60 |
| - public void reconcileCustomResource(CustomResourceID customResourceID, |
| 60 | + public void reconcileCustomResource(ResourceID resourceID, |
61 | 61 | RetryInfo retryInfo) {
|
62 |
| - incrementCounter(customResourceID, RECONCILIATIONS + "started", |
| 62 | + incrementCounter(resourceID, RECONCILIATIONS + "started", |
63 | 63 | RECONCILIATIONS + "retries.number", "" + retryInfo.getAttemptCount(),
|
64 | 64 | RECONCILIATIONS + "retries.last", "" + retryInfo.isLastAttempt());
|
65 | 65 | }
|
66 | 66 |
|
67 | 67 | @Override
|
68 |
| - public void finishedReconciliation(CustomResourceID customResourceID) { |
69 |
| - incrementCounter(customResourceID, RECONCILIATIONS + "success"); |
| 68 | + public void finishedReconciliation(ResourceID resourceID) { |
| 69 | + incrementCounter(resourceID, RECONCILIATIONS + "success"); |
70 | 70 | }
|
71 | 71 |
|
72 |
| - public void failedReconciliation(CustomResourceID customResourceID, RuntimeException exception) { |
| 72 | + public void failedReconciliation(ResourceID resourceID, RuntimeException exception) { |
73 | 73 | var cause = exception.getCause();
|
74 | 74 | if (cause == null) {
|
75 | 75 | cause = exception;
|
76 | 76 | } else if (cause instanceof RuntimeException) {
|
77 | 77 | cause = cause.getCause() != null ? cause.getCause() : cause;
|
78 | 78 | }
|
79 |
| - incrementCounter(customResourceID, RECONCILIATIONS + "failed", "exception", |
| 79 | + incrementCounter(resourceID, RECONCILIATIONS + "failed", "exception", |
80 | 80 | cause.getClass().getSimpleName());
|
81 | 81 | }
|
82 | 82 |
|
83 | 83 | public <T extends Map<?, ?>> T monitorSizeOf(T map, String name) {
|
84 | 84 | return registry.gaugeMapSize(PREFIX + name + ".size", Collections.emptyList(), map);
|
85 | 85 | }
|
86 | 86 |
|
87 |
| - private void incrementCounter(CustomResourceID id, String counterName, String... additionalTags) { |
| 87 | + private void incrementCounter(ResourceID id, String counterName, String... additionalTags) { |
88 | 88 | var tags = List.of(
|
89 | 89 | "name", id.getName(),
|
90 | 90 | "name", id.getName(), "namespace", id.getNamespace().orElse(""),
|
|
0 commit comments