forked from open-telemetry/opentelemetry-java
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ResourceProvider.java
29 lines (24 loc) · 951 Bytes
/
ResourceProvider.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/*
* Copyright The OpenTelemetry Authors
* SPDX-License-Identifier: Apache-2.0
*/
package io.opentelemetry.sdk.autoconfigure.spi;
import io.opentelemetry.sdk.resources.Resource;
/**
* A service provider interface (SPI) for providing a {@link Resource} that is merged into the
* {@linkplain Resource#getDefault() default resource}.
*/
public interface ResourceProvider extends Ordered {
Resource createResource(ConfigProperties config);
/**
* If an implementation needs to apply only under certain conditions related to the config or the
* existing state of the Resource being built, they can choose to override this default.
*
* @param config The auto configuration properties
* @param existing The current state of the Resource being created
* @return false to skip over this ResourceProvider, or true to use it
*/
default boolean shouldApply(ConfigProperties config, Resource existing) {
return true;
}
}