mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-06 11:50:54 +07:00
[telemetry metrics] Support Jaeger visualisation since it expects metrics in microseconds
GitOrigin-RevId: 8b1d7cc5a2dc9a3ead43d36552e6ebba9457f5a0
This commit is contained in:
committed by
intellij-monorepo-bot
parent
87cd8505ee
commit
bf7299d6ca
@@ -31,8 +31,10 @@
|
||||
"spanID": "809f150acd521f74",
|
||||
"operationName": "Attempt: 1",
|
||||
"processID": "p1",
|
||||
"startTime": 1700119096816631,
|
||||
"duration": 243012000,
|
||||
"startTime": 1700119096816,
|
||||
"duration": 243012,
|
||||
"startTimeNano": 1700119096816631,
|
||||
"durationNano": 243012000,
|
||||
"tags": [
|
||||
{
|
||||
"key": "Attempt status",
|
||||
@@ -58,8 +60,10 @@
|
||||
"spanID": "d904b99697b813b7",
|
||||
"operationName": "simple perf test",
|
||||
"processID": "p1",
|
||||
"startTime": 1700119096713000,
|
||||
"duration": 379215000,
|
||||
"startTime": 1700119096713,
|
||||
"duration": 379215,
|
||||
"startTimeNano": 1700119096713000,
|
||||
"durationNano": 379215000,
|
||||
"tags": [
|
||||
{
|
||||
"key": "warmup",
|
||||
@@ -73,8 +77,10 @@
|
||||
"spanID": "081a305a1f14d933",
|
||||
"operationName": "Attempt: 1",
|
||||
"processID": "p1",
|
||||
"startTime": 1700119097395956,
|
||||
"duration": 486235000,
|
||||
"startTime": 1700119097395,
|
||||
"duration": 486235,
|
||||
"startTimeNano": 1700119097395956,
|
||||
"durationNano": 486235000,
|
||||
"tags": [
|
||||
{
|
||||
"key": "Attempt status",
|
||||
@@ -95,8 +101,10 @@
|
||||
"spanID": "8e69596e1b91aa55",
|
||||
"operationName": "Attempt: 2",
|
||||
"processID": "p1",
|
||||
"startTime": 1700119098210549,
|
||||
"duration": 110988000,
|
||||
"startTime": 1700119098210,
|
||||
"duration": 110988,
|
||||
"startTimeNano": 1700119098210549,
|
||||
"durationNano": 110988000,
|
||||
"tags": [
|
||||
{
|
||||
"key": "Attempt status",
|
||||
@@ -117,8 +125,10 @@
|
||||
"spanID": "23c840e94caf056f",
|
||||
"operationName": "Attempt: 3",
|
||||
"processID": "p1",
|
||||
"startTime": 1700119098749467,
|
||||
"duration": 324189000,
|
||||
"startTime": 1700119098749,
|
||||
"duration": 324189,
|
||||
"startTimeNano": 1700119098749467,
|
||||
"durationNano": 324189000,
|
||||
"tags": [
|
||||
{
|
||||
"key": "Attempt status",
|
||||
@@ -139,8 +149,10 @@
|
||||
"spanID": "c1ccfdfe0001bb6a",
|
||||
"operationName": "simple perf test",
|
||||
"processID": "p1",
|
||||
"startTime": 1700119097093000,
|
||||
"duration": 2004871000,
|
||||
"startTime": 1700119097093,
|
||||
"duration": 2004871,
|
||||
"startTimeNano": 1700119097093000,
|
||||
"durationNano": 2004871000,
|
||||
"tags": [
|
||||
{
|
||||
"key": "warmup",
|
||||
|
||||
@@ -107,7 +107,8 @@ class SpanExtractionFromUnitPerfTest {
|
||||
jacksonObjectMapper().writerWithDefaultPrettyPrinter().writeValue(reportFile.toFile(), metricsDto)
|
||||
}
|
||||
|
||||
fun unitPerfTestsMetricsExtraction(testInfo: TestInfo) = runBlocking {
|
||||
@Test
|
||||
fun `unit perf test metrics extraction - nanosecond precision`(testInfo: TestInfo) = runBlocking {
|
||||
val mainMetricName = "simple perf test"
|
||||
|
||||
val extractedMetrics = BenchmarksSpanMetricsCollector(spanName = mainMetricName,
|
||||
|
||||
@@ -3,9 +3,10 @@
|
||||
package com.intellij.tools.ide.metrics.collector.telemetry
|
||||
|
||||
import kotlinx.serialization.Contextual
|
||||
import kotlinx.serialization.ExperimentalSerializationApi
|
||||
import kotlinx.serialization.Serializable
|
||||
import kotlinx.serialization.json.JsonNames
|
||||
import java.time.Instant
|
||||
import kotlin.math.roundToLong
|
||||
import kotlin.time.Duration
|
||||
|
||||
/**
|
||||
@@ -37,20 +38,28 @@ internal fun toSpanElement(span: SpanData): SpanElement {
|
||||
return SpanElement(
|
||||
isWarmup = isWarmup(tags),
|
||||
name = span.operationName,
|
||||
duration = span.duration,
|
||||
startTimestamp = span.startTime,
|
||||
duration = span.durationNano,
|
||||
startTimestamp = span.startTimeNano,
|
||||
spanId = span.spanID,
|
||||
parentSpanId = span.getParentSpanId(),
|
||||
tags = tags,
|
||||
)
|
||||
}
|
||||
|
||||
@OptIn(ExperimentalSerializationApi::class)
|
||||
@Serializable
|
||||
data class SpanData(
|
||||
@JvmField val spanID: String,
|
||||
@JvmField val operationName: String,
|
||||
@Contextual val duration: Duration,
|
||||
@Contextual val startTime: Instant,
|
||||
|
||||
// see com.intellij.platform.diagnostic.telemetry.exporters.JaegerJsonSpanExporter.export
|
||||
//@Serializable(with = DurationSerializer::class)
|
||||
@JsonNames("duration")
|
||||
@Contextual val durationNano: Duration,
|
||||
//@Serializable(with = InstantSerializer::class)
|
||||
@JsonNames("startTime")
|
||||
@Contextual val startTimeNano: Instant,
|
||||
|
||||
@JvmField val references: List<SpanRef> = emptyList(),
|
||||
@JvmField val tags: List<SpanTag> = emptyList(),
|
||||
)
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user