use of com.microsoft.applicationinsights.agent.internal.exporter.models.MonitorBase in project ApplicationInsights-Java by microsoft.
the class TelemetryClient method initTelemetry.
private void initTelemetry(TelemetryItem telemetry, MonitorDomain data, String telemetryName, String baseType) {
telemetry.setVersion(1);
telemetry.setName(telemetryName);
telemetry.setInstrumentationKey(instrumentationKey);
telemetry.setTags(new HashMap<>(globalTags));
data.setVersion(2);
MonitorBase monitorBase = new MonitorBase();
telemetry.setData(monitorBase);
monitorBase.setBaseType(baseType);
monitorBase.setBaseData(data);
}
use of com.microsoft.applicationinsights.agent.internal.exporter.models.MonitorBase in project ApplicationInsights-Java by microsoft.
the class TestUtils method createMetricTelemetry.
public static TelemetryItem createMetricTelemetry(String name, int value, String instrumentationKey) {
TelemetryItem telemetry = new TelemetryItem();
telemetry.setVersion(1);
telemetry.setName("Metric");
telemetry.setInstrumentationKey(instrumentationKey);
Map<String, String> tags = new HashMap<>();
tags.put("ai.internal.sdkVersion", "test_version");
tags.put("ai.internal.nodeName", "test_role_name");
tags.put("ai.cloud.roleInstance", "test_cloud_name");
telemetry.setTags(tags);
MetricsData data = new MetricsData();
List<MetricDataPoint> dataPoints = new ArrayList<>();
MetricDataPoint dataPoint = new MetricDataPoint();
dataPoint.setDataPointType(DataPointType.MEASUREMENT);
dataPoint.setName(name);
dataPoint.setValue(value);
dataPoint.setCount(1);
dataPoints.add(dataPoint);
Map<String, String> properties = new HashMap<>();
properties.put("state", "blocked");
data.setMetrics(dataPoints);
data.setProperties(properties);
MonitorBase monitorBase = new MonitorBase();
monitorBase.setBaseType("MetricData");
monitorBase.setBaseData(data);
telemetry.setData(monitorBase);
telemetry.setTime(FormattedTime.offSetDateTimeFromNow());
return telemetry;
}
Aggregations