Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions snap/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ There are a small number of config options:
| `http-address` | Any string | `:7071` | Address for HTTP server to bind to. |
| `remote-store-address` | Any string | `localhost:7071` | Remote store (gRPC) address to send profiles and symbols to. |
| `remote-store-insecure` | `true`, `false` | `false` | Send gRPC requests via plaintext instead of TLS. |
| `remote-store-grpc-headers` | Comma-separated key=value pairs | `` | Additional gRPC headers to send with each request. |
| `config-path` | Any string | `` | Path to config file. |

Config options can be set with `sudo snap set parca-agent <option>=<value>`
6 changes: 6 additions & 0 deletions snap/hooks/configure
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,9 @@ off_cpu_threshold="$(snapctl get off-cpu-threshold)"
if [[ -z "$off_cpu_threshold" ]]; then
snapctl set off-cpu-threshold="0"
fi

# Set gRPC headers
remote_store_grpc_headers="$(snapctl get remote-store-grpc-headers)"
if [[ -z "$remote_store_grpc_headers" ]]; then
snapctl set remote-store-grpc-headers=""
fi
10 changes: 10 additions & 0 deletions snap/local/parca-agent-wrapper
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ token="$(snapctl get remote-store-bearer-token)"
metadata_external_labels="$(snapctl get metadata-external-labels)"
config_path="$(snapctl get config-path)"
off_cpu_threshold="$(snapctl get off-cpu-threshold)"
grpc_headers="$(snapctl get remote-store-grpc-headers)"

# Start building an array of command line options
opts=(
Expand All @@ -46,5 +47,14 @@ if [[ -n "${token}" ]]; then
opts+=("--remote-store-bearer-token=${token}")
fi

# If gRPC headers have been set, append them to the command line args
# Headers should be comma-separated key=value pairs, e.g., "X-Custom-Header=value1,X-Another=value2"
if [[ -n "${grpc_headers}" ]]; then
IFS=',' read -ra headers <<< "${grpc_headers}"
for header in "${headers[@]}"; do
opts+=("--remote-store-grpc-headers=${header}")
done
fi

# Run parca-agent with the gathered arguments
exec "${SNAP}/parca-agent" "${opts[@]}" 2>&1 | tee -a "$SNAP_COMMON/parca-agent.log"