Skip to content

Commit

Permalink
eval: make backend ws pattern configurable (#1746)
Browse files Browse the repository at this point in the history
Allow the pattern to be customized so secure option can be used
for use-cases other than local testing.
  • Loading branch information
brharrington authored Feb 10, 2025
1 parent 4c3bbc2 commit ff38f2a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
4 changes: 4 additions & 0 deletions atlas-eval/src/main/resources/reference.conf
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ atlas.eval {
edda-uri = "http://localhost:7102/api/v1/autoScalingGroups/local-dev:7001"
}
]

// Pattern to use for backend URIs
backend-uri-pattern = "ws://{ip}:{port}"

// Number of buffers to use for the time grouping. More buffers means that data has
// more time to accumulate and there is less chance of data being dropped because it
// is too old
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,9 @@ private[stream] abstract class EvaluatorImpl(
// Cached context instance used for things like expression validation.
private val validationStreamContext = newStreamContext(new ThrowingDSLogger)

// URI pattern for web-socket request to backend
private val backendUriPattern = config.getString("atlas.eval.stream.backend-uri-pattern")

// Timeout for DataSources unique operator: emit repeating DataSources after timeout exceeds
private val uniqueTimeout: Long = config.getDuration("atlas.eval.stream.unique-timeout").toMillis

Expand Down Expand Up @@ -533,7 +536,7 @@ private[stream] abstract class EvaluatorImpl(
private def createWebSocketFlow(
instance: EddaSource.Instance
): Flow[ByteString, ByteString, NotUsed] = {
val base = instance.substitute("ws://{ip}:{port}")
val base = instance.substitute(backendUriPattern)
val id = UUID.randomUUID().toString
val uri = s"$base/api/v$lwcapiVersion/subscribe/$id"
val webSocketFlowOrigin = Http(system).webSocketClientFlow(WebSocketRequest(uri))
Expand Down

0 comments on commit ff38f2a

Please sign in to comment.