-
Notifications
You must be signed in to change notification settings - Fork 852
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add file configuration ComponentProvider support for resources (#6625)
- Loading branch information
Showing
8 changed files
with
203 additions
and
14 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
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
27 changes: 27 additions & 0 deletions
27
...opentelemetry/sdk/extension/incubator/fileconfig/component/ResourceComponentProvider.java
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,27 @@ | ||
/* | ||
* Copyright The OpenTelemetry Authors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package io.opentelemetry.sdk.extension.incubator.fileconfig.component; | ||
|
||
import io.opentelemetry.sdk.autoconfigure.spi.internal.ComponentProvider; | ||
import io.opentelemetry.sdk.autoconfigure.spi.internal.StructuredConfigProperties; | ||
import io.opentelemetry.sdk.resources.Resource; | ||
|
||
public class ResourceComponentProvider implements ComponentProvider<Resource> { | ||
@Override | ||
public Class<Resource> getType() { | ||
return Resource.class; | ||
} | ||
|
||
@Override | ||
public String getName() { | ||
return "unused"; | ||
} | ||
|
||
@Override | ||
public Resource create(StructuredConfigProperties config) { | ||
return Resource.builder().put("shape", "square").put("color", "red").build(); | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
...y/sdk/extension/incubator/fileconfig/component/ResourceOrderedFirstComponentProvider.java
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,33 @@ | ||
/* | ||
* Copyright The OpenTelemetry Authors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package io.opentelemetry.sdk.extension.incubator.fileconfig.component; | ||
|
||
import io.opentelemetry.sdk.autoconfigure.spi.Ordered; | ||
import io.opentelemetry.sdk.autoconfigure.spi.internal.ComponentProvider; | ||
import io.opentelemetry.sdk.autoconfigure.spi.internal.StructuredConfigProperties; | ||
import io.opentelemetry.sdk.resources.Resource; | ||
|
||
public class ResourceOrderedFirstComponentProvider implements ComponentProvider<Resource>, Ordered { | ||
@Override | ||
public Class<Resource> getType() { | ||
return Resource.class; | ||
} | ||
|
||
@Override | ||
public String getName() { | ||
return "unused"; | ||
} | ||
|
||
@Override | ||
public Resource create(StructuredConfigProperties config) { | ||
return Resource.builder().put("order", "first").build(); | ||
} | ||
|
||
@Override | ||
public int order() { | ||
return 1; | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
.../sdk/extension/incubator/fileconfig/component/ResourceOrderedSecondComponentProvider.java
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,34 @@ | ||
/* | ||
* Copyright The OpenTelemetry Authors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package io.opentelemetry.sdk.extension.incubator.fileconfig.component; | ||
|
||
import io.opentelemetry.sdk.autoconfigure.spi.Ordered; | ||
import io.opentelemetry.sdk.autoconfigure.spi.internal.ComponentProvider; | ||
import io.opentelemetry.sdk.autoconfigure.spi.internal.StructuredConfigProperties; | ||
import io.opentelemetry.sdk.resources.Resource; | ||
|
||
public class ResourceOrderedSecondComponentProvider | ||
implements ComponentProvider<Resource>, Ordered { | ||
@Override | ||
public Class<Resource> getType() { | ||
return Resource.class; | ||
} | ||
|
||
@Override | ||
public String getName() { | ||
return "unused"; | ||
} | ||
|
||
@Override | ||
public Resource create(StructuredConfigProperties config) { | ||
return Resource.builder().put("order", "second").build(); | ||
} | ||
|
||
@Override | ||
public int order() { | ||
return 2; | ||
} | ||
} |
3 changes: 3 additions & 0 deletions
3
...urces/META-INF/services/io.opentelemetry.sdk.autoconfigure.spi.internal.ComponentProvider
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 |
---|---|---|
@@ -1,3 +1,6 @@ | ||
io.opentelemetry.sdk.extension.incubator.fileconfig.component.MetricExporterComponentProvider | ||
io.opentelemetry.sdk.extension.incubator.fileconfig.component.SpanExporterComponentProvider | ||
io.opentelemetry.sdk.extension.incubator.fileconfig.component.LogRecordExporterComponentProvider | ||
io.opentelemetry.sdk.extension.incubator.fileconfig.component.ResourceComponentProvider | ||
io.opentelemetry.sdk.extension.incubator.fileconfig.component.ResourceOrderedFirstComponentProvider | ||
io.opentelemetry.sdk.extension.incubator.fileconfig.component.ResourceOrderedSecondComponentProvider |