use of org.eclipse.che.commons.annotation.Traced in project devspaces-images by redhat-developer.
the class ServiceAccountProvisioner method provision.
@Override
@Traced
public void provision(KubernetesEnvironment k8sEnv, RuntimeIdentity identity) throws InfrastructureException {
TracingTags.WORKSPACE_ID.set(identity::getWorkspaceId);
if (!isNullOrEmpty(serviceAccount)) {
for (PodData pod : k8sEnv.getPodsData().values()) {
pod.getSpec().setServiceAccountName(serviceAccount);
pod.getSpec().setAutomountServiceAccountToken(true);
}
}
}
use of org.eclipse.che.commons.annotation.Traced in project devspaces-images by redhat-developer.
the class OpenShiftInternalRuntime method startMachines.
@Override
@Traced
protected void startMachines() throws InfrastructureException {
OpenShiftEnvironment osEnv = getContext().getEnvironment();
String workspaceId = getContext().getIdentity().getWorkspaceId();
createSecrets(osEnv, workspaceId);
List<ConfigMap> createdConfigMaps = createConfigMaps(osEnv, getContext().getIdentity());
List<Service> createdServices = createServices(osEnv, workspaceId);
List<Route> createdRoutes = createRoutes(osEnv, workspaceId);
listenEvents();
doStartMachine(serverResolverFactory.create(createdServices, createdRoutes, createdConfigMaps));
}
use of org.eclipse.che.commons.annotation.Traced in project devspaces-images by redhat-developer.
the class RouteTlsProvisioner method provision.
@Override
@Traced
public void provision(OpenShiftEnvironment osEnv, RuntimeIdentity identity) {
TracingTags.WORKSPACE_ID.set(identity::getWorkspaceId);
if (!isTlsEnabled) {
return;
}
final Set<Route> routes = new HashSet<>(osEnv.getRoutes().values());
for (Route route : routes) {
useSecureProtocolForServers(route);
enableTls(route);
}
}
use of org.eclipse.che.commons.annotation.Traced in project devspaces-images by redhat-developer.
the class TracingInterceptor method getSpanName.
private String getSpanName(MethodInvocation invocation) {
Class<?> objectType = invocation.getThis().getClass();
Method method = invocation.getMethod();
// we assume that there won't be more than 4 traced methods on a type. If there are, we're
// adding a little bit of runtime overhead of enlarging the hashmap's capacity, but in the usual
// case we're saving 12 entries in the map (16 is the default capacity).
String ret = spanNames.computeIfAbsent(objectType, __ -> new WeakHashMap<>(4)).get(method);
if (ret != null) {
return ret;
}
Traced annotation = method.getAnnotation(Traced.class);
if (annotation == null) {
throw new IllegalStateException("Misconfigured Guice interception. Tracing interceptor called on method " + method + " that is not annotated with @Traced.");
}
String name = annotation.name();
if (name.isEmpty()) {
name = cleanName(objectType) + "#" + method.getName();
}
spanNames.get(objectType).put(method, name);
return name;
}
use of org.eclipse.che.commons.annotation.Traced in project devspaces-images by redhat-developer.
the class KubernetesInternalRuntime method internalStop.
@Traced
@Override
protected void internalStop(Map<String, String> stopOptions) throws InfrastructureException {
RuntimeIdentity identity = getContext().getIdentity();
TracingTags.WORKSPACE_ID.set(identity.getWorkspaceId());
runtimeHangingDetector.stopTracking(getContext().getIdentity());
if (startSynchronizer.interrupt()) {
// runtime is STARTING. Need to wait until start will be interrupted properly
try {
if (!startSynchronizer.awaitInterruption(workspaceStartTimeoutMin, TimeUnit.MINUTES)) {
// Runtime is not interrupted yet. It may occur when start was performing by another
// Che Server that is crashed so start is hung up in STOPPING phase.
// Need to clean up runtime resources
probeScheduler.cancel(identity.getWorkspaceId());
runtimeCleaner.cleanUp(namespace, identity.getWorkspaceId());
}
} catch (InterruptedException e) {
throw new InfrastructureException("Interrupted while waiting for start task cancellation", e);
}
} else {
// runtime is RUNNING. Clean up used resources
// Cancels workspace servers probes if any
probeScheduler.cancel(identity.getWorkspaceId());
runtimeCleaner.cleanUp(namespace, identity.getWorkspaceId());
}
}
Aggregations