Search in sources :

Example 1 with ClusterInfo

use of com.redhat.devtools.intellij.common.kubernetes.ClusterInfo in project intellij-tekton by redhat-developer.

the class TknCli method reportTelemetry.

private void reportTelemetry() {
    TelemetryMessageBuilder.ActionMessage telemetry = TelemetryService.instance().action(TelemetryService.NAME_PREFIX_MISC + "login");
    try {
        ClusterInfo info = ClusterHelper.getClusterInfo(client);
        telemetry.property(KUBERNETES_VERSION, info.getKubernetesVersion());
        telemetry.property(IS_OPENSHIFT, Boolean.toString(info.isOpenshift()));
        telemetry.property(OPENSHIFT_VERSION, info.getOpenshiftVersion());
        telemetry.send();
    } catch (RuntimeException e) {
        // do not send telemetry when there is no context ( ie default kube URL as master URL )
        try {
            // workaround to not send null values
            if (e.getMessage() != null) {
                telemetry.error(e).send();
            } else {
                telemetry.error(e.toString()).send();
            }
        } catch (RuntimeException ex) {
            LOGGER.warn(ex.getLocalizedMessage(), ex);
        }
    }
}
Also used : ClusterInfo(com.redhat.devtools.intellij.common.kubernetes.ClusterInfo) TelemetryMessageBuilder(com.redhat.devtools.intellij.telemetry.core.service.TelemetryMessageBuilder)

Example 2 with ClusterInfo

use of com.redhat.devtools.intellij.common.kubernetes.ClusterInfo in project intellij-openshift-connector by redhat-developer.

the class OdoCli method reportTelemetry.

private void reportTelemetry() {
    TelemetryMessageBuilder.ActionMessage telemetry = TelemetryService.instance().getBuilder().action(TelemetryService.NAME_PREFIX_MISC + "login");
    try {
        ClusterInfo info = ClusterHelper.getClusterInfo(client);
        telemetry.property(KUBERNETES_VERSION, info.getKubernetesVersion());
        telemetry.property(IS_OPENSHIFT, Boolean.toString(info.isOpenshift()));
        telemetry.property(OPENSHIFT_VERSION, info.getOpenshiftVersion());
        telemetry.send();
    } catch (RuntimeException e) {
        // do not send telemetry when there is no context ( ie default kube URL as master URL )
        if (!e.getMessage().startsWith(Constants.DEFAULT_KUBE_URL)) {
            // workaround to not send null values
            if (e.getMessage() != null) {
                telemetry.error(e).send();
            } else {
                telemetry.error(e.toString()).send();
            }
        }
    }
}
Also used : ClusterInfo(com.redhat.devtools.intellij.common.kubernetes.ClusterInfo) TelemetryMessageBuilder(com.redhat.devtools.intellij.telemetry.core.service.TelemetryMessageBuilder)

Aggregations

ClusterInfo (com.redhat.devtools.intellij.common.kubernetes.ClusterInfo)2 TelemetryMessageBuilder (com.redhat.devtools.intellij.telemetry.core.service.TelemetryMessageBuilder)2