Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions instrumentation/slowrendering/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ dependencies {
implementation(project(":session"))
implementation(project(":common"))
implementation(project(":agent-api"))
implementation(project(":semconv"))
implementation(libs.androidx.core)
implementation(libs.opentelemetry.semconv.kotlin)
implementation(libs.opentelemetry.sdk)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,8 @@ package io.opentelemetry.android.instrumentation.slowrendering

import android.util.Log
import io.opentelemetry.android.common.RumConstants
import io.opentelemetry.api.common.Attributes
import io.opentelemetry.android.semconv.events.AppJankEvent
import io.opentelemetry.api.logs.Logger
import io.opentelemetry.kotlin.semconv.AppAttributes.APP_JANK_FRAME_COUNT
import io.opentelemetry.kotlin.semconv.AppAttributes.APP_JANK_PERIOD
import io.opentelemetry.kotlin.semconv.AppAttributes.APP_JANK_THRESHOLD
import io.opentelemetry.kotlin.semconv.IncubatingApi

internal class EventJankReporter(
Expand Down Expand Up @@ -41,18 +38,13 @@ internal class EventJankReporter(
}

if (frameCount > 0) {
val eventBuilder = eventLogger.logRecordBuilder()
val attributes =
Attributes
.builder()
.put(APP_JANK_FRAME_COUNT, frameCount)
.put(APP_JANK_PERIOD, periodSeconds)
.put(APP_JANK_THRESHOLD, threshold)
.build()
eventBuilder
.setEventName("app.jank")
.setAllAttributes(attributes)
.emit()
AppJankEvent(
appJankFrameCount = frameCount,
appJankPeriod = periodSeconds,
appJankThreshold = threshold,
).emit(
logger = eventLogger,
)
}
}
}
9 changes: 9 additions & 0 deletions semconv/model/android/registry.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
# Imports events defined in dependency registries, by event name, so event classes are
# generated for them in this module. Code is only generated for definitions that are part
# of this registry, so each upstream event to generate must be imported explicitly.
imports:
events:
- app.jank
- app.screen.click
- app.widget.click
- device.app.lifecycle
groups:
- id: registry.android.semconv
type: attribute_group
Expand Down