generated from micronaut-projects/micronaut-project-template
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1035 from micronaut-projects/metrics-fix-endpoint
fix metrics endpoint
- Loading branch information
Showing
4 changed files
with
58 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 0 additions & 1 deletion
1
...ovy/io/micronaut/oraclecloud/monitoring/micrometer/OracleCloudMeterRawRegistrySpec.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
...o/micronaut/oraclecloud/monitoring/micrometer/OracleCloudMonitorClientEndpointSpec.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package io.micronaut.oraclecloud.monitoring.micrometer | ||
|
||
import com.oracle.bmc.Region | ||
import com.oracle.bmc.auth.RegionProvider | ||
import io.micronaut.context.ApplicationContext | ||
import io.micronaut.context.annotation.BootstrapContextCompatible | ||
import io.micronaut.context.annotation.Primary | ||
import io.micronaut.context.annotation.Property | ||
import io.micronaut.context.annotation.Replaces | ||
import io.micronaut.context.annotation.Requires | ||
import io.micronaut.oraclecloud.monitoring.MonitoringIngestionClient | ||
import io.micronaut.test.extensions.spock.annotation.MicronautTest | ||
import jakarta.inject.Inject | ||
import jakarta.inject.Singleton | ||
import spock.lang.Specification | ||
|
||
@MicronautTest(startApplication = false) | ||
@Property(name="micronaut.metrics.export.oraclecloud.enabled", value = "false") | ||
@Property(name="spec.name", value = "OracleCloudMonitorClientEndpointSpec") | ||
class OracleCloudMonitorClientEndpointSpec extends Specification { | ||
|
||
@Inject | ||
ApplicationContext context | ||
|
||
def "test oci sdk metrics client filter request returns exception" () { | ||
when: | ||
MonitoringIngestionClient monitoringIngestionClient = context.getBean(MonitoringIngestionClient) | ||
monitoringIngestionClient.getDelegate() | ||
|
||
then: | ||
final IllegalArgumentException exception = thrown() | ||
exception.message == "Region is required for the Monitoring Ingestion client" | ||
|
||
} | ||
|
||
@Singleton | ||
@BootstrapContextCompatible | ||
@Primary | ||
@Replaces(RegionProvider.class) | ||
@Requires(property = "spec.name", value = "OracleCloudMonitorClientEndpointSpec") | ||
static class RegionProviderReplacement implements RegionProvider { | ||
|
||
@Override | ||
Region getRegion() { | ||
return null | ||
} | ||
} | ||
|
||
} |