Skip to content

Commit

Permalink
Merge pull request #43 from sourceplusplus/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
BFergerson authored Mar 13, 2022
2 parents 272f95e + 1ccc1a8 commit b8de8cc
Show file tree
Hide file tree
Showing 28 changed files with 447 additions and 241 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
kotlin.code.style=official

projectVersion=0.4.1
projectVersion=0.4.2

kotlinVersion=1.6.10
vertxVersion=4.2.4
Expand Down
67 changes: 0 additions & 67 deletions src/commonMain/kotlin/spp.protocol/Serializers.kt

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
package spp.protocol.artifact

import kotlinx.serialization.Serializable
import spp.protocol.Serializers.ArtifactTypeSerializer

/**
* todo: description.
Expand All @@ -30,7 +29,6 @@ import spp.protocol.Serializers.ArtifactTypeSerializer
data class ArtifactQualifiedName(
val identifier: String,
val commitId: String? = null,
@Serializable(with = ArtifactTypeSerializer::class)
val type: ArtifactType,
val lineNumber: Int? = null,
val operationName: String? = null //todo: only method artifacts need
Expand Down
4 changes: 2 additions & 2 deletions src/commonMain/kotlin/spp.protocol/artifact/log/Log.kt
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
package spp.protocol.artifact.log

import kotlinx.datetime.Instant
import kotlinx.datetime.serializers.InstantIso8601Serializer
import kotlinx.serialization.Serializable
import spp.protocol.Serializers
import spp.protocol.artifact.exception.LiveStackTrace

/**
Expand All @@ -30,7 +30,7 @@ import spp.protocol.artifact.exception.LiveStackTrace
*/
@Serializable
data class Log(
@Serializable(with = Serializers.InstantKSerializer::class)
@Serializable(with = InstantIso8601Serializer::class)
val timestamp: Instant,
val content: String,
val level: String,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
package spp.protocol.artifact.log

import kotlinx.datetime.Instant
import kotlinx.datetime.serializers.InstantIso8601Serializer
import kotlinx.serialization.Serializable
import spp.protocol.Serializers

/**
* todo: description.
Expand All @@ -29,7 +29,7 @@ import spp.protocol.Serializers
*/
@Serializable
data class LogCountSummary(
@Serializable(with = Serializers.InstantKSerializer::class)
@Serializable(with = InstantIso8601Serializer::class)
val timestamp: Instant,
val logCounts: Map<String, Int>
)
4 changes: 2 additions & 2 deletions src/commonMain/kotlin/spp.protocol/artifact/log/LogResult.kt
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
package spp.protocol.artifact.log

import kotlinx.datetime.Instant
import kotlinx.datetime.serializers.InstantIso8601Serializer
import kotlinx.serialization.Serializable
import spp.protocol.Serializers
import spp.protocol.artifact.ArtifactQualifiedName

/**
Expand All @@ -32,7 +32,7 @@ import spp.protocol.artifact.ArtifactQualifiedName
data class LogResult(
val artifactQualifiedName: ArtifactQualifiedName? = null,
val orderType: LogOrderType,
@Serializable(with = Serializers.InstantKSerializer::class)
@Serializable(with = InstantIso8601Serializer::class)
val timestamp: Instant,
val logs: List<Log> = emptyList(),
val total: Int = 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
package spp.protocol.artifact.metrics

import kotlinx.datetime.Instant
import kotlinx.datetime.serializers.InstantIso8601Serializer
import kotlinx.serialization.Serializable
import spp.protocol.Serializers
import spp.protocol.artifact.ArtifactQualifiedName
import spp.protocol.artifact.QueryTimeFrame

Expand All @@ -34,9 +34,9 @@ data class ArtifactMetricResult(
val artifactQualifiedName: ArtifactQualifiedName,
val timeFrame: QueryTimeFrame,
val focus: MetricType,
@Serializable(with = Serializers.InstantKSerializer::class)
@Serializable(with = InstantIso8601Serializer::class)
val start: Instant,
@Serializable(with = Serializers.InstantKSerializer::class)
@Serializable(with = InstantIso8601Serializer::class)
val stop: Instant,
val step: String,
val artifactMetrics: List<ArtifactMetrics>,
Expand Down
12 changes: 12 additions & 0 deletions src/commonMain/kotlin/spp.protocol/artifact/metrics/MetricType.kt
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,18 @@ enum class MetricType {
|| this == ResponseTime_75Percentile
|| this == ResponseTime_50Percentile

val simpleName: String
get() = when (this) {
Throughput_Average -> "Throughput"
ResponseTime_Average -> "Response"
ServiceLevelAgreement_Average -> "SLA"
ResponseTime_99Percentile -> "Resp(99%)"
ResponseTime_95Percentile -> "Resp(95%)"
ResponseTime_90Percentile -> "Resp(90%)"
ResponseTime_75Percentile -> "Resp(75%)"
ResponseTime_50Percentile -> "Resp(50%)"
}

companion object {
//todo: remove
fun realValueOf(name: String): MetricType {
Expand Down
4 changes: 2 additions & 2 deletions src/commonMain/kotlin/spp.protocol/artifact/trace/Trace.kt
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
package spp.protocol.artifact.trace

import kotlinx.datetime.Instant
import kotlinx.datetime.serializers.InstantIso8601Serializer
import kotlinx.serialization.Serializable
import spp.protocol.Serializers

/**
* todo: description.
Expand All @@ -32,7 +32,7 @@ data class Trace(
val key: String? = null,
val operationNames: List<String>,
val duration: Int,
@Serializable(with = Serializers.InstantKSerializer::class)
@Serializable(with = InstantIso8601Serializer::class)
val start: Instant,
val error: Boolean? = null,
val traceIds: List<String>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
package spp.protocol.artifact.trace

import kotlinx.datetime.Instant
import kotlinx.datetime.serializers.InstantIso8601Serializer
import kotlinx.serialization.Serializable
import spp.protocol.Serializers
import spp.protocol.artifact.ArtifactQualifiedName

/**
Expand All @@ -33,9 +33,9 @@ data class TraceResult(
val artifactQualifiedName: ArtifactQualifiedName,
val artifactSimpleName: String? = null,
val orderType: TraceOrderType,
@Serializable(with = Serializers.InstantKSerializer::class)
@Serializable(with = InstantIso8601Serializer::class)
val start: Instant,
@Serializable(with = Serializers.InstantKSerializer::class)
@Serializable(with = InstantIso8601Serializer::class)
val stop: Instant,
val step: String,
val traces: List<Trace>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
package spp.protocol.artifact.trace

import kotlinx.datetime.Instant
import kotlinx.datetime.serializers.InstantIso8601Serializer
import kotlinx.serialization.Serializable
import spp.protocol.Serializers
import spp.protocol.artifact.ArtifactQualifiedName

/**
Expand All @@ -37,9 +37,9 @@ data class TraceSpan(
val refs: List<TraceSpanRef> = emptyList(),
val serviceCode: String,
val serviceInstanceName: String? = null,
@Serializable(with = Serializers.InstantKSerializer::class)
@Serializable(with = InstantIso8601Serializer::class)
val startTime: Instant,
@Serializable(with = Serializers.InstantKSerializer::class)
@Serializable(with = InstantIso8601Serializer::class)
val endTime: Instant,
val endpointName: String? = null,
val artifactQualifiedName: ArtifactQualifiedName? = null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
package spp.protocol.artifact.trace

import kotlinx.datetime.Instant
import kotlinx.datetime.serializers.InstantIso8601Serializer
import kotlinx.serialization.Serializable
import spp.protocol.Serializers

/**
* todo: description.
Expand All @@ -29,7 +29,7 @@ import spp.protocol.Serializers
*/
@Serializable
data class TraceSpanLogEntry(
@Serializable(with = Serializers.InstantKSerializer::class)
@Serializable(with = InstantIso8601Serializer::class)
val time: Instant,
val data: String
)
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
package spp.protocol.instrument.event

import kotlinx.datetime.Instant
import kotlinx.datetime.serializers.InstantIso8601Serializer
import kotlinx.serialization.Serializable
import spp.protocol.Serializers
import spp.protocol.artifact.exception.LiveStackTrace

/**
Expand All @@ -32,7 +32,7 @@ import spp.protocol.artifact.exception.LiveStackTrace
data class LiveBreakpointHit(
val breakpointId: String,
val traceId: String,
@Serializable(with = Serializers.InstantKSerializer::class)
@Serializable(with = InstantIso8601Serializer::class)
override val occurredAt: Instant,
val serviceInstance: String,
val service: String,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
package spp.protocol.instrument.event

import kotlinx.datetime.Instant
import kotlinx.datetime.serializers.InstantIso8601Serializer
import kotlinx.serialization.Serializable
import spp.protocol.Serializers
import spp.protocol.artifact.exception.LiveStackTrace
import spp.protocol.instrument.LiveInstrument

Expand All @@ -32,7 +32,7 @@ import spp.protocol.instrument.LiveInstrument
@Serializable
data class LiveInstrumentRemoved(
val liveInstrument: LiveInstrument,
@Serializable(with = Serializers.InstantKSerializer::class)
@Serializable(with = InstantIso8601Serializer::class)
override val occurredAt: Instant,
val cause: LiveStackTrace? = null
) : TrackedLiveEvent
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
package spp.protocol.instrument.event

import kotlinx.datetime.Instant
import kotlinx.datetime.serializers.InstantIso8601Serializer
import kotlinx.serialization.Serializable
import spp.protocol.Serializers
import spp.protocol.artifact.log.LogResult

/**
Expand All @@ -31,7 +31,7 @@ import spp.protocol.artifact.log.LogResult
@Serializable
data class LiveLogHit(
val logId: String,
@Serializable(with = Serializers.InstantKSerializer::class)
@Serializable(with = InstantIso8601Serializer::class)
override val occurredAt: Instant,
val serviceInstance: String,
val service: String,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
package spp.protocol.instrument.event

import kotlinx.datetime.Instant
import kotlinx.datetime.serializers.InstantIso8601Serializer
import kotlinx.serialization.Serializable

/**
* todo: description.
Expand All @@ -26,5 +28,6 @@ import kotlinx.datetime.Instant
* @author [Brandon Fergerson](mailto:[email protected])
*/
interface TrackedLiveEvent {
@Serializable(with = InstantIso8601Serializer::class)
val occurredAt: Instant
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,30 +15,24 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package spp.protocol.service
package spp.protocol.portal

import io.vertx.codegen.annotations.ProxyGen
import io.vertx.codegen.annotations.VertxGen
import io.vertx.core.Future
import io.vertx.core.json.JsonObject
import kotlinx.datetime.Instant
import spp.protocol.instrument.DurationStep
import kotlinx.serialization.Contextual
import kotlinx.serialization.Serializable
import spp.protocol.artifact.ArtifactQualifiedName

/**
* todo: description.
*
* @since 0.2.1
* @author [Brandon Fergerson](mailto:[email protected])
*/
@ProxyGen
@VertxGen
interface LogCountIndicatorService {
@Serializable
data class PortalConfiguration(
var artifactQualifiedName: ArtifactQualifiedName,
var darkMode: Boolean = false,
var external: Boolean = false,
var config: MutableMap<String, @Contextual Any> = mutableMapOf()
) {
fun <T> get(key: String): T {
return config[key] as T
}

fun getPatternOccurrences(
logPatterns: List<String>,
serviceName: String?,
start: Instant,
stop: Instant,
step: DurationStep
): Future<JsonObject>
fun <T> get(key: String, default: T): T {
return config[key] as T ?: default
}
}
2 changes: 1 addition & 1 deletion src/commonMain/kotlin/spp.protocol/view/LiveViewConfig.kt
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,5 @@ import kotlinx.serialization.Serializable
data class LiveViewConfig(
val viewName: String,
val viewMetrics: List<String>,
val refreshRateLimit: Int = 1000 //limit of once per X milliseconds
val refreshRateLimit: Int = -1 //limit of once per X milliseconds
)
Loading

0 comments on commit b8de8cc

Please sign in to comment.