Merge pull request #34004 from eddumelendez
* pr/34004: Add property `headers` in `OtlpProperties` Closes gh-34004
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2022 the original author or authors.
|
||||
* Copyright 2012-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -41,6 +41,11 @@ public class OtlpProperties extends StepRegistryProperties {
|
||||
*/
|
||||
private Map<String, String> resourceAttributes;
|
||||
|
||||
/**
|
||||
* Headers for the exported metrics.
|
||||
*/
|
||||
private Map<String, String> headers;
|
||||
|
||||
public String getUrl() {
|
||||
return this.url;
|
||||
}
|
||||
@@ -57,4 +62,12 @@ public class OtlpProperties extends StepRegistryProperties {
|
||||
this.resourceAttributes = resourceAttributes;
|
||||
}
|
||||
|
||||
public Map<String, String> getHeaders() {
|
||||
return this.headers;
|
||||
}
|
||||
|
||||
public void setHeaders(Map<String, String> headers) {
|
||||
this.headers = headers;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2022 the original author or authors.
|
||||
* Copyright 2012-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -48,4 +48,9 @@ class OtlpPropertiesConfigAdapter extends StepRegistryPropertiesConfigAdapter<Ot
|
||||
return get(OtlpProperties::getResourceAttributes, OtlpConfig.super::resourceAttributes);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, String> headers() {
|
||||
return get(OtlpProperties::getHeaders, OtlpConfig.super::headers);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2022 the original author or authors.
|
||||
* Copyright 2012-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -44,4 +44,11 @@ class OtlpPropertiesConfigAdapterTests {
|
||||
"boot-service");
|
||||
}
|
||||
|
||||
@Test
|
||||
void whenPropertiesHeadersIsSetAdapterHeadersReturnsIt() {
|
||||
OtlpProperties properties = new OtlpProperties();
|
||||
properties.setHeaders(Map.of("header", "value"));
|
||||
assertThat(new OtlpPropertiesConfigAdapter(properties).headers()).containsEntry("header", "value");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -932,7 +932,7 @@ bom {
|
||||
]
|
||||
}
|
||||
}
|
||||
library("Micrometer", "1.10.3") {
|
||||
library("Micrometer", "1.11.0-SNAPSHOT") {
|
||||
group("io.micrometer") {
|
||||
modules = [
|
||||
"micrometer-registry-stackdriver" {
|
||||
|
||||
Reference in New Issue
Block a user