Skip to content

Commit

Permalink
NH-57065: automagically set otel log exporting configs when enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
cleverchuk committed Jul 3, 2024
1 parent aef1de6 commit 6297c2c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,6 @@ public static GenericContainer<?> build(Network network) {
.withNetworkAliases("collector")
.withLogConsumer(new Slf4jLogConsumer(logger))
.withExposedPorts(COLLECTOR_PORT, COLLECTOR_HEALTH_CHECK_PORT)
.waitingFor(
Wait.forHttp("/health")
.forPort(COLLECTOR_HEALTH_CHECK_PORT)
.withReadTimeout(Duration.ofMinutes(5)))
.withCopyFileToContainer(
MountableFile.forClasspathResource("collector.yaml"), "/etc/otel.yaml")
.withCommand("--config /etc/otel.yaml");
Expand Down
21 changes: 16 additions & 5 deletions smoke-tests/netty-test/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import groovy.json.JsonSlurper
import kotlinx.serialization.json.Json
import kotlinx.serialization.json.JsonArray
import kotlinx.serialization.json.JsonObject
import kotlinx.serialization.json.jsonPrimitive
import java.net.URI
import java.net.http.HttpClient
import java.net.http.HttpRequest
Expand Down Expand Up @@ -26,6 +29,12 @@ plugins {
id("de.undercouch.download") version "5.5.0"
}

buildscript {
dependencies {
classpath("org.jetbrains.kotlinx:kotlinx-serialization-json:1.6.3")
}
}

group = "com.solarwinds"
version = "unspecified"

Expand Down Expand Up @@ -57,12 +66,14 @@ fun getAgentUrlFromGitRelease(): String {
.GET().build()

val httpResponse = httpClient.send(request, HttpResponse.BodyHandlers.ofString())
val payload = JsonSlurper().parseText(httpResponse.body()) as List<Map<String, Any?>>
val payload = Json.decodeFromString<JsonArray>(httpResponse.body())

// The latest release is assumed to be the first item in the list
val latest = payload[0]
val assets = latest["assets"] as List<Map<String, *>>
return assets[0]["url"] as String
val latest = payload[0] as JsonObject
val assets = latest["assets"] as JsonArray
val asset = assets[0] as JsonObject
println(asset)
return asset["url"]!!.jsonPrimitive.content
}

application {
Expand Down

0 comments on commit 6297c2c

Please sign in to comment.