Skip to content

Commit

Permalink
fix(deps): update spotless packages to v7 (major) (#13004)
Browse files Browse the repository at this point in the history
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Lauri Tulmin <[email protected]>
  • Loading branch information
renovate[bot] and laurit authored Jan 8, 2025
1 parent ae3f6ac commit c22bb59
Show file tree
Hide file tree
Showing 41 changed files with 333 additions and 425 deletions.
2 changes: 1 addition & 1 deletion benchmark-overhead/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
plugins {
id("java")
id("com.diffplug.spotless") version "6.25.0"
id("com.diffplug.spotless") version "7.0.1"
}

spotless {
Expand Down
4 changes: 2 additions & 2 deletions conventions/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
plugins {
`kotlin-dsl`
// When updating, update below in dependencies too
id("com.diffplug.spotless") version "6.25.0"
id("com.diffplug.spotless") version "7.0.1"
}

spotless {
Expand Down Expand Up @@ -54,7 +54,7 @@ dependencies {
implementation("org.apache.maven:maven-aether-provider:3.3.9")

// When updating, update above in plugins too
implementation("com.diffplug.spotless:spotless-plugin-gradle:6.25.0")
implementation("com.diffplug.spotless:spotless-plugin-gradle:7.0.1")
implementation("com.google.guava:guava:33.4.0-jre")
implementation("gradle.plugin.com.google.protobuf:protobuf-gradle-plugin:0.8.18")
implementation("com.gradleup.shadow:shadow-gradle-plugin:8.3.5")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,9 @@ spotless {
// also very hard to find out where this happens
"ktlint_standard_wrapping" to "disabled",
// we use variable names like v1_10Deps
"ktlint_standard_property-naming" to "disabled"
"ktlint_standard_property-naming" to "disabled",
// prevent moving comment to next line in latestDepTestLibrary("xxx") { // see xxx module
"ktlint_standard_function-literal" to "disabled"
)
)
}
Expand All @@ -97,7 +99,7 @@ if (project == rootProject) {
"**/*.dockerfile",
"**/gradle.properties"
)
indentWithSpaces()
leadingTabsToSpaces()
trimTrailingWhitespace()
endWithNewline()
}
Expand Down
2 changes: 1 addition & 1 deletion examples/distro/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ buildscript {
}
}
dependencies {
classpath "com.diffplug.spotless:spotless-plugin-gradle:6.25.0"
classpath "com.diffplug.spotless:spotless-plugin-gradle:7.0.1"
classpath "com.gradleup.shadow:shadow-gradle-plugin:8.3.5"
classpath "io.opentelemetry.instrumentation:gradle-plugins:2.12.0-alpha-SNAPSHOT"
}
Expand Down
2 changes: 1 addition & 1 deletion examples/extension/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ plugins {
See https://imperceptiblethoughts.com/shadow/ for more details about Shadow plugin.
*/
id "com.gradleup.shadow" version "8.3.5"
id "com.diffplug.spotless" version "6.25.0"
id "com.diffplug.spotless" version "7.0.1"

id "io.opentelemetry.instrumentation.muzzle-generation" version "2.12.0-alpha-SNAPSHOT"
id "io.opentelemetry.instrumentation.muzzle-check" version "2.12.0-alpha-SNAPSHOT"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,7 @@ val scalaMinor = Regex("""^([0-9]+\.[0-9]+)\.?.*$""").find(scalaVersion)!!.run {
minorVersion
}

val scalified = fun(pack: String): String {
return "${pack}_$scalaMinor"
}
val scalified = fun(pack: String): String = "${pack}_$scalaMinor"

dependencies {
bootstrap(project(":instrumentation:executors:bootstrap"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ void enrollExtractor(
String unit = metricInfo.getUnit();

switch (instrumentType) {
// CHECKSTYLE:OFF
// CHECKSTYLE:OFF
case COUNTER:
{
// CHECKSTYLE:ON
Expand All @@ -88,7 +88,7 @@ void enrollExtractor(
}
break;

// CHECKSTYLE:OFF
// CHECKSTYLE:OFF
case UPDOWNCOUNTER:
{
// CHECKSTYLE:ON
Expand All @@ -105,7 +105,7 @@ void enrollExtractor(
}
break;

// CHECKSTYLE:OFF
// CHECKSTYLE:OFF
case GAUGE:
{
// CHECKSTYLE:ON
Expand All @@ -121,7 +121,7 @@ void enrollExtractor(
logger.log(INFO, "Created Gauge for {0}", metricName);
}
break;
// CHECKSTYLE:OFF
// CHECKSTYLE:OFF
case STATE:
{
// CHECKSTYLE:ON
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,34 +95,34 @@ private static void copy(Object[] array, int count, List<Object> list) {
@Override
public void visitFrame(int type, int numLocal, Object[] local, int numStack, Object[] stack) {
switch (type) {
// An expanded frame.
// An expanded frame.
case Opcodes.F_NEW:
// A compressed frame with complete frame data.
// A compressed frame with complete frame data.
case Opcodes.F_FULL:
copy(local, numLocal, currentLocals);
copy(stack, numStack, currentStack);
break;
// A compressed frame with exactly the same locals as the previous frame and with an empty
// stack.
// A compressed frame with exactly the same locals as the previous frame and with an empty
// stack.
case Opcodes.F_SAME:
currentStack.clear();
break;
// A compressed frame with exactly the same locals as the previous frame and with a single
// value on the stack.
// A compressed frame with exactly the same locals as the previous frame and with a single
// value on the stack.
case Opcodes.F_SAME1:
currentStack.clear();
currentStack.add(stack[0]);
break;
// A compressed frame where locals are the same as the locals in the previous frame,
// except that additional 1-3 locals are defined, and with an empty stack.
// A compressed frame where locals are the same as the locals in the previous frame,
// except that additional 1-3 locals are defined, and with an empty stack.
case Opcodes.F_APPEND:
currentStack.clear();
for (int i = 0; i < numLocal; i++) {
currentLocals.add(local[i]);
}
break;
// A compressed frame where locals are the same as the locals in the previous frame,
// except that the last 1-3 locals are absent and with an empty stack.
// A compressed frame where locals are the same as the locals in the previous frame,
// except that the last 1-3 locals are absent and with an empty stack.
case Opcodes.F_CHOP:
currentStack.clear();
for (Iterator<Object> iterator =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -461,9 +461,7 @@ class KotlinCoroutinesInstrumentationTest {
tracer.spanBuilder(opName).startSpan().end()
}

private fun <T> runTest(dispatcherWrapper: DispatcherWrapper, block: suspend CoroutineScope.() -> T): T {
return runTest(dispatcherWrapper.dispatcher, block)
}
private fun <T> runTest(dispatcherWrapper: DispatcherWrapper, block: suspend CoroutineScope.() -> T): T = runTest(dispatcherWrapper.dispatcher, block)

private fun <T> runTest(dispatcher: CoroutineDispatcher, block: suspend CoroutineScope.() -> T): T {
val parentSpan = tracer.spanBuilder("parent").startSpan()
Expand Down Expand Up @@ -562,9 +560,7 @@ class KotlinCoroutinesInstrumentationTest {
oldState.close()
}

override fun updateThreadContext(context: CoroutineContext): Scope {
return otelContext.makeCurrent()
}
override fun updateThreadContext(context: CoroutineContext): Scope = otelContext.makeCurrent()
}

// regression test for
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ import io.opentelemetry.instrumentation.api.instrumenter.Instrumenter
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.onCompletion

fun <REQUEST, RESPONSE> onComplete(flow: Flow<*>, instrumenter: Instrumenter<REQUEST, RESPONSE>, context: Context, request: REQUEST & Any): Flow<*> {
return flow.onCompletion { cause: Throwable? ->
instrumenter.end(context, request, null, cause)
}
fun <REQUEST, RESPONSE> onComplete(flow: Flow<*>, instrumenter: Instrumenter<REQUEST, RESPONSE>, context: Context, request: REQUEST & Any): Flow<*> = flow.onCompletion { cause: Throwable? ->
instrumenter.end(context, request, null, cause)
}
Original file line number Diff line number Diff line change
Expand Up @@ -185,9 +185,7 @@ class KotlinCoroutines13InstrumentationTest {
tracer.spanBuilder(opName).startSpan().end()
}

private fun <T> runTest(dispatcherWrapper: DispatcherWrapper, block: suspend CoroutineScope.() -> T): T {
return runTest(dispatcherWrapper.dispatcher, block)
}
private fun <T> runTest(dispatcherWrapper: DispatcherWrapper, block: suspend CoroutineScope.() -> T): T = runTest(dispatcherWrapper.dispatcher, block)

private fun <T> runTest(dispatcher: CoroutineDispatcher, block: suspend CoroutineScope.() -> T): T {
val parentSpan = tracer.spanBuilder("parent").startSpan()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,7 @@ import io.ktor.request.*
import io.opentelemetry.context.propagation.TextMapGetter

internal object ApplicationRequestGetter : TextMapGetter<ApplicationRequest> {
override fun keys(carrier: ApplicationRequest): Iterable<String> {
return carrier.headers.names()
}
override fun keys(carrier: ApplicationRequest): Iterable<String> = carrier.headers.names()

override fun get(carrier: ApplicationRequest?, name: String): String? {
return carrier?.headers?.get(name)
}
override fun get(carrier: ApplicationRequest?, name: String): String? = carrier?.headers?.get(name)
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,43 +11,26 @@ import io.ktor.response.*
import io.opentelemetry.instrumentation.api.semconv.http.HttpServerAttributesGetter
import io.opentelemetry.instrumentation.ktor.isIpAddress

internal enum class KtorHttpServerAttributesGetter :
HttpServerAttributesGetter<ApplicationRequest, ApplicationResponse> {
internal enum class KtorHttpServerAttributesGetter : HttpServerAttributesGetter<ApplicationRequest, ApplicationResponse> {
INSTANCE, ;

override fun getHttpRequestMethod(request: ApplicationRequest): String {
return request.httpMethod.value
}
override fun getHttpRequestMethod(request: ApplicationRequest): String = request.httpMethod.value

override fun getHttpRequestHeader(request: ApplicationRequest, name: String): List<String> {
return request.headers.getAll(name) ?: emptyList()
}
override fun getHttpRequestHeader(request: ApplicationRequest, name: String): List<String> = request.headers.getAll(name) ?: emptyList()

override fun getHttpResponseStatusCode(request: ApplicationRequest, response: ApplicationResponse, error: Throwable?): Int? {
return response.status()?.value
}
override fun getHttpResponseStatusCode(request: ApplicationRequest, response: ApplicationResponse, error: Throwable?): Int? = response.status()?.value

override fun getHttpResponseHeader(request: ApplicationRequest, response: ApplicationResponse, name: String): List<String> {
return response.headers.allValues().getAll(name) ?: emptyList()
}
override fun getHttpResponseHeader(request: ApplicationRequest, response: ApplicationResponse, name: String): List<String> = response.headers.allValues().getAll(name) ?: emptyList()

override fun getUrlScheme(request: ApplicationRequest): String {
return request.origin.scheme
}
override fun getUrlScheme(request: ApplicationRequest): String = request.origin.scheme

override fun getUrlPath(request: ApplicationRequest): String {
return request.path()
}
override fun getUrlPath(request: ApplicationRequest): String = request.path()

override fun getUrlQuery(request: ApplicationRequest): String {
return request.queryString()
}
override fun getUrlQuery(request: ApplicationRequest): String = request.queryString()

override fun getNetworkProtocolName(request: ApplicationRequest, response: ApplicationResponse?): String? =
if (request.httpVersion.startsWith("HTTP/")) "http" else null
override fun getNetworkProtocolName(request: ApplicationRequest, response: ApplicationResponse?): String? = if (request.httpVersion.startsWith("HTTP/")) "http" else null

override fun getNetworkProtocolVersion(request: ApplicationRequest, response: ApplicationResponse?): String? =
if (request.httpVersion.startsWith("HTTP/")) request.httpVersion.substring("HTTP/".length) else null
override fun getNetworkProtocolVersion(request: ApplicationRequest, response: ApplicationResponse?): String? = if (request.httpVersion.startsWith("HTTP/")) request.httpVersion.substring("HTTP/".length) else null

override fun getNetworkPeerAddress(request: ApplicationRequest, response: ApplicationResponse?): String? {
val remote = request.local.remoteHost
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,12 @@ class KtorServerTelemetry private constructor(
extractor: (SpanStatusExtractor<in ApplicationRequest, in ApplicationResponse>) -> SpanStatusExtractor<in ApplicationRequest, in ApplicationResponse>
) {
builder.setStatusExtractor { prevExtractor ->
SpanStatusExtractor { spanStatusBuilder: SpanStatusBuilder,
request: ApplicationRequest,
response: ApplicationResponse?,
throwable: Throwable? ->
SpanStatusExtractor {
spanStatusBuilder: SpanStatusBuilder,
request: ApplicationRequest,
response: ApplicationResponse?,
throwable: Throwable?
->
extractor(prevExtractor).extract(spanStatusBuilder, request, response, throwable)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,12 @@ class KtorServerTracing private constructor(
extractor: (SpanStatusExtractor<in ApplicationRequest, in ApplicationResponse>) -> SpanStatusExtractor<in ApplicationRequest, in ApplicationResponse>
) {
builder.setStatusExtractor { prevExtractor ->
SpanStatusExtractor { spanStatusBuilder: SpanStatusBuilder,
request: ApplicationRequest,
response: ApplicationResponse?,
throwable: Throwable? ->
SpanStatusExtractor {
spanStatusBuilder: SpanStatusBuilder,
request: ApplicationRequest,
response: ApplicationResponse?,
throwable: Throwable?
->
extractor(prevExtractor).extract(spanStatusBuilder, request, response, throwable)
}
}
Expand Down
Loading

0 comments on commit c22bb59

Please sign in to comment.