Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
Expand Up @@ -81,3 +81,6 @@ da85b978db204adf6f236bfd4e453628a6d4cdda

# Scala Steward: Reformat with scalafmt 3.10.7
32ddff2605807a89e66272507b85230c3d3adfa1

# Scala Steward: Reformat with scalafmt 3.11.1
17d6746ee877b9c0e3f15602b6aed0dfa16e1691
2 changes: 1 addition & 1 deletion .scalafmt.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version = 3.10.7
version = 3.11.1
maxColumn = 140
runner.dialect = scala213source3
fileOverride {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,10 @@ class WebSocketToFs2Pipe[_F[_]: Concurrent, R <: Fs2Streams[_F] with WebSockets]
}
.collect { case (_, Right(d)) => d }
.unNoneTerminate
// `unNoneTerminate` halts `receives` immediately when the server's Close frame produces a
// `None`. This is important because after returning the Close frame, `ws.receive()` arms
// an internal poison pill - the next call raises `WebSocketClosed`. Halting here cancels
// the upstream `Stream.repeatEval(ws.receive())` before it can make that follow-up call.
// `unNoneTerminate` halts `receives` immediately when the server's Close frame produces a
// `None`. This is important because after returning the Close frame, `ws.receive()` arms
// an internal poison pill - the next call raises `WebSocketClosed`. Halting here cancels
// the upstream `Stream.repeatEval(ws.receive())` before it can make that follow-up call.

// `concurrently` (rather than `merge`) makes `sends` a side-effect of `receives`: when the
// output stream from the server terminates (e.g. on Close), the `sends` background fiber is
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ case class OpenTelemetryMetrics[F[_]](meter: Meter, metrics: List[Metric[F, _]])
def addRequestsActive(labels: MetricLabels = OpenTelemetryAttributes): OpenTelemetryMetrics[F] =
copy(metrics = metrics :+ requestActive(meter, labels))

/** Registers a `http.server.request.total` counter (assuming default labels). Note: this metric is not part of the OpenTelemetry
* HTTP semantic conventions - the count is implicitly provided by the `http.server.request.duration` histogram.
/** Registers a `http.server.request.total` counter (assuming default labels). Note: this metric is not part of the OpenTelemetry HTTP
* semantic conventions - the count is implicitly provided by the `http.server.request.duration` histogram.
*/
def addRequestsTotal(labels: MetricLabels = OpenTelemetryAttributes): OpenTelemetryMetrics[F] =
copy(metrics = metrics :+ requestTotal(meter, labels))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ object Otel4sMetrics {
private type MetricLabels = MetricLabelsTyped[Attribute[_]]

private val DurationBucketBoundaries = BucketBoundaries(
0.005, 0.01, 0.025, 0.05, 0.075, 0.1, 0.25, 0.5, 0.75, 1, 2.5, 5, 7.5, 10
0.005, 0.01, 0.025, 0.05, 0.075, 0.1, 0.25, 0.5, 0.75, 1, 2.5, 5, 7.5, 10
)

/** Using the default labels, registers the following metrics:
Expand Down Expand Up @@ -77,7 +77,7 @@ object Otel4sMetrics {
forResponse = List(
{
case Right(r) => Some(HttpAttributes.HttpResponseStatusCode(r.code.code.toLong))
case Left(_) => Some(HttpAttributes.HttpResponseStatusCode(500))
case Left(_) => Some(HttpAttributes.HttpResponseStatusCode(500))
},
{
case Right(_) => None
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -277,26 +277,23 @@ class Otel4sMetricsTest extends AsyncFlatSpec with Matchers {
.description(HttpMetrics.ServerRequestDuration.description)

if (isFailure) {
base
.pointCount(1)
.containsPoints(
PointExpectation
.histogram
.count(expectedCount.toLong)
.attributesSubset((baseResponseAttributes(expectedStatusCode) ++ failureAttributes(isFailure)): _*)
)
base
.pointCount(1)
.containsPoints(
PointExpectation.histogram
.count(expectedCount.toLong)
.attributesSubset((baseResponseAttributes(expectedStatusCode) ++ failureAttributes(isFailure)): _*)
)
} else {
base
.pointCount(2)
.containsPoints(
PointExpectation
.histogram
PointExpectation.histogram
.count(expectedCount.toLong)
.attributesSubset((baseResponseAttributes(expectedStatusCode) ++ phaseAttribute("headers")): _*)
)
.containsPoints(
PointExpectation
.histogram
PointExpectation.histogram
.count(expectedCount.toLong)
.attributesSubset((baseResponseAttributes(expectedStatusCode) ++ phaseAttribute("body")): _*)
)
Expand Down Expand Up @@ -347,7 +344,7 @@ class Otel4sMetricsTest extends AsyncFlatSpec with Matchers {

private def assertMetrics(metrics: List[io.opentelemetry.sdk.metrics.data.MetricData], expectations: List[MetricExpectation]): Assertion =
MetricExpectations.checkAll(metrics, expectations) match {
case Right(_) => succeed
case Right(_) => succeed
case Left(mismatches) =>
fail(MetricExpectations.format(mismatches))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,10 @@ class ServerInterpreterTest extends AnyFlatSpec with Matchers {
// due to Scala 3.8 compatibility (the implicit can no longer be applied as a regular argument)
.securityIn(queryAnyFormat[StringWrapper, TextPlain]("x", Codec.listHead(addToTrailCodec("x"))))
.in(queryAnyFormat[StringWrapper, TextPlain]("y", Codec.listHead(addToTrailCodec("y"))))
.in(EndpointIO.Body(RawBodyType.StringBody(java.nio.charset.StandardCharsets.UTF_8), addToTrailCodec("z"), EndpointIO.Info.empty))
.in(
EndpointIO
.Body(RawBodyType.StringBody(java.nio.charset.StandardCharsets.UTF_8), addToTrailCodec("z"), EndpointIO.Info.empty)
)
.serverSecurityLogic[Unit, Identity](_ => Left(()))
.serverLogic(_ => _ => Right(()))
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ class Otel4sTracingTest extends AsyncFlatSpec with Matchers {

private def assertTrace(spans: List[SpanData], expectation: TraceForestExpectation): Assertion =
TraceExpectations.check(spans, expectation) match {
case Right(_) => succeed
case Right(_) => succeed
case Left(mismatches) =>
fail(TraceExpectations.format(mismatches))
}
Expand Down
Loading