MECS-21328: Tenant metric label case unification (#2907)

This commit is contained in:
Desislava Marinova
2026-02-06 09:09:05 +02:00
committed by GitHub
parent 9f7ca0a3ed
commit ff21d788b3
3 changed files with 15 additions and 8 deletions

View File

@@ -12,6 +12,7 @@ package org.eclipse.hawkbit.repository.jpa.scheduler;
import static org.eclipse.hawkbit.context.AccessContext.asActor;
import static org.eclipse.hawkbit.context.AccessContext.withSecurityContext;
import static org.eclipse.hawkbit.tenancy.DefaultTenantConfiguration.TENANT_TAG;
import static org.eclipse.hawkbit.tenancy.DefaultTenantConfiguration.TENANT_TAG_VALUE_PROVIDER;
import java.util.Collections;
import java.util.List;
@@ -119,7 +120,7 @@ public class JpaAutoAssignHandler implements AutoAssignHandler {
} finally {
meterRegistry // handle single targetFilterQuery
.map(mReg -> mReg.timer(
"hawkbit.autoassign.handle", TENANT_TAG, AccessContext.tenant(), "targetFilterQuery",
"hawkbit.autoassign.handle", TENANT_TAG, TENANT_TAG_VALUE_PROVIDER.get(), "targetFilterQuery",
String.valueOf(targetFilterQuery.getId())))
.ifPresent(timer -> timer.record(System.nanoTime() - startNanoPartial, TimeUnit.NANOSECONDS));
}
@@ -132,7 +133,7 @@ public class JpaAutoAssignHandler implements AutoAssignHandler {
// only if there is at least one targetFilterQuery and lock has been obtained then will be measured (as in rollouts)
meterRegistry // handle single targetFilterQuery for single target
.map(mReg -> mReg.timer(
"hawkbit.autoassign.handle.all", TENANT_TAG, AccessContext.tenant()))
"hawkbit.autoassign.handle.all", TENANT_TAG, TENANT_TAG_VALUE_PROVIDER.get()))
.ifPresent(timer -> timer.record(System.nanoTime() - startNano, TimeUnit.NANOSECONDS));
log.debug("Auto assign check all targets finished");
}
@@ -151,7 +152,7 @@ public class JpaAutoAssignHandler implements AutoAssignHandler {
} finally {
meterRegistry // handle single targetFilterQuery for single target
.map(mReg -> mReg.timer(
"hawkbit.autoassign.handle.single", TENANT_TAG, AccessContext.tenant(), "targetFilterQuery",
"hawkbit.autoassign.handle.single", TENANT_TAG, TENANT_TAG_VALUE_PROVIDER.get(), "targetFilterQuery",
String.valueOf(targetFilterQuery.getId())))
.ifPresent(timer -> timer.record(System.nanoTime() - startNanoPartial, TimeUnit.NANOSECONDS));
}
@@ -159,7 +160,7 @@ public class JpaAutoAssignHandler implements AutoAssignHandler {
meterRegistry // handle single targetFilterQuery for single target
.map(mReg -> mReg.timer(
"hawkbit.autoassign.handle.single.all", TENANT_TAG, AccessContext.tenant()))
"hawkbit.autoassign.handle.single.all", TENANT_TAG, TENANT_TAG_VALUE_PROVIDER.get()))
.ifPresent(timer -> timer.record(System.nanoTime() - startNano, TimeUnit.NANOSECONDS));
log.debug("Auto assign check call for device {} finished", controllerId);
}

View File

@@ -10,6 +10,7 @@
package org.eclipse.hawkbit.repository.jpa.scheduler;
import static org.eclipse.hawkbit.tenancy.DefaultTenantConfiguration.TENANT_TAG;
import static org.eclipse.hawkbit.tenancy.DefaultTenantConfiguration.TENANT_TAG_VALUE_PROVIDER;
import java.util.List;
import java.util.Optional;
@@ -91,7 +92,7 @@ public class JpaRolloutHandler implements RolloutHandler {
log.trace("Unlock lock {}", lock);
}
meterRegistry // handle all rollouts of a tenant
.map(mReg -> mReg.timer("hawkbit.rollout.handle.all", TENANT_TAG, AccessContext.tenant()))
.map(mReg -> mReg.timer("hawkbit.rollout.handle.all", TENANT_TAG, TENANT_TAG_VALUE_PROVIDER.get()))
.ifPresent(timer -> timer.record(System.nanoTime() - startNano, TimeUnit.NANOSECONDS));
}
}
@@ -113,7 +114,7 @@ public class JpaRolloutHandler implements RolloutHandler {
meterRegistry // handle single rollout
.map(mReg -> mReg.timer(
"hawkbit.rollout.handle", TENANT_TAG, AccessContext.tenant(), "rollout", String.valueOf(rolloutId)))
"hawkbit.rollout.handle", TENANT_TAG, TENANT_TAG_VALUE_PROVIDER.get(), "rollout", String.valueOf(rolloutId)))
.ifPresent(timer -> timer.record(System.nanoTime() - startNano, TimeUnit.NANOSECONDS));
}
}