diff --git a/recipes/beyla-golden-signals/gce/README.md b/recipes/beyla-golden-signals/gce/README.md index 140c473..4fa88b1 100644 --- a/recipes/beyla-golden-signals/gce/README.md +++ b/recipes/beyla-golden-signals/gce/README.md @@ -32,9 +32,8 @@ From the location of this recipe *(beyla-golden-sigals/gce)*, execute the follow #### Install and configure Beyla on the VM: ```sh -# Make sure to run this without a dot slash (./) since it needs to source variables. -# Running using ./ will run the script it in a subshell. -. configure-beyla.sh +# Install beyla on VM and configure Ops Agent +./install-beyla.sh ``` #### Check if Google Cloud Ops Agent is still running (Optional): @@ -51,7 +50,7 @@ sudo systemctl status "google-cloud-ops-agent*" ```sh # Start beyla in the background -sudo -E beyla & +sudo beyla --config=beyla-config.yaml & ``` ## Build & run the sample Java server app @@ -62,7 +61,7 @@ sudo -E beyla & > If for whatever reason you need to kill the currently running server app, run the following command `fuser -k 8080/tcp`. ```sh -# This will start the built server application in the background, listening on port 8080. +# This will start the built server application in the background, listening on port 8080 ./run-sample-app.sh ``` diff --git a/recipes/beyla-golden-signals/gce/beyla-config.yaml b/recipes/beyla-golden-signals/gce/beyla-config.yaml new file mode 100644 index 0000000..4abc9f6 --- /dev/null +++ b/recipes/beyla-golden-signals/gce/beyla-config.yaml @@ -0,0 +1,31 @@ +# Beyla can be configured to listen to applications running on multiple ports. +# Beyla can also be configured globally using environment variables. +# Environment variables have priority over the properties in the config file. +open_port: 8080,8082,8083 +trace_printer: text +protocol: grpc + +otel_metrics_export: + endpoint: http://0.0.0.0:4317 + # default includes all possible instrumentations "*" + instrumentations: ["http","grpc"] + # default only includes "application" + features: ["application","application_process"] + +otel_traces_export: + endpoint: http://0.0.0.0:4317 + +# This section describes how you can discover various services +# running on your system and assign them different names and +# namespaces based on the exe_path. +# This feature is not available when configuring through environment variables. +discovery: + services: + - exe_path: java + name: "my-java-service" + namespace: beyla-gce-java-apps + # This configuration is not relevant to this sample + # since we are only runninfg a java application + - exe_path: node + name: "my-node-service" + namespace: beyla-gce-node-apps diff --git a/recipes/beyla-golden-signals/gce/configure-beyla.sh b/recipes/beyla-golden-signals/gce/install-beyla.sh similarity index 72% rename from recipes/beyla-golden-signals/gce/configure-beyla.sh rename to recipes/beyla-golden-signals/gce/install-beyla.sh index 2d4dbf0..ec118f7 100755 --- a/recipes/beyla-golden-signals/gce/configure-beyla.sh +++ b/recipes/beyla-golden-signals/gce/install-beyla.sh @@ -14,7 +14,7 @@ # See the License for the specific language governing permissions and # limitations under the License. # -# This script installs and configures beyla on to the current GCE VM instance, installing necessary dependencies. +# This script installs beyla on to the current GCE VM instance while installing necessary dependencies. # The script also configures the installed google-cloud-ops-agent so that it can collect metrics emitted by Beyla. # Update dependencies @@ -34,19 +34,6 @@ tar -xzf beyla.tar.gz -C beyla-installation/ # /usr/local/bin is the path on a default GCE instance running Debian sudo cp beyla-installation/beyla /usr/local/bin -# Configuring Beyla Environment variables when running in direct mode -echo "Configuring Beyla..." -# Beyla configuration options -export BEYLA_OPEN_PORT=8080 -export BEYLA_TRACE_PRINTER=text -export BEYLA_SERVICE_NAMESPACE="otel-beyla-gce-sample-service-ns" - -# OpenTelemetry export settings -export OTEL_EXPORTER_OTLP_PROTOCOL="grpc" -export OTEL_EXPORTER_OTLP_ENDPOINT="http://0.0.0.0:4317" -export OTEL_SERVICE_NAME="otel-beyla-gce-sample-service" -echo "Beyla Configured..." - # Apply the custom configuration to installed Google Cloud Ops Agent echo "Configuring the Google Cloud Ops Agent..." sudo cp ./google-cloud-ops-agent/config.yaml /etc/google-cloud-ops-agent/config.yaml