Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/candidate-9.8.x'
Browse files Browse the repository at this point in the history
Signed-off-by: Jake Smith <[email protected]>

# Conflicts:
#	commons-hpcc/pom.xml
#	dfsclient/pom.xml
#	pom.xml
#	wsclient/pom.xml
  • Loading branch information
jakesmith committed Sep 13, 2024
2 parents 3789bdb + c3ab1f8 commit 7aac83f
Show file tree
Hide file tree
Showing 6 changed files with 148 additions and 31 deletions.
63 changes: 53 additions & 10 deletions .github/workflows/JirabotMerge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ jobs:
PULL_REQUEST_TITLE : ${{ github.event.pull_request.title }}
PULL_REQUEST_AUTHOR_NAME : ${{ github.event.pull_request.user.login }}
PULL_URL: ${{ github.event.pull_request.html_url }}
PROJECT_CONFIG: ${{ vars.PROJECT_CONFIG}}
COMMENTS_URL: ${{ github.event.pull_request.comments_url }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BRANCH_NAME: ${{ github.ref_name }}
Expand Down Expand Up @@ -95,9 +96,40 @@ jobs:
major, minor, point = map(int, version)
return f"{major}.{minor}.{point}"
def generateFixVersionList(jira, projectName, branchName):
cmd = "git tag --list 'hpcc4j_*-release' --sort=-v:refname | head -n 1"
latestVersion = getTagVersionForCmd(cmd)
def createReleaseTagPattern(projectConfig, major = None, minor = None, point = None):
releaseTagPrefix = projectConfig.get('tagPrefix')
releaseTagPostfix = projectConfig.get('tagPostfix')
if releaseTagPrefix is None or releaseTagPostfix is None:
print('Error: PROJECT_CONFIG is missing required fields: tagPrefix and/or tagPostfix')
sys.exit(1)
releaseTagPattern = releaseTagPrefix
if major is not None:
releaseTagPattern += str(major) + '\.'
else:
releaseTagPattern += '[0-9]+\.'
if minor is not None:
releaseTagPattern += str(minor) + '\.'
else:
releaseTagPattern += '[0-9]+\.'
if point is not None:
releaseTagPattern += str(point) + '(-[0-9]+)?'
else:
releaseTagPattern += '[0-9]+(-[0-9]+)?'
releaseTagPattern += releaseTagPostfix + '$'
return releaseTagPattern
def getLatestSemVer(projectConfig, major = None, minor = None, point = None):
cmd = "git tag --list --sort=-v:refname | grep -E '" + createReleaseTagPattern(projectConfig, major, minor, point) + "' | head -n 1"
return getTagVersionForCmd(cmd)
def generateFixVersionList(jira, projectConfig, projectName, branchName):
latestVersion = getLatestSemVer(projectConfig)
# If we are merging into master we assume it is going into the next minor release
fixVersions = []
Expand All @@ -110,14 +142,12 @@ jobs:
branchVersion = extractVersion(branchVersionMatch.group(1))
# Get latest release in branch
findLatestBranchVer = "git tag --list 'hpcc4j_" + str(branchVersion[0]) + "." + str(branchVersion[1]) + "*-release' --sort=-v:refname | head -n 1"
latestBranchVer = getTagVersionForCmd(findLatestBranchVer)
latestBranchVer = getLatestSemVer(projectConfig, branchVersion[0], branchVersion[1])
curMajor = branchVersion[0]
latestMajor = latestVersion[0]
while curMajor <= latestMajor:
cmd = "git tag --list 'hpcc4j_" + str(curMajor) + "*-release' --sort=-v:refname | head -n 1"
latestVersionInMajor = getTagVersionForCmd(cmd)
latestVersionInMajor = getLatestSemVer(projectConfig, curMajor)
curMinor = 0
if curMajor == branchVersion[0]:
Expand All @@ -126,7 +156,7 @@ jobs:
latestMinor = latestVersionInMajor[1]
while curMinor <= latestMinor:
latestPointInMinor = getTagVersionForCmd("git tag --list 'hpcc4j_" + str(curMajor) + "." + str(curMinor) + "*-release' --sort=-v:refname | head -n 1")
latestPointInMinor = getLatestSemVer(projectConfig, curMajor, curMinor)
fixVersions.append(buildVersionString([latestPointInMinor[0], latestPointInMinor[1], latestPointInMinor[2] + 2]))
curMinor += 2
curMajor += 1
Expand Down Expand Up @@ -214,7 +244,20 @@ jobs:
github_token = os.environ['GITHUB_TOKEN']
branch_name = os.environ['BRANCH_NAME']
comments_url = os.environ['COMMENTS_URL']
project_name = 'HPCC4J'
projectConfig = json.loads(os.environ['PROJECT_CONFIG'])
if not isinstance(projectConfig, dict):
print('Error: PROJECT_CONFIG is not a valid JSON object, aborting.')
sys.exit(1)
if 'tagPrefix' not in projectConfig or 'tagPostfix' not in projectConfig:
print('Error: PROJECT_CONFIG is missing required fields: tagPrefix and/or tagPostfix')
sys.exit(1)
project_name = projectConfig.get('projectName')
if project_name is None:
print('Error: PROJECT_CONFIG is missing required field: projectName')
sys.exit(1)
result = ''
issuem = re.search("(" + project_name + ")-[0-9]+", title, re.IGNORECASE)
Expand All @@ -230,7 +273,7 @@ jobs:
result = 'Jirabot Action Result:\n'
fixVersions = generateFixVersionList(jira, project_name, branch_name)
fixVersions = generateFixVersionList(jira, projectConfig, project_name, branch_name)
result += resolveIssue(jira, project_name, issue, fixVersions)
jira.issue_add_comment(issue_name, result)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -696,7 +696,7 @@ public int getHandle()

/**
* The delay in milliseconds between read requests. Primarily used for testing.
* @param sleepTimeMS
* @param sleepTimeMS the sleep time in milliseconds
*/
public void setReadRequestDelay(int sleepTimeMS)
{
Expand Down Expand Up @@ -1272,14 +1272,6 @@ private void finishFetch()
}
}

if (readSpan != null)
{
Attributes attributes = Attributes.of( AttributeKey.longKey("server.index"), Long.valueOf(getFilePartCopy()),
AttributeKey.longKey("read.offset"), streamPos,
AttributeKey.longKey("read.size"), Long.valueOf(maxReadSizeKB*1000));
readSpan.addEvent("RowServiceInputStream.readRequest", attributes);
}

// Create the read ahead request
if (this.simulateFail) this.handle = -1;
String readAheadRequest = (this.forceTokenUse) ? this.makeTokenRequest() : this.makeHandleRequest();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class DFSReadWriteTest extends BaseRemoteTest
{
// private static final String[] datasets = { "~benchmark::integer::20kb", "~unit_test::all_types::thor", "~unit_test::all_types::xml", "~unit_test::all_types::json", "~unit_test::all_types::csv" };
private static final String[] datasets = { "~unit_test::all_types::xml", "~unit_test::all_types::json", "~unit_test::all_types::csv" };
private static final int[] expectedCounts = { 1250, 100000, 100000, 100000, 100000, 100000};
// Note: These datasets are generated by dfsclient/src/target/resources/generate-datasets.ecl
private static final String[] datasets = { "~benchmark::integer::20kb", "~unit_test::all_types::thor", "~unit_test::all_types::json", "~unit_test::all_types::csv" };
private static final int[] expectedCounts = { 1250, 100000, 100000, 100000};

private static final Version newProtocolVersion = new Version(8,12,10);

Expand Down
75 changes: 75 additions & 0 deletions wsclient/src/main/java/org/hpccsystems/ws/client/utils/Utils.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import java.io.OutputStream;
import java.io.PrintStream;
import java.io.StringWriter;
import java.lang.management.ManagementFactory;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLConnection;
Expand Down Expand Up @@ -1261,4 +1262,78 @@ static public String getTraceParentHeader(Span span)

return traceparent;
}

/**
* Checks if a specified VM argument is present.
*
* This method retrieves the list of VM arguments and searches for the specified argument name.
* If the argument is found, it returns true. If the argument is not found, it returns false.
*
* @param vmArgName the name of the VM argument to search for
* @return {@code true} if the specified VM argument is present, {@code false} otherwise
*/
static public boolean containsVMArgument(String vmArgName)
{
List<String> argslist = ManagementFactory.getRuntimeMXBean().getInputArguments();
for (String string : argslist)
{
if(string.matches("(?i)(" + vmArgName + "):.*"))
{
return true;
}
}
return false;
}

/**
* Fetches the value of a specified VM argument.
*
* This method retrieves the list of VM arguments and searches for the specified argument name.
* If the argument is found, it returns the value associated with it. If the argument is not found,
* it returns an empty string.
*
* @param vmArgName the name of the VM argument to search for
* @return the value of the specified VM argument, or an empty string if the argument is not found
*/
static public String fetchVMArgument(String vmArgName)
{
List<String> argslist = ManagementFactory.getRuntimeMXBean().getInputArguments();
for (String string : argslist)
{
if(string.matches("(?i)(" + vmArgName + "):.*"))
{
String[] keyval = string.split(vmArgName+":");

return keyval[1];
}
}
return "";
}

/**
* Checks if the OpenTelemetry Java agent is used by inspecting the VM arguments.
*
* This method fetches the VM argument specified by "-javaagent" and checks if it contains
* the term "opentelemetry". If the argument is found and contains "opentelemetry", it returns true.
* Otherwise, it returns false.
*
* @return {@code true} if the OpenTelemetry Java agent is detected, {@code false} otherwise.
*/
static public boolean isOtelJavaagentUsed()
{
String javaAgentPath = fetchVMArgument("-javaagent");
if (!javaAgentPath.isEmpty())
{
System.out.println("javaagent VM argument detected: " + javaAgentPath);

File jaFile = new File(javaAgentPath);

if (jaFile.getName().contains("opentelemetry") || jaFile.getName().contains("otel"))
{
System.out.println("Otel javaagent argument detected: " + javaAgentPath);
return true;
}
}
return false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ HPCC SYSTEMS software Copyright (C) 2019 HPCC Systems®.
import org.hpccsystems.ws.client.HPCCWsTopologyClient.TopologyGroupQueryKind;
import org.hpccsystems.ws.client.platform.Platform;
import org.hpccsystems.ws.client.utils.Connection;
import org.hpccsystems.ws.client.utils.Utils;
import org.hpccsystems.ws.client.wrappers.gen.wstopology.TpGroupWrapper;
import org.hpccsystems.ws.client.wrappers.wsworkunits.WorkunitWrapper;
import org.junit.Assert;
Expand Down Expand Up @@ -135,9 +136,13 @@ public static void initialize() throws Exception
System.out.println(" otel.metrics.exporter: "+ System.getProperty("otel.metrics.exporter"));
System.out.println(" OTEL_METRICS_EXPORTER Env var: " + System.getenv("OTEL_METRICS_EXPORTER"));

globalOTel = AutoConfiguredOpenTelemetrySdk.initialize().getOpenTelemetrySdk();
if (!Utils.isOtelJavaagentUsed())
{
globalOTel = AutoConfiguredOpenTelemetrySdk.initialize().getOpenTelemetrySdk();
}
}
else

if (globalOTel == null)
{
globalOTel = GlobalOpenTelemetry.get();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,21 +190,23 @@ else if (currentParam.matches(WSSQLPORTPATTERN))
System.out.println("If missing dependancies arise, test will halt!");
System.out.println(" otel.traces.exporter sys property: "+System.getProperty("otel.traces.exporter"));
System.out.println(" OTEL_TRACES_EXPORTER Env var: " + System.getenv("OTEL_TRACES_EXPORTER"));
System.out.println(" OTEL_TRACES_SAMPLER Env var: " + System.getenv("OTEL_TRACES_SAMPLER"));
System.out.println(" otel.traces.sampler sys property: "+System.getProperty("otel.traces.sampler"));
System.out.println(" OTEL_TRACES_SAMPLER Env var: " + System.getenv("OTEL_TRACES_SAMPLER"));
System.out.println(" otel.traces.sampler sys property: "+System.getProperty("otel.traces.sampler"));
System.out.println(" otel.logs.exporter: "+ System.getProperty("otel.logs.exporter"));
System.out.println(" OTEL_LOGS_EXPORTER Env var: " + System.getenv("OTEL_LOGS_EXPORTER"));
System.out.println(" otel.metrics.exporter: "+ System.getProperty("otel.metrics.exporter"));
System.out.println(" OTEL_METRICS_EXPORTER Env var: " + System.getenv("OTEL_METRICS_EXPORTER"));

globalOTel = AutoConfiguredOpenTelemetrySdk.initialize().getOpenTelemetrySdk();
if (!Utils.isOtelJavaagentUsed())
{
globalOTel = AutoConfiguredOpenTelemetrySdk.initialize().getOpenTelemetrySdk();
}
}
else
{

if (globalOTel == null)
globalOTel = GlobalOpenTelemetry.get();
}

Span rootSpan = globalOTel.getTracer("PlatformTester").spanBuilder("rootspan").startSpan();
Span rootSpan = globalOTel.getTracer("PlatformTester").spanBuilder("PlatformTest").startSpan();
try (Scope scope = rootSpan.makeCurrent())
{
Platform platform = Platform.get(prot, hpccServer, port, user, pass);
Expand Down

0 comments on commit 7aac83f

Please sign in to comment.