Skip to content

Commit 27f4ac4

Browse files
committed
tst
1 parent 6b2f599 commit 27f4ac4

File tree

4 files changed

+14
-49
lines changed

4 files changed

+14
-49
lines changed

telemetry/jetbrains/src/main/kotlin/software/aws/toolkits/telemetry/generator/OTelTelemetryGenerator.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import com.squareup.kotlinpoet.CodeBlock
99
import com.squareup.kotlinpoet.FileSpec
1010
import com.squareup.kotlinpoet.FunSpec
1111
import com.squareup.kotlinpoet.KModifier
12-
import com.squareup.kotlinpoet.NUMBER
1312
import com.squareup.kotlinpoet.ParameterizedTypeName.Companion.parameterizedBy
1413
import com.squareup.kotlinpoet.PropertySpec
1514
import com.squareup.kotlinpoet.STRING

telemetry/jetbrains/src/test/resources/generateOTelBaseSpan/output/software/aws/toolkits/telemetry/impl/BaseSpan.kt

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,24 +9,15 @@ import io.opentelemetry.api.trace.Span
99
import io.opentelemetry.context.Context
1010
import io.opentelemetry.sdk.trace.ReadWriteSpan
1111
import kotlin.Boolean
12-
import kotlin.Number
1312
import kotlin.Suppress
14-
import software.amazon.awssdk.services.toolkittelemetry.model.MetricUnit
1513
import software.aws.toolkits.jetbrains.services.telemetry.otel.AbstractBaseSpan
1614

1715
public open class BaseSpan<SpanType : BaseSpan<SpanType>>(
1816
context: Context?,
1917
`delegate`: Span,
2018
) : AbstractBaseSpan<SpanType>(context, delegate as ReadWriteSpan) {
21-
public fun passive(passive: Boolean) {
22-
this._passive = passive
23-
}
24-
25-
public fun unit(unit: MetricUnit) {
26-
this._unit = unit
27-
}
28-
29-
public fun `value`(`value`: Number) {
30-
this._value = `value`.toDouble()
19+
public fun success(success: Boolean): SpanType {
20+
result(if(success) MetricResult.Succeeded else MetricResult.Failed)
21+
return this as SpanType
3122
}
3223
}

telemetry/jetbrains/src/test/resources/generatesOTelWithNormalInput/output/software/aws/toolkits/telemetry/impl/BaseSpan.kt

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,7 @@ import io.opentelemetry.sdk.trace.ReadWriteSpan
1111
import kotlin.Boolean
1212
import kotlin.Double
1313
import kotlin.Float
14-
import kotlin.Number
1514
import kotlin.Suppress
16-
import software.amazon.awssdk.services.toolkittelemetry.model.MetricUnit
1715
import software.aws.toolkits.jetbrains.services.telemetry.otel.AbstractBaseSpan
1816

1917
public open class BaseSpan<SpanType : BaseSpan<SpanType>>(
@@ -23,26 +21,15 @@ public open class BaseSpan<SpanType : BaseSpan<SpanType>>(
2321
/**
2422
* The duration of the operation in miliseconds
2523
*/
26-
public fun duration(duration: Float?) {
27-
metadata("duration", duration?.let { it.toString() })
28-
}
24+
public fun duration(duration: Float?): SpanType = metadata("duration", duration?.let { it.toString() })
2925

3026
/**
3127
* The duration of the operation in miliseconds
3228
*/
33-
public fun duration(duration: Double?) {
34-
metadata("duration", duration?.let { it.toString() })
35-
}
36-
37-
public fun passive(passive: Boolean) {
38-
this._passive = passive
39-
}
40-
41-
public fun unit(unit: MetricUnit) {
42-
this._unit = unit
43-
}
29+
public fun duration(duration: Double?): SpanType = metadata("duration", duration?.let { it.toString() })
4430

45-
public fun `value`(`value`: Number) {
46-
this._value = `value`.toDouble()
31+
public fun success(success: Boolean): SpanType {
32+
result(if(success) MetricResult.Succeeded else MetricResult.Failed)
33+
return this as SpanType
4734
}
4835
}

telemetry/jetbrains/src/test/resources/generatesOTelWithNormalInput/output/software/aws/toolkits/telemetry/impl/LambdaTracer.kt

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,7 @@ public class LambdadeleteSpan internal constructor(
3535
/**
3636
* a test boolean type
3737
*/
38-
public fun booltype(booltype: Boolean) {
39-
metadata("booltype", booltype.toString())
40-
}
38+
public fun booltype(booltype: Boolean): LambdadeleteSpan = metadata("booltype", booltype.toString())
4139
}
4240

4341
public class LambdadeleteSpanBuilder internal constructor(
@@ -62,16 +60,12 @@ public class LambdacreateSpan internal constructor(
6260
/**
6361
* The lambda runtime
6462
*/
65-
public fun lambdaRuntime(lambdaRuntime: LambdaRuntime) {
66-
metadata("lambdaRuntime", lambdaRuntime.toString())
67-
}
63+
public fun lambdaRuntime(lambdaRuntime: LambdaRuntime): LambdacreateSpan = metadata("lambdaRuntime", lambdaRuntime.toString())
6864

6965
/**
7066
* untyped string type
7167
*/
72-
public fun arbitraryString(arbitraryString: String) {
73-
metadata("arbitraryString", arbitraryString)
74-
}
68+
public fun arbitraryString(arbitraryString: String): LambdacreateSpan = metadata("arbitraryString", arbitraryString)
7569
}
7670

7771
public class LambdacreateSpanBuilder internal constructor(
@@ -96,23 +90,17 @@ public class LambdaremoteinvokeSpan internal constructor(
9690
/**
9791
* The lambda runtime
9892
*/
99-
public fun lambdaRuntime(lambdaRuntime: LambdaRuntime?) {
100-
metadata("lambdaRuntime", lambdaRuntime?.let { it.toString() })
101-
}
93+
public fun lambdaRuntime(lambdaRuntime: LambdaRuntime?): LambdaremoteinvokeSpan = metadata("lambdaRuntime", lambdaRuntime?.let { it.toString() })
10294

10395
/**
10496
* a test int type
10597
*/
106-
public fun inttype(inttype: Long) {
107-
metadata("inttype", inttype.toString())
108-
}
98+
public fun inttype(inttype: Long): LambdaremoteinvokeSpan = metadata("inttype", inttype.toString())
10999

110100
/**
111101
* a test int type
112102
*/
113-
public fun inttype(inttype: Int) {
114-
metadata("inttype", inttype.toString())
115-
}
103+
public fun inttype(inttype: Int): LambdaremoteinvokeSpan = metadata("inttype", inttype.toString())
116104
}
117105

118106
public class LambdaremoteinvokeSpanBuilder internal constructor(

0 commit comments

Comments
 (0)