-
Notifications
You must be signed in to change notification settings - Fork 155
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support to create default Instrumentation for operator based auto-instrumentation #836
Merged
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
3b6a733
Add support to create default Instrumentation for operator based auto…
jvoravong da8f7c8
remove duplicated file
jvoravong 3269653
patch: move non-dynamic instrumentation configurations to values.yaml
jvoravong 201d8cf
Refactor port values updates to be more strict
jvoravong 81bd753
Refactor update_java_agent.yaml to update_instrumentation_dependencie…
jvoravong 79cf10a
Remove done TODO
jvoravong 7a4d99f
Merge branch 'main' of github.com:jvoravong/splunk-otel-collector-cha…
jvoravong 409c937
patch: manually updates examples and comments
jvoravong bfa1904
patch: remove extra comment
jvoravong fdf2bb0
patch: reduce comment
jvoravong c9077c3
patch: enhance validation logic
jvoravong f5a1dcb
patch: refactor validation rules for environment
jvoravong File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We might be able to have automation extract the list value for this line, will add in a future PR if possible.