Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
NipunaMadhushan committed Jan 3, 2025
2 parents 9c28a6a + 53f6d83 commit e4a6041
Show file tree
Hide file tree
Showing 16 changed files with 530 additions and 314 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/daily_spec_conformance_test_runner.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
uses: actions/setup-java@v4
with:
distribution: "temurin"
java-version: "17"
java-version: "21.0.3"

- name: Initialize sub-modules
run: |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ public final class ObserveUtils {
private static final BString metricsReporter;
private static final boolean tracingEnabled;
private static final BString tracingProvider;
private static final boolean metricsLogsEnabled;

static {
// TODO: Move config initialization to ballerina level once checking config key is possible at ballerina level
Expand All @@ -88,13 +89,16 @@ public final class ObserveUtils {
, false);
VariableKey tracingProviderKey = new VariableKey(observeModule, "tracingProvider",
PredefinedTypes.TYPE_STRING, false);
VariableKey metricsLogsEnabledKey = new VariableKey(observeModule, "metricsLogsEnabled",
PredefinedTypes.TYPE_BOOLEAN, false);

metricsEnabled = readConfig(metricsEnabledKey, enabledKey, false);
metricsProvider = readConfig(metricsProviderKey, null, StringUtils.fromString("default"));
metricsReporter = readConfig(metricsReporterKey, providerKey, StringUtils.fromString("choreo"));
tracingEnabled = readConfig(tracingEnabledKey, enabledKey, false);
tracingProvider = readConfig(tracingProviderKey, providerKey, StringUtils.fromString("choreo"));
enabled = metricsEnabled || tracingEnabled;
metricsLogsEnabled = readConfig(metricsLogsEnabledKey, metricsLogsEnabledKey, false);
enabled = metricsEnabled || tracingEnabled || metricsLogsEnabled;
}

private ObserveUtils() {
Expand Down Expand Up @@ -136,6 +140,10 @@ public static BString getTracingProvider() {
return tracingProvider;
}

public static boolean isMetricsLogsEnabled() {
return metricsLogsEnabled;
}

/**
* Add metrics and tracing observers.
*
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
/*
* Copyright (c) 2024, WSO2 LLC. (http://www.wso2.org).
*
* WSO2 LLC. 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 org.ballerinalang.langserver.commons.workspace;

import java.nio.file.Path;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
* Represents the context required to run a Ballerina program using the LS workspace manager.
*
* @param balSourcePath Ballerina source file path to run
* @param programArgs program arguments to run the program
* @param env environment variables to be added to the program
* @param debugPort debug port to be used for debugging (if available)
* @since 2201.11.0
*/
public record RunContext(Path balSourcePath, List<String> programArgs, Map<String, String> env, Integer debugPort) {

public static class Builder {

private final Path sourcePath;
private List<String> programArgs = new ArrayList<>();
private Map<String, String> env = Map.of();
private int debugPort = -1;

public Builder(Path sourcePath) {
this.sourcePath = sourcePath;
}

public Builder withProgramArgs(List<String> programArgs) {
this.programArgs = programArgs;
return this;
}

public Builder withEnv(Map<String, String> env) {
this.env = env;
return this;
}

public Builder withDebugPort(int debugPort) {
this.debugPort = debugPort;
return this;
}

public RunContext build() {
return new RunContext(sourcePath, programArgs, env, debugPort);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -239,12 +239,13 @@ public interface WorkspaceManager {

/**
* Compiles and runs the project of the given file path. Run happens in a separate process.
* @param filePath Path that belongs to the project to be run.
*
* @param runContext context related to the project to be run.
* @return Process created by running the project. Empty if failed due to non process related issues.
* @throws IOException If failed to start the process.
* @since 2201.6.0
*/
Optional<Process> run(Path filePath, List<String> mainFuncArgs) throws IOException;
Optional<Process> run(RunContext runContext) throws IOException;

/**
* Stop a running process started with {@link #run}.
Expand Down
Loading

0 comments on commit e4a6041

Please sign in to comment.