-
Notifications
You must be signed in to change notification settings - Fork 148
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support to create default Instrumentation for operator based auto…
…-instrumentation (#836) Add support to create default Instrumentation for operator based auto-instrumentation
- Loading branch information
Showing
14 changed files
with
430 additions
and
97 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,42 @@ | ||
name: Check for new java agent | ||
name: Check for new instrumentation versions | ||
|
||
on: | ||
schedule: | ||
- cron: "45 */4 * * *" | ||
workflow_dispatch: | ||
|
||
env: | ||
JAVA_REPO: ghcr.io/signalfx/splunk-otel-java/splunk-otel-java | ||
VALUES_YAML: helm-charts/splunk-otel-collector/values.yaml | ||
LATEST_API: https://api.github.com/repos/signalfx/splunk-otel-java/releases/latest | ||
LATEST_API: https://api.github.com/repos/signalfx/splunk-otel-{lang}/releases/latest | ||
|
||
jobs: | ||
maybe_update_java: | ||
maybe_update: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
language: ['java'] # Add other languages here | ||
steps: | ||
- uses: actions/[email protected] | ||
- name: swizzle version | ||
id: swizzle_version | ||
run: | | ||
LOCAL_VER=$(grep -A 1 $JAVA_REPO $VALUES_YAML | tail -1 | sed -e 's/.*tag: //' | tr -d '"') | ||
LATEST_VER=$(curl -qs -H "Accept: application/vnd.github+json" $LATEST_API | jq -r .tag_name) | ||
REPO=ghcr.io/signalfx/splunk-otel-${{ matrix.language }}/splunk-otel-${{ matrix.language }} | ||
LOCAL_VER=$(grep $REPO $VALUES_YAML | awk -F: '{print $2}' | tr -d ' "') | ||
LATEST_VER=$(curl -qs -H "Accept: application/vnd.github+json" $(echo $LATEST_API | sed "s/{lang}/${{ matrix.language }}/g") | jq -r .tag_name) | ||
echo "LATEST_VER=$LATEST_VER" >> $GITHUB_OUTPUT | ||
echo "Current version is $LOCAL_VER, latest is $LATEST_VER" | ||
echo "Current version of ${{ matrix.language }} is $LOCAL_VER, latest is $LATEST_VER" | ||
if [ "$LATEST_VER" == "$LOCAL_VER" ]; then | ||
echo We are already up to date. Nothing else to do. | ||
else | ||
echo 'Verifying that the image is pullable...' | ||
echo '(If this fails, the agent version is out of sync with ghcr version)' | ||
docker pull $JAVA_REPO:$LATEST_VER | ||
docker pull $REPO:$LATEST_VER | ||
echo 'Looks like we are good to update...' | ||
echo Updating to new version | ||
echo "NEED_UPDATE=1" >> $GITHUB_OUTPUT | ||
VLINE=$(grep -n -A 1 $JAVA_REPO $VALUES_YAML | tail -1 | sed -e "s/-.*//") | ||
echo sed -i "${VLINE}s/\"v.*\"/\"${LATEST_VER}\"/" $VALUES_YAML | ||
sed -i "${VLINE}s/\"v.*\"/\"${LATEST_VER}\"/" $VALUES_YAML | ||
VLINE=$(grep -n $REPO $VALUES_YAML | cut -f1 -d:) | ||
echo sed -i "${VLINE}s|:${LOCAL_VER}|:${LATEST_VER}|" $VALUES_YAML | ||
sed -i "${VLINE}s|:${LOCAL_VER}|:${LATEST_VER}|" $VALUES_YAML | ||
git --no-pager diff | ||
fi | ||
- name: render some templates | ||
|
@@ -51,8 +54,8 @@ jobs: | |
if: ${{ steps.swizzle_version.outputs.NEED_UPDATE == 1 }} | ||
uses: peter-evans/create-pull-request@v5 | ||
with: | ||
commit-message: update java agent version | ||
title: Update Java agent version to ${{ steps.swizzle_version.outputs.LATEST_VER }} | ||
body: Use the new version of the java agent | ||
branch: "update-java-${{ steps.swizzle_version.outputs.LATEST_VER }}" | ||
commit-message: Update ${{ matrix.language }} instrumentation version | ||
title: Update ${{ matrix.language }} agent version to ${{ steps.swizzle_version.outputs.LATEST_VER }} | ||
body: Use the new version of the ${{ matrix.language }} instrumentation library | ||
branch: "update-${{ matrix.language }}-${{ steps.swizzle_version.outputs.LATEST_VER }}" | ||
base: main |
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
23 changes: 0 additions & 23 deletions
23
examples/enable-operator-and-auto-instrumentation/instrumentation.yaml
This file was deleted.
Oops, something went wrong.
43 changes: 43 additions & 0 deletions
43
...auto-instrumentation/instrumentation/instrumentation-add-custom-environment-span-tag.yaml
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 @@ | ||
--- | ||
# Source: splunk-otel-collector/templates/operator/instrumentation.yaml | ||
# Description: Set a custom value (dev) for the deployment.environment tag on exported spans | ||
# Input values.yaml: | ||
# splunkObservability: | ||
# accessToken: CHANGEME | ||
# realm: us0 | ||
# clusterName: CHANGEME | ||
# environment: CHANGEME | ||
# operator: | ||
# enabled: true | ||
# instrumentation: | ||
# spec: | ||
# env: | ||
# - name: OTEL_RESOURCE_ATTRIBUTES | ||
# value: "deployment.environment=dev" | ||
# certmanager: | ||
# enabled: true | ||
# Output instrumentation.yaml: | ||
apiVersion: opentelemetry.io/v1alpha1 | ||
kind: Instrumentation | ||
metadata: | ||
name: splunk-instrumentation | ||
spec: | ||
dotnet: | ||
env: | ||
- name: OTEL_EXPORTER_OTLP_ENDPOINT | ||
value: http://$(SPLUNK_OTEL_AGENT):4318 | ||
env: | ||
- name: OTEL_RESOURCE_ATTRIBUTES | ||
value: deployment.environment=dev | ||
exporter: | ||
endpoint: http://$(SPLUNK_OTEL_AGENT):4317 | ||
java: | ||
image: ghcr.io/signalfx/splunk-otel-java/splunk-otel-java:v1.25.0 | ||
propagators: | ||
- tracecontext | ||
- baggage | ||
- b3 | ||
python: | ||
env: | ||
- name: OTEL_EXPORTER_OTLP_ENDPOINT | ||
value: http://$(SPLUNK_OTEL_AGENT):4318 |
49 changes: 49 additions & 0 deletions
49
...-operator-and-auto-instrumentation/instrumentation/instrumentation-add-trace-sampler.yaml
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,49 @@ | ||
--- | ||
# Source: splunk-otel-collector/templates/operator/instrumentation.yaml | ||
# Description: Add a trace sampler to control how many traces are exported | ||
# Input values.yaml: | ||
# splunkObservability: | ||
# accessToken: CHANGEME | ||
# realm: us0 | ||
# clusterName: CHANGEME | ||
# environment: CHANGEME | ||
# operator: | ||
# enabled: true | ||
# instrumentation: | ||
# spec: | ||
# sampler: | ||
# type: traceidratio | ||
# argument: "0.95" | ||
# certmanager: | ||
# enabled: true | ||
# Output instrumentation.yaml: | ||
apiVersion: opentelemetry.io/v1alpha1 | ||
kind: Instrumentation | ||
metadata: | ||
name: splunk-instrumentation | ||
spec: | ||
dotnet: | ||
env: | ||
- name: OTEL_EXPORTER_OTLP_ENDPOINT | ||
value: http://$(SPLUNK_OTEL_AGENT):4318 | ||
env: | ||
- name: SPLUNK_OTEL_AGENT | ||
valueFrom: | ||
fieldRef: | ||
apiVersion: v1 | ||
fieldPath: status.hostIP | ||
exporter: | ||
endpoint: http://$(SPLUNK_OTEL_AGENT):4317 | ||
java: | ||
image: ghcr.io/signalfx/splunk-otel-java/splunk-otel-java:v1.25.0 | ||
propagators: | ||
- tracecontext | ||
- baggage | ||
- b3 | ||
python: | ||
env: | ||
- name: OTEL_EXPORTER_OTLP_ENDPOINT | ||
value: http://$(SPLUNK_OTEL_AGENT):4318 | ||
sampler: | ||
argument: "0.95" | ||
type: traceidratio |
Oops, something went wrong.