| 1 | /* |
| 2 | * Copyright (c) 2023 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) |
| 3 | * |
| 4 | * This program and the accompanying materials are made available under the |
| 5 | * terms of the Apache License, Version 2.0 which is available at |
| 6 | * https://www.apache.org/licenses/LICENSE-2.0 |
| 7 | * |
| 8 | * SPDX-License-Identifier: Apache-2.0 |
| 9 | * |
| 10 | * Contributors: |
| 11 | * Bayerische Motoren Werke Aktiengesellschaft (BMW AG) - initial API and implementation |
| 12 | * |
| 13 | */ |
| 14 | |
| 15 | plugins { |
| 16 | java |
| 17 | } |
| 18 | |
| 19 | dependencies { |
| 20 | testImplementation(project(":spi:common:json-ld-spi")) |
| 21 | testImplementation(project(":spi:control-plane:catalog-spi")) |
| 22 | testImplementation(project(":core:common:junit")) |
| 23 | testImplementation(project(":extensions:common:json-ld")) |
| 24 | testImplementation(project(":core:common:connector-core")) |
| 25 | |
| 26 | testImplementation(libs.restAssured) |
| 27 | testImplementation(libs.assertj) |
| 28 | testImplementation(libs.awaitility) |
| 29 | testImplementation(libs.junit.jupiter.api) |
| 30 | testImplementation(libs.mockserver.netty) |
| 31 | testImplementation(libs.mockserver.client) |
| 32 | testImplementation(libs.opentelemetry.proto) |
| 33 | |
| 34 | testCompileOnly(project(":system-tests:telemetry:telemetry-test-runtime")) |
| 35 | } |
| 36 | |
| 37 | edcBuild { |
| 38 | publish.set(false) |
| 39 | } |
| 40 | |
| 41 | tasks.withType<Test> { |
| 42 | val download = { url: String, destFile: File -> ant.invokeMethod("get", mapOf("src" to url, "dest" to destFile)) } |
| 43 | |
| 44 | val agentFile = rootDir.resolve("opentelemetry-javaagent.jar") |
| 45 | |
| 46 | if (!agentFile.exists()) { |
| 47 | logger.lifecycle("Downloading OpenTelemetry Agent") |
| 48 | download( |
| 49 | "https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases/download/v1.27.0/opentelemetry-javaagent.jar", |
| 50 | agentFile |
| 51 | ) |
| 52 | } |
| 53 | jvmArgs( |
| 54 | "-javaagent:${agentFile.absolutePath}", |
| 55 | "-Dotel.exporter.otlp.protocol=http/protobuf", |
| 56 | // Exposes metrics at http://localhost:9464/metrics |
| 57 | "-Dotel.metrics.exporter=prometheus" |
| 58 | ) |
| 59 | } |
| 60 | |