-
Notifications
You must be signed in to change notification settings - Fork 158
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Include splunk-otel-js in auto instrumentation deb/rpm (#3540)
* Add systemd sample file to splunk-otel-auto-instrumention * Update tests for new libsplunk.so * Include splunk-otel-js in auto instrumentation deb/rpm * Include default /etc/splunk/zeroconfig_node.conf in deb/rpm packages
- Loading branch information
1 parent
b39393e
commit 865c112
Showing
10 changed files
with
171 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
#!/usr/bin/env bash | ||
set -euo pipefail | ||
|
||
# NOTE: this script is meant to be run on the GitLab CI, it depends on GitLab CI variables | ||
# Based on https://github.com/signalfx/splunk-otel-java/blob/c9134906c84e9a32a974dec4b380453fe1757410/scripts/propagate-version.sh | ||
|
||
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" | ||
|
||
# shellcheck source-path=SCRIPTDIR | ||
source "${SCRIPT_DIR}/common.sh" | ||
|
||
ROOT_DIR="${SCRIPT_DIR}/../" | ||
cd "${ROOT_DIR}" | ||
|
||
create_collector_pr() { | ||
local repo="signalfx/splunk-otel-collector" | ||
local repo_url="https://srv-gh-o11y-gdi:${GITHUB_TOKEN}@github.com/${repo}.git" | ||
local branch="create-pull-request/update-nodejs-agent" | ||
local message="Update splunk-otel-js to latest" | ||
|
||
echo ">>> Cloning the $repo repository ..." | ||
git clone "$repo_url" collector-mirror | ||
cd collector-mirror | ||
|
||
setup_branch "$branch" "$repo_url" | ||
|
||
echo ">>> Getting latest splunk-otel-js release ..." | ||
tag="$( gh release view --repo "https://github.com/signalfx/splunk-otel-js" --json tagName --jq 'select(.isDraft|not and .isPrelease|not) | .tagName' )" | ||
if [[ -n "$tag" ]]; then | ||
echo ">>> Updating splunk-otel-js version to $tag ..." | ||
echo "$tag" > instrumentation/packaging/nodejs-agent-release.txt | ||
else | ||
echo "ERROR: Failed to get latest release tag from https://github.com/signalfx/splunk-otel-js !" >&2 | ||
exit 1 | ||
fi | ||
|
||
# Only create the PR if there are changes | ||
if ! git diff --exit-code >/dev/null 2>&1; then | ||
git commit -S -am "$message" | ||
git push -f "$repo_url" "$branch" | ||
echo ">>> Creating the PR ..." | ||
gh pr create \ | ||
--draft \ | ||
--repo "$repo" \ | ||
--title "$message" \ | ||
--body "$message" \ | ||
--base main \ | ||
--head "$branch" | ||
fi | ||
} | ||
|
||
setup_gpg | ||
import_gpg_secret_key "$GITHUB_BOT_GPG_KEY" | ||
setup_git | ||
create_collector_pr |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
instrumentation/packaging/fpm/examples/systemd/00-splunk-otel-js.conf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# Copyright Splunk Inc. | ||
# | ||
# Licensed 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. | ||
|
||
# Sample systemd drop-in file to activate and configure Splunk OpenTelemetry Auto Instrumentation for Node.js | ||
# https://docs.splunk.com/Observability/gdi/get-data-in/application/nodejs/get-started.html | ||
|
||
# To use this file to activate/configure auto instrumentation for all supported Node.js applications running as systemd | ||
# services (requires root privileges): | ||
# 1. Check https://docs.splunk.com/Observability/gdi/get-data-in/application/nodejs/nodejs-otel-requirements.html for | ||
# minimum requirements. | ||
# 2. Install the provided Node.js auto instrumentation package with npm. For example: | ||
# $ sudo npm install --global /usr/lib/splunk-instrumentation/splunk-otel-js.tar.gz | ||
# 3. See https://docs.splunk.com/Observability/gdi/get-data-in/application/nodejs/configuration/advanced-nodejs-otel-configuration.html | ||
# for supported environment variables and defaults for Node.js auto instrumentation | ||
# 4. Add/Update the DefaultEnvironment entries below for the desired environment variables and values | ||
# 5. Copy this file to the systemd configuration directory, e.g. /usr/lib/systemd/system.conf.d/ | ||
# 6. Reboot the system or run the following commands to restart the applicable service(s) for any changes to take effect: | ||
# $ sudo systemctl daemon-reload | ||
# $ sudo systemctl restart <service-name> # replace "<service-name>" and run for each applicable service | ||
|
||
# See https://www.freedesktop.org/software/systemd/man/systemd-system.conf.html for general information | ||
# about systemd configuration and other supported options. | ||
|
||
[Manager] | ||
# Required to activate Splunk OpenTelemetry Auto Instrumentation for Node.js | ||
DefaultEnvironment="NODE_OPTIONS=-r @splunk/otel/instrument" | ||
|
||
# Examples of common configuration options: | ||
#DefaultEnvironment="OTEL_EXPORTER_OTLP_ENDPOINT=http://1.2.3.4:5678" | ||
#DefaultEnvironment="OTEL_RESOURCE_ATTRIBUTES=deployment.environment=my_deployment_environment" | ||
#DefaultEnvironment="OTEL_SERVICE_NAME=my_service_name" | ||
#DefaultEnvironment="SPLUNK_PROFILER_ENABLED=true" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
NODE_OPTIONS=-r @splunk/otel/instrument |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
v2.4.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters