Skip to content

Commit

Permalink
another try
Browse files Browse the repository at this point in the history
Signed-off-by: sallyom <[email protected]>
  • Loading branch information
sallyom committed Jun 23, 2024
1 parent 1f0f1f9 commit e06a175
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
11 changes: 6 additions & 5 deletions .github/workflows/test-trace-steps.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,9 @@ jobs:
wget https://github.com/open-telemetry/opentelemetry-collector-releases/releases/download/v0.103.0/otelcol-contrib_0.103.0_linux_amd64.tar.gz
tar -xvf otelcol-contrib_0.103.0_linux_amd64.tar.gz
- name: CA secret to 1-line
env:
ROSA_OTEL_CABUNDLE: ${{ secrets.ROSA_OTEL_CABUNDLE }}
- name: Write secrets to files
run: |
echo "$ROSA_OTEL_CABUNDLE" > /tmp/ca.crt
echo "${{ secrets.ROSA_OTEL_CABUNDLE }}" > /tmp/ca.crt
- name: Configure OpenTelemetry Collector
run: |
Expand Down Expand Up @@ -70,7 +68,7 @@ jobs:
- name: Run OpenTelemetry Collector
run: |
./otelcol-contrib --config otel-collector-config.yaml &
./otelcol-contrib --config otel-collector-config.yaml > otel-collector.log 2>&1 &
- name: Start build trace
run: |
Expand Down Expand Up @@ -109,3 +107,6 @@ jobs:
export STEP_NAME="test"
export TRACE_ACTION="end"
python ci/trace-steps.py
- name: Display OpenTelemetry Collector Logs
run: cat otel-collector.log
7 changes: 5 additions & 2 deletions ci/trace-steps.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,20 @@
tracer = trace.get_tracer(__name__)

# Set up OTLP exporter to send to OpenTelemetry Collector
otlp_exporter = OTLPSpanExporter(endpoint="0.0.0.0:4317", insecure=True)
otlp_exporter = OTLPSpanExporter(endpoint="http://0.0.0.0:4317", insecure=True)
trace.get_tracer_provider().add_span_processor(BatchSpanProcessor(otlp_exporter))

# Export to console for debugging
console_exporter = ConsoleSpanExporter()
trace.get_tracer_provider().add_span_processor(BatchSpanProcessor(console_exporter))

def start_trace(step_name):
return tracer.start_span(name=step_name)
span = tracer.start_span(name=step_name)
print(f"Started span: {span.get_span_context().trace_id}")
return span

def end_trace(span):
print(f"Ending span: {span.get_span_context().trace_id}")
span.end()

if __name__ == "__main__":
Expand Down

0 comments on commit e06a175

Please sign in to comment.