Skip to content

Commit

Permalink
Merge pull request #15 from codecov/joseph/fix-unbound-res
Browse files Browse the repository at this point in the history
fix: res referenced before assignment
  • Loading branch information
joseph-sentry authored Apr 16, 2024
2 parents 02bf400 + 7d21d59 commit e59b288
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
14 changes: 7 additions & 7 deletions .github/workflows/run.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.6, 3.7, 3.8]
python-version: ['3.7', '3.8', '3.9', '3.10']
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
Expand All @@ -20,7 +20,7 @@ jobs:
- name: Test with pytest
run: |
make testsuite.run
- uses: codecov/codecov-action@v2
- uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
flags: Python-v${{ matrix.python-version }}
Expand All @@ -30,11 +30,11 @@ jobs:
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: 3.8
python-version: '3.8'
- name: Install Packaging Tools
run: |
make package.install
Expand Down
8 changes: 5 additions & 3 deletions codecovopentelem/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,17 +121,19 @@ def export(self, spans):
if not tracked_spans and not untracked_spans:
return SpanExportResult.SUCCESS
url = urllib.parse.urljoin(self._codecov_endpoint, "/profiling/uploads")
headers = {"Authorization": f"repotoken {self._repository_token}"}
json_data = {"profiling": self._code}
try:
res = requests.post(
url,
headers={"Authorization": f"repotoken {self._repository_token}"},
json={"profiling": self._code},
headers=headers,
json=json_data,
)
res.raise_for_status()
except requests.RequestException:
log.warning(
"Unable to send profiling data to codecov",
extra=dict(response_data=res.json())
extra=dict(url=url, json=json_data)
)
return SpanExportResult.FAILURE
location = res.json()["raw_upload_location"]
Expand Down

0 comments on commit e59b288

Please sign in to comment.