Skip to content

Commit

Permalink
Use Vector instead of List
Browse files Browse the repository at this point in the history
  • Loading branch information
iRevive committed Dec 7, 2023
1 parent 43d4783 commit a14d318
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ private[trace] object SdkSpanBackend {
parentContext: Option[SpanContext],
processor: SpanProcessor[F],
attributes: Attributes,
links: List[LinkData],
links: Vector[LinkData],
userStartTimestamp: Option[FiniteDuration]
): F[SdkSpanBackend[F]] = {
def immutableState(startTimestamp: FiniteDuration) =
Expand All @@ -276,7 +276,7 @@ private[trace] object SdkSpanBackend {
name = name,
status = StatusData.Unset,
attributes = attributes,
events = Nil,
events = Vector.empty,
endTimestamp = None
)

Expand All @@ -294,7 +294,7 @@ private[trace] object SdkSpanBackend {
kind: SpanKind,
parentContext: Option[SpanContext],
resource: Resource,
links: List[LinkData],
links: Vector[LinkData],
startTimestamp: FiniteDuration
)

Expand All @@ -304,7 +304,7 @@ private[trace] object SdkSpanBackend {
name: String,
status: StatusData,
attributes: Attributes,
events: List[EventData],
events: Vector[EventData],
endTimestamp: Option[FiniteDuration]
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,11 @@ sealed trait SpanData {

/** The events associated with the span.
*/
def events: List[EventData]
def events: Vector[EventData]

/** The links associated with the span.
*/
def links: List[LinkData]
def links: Vector[LinkData]

/** The instrumentation scope associated with the span.
*/
Expand Down Expand Up @@ -151,8 +151,8 @@ object SpanData {
endTimestamp: Option[FiniteDuration],
status: StatusData,
attributes: Attributes,
events: List[EventData],
links: List[LinkData],
events: Vector[EventData],
links: Vector[LinkData],
instrumentationScope: InstrumentationScope,
resource: Resource
): SpanData =
Expand Down Expand Up @@ -219,8 +219,8 @@ object SpanData {
endTimestamp: Option[FiniteDuration],
status: StatusData,
attributes: Attributes,
events: List[EventData],
links: List[LinkData],
events: Vector[EventData],
links: Vector[LinkData],
instrumentationScope: InstrumentationScope,
resource: Resource
) extends SpanData
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,8 @@ object Cogens {
Option[FiniteDuration],
StatusData,
Attributes,
List[EventData],
List[LinkData],
Vector[EventData],
Vector[LinkData],
InstrumentationScope,
Resource
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,8 @@ object Gens {
endEpochNanos,
status,
attributes,
events,
links,
events.toVector,
links.toVector,
instrumentationScope,
resource
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,9 @@ class SdkSpanBackendSuite extends CatsEffectSuite with ScalaCheckEffectSuite {
TestControl.executeEmbed {
for {
span <- start()
_ <- assertIO(span.toSpanData.map(_.events), Nil)
_ <- assertIO(span.toSpanData.map(_.events), Vector.empty)
_ <- span.addEvent(name, attributes.toList: _*)
_ <- assertIO(span.toSpanData.map(_.events), List(event))
_ <- assertIO(span.toSpanData.map(_.events), Vector(event))
} yield ()
}
}
Expand All @@ -97,9 +97,9 @@ class SdkSpanBackendSuite extends CatsEffectSuite with ScalaCheckEffectSuite {
TestControl.executeEmbed {
for {
span <- start()
_ <- assertIO(span.toSpanData.map(_.events), Nil)
_ <- assertIO(span.toSpanData.map(_.events), Vector.empty)
_ <- span.addEvent(name, ts, attrs.toList: _*)
_ <- assertIO(span.toSpanData.map(_.events), List(event))
_ <- assertIO(span.toSpanData.map(_.events), Vector(event))
} yield ()
}
}
Expand Down Expand Up @@ -129,9 +129,9 @@ class SdkSpanBackendSuite extends CatsEffectSuite with ScalaCheckEffectSuite {
TestControl.executeEmbed {
for {
span <- start()
_ <- assertIO(span.toSpanData.map(_.events), Nil)
_ <- assertIO(span.toSpanData.map(_.events), Vector.empty)
_ <- span.recordException(exception, attributes.toList: _*)
_ <- assertIO(span.toSpanData.map(_.events), List(event))
_ <- assertIO(span.toSpanData.map(_.events), Vector(event))
} yield ()
}
}
Expand Down Expand Up @@ -303,7 +303,7 @@ class SdkSpanBackendSuite extends CatsEffectSuite with ScalaCheckEffectSuite {
kind: SpanKind,
parentCtx: Option[SpanContext],
attributes: Attributes,
links: List[LinkData],
links: Vector[LinkData],
userStartTimestamp: Option[FiniteDuration]
) =>
def expected(end: Option[FiniteDuration]) =
Expand All @@ -316,7 +316,7 @@ class SdkSpanBackendSuite extends CatsEffectSuite with ScalaCheckEffectSuite {
endTimestamp = end,
status = StatusData.Unset,
attributes = attributes,
events = Nil,
events = Vector.empty,
links = links,
instrumentationScope = scope,
resource = Defaults.resource
Expand Down Expand Up @@ -385,8 +385,8 @@ class SdkSpanBackendSuite extends CatsEffectSuite with ScalaCheckEffectSuite {
endTimestamp = end,
status = StatusData.Unset,
attributes = Defaults.attributes,
events = Nil,
links = Nil,
events = Vector.empty,
links = Vector.empty,
instrumentationScope = Defaults.scope,
resource = Defaults.resource
)
Expand Down Expand Up @@ -445,7 +445,7 @@ class SdkSpanBackendSuite extends CatsEffectSuite with ScalaCheckEffectSuite {
parentSpanContext: Option[SpanContext] = None,
attributes: Attributes = Defaults.attributes,
spanProcessor: SpanProcessor[IO] = Defaults.spanProcessor,
links: List[LinkData] = Nil,
links: Vector[LinkData] = Vector.empty,
userStartTimestamp: Option[FiniteDuration] = None
): IO[SdkSpanBackend[IO]] = {
SdkSpanBackend.start[IO](
Expand Down

0 comments on commit a14d318

Please sign in to comment.