Skip to content

Commit

Permalink
Update GCE Beyla sample to use config file
Browse files Browse the repository at this point in the history
  • Loading branch information
psx95 committed Aug 3, 2024
1 parent d2781cc commit 210024b
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 19 deletions.
9 changes: 4 additions & 5 deletions recipes/beyla-golden-signals/gce/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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
Expand All @@ -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
```

Expand Down
31 changes: 31 additions & 0 deletions recipes/beyla-golden-signals/gce/beyla-config.yaml
Original file line number Diff line number Diff line change
@@ -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"]

Check failure on line 11 in recipes/beyla-golden-signals/gce/beyla-config.yaml

View workflow job for this annotation

GitHub Actions / yamllint

11:29 [commas] too few spaces after comma
# default only includes "application"
features: ["application","application_process"]

Check failure on line 13 in recipes/beyla-golden-signals/gce/beyla-config.yaml

View workflow job for this annotation

GitHub Actions / yamllint

13:28 [commas] too few spaces after comma

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
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 210024b

Please sign in to comment.