Skip to content

Feature Request: override OTEL_SERVICE_NAME when using the observability feature #46213

Description

@v1v

What

I want to override the default service name.

Why

So I can cerate my own set of service names according to my org's guidelines.

Further details

As far as I see OTEL_SERVICE_NAME is always set regardless if it's defined

diff --git a/.github/workflows/cluster-triage.md b/.github/workflows/cluster-triage.md
index f7cdc61a4ae..856b28633f3 100644
--- a/.github/workflows/cluster-triage.md
+++ b/.github/workflows/cluster-triage.md
@@ -18,6 +18,12 @@ permissions:
   issues: read
   pull-requests: read
   copilot-requests: write
+observability:
+  otlp:
+    endpoint:
+      - url: ${{ secrets.GH_AW_OTEL_ENDPOINT }}
+env:
+  OTEL_SERVICE_NAME: my-service
 imports:
   - .github/agents/oblt-clusters-triage.agent.md
 pre-agent-steps:
@@ -91,6 +97,7 @@ safe-outputs:
 timeout-minutes: 30
 network:
   allowed:
+    - "*.grafana.net"

and gh aw compile fails with

✗ Compiled 1 workflow(s): 1 error(s) across 1 failed workflow(s), 2 warning(s)

✗ Failed workflows:
✗ cluster-triage.md

✗ cluster-triage.md (1 error(s)):
  • 🔴 CRITICAL (fix first):
  • 1. generated lock file is not valid YAML: [84:3] mapping key "OTEL_SERVICE_NAME" already defined at [82:3]                                                                                                  
  81 | env:                                                                                                                                                                                                     
  82 |   OTEL_SERVICE_NAME: my-service                                                                                                                                                                          
  83 |   OTEL_EXPORTER_OTLP_ENDPOINT: ${{ secrets.GH_AW_OTEL_ENDPOINT }}                                                                                                                                
> 84 |   OTEL_SERVICE_NAME: gh-aw.cluster-triage                                                                                                                                                                
         ^                                                                                                                                                                                                      
  85 |   OTEL_RESOURCE_ATTRIBUTES: 'gh-aw.workflow.name=Cluster%20Triage,gh-aw.repository=${{ github.repository }},gh-aw.run.id=${{ github.run_id }},github.run_id=${{ github.run_id }},gh-aw.engine.id=copilot'
  86 |   GH_AW_OTLP_ENDPOINTS: '[{"url":"${{ secrets.GH_AW_OTEL_ENDPOINT }}"}]'                                                                                                                         
i → Remove the duplicate OTEL_SERVICE_NAME key; the first definition is at line 82.
✗ compilation failed

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions