16
16
import com .fasterxml .jackson .databind .ObjectMapper ;
17
17
import com .fasterxml .jackson .databind .deser .std .StdNodeBasedDeserializer ;
18
18
import com .fasterxml .jackson .databind .module .SimpleModule ;
19
+ import com .redhat .devtools .intellij .common .kubernetes .ClusterHelper ;
20
+ import com .redhat .devtools .intellij .common .kubernetes .ClusterInfo ;
19
21
import com .redhat .devtools .intellij .common .utils .ExecHelper ;
20
22
import com .redhat .devtools .intellij .common .utils .NetworkUtils ;
23
+ import com .redhat .devtools .intellij .telemetry .core .service .TelemetryMessageBuilder ;
21
24
import io .fabric8 .kubernetes .api .model .ConfigMap ;
22
25
import io .fabric8 .kubernetes .api .model .LabelSelector ;
23
26
import io .fabric8 .kubernetes .api .model .LabelSelectorBuilder ;
33
36
import io .fabric8 .servicecatalog .client .ServiceCatalogClient ;
34
37
import org .apache .commons .lang3 .StringUtils ;
35
38
import org .jboss .tools .intellij .openshift .KubernetesLabels ;
39
+ import org .jboss .tools .intellij .openshift .telemetry .TelemetryService ;
36
40
import org .slf4j .Logger ;
37
41
import org .slf4j .LoggerFactory ;
38
42
58
62
import static org .jboss .tools .intellij .openshift .Constants .OCP4_CONSOLE_URL_KEY_NAME ;
59
63
import static org .jboss .tools .intellij .openshift .Constants .PLUGIN_FOLDER ;
60
64
import static org .jboss .tools .intellij .openshift .KubernetesLabels .NAME_LABEL ;
65
+ import static org .jboss .tools .intellij .openshift .telemetry .TelemetryService .IS_OPENSHIFT ;
66
+ import static org .jboss .tools .intellij .openshift .telemetry .TelemetryService .KUBERNETES_VERSION ;
67
+ import static org .jboss .tools .intellij .openshift .telemetry .TelemetryService .OPENSHIFT_VERSION ;
61
68
62
69
public class OdoCli implements Odo {
63
70
@@ -82,8 +89,23 @@ public class OdoCli implements Odo {
82
89
} catch (URISyntaxException e ) {
83
90
this .envVars = Collections .emptyMap ();
84
91
}
92
+ reportTelemetry ();
85
93
}
86
94
95
+ private void reportTelemetry () {
96
+ TelemetryMessageBuilder .ActionMessage telemetry = TelemetryService .instance ().getBuilder ().action (TelemetryService .NAME_PREFIX_MISC + "login" );
97
+ try {
98
+ ClusterInfo info = ClusterHelper .getClusterInfo (client );
99
+ telemetry .property (KUBERNETES_VERSION , info .getKubernetesVersion ());
100
+ telemetry .property (IS_OPENSHIFT , Boolean .toString (info .isOpenshift ()));
101
+ telemetry .property (OPENSHIFT_VERSION , info .getOpenshiftVersion ());
102
+ telemetry .send ();
103
+ } catch (RuntimeException e ) {
104
+ telemetry .error (e ).send ();
105
+ }
106
+ }
107
+
108
+
87
109
private ObjectMapper configureObjectMapper (final StdNodeBasedDeserializer <? extends List <?>> deserializer ) {
88
110
final SimpleModule module = new SimpleModule ();
89
111
module .addDeserializer (List .class , deserializer );
0 commit comments