Skip to content

Commit

Permalink
add if statement for service name
Browse files Browse the repository at this point in the history
  • Loading branch information
msarahan committed Nov 5, 2024
1 parent 4835798 commit c77937f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
11 changes: 10 additions & 1 deletion telemetry-dispatch-load-base-env-vars/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ description: |
in their pipelines.
Outputs here are all assumed to be env vars set in the calling environment
inputs:
load_service_name:
description: |
If true, loads OTEL_SERVICE_NAME from the stashed env vars. This is used for top-level workflows.
Otherwise the telemetry service name is obtained from Github job metadata. This is for child workflows.
default: 'false'

runs:
using: 'composite'
Expand All @@ -15,5 +21,8 @@ runs:
repository: ${{ env.SHARED_ACTIONS_REPO}}
ref: ${{ env.SHARED_ACTIONS_REF}}
path: ./shared-actions
- name: Stash base env vars
- name: Set OTEL_SERVICE_NAME from job if not loading from stash
if: ${{ inputs.load_service_name != 'true' }}
uses: ./shared-actions/telemetry-impls/_set-otel-service-name
- name: Load base env vars
uses: ./shared-actions/telemetry-impls/_load-base-env-vars
1 change: 1 addition & 0 deletions telemetry-impls/_set-otel-service-name/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,6 @@ runs:
echo JOB_NAME="$(cat job_info.json | jq -r '.name')" >> ${GITHUB_OUTPUT};
- shell: bash
id: set-otel-service-name-env
if: ${{ env.OTEL_SERVICE_NAME == "" }}
run: |
echo OTEL_SERVICE_NAME="${{ steps.get-job-name.outputs.JOB_NAME}}" >> ${GITHUB_ENV};

0 comments on commit c77937f

Please sign in to comment.