本文整理汇总了Java中com.microsoft.applicationinsights.TelemetryClient类的典型用法代码示例。如果您正苦于以下问题:Java TelemetryClient类的具体用法?Java TelemetryClient怎么用?Java TelemetryClient使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TelemetryClient类属于com.microsoft.applicationinsights包,在下文中一共展示了TelemetryClient类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: startTelemetryClient
import com.microsoft.applicationinsights.TelemetryClient; //导入依赖的package包/类
private static void startTelemetryClient() {
TelemetryConfiguration telemetryConfiguration = TelemetryConfiguration.getActive();
telemetryConfiguration.setInstrumentationKey(Globals.BUILD_INFO.getAzureInstrumentationKey());
telemetryConfiguration.setTrackingIsDisabled(!Globals.prefs.shouldCollectTelemetry());
telemetryClient = new TelemetryClient(telemetryConfiguration);
telemetryClient.getContext().getProperties().put("JabRef version", Globals.BUILD_INFO.getVersion().toString());
telemetryClient.getContext().getProperties().put("Java version", StandardSystemProperty.JAVA_VERSION.value());
telemetryClient.getContext().getUser().setId(Globals.prefs.getOrCreateUserId());
telemetryClient.getContext().getSession().setId(UUID.randomUUID().toString());
telemetryClient.getContext().getDevice().setOperatingSystem(StandardSystemProperty.OS_NAME.value());
telemetryClient.getContext().getDevice().setOperatingSystemVersion(StandardSystemProperty.OS_VERSION.value());
telemetryClient.getContext().getDevice().setScreenResolution(
Toolkit.getDefaultToolkit().getScreenSize().toString());
telemetryClient.trackSessionState(SessionState.Start);
}
开发者ID:JabRef,项目名称:jabref,代码行数:17,代码来源:Globals.java
示例2: create
import com.microsoft.applicationinsights.TelemetryClient; //导入依赖的package包/类
public static void create(String eventName, String version) {
String dataFile = WAHelper.getTemplateFile(message("dataFileName"));
if (new File(dataFile).exists()) {
String prefValue = DataOperations.getProperty(dataFile, message("prefVal"));
if (prefValue != null && !prefValue.isEmpty() && prefValue.equalsIgnoreCase("true")) {
TelemetryClient telemetry = new TelemetryClient();
telemetry.getContext().setInstrumentationKey("appinsights-instrumentation-key");
Map<String, String> properties = new HashMap<String, String>();
if (version != null && !version.isEmpty()) {
properties.put("Library Version", version);
}
String pluginVersion = DataOperations.getProperty(dataFile, message("pluginVersion"));
if (pluginVersion != null && !pluginVersion.isEmpty()) {
properties.put("Plugin Version", pluginVersion);
}
Map<String, Double> metrics = new HashMap<String, Double>();
String instID = DataOperations.getProperty(dataFile, message("instID"));
if (instID != null && !instID.isEmpty()) {
metrics.put("Installation ID", Double.parseDouble(instID));
}
telemetry.trackEvent(eventName, properties, metrics);
telemetry.flush();
}
}
}
开发者ID:Microsoft,项目名称:Azure-Toolkit-for-IntelliJ,代码行数:28,代码来源:AppInsightsCustomEvent.java
示例3: AppInsightsProxy
import com.microsoft.applicationinsights.TelemetryClient; //导入依赖的package包/类
public AppInsightsProxy(final TelemetryConfiguration config) {
// InstrumentationKey will be read from ApplicationInsights.xml
client = new TelemetryClient();
if (config == null) {
throw new NullPointerException();
}
configuration = config;
defaultProperties = configuration.getTelemetryProperties();
}
开发者ID:Microsoft,项目名称:azure-maven-plugins,代码行数:10,代码来源:AppInsightsProxy.java
示例4: TfsTelemetryHelper
import com.microsoft.applicationinsights.TelemetryClient; //导入依赖的package包/类
private TfsTelemetryHelper() {
final String skip = System.getProperties().getProperty("com.microsoft.alm.plugin.telemetry.skipClientInitialization");
if (StringUtils.isNotEmpty(skip) && StringUtils.equalsIgnoreCase(skip, "true")) {
// this flag is here for testing purposes in which case we do not want to create a telemetry channel
// or client.
return;
}
// Initialize the internal logger
final Map<String, String> loggerData = new HashMap<String, String>();
loggerData.put("Level", InternalLogger.LoggingLevel.ERROR.toString());
loggerData.put("UniquePrefix", UNIQUE_PREFIX);
loggerData.put("BaseFolder", BASE_FOLDER);
InternalLogger.INSTANCE.initialize(LoggerOutputType.FILE.toString(), loggerData);
// Initialize the active TelemetryConfiguration
ContextInitializer initializer = PluginServiceProvider.getInstance().getTelemetryContextInitializer();
TelemetryConfiguration.getActive().getContextInitializers().add(initializer);
// Create a channel to AppInsights
final TelemetryChannel channel = TelemetryConfiguration.getActive().getChannel();
if (channel != null) {
channel.setDeveloperMode(TfsTelemetryInstrumentationInfo.getInstance().isDeveloperMode());
} else {
logger.error("Failed to load telemetry channel");
return;
}
// Create the telemetry client and cache it for later use
logger.debug("AppInsights telemetry initialized");
logger.debug(MessageFormat.format(
" Developer Mode: {0}", TfsTelemetryInstrumentationInfo.getInstance().isDeveloperMode()));
logger.debug(MessageFormat.format(
" Production Environment: {0}", !TfsTelemetryInstrumentationInfo.getInstance().isTestKey()));
telemetryClient = new TelemetryClient();
}
开发者ID:Microsoft,项目名称:vso-intellij,代码行数:38,代码来源:TfsTelemetryHelper.java
示例5: initializeTelemetryClientMock
import com.microsoft.applicationinsights.TelemetryClient; //导入依赖的package包/类
private void initializeTelemetryClientMock() {
telemetryClientMock = mock(com.microsoft.applicationinsights.TelemetryClient.class);
Mockito.doAnswer(new Answer() {
@Override
public Object answer(InvocationOnMock invocation) throws Throwable {
Telemetry telemetry = ((Telemetry) invocation.getArguments()[0]);
telemetries.add(telemetry);
return null;
}
}).when(telemetryClientMock).track(Matchers.any(Telemetry.class));
}
开发者ID:Microsoft,项目名称:ApplicationInsights-Docker,代码行数:13,代码来源:ApplicationInsightsSenderTests.java
示例6: telemetryClient
import com.microsoft.applicationinsights.TelemetryClient; //导入依赖的package包/类
@Bean
public TelemetryClient telemetryClient(TelemetryConfiguration configuration) {
return new TelemetryClient(configuration);
}
开发者ID:gavlyukovskiy,项目名称:azure-application-insights-spring-boot-starter,代码行数:5,代码来源:ApplicationInsightsTelemetryAutoConfiguration.java
示例7: ApplicationInsightsSender
import com.microsoft.applicationinsights.TelemetryClient; //导入依赖的package包/类
protected ApplicationInsightsSender(TelemetryClient telemetryClient, TelemetryFactory telemetryFactory) {
this.telemetryClient = telemetryClient;
this.telemetryFactory = telemetryFactory;
}
开发者ID:Microsoft,项目名称:ApplicationInsights-Docker,代码行数:5,代码来源:ApplicationInsightsSender.java
示例8: initializeTelemetryClient
import com.microsoft.applicationinsights.TelemetryClient; //导入依赖的package包/类
private static TelemetryClient initializeTelemetryClient(String instrumentationKey) {
TelemetryConfiguration telemetryConfiguration = TelemetryConfiguration.getActive();
telemetryConfiguration.setInstrumentationKey(instrumentationKey);
return new TelemetryClient(telemetryConfiguration);
}
开发者ID:Microsoft,项目名称:ApplicationInsights-Docker,代码行数:6,代码来源:ApplicationInsightsSender.java
示例9: getTelemetryClient
import com.microsoft.applicationinsights.TelemetryClient; //导入依赖的package包/类
public static Optional<TelemetryClient> getTelemetryClient() {
return Optional.ofNullable(telemetryClient);
}
开发者ID:JabRef,项目名称:jabref,代码行数:4,代码来源:Globals.java
注:本文中的com.microsoft.applicationinsights.TelemetryClient类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论