Skip to content

Commit

Permalink
use inspectit default actions for execution time
Browse files Browse the repository at this point in the history
  • Loading branch information
EddeCCC committed Aug 26, 2024
1 parent 2e721f1 commit a1ce32f
Showing 1 changed file with 6 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ import rocks.inspectit.ocelot.agentconfiguration.ObjectStructureMerger
import java.time.Duration
import java.util.*

/**
* This got kinda messy. I'm so sorry...
*/
@Mapper
@Component
class InspectItOcelotInstrumentationPlanMapper {
Expand Down Expand Up @@ -165,7 +168,6 @@ class InspectItOcelotInstrumentationPlanMapper {
val type = it.measurementType
val instrumentType = it.instrumentType


val definitionNameTemplate = getMetricNameTemplateFromType(type)

val viewBuilders = mutableMapOf<String, ViewDefinitionSettingsBuilder>()
Expand Down Expand Up @@ -234,15 +236,6 @@ class InspectItOcelotInstrumentationPlanMapper {
}
}

private fun getMetricFromType(settings: MetricsSettings, type: MeasurementType): MetricDefinitionSettings {
val name = getMetricNameTemplateFromType(type).format("")

return settings.definitions.computeIfAbsent(name) {
throw IllegalArgumentException("Metric with name $name not found")
}
}


private fun generateScopes(
dam: DomainArchitectureMapping,
instrumentation: ServiceMonitoringConfiguration
Expand Down Expand Up @@ -304,7 +297,6 @@ class InspectItOcelotInstrumentationPlanMapper {
return scopes.toImmutableMap()
}


//how to instrument (e.g. java code how to measure)
private fun generateActions(
dam: DomainArchitectureMapping,
Expand Down Expand Up @@ -446,9 +438,10 @@ class InspectItOcelotInstrumentationPlanMapper {

val instrumentationRuleSettings = InstrumentationRuleSettings().apply {
this.include = mapOf(Pair("r_trace_method", true))
this.entry = mapOf(getSimpleAction("method_entry_time", "a_timestamp_ms"))
// Use the inspectIT default actions
this.entry = mapOf(getSimpleAction("method_entry_time", "a_timing_nanos"))
this.exit = mapOf(Pair("duration", ActionCallSettings().apply {
this.action = "a_calculate_time_difference"
this.action = "a_timing_elapsedMillis"
this.dataInput = mapOf(Pair("timestamp", "method_entry_time"))
}))
this.scopes = mapOf(Pair(instrument.location.toScopeName(), true))
Expand Down Expand Up @@ -544,7 +537,6 @@ class InspectItOcelotInstrumentationPlanMapper {
)
}


return InstrumentationRuleSettings().apply {
this.scopes = scopes
this.tracing = tracingSettings
Expand Down

0 comments on commit a1ce32f

Please sign in to comment.