-
Notifications
You must be signed in to change notification settings - Fork 31
Universal profiling integration autoconfig and inclusion in distro #215
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
JonasKunz
merged 15 commits into
elastic:main
from
JonasKunz:profiler-integration-autoconfig
Apr 24, 2024
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
b9def6e
Added profiler integration auto config
JonasKunz 4ce5635
Move PropertiesApplier to common project
JonasKunz 0e1f49b
Implemented autoconfig options, fixed span value issue if used as age…
JonasKunz a471d0f
spotless
JonasKunz ff673e5
Do not crash agent if no service name is configured
JonasKunz 4269b7c
Fixed LocalRootSpan to not break when invoked on `MutableSpan`
JonasKunz b3ccc31
spotless
JonasKunz 66eb708
Added javadoc and readme
JonasKunz 1796134
Merge remote-tracking branch 'elastic/main' into profiler-integration…
JonasKunz 4437e0a
Added libs as buildkite artifacts
JonasKunz daa6aa4
Merge branch 'main' into profiler-integration-autoconfig
JonasKunz 0c1b766
add hdrhistogram license
SylvainJuge 325bc9e
add cc0 for hdrhistogram
SylvainJuge 82ef0e3
Merge pull request #1 from SylvainJuge/add-hdrhistogram-license
JonasKunz 0c657df
Add comment linking information on socket path length requirements.
JonasKunz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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
72 changes: 72 additions & 0 deletions
72
common/src/main/java/co/elastic/otel/common/config/PropertiesApplier.java
This file contains hidden or 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,72 @@ | ||
| /* | ||
| * Licensed to Elasticsearch B.V. under one or more contributor | ||
| * license agreements. See the NOTICE file distributed with | ||
| * this work for additional information regarding copyright | ||
| * ownership. Elasticsearch B.V. licenses this file to you under | ||
| * the Apache License, Version 2.0 (the "License"); you may | ||
| * not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, | ||
| * software distributed under the License is distributed on an | ||
| * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| * KIND, either express or implied. See the License for the | ||
| * specific language governing permissions and limitations | ||
| * under the License. | ||
| */ | ||
| package co.elastic.otel.common.config; | ||
|
|
||
| import io.opentelemetry.sdk.autoconfigure.spi.ConfigProperties; | ||
| import java.time.Duration; | ||
| import java.util.Arrays; | ||
| import java.util.List; | ||
| import java.util.function.Consumer; | ||
| import java.util.stream.Collectors; | ||
|
|
||
| public class PropertiesApplier { | ||
|
|
||
| private final ConfigProperties properties; | ||
|
|
||
| public PropertiesApplier(ConfigProperties properties) { | ||
| this.properties = properties; | ||
| } | ||
|
|
||
| public void applyBool(String configKey, Consumer<Boolean> funcToApply) { | ||
| applyValue(properties.getBoolean(configKey), funcToApply); | ||
| } | ||
|
|
||
| public void applyInt(String configKey, Consumer<Integer> funcToApply) { | ||
| applyValue(properties.getInt(configKey), funcToApply); | ||
| } | ||
|
|
||
| public void applyDuration(String configKey, Consumer<Duration> funcToApply) { | ||
| applyValue(properties.getDuration(configKey), funcToApply); | ||
| } | ||
|
|
||
| public void applyString(String configKey, Consumer<String> funcToApply) { | ||
| applyValue(properties.getString(configKey), funcToApply); | ||
| } | ||
|
|
||
| public void applyWildcards( | ||
| String configKey, Consumer<? super List<WildcardMatcher>> funcToApply) { | ||
| String wildcardListString = properties.getString(configKey); | ||
| if (wildcardListString != null && !wildcardListString.isEmpty()) { | ||
| List<WildcardMatcher> values = | ||
| Arrays.stream(wildcardListString.split(",")) | ||
| .filter(str -> !str.isEmpty()) | ||
| .map(WildcardMatcher::valueOf) | ||
| .collect(Collectors.toList()); | ||
| if (!values.isEmpty()) { | ||
| funcToApply.accept(values); | ||
| } | ||
| } | ||
| } | ||
|
|
||
| private static <T> void applyValue(T value, Consumer<T> funcToApply) { | ||
| if (value != null) { | ||
| funcToApply.accept(value); | ||
| } | ||
| } | ||
| } |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,41 @@ | ||
| The code in this repository code was Written by Gil Tene, Michael Barker, | ||
| and Matt Warren, and released to the public domain, as explained at | ||
| http://creativecommons.org/publicdomain/zero/1.0/ | ||
|
|
||
| For users of this code who wish to consume it under the "BSD" license | ||
| rather than under the public domain or CC0 contribution text mentioned | ||
| above, the code found under this directory is *also* provided under the | ||
| following license (commonly referred to as the BSD 2-Clause License). This | ||
| license does not detract from the above stated release of the code into | ||
| the public domain, and simply represents an additional license granted by | ||
| the Author. | ||
|
|
||
| ----------------------------------------------------------------------------- | ||
| ** Beginning of "BSD 2-Clause License" text. ** | ||
|
|
||
| Copyright (c) 2012, 2013, 2014, 2015, 2016 Gil Tene | ||
| Copyright (c) 2014 Michael Barker | ||
| Copyright (c) 2014 Matt Warren | ||
| All rights reserved. | ||
|
|
||
| Redistribution and use in source and binary forms, with or without | ||
| modification, are permitted provided that the following conditions are met: | ||
|
|
||
| 1. Redistributions of source code must retain the above copyright notice, | ||
| this list of conditions and the following disclaimer. | ||
|
|
||
| 2. Redistributions in binary form must reproduce the above copyright notice, | ||
| this list of conditions and the following disclaimer in the documentation | ||
| and/or other materials provided with the distribution. | ||
|
|
||
| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
| AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE | ||
| LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||
| CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | ||
| SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | ||
| INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | ||
| CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
| ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF | ||
| THE POSSIBILITY OF SUCH DAMAGE. |
This file contains hidden or 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 hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.