Skip to content
This repository was archived by the owner on Jul 16, 2025. It is now read-only.

Commit dca7a65

Browse files
fix: add more data to opentelem (#600)
* fix: add more data to opentelem * fix: tests * fix: update all other commands
1 parent eb24fb1 commit dca7a65

25 files changed

+779
-792
lines changed

codecov_cli/commands/base_picking.py

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import typing
33

44
import click
5+
import sentry_sdk
56

67
from codecov_cli.fallbacks import CodecovOption, FallbackFieldEnum
78
from codecov_cli.helpers.args import get_cli_args
@@ -54,19 +55,21 @@ def pr_base_picking(
5455
token: typing.Optional[str],
5556
service: typing.Optional[str],
5657
):
57-
enterprise_url = ctx.obj.get("enterprise_url")
58-
args = get_cli_args(ctx)
59-
logger.debug(
60-
"Starting base picking process",
61-
extra=dict(
62-
extra_log_attributes=args,
63-
),
64-
)
58+
with sentry_sdk.start_transaction(op="task", name="Base Picking"):
59+
with sentry_sdk.start_span(name="base_picking"):
60+
enterprise_url = ctx.obj.get("enterprise_url")
61+
args = get_cli_args(ctx)
62+
logger.debug(
63+
"Starting base picking process",
64+
extra=dict(
65+
extra_log_attributes=args,
66+
),
67+
)
6568

66-
if slug_without_subgroups_is_invalid(slug):
67-
logger.error(
68-
"Slug is invalid. Slug should be in the form of owner_username/repo_name"
69-
)
70-
return
69+
if slug_without_subgroups_is_invalid(slug):
70+
logger.error(
71+
"Slug is invalid. Slug should be in the form of owner_username/repo_name"
72+
)
73+
return
7174

72-
base_picking_logic(base_sha, pr, slug, token, service, enterprise_url, args)
75+
base_picking_logic(base_sha, pr, slug, token, service, enterprise_url, args)

codecov_cli/commands/commit.py

Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import typing
33

44
import click
5+
import sentry_sdk
56

67
from codecov_cli.fallbacks import CodecovOption, FallbackFieldEnum
78
from codecov_cli.helpers.args import get_cli_args
@@ -47,23 +48,25 @@ def create_commit(
4748
git_service: typing.Optional[str],
4849
fail_on_error: bool,
4950
):
50-
enterprise_url = ctx.obj.get("enterprise_url")
51-
args = get_cli_args(ctx)
52-
logger.debug(
53-
"Starting create commit process",
54-
extra=dict(
55-
extra_log_attributes=args,
56-
),
57-
)
58-
create_commit_logic(
59-
commit_sha,
60-
parent_sha,
61-
pull_request_number,
62-
branch,
63-
slug,
64-
token,
65-
git_service,
66-
enterprise_url,
67-
fail_on_error,
68-
args,
69-
)
51+
with sentry_sdk.start_transaction(op="task", name="Create Commit"):
52+
with sentry_sdk.start_span(name="create_commit"):
53+
enterprise_url = ctx.obj.get("enterprise_url")
54+
args = get_cli_args(ctx)
55+
logger.debug(
56+
"Starting create commit process",
57+
extra=dict(
58+
extra_log_attributes=args,
59+
),
60+
)
61+
create_commit_logic(
62+
commit_sha,
63+
parent_sha,
64+
pull_request_number,
65+
branch,
66+
slug,
67+
token,
68+
git_service,
69+
enterprise_url,
70+
fail_on_error,
71+
args,
72+
)

codecov_cli/commands/create_report_result.py

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import logging
22

33
import click
4+
import sentry_sdk
45

56
from codecov_cli.helpers.args import get_cli_args
67
from codecov_cli.helpers.options import global_options
@@ -25,14 +26,16 @@ def create_report_results(
2526
token: str,
2627
fail_on_error: bool,
2728
):
28-
enterprise_url = ctx.obj.get("enterprise_url")
29-
args = get_cli_args(ctx)
30-
logger.debug(
31-
"Creating report results",
32-
extra=dict(
33-
extra_log_attributes=args,
34-
),
35-
)
36-
create_report_results_logic(
37-
commit_sha, code, slug, git_service, token, enterprise_url, fail_on_error, args
38-
)
29+
with sentry_sdk.start_transaction(op="task", name="Create Report Result"):
30+
with sentry_sdk.start_span(name="create_report_result"):
31+
enterprise_url = ctx.obj.get("enterprise_url")
32+
args = get_cli_args(ctx)
33+
logger.debug(
34+
"Creating report results",
35+
extra=dict(
36+
extra_log_attributes=args,
37+
),
38+
)
39+
create_report_results_logic(
40+
commit_sha, code, slug, git_service, token, enterprise_url, fail_on_error, args
41+
)

codecov_cli/commands/empty_upload.py

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import typing
33

44
import click
5+
import sentry_sdk
56

67
from codecov_cli.fallbacks import CodecovOption, FallbackFieldEnum
78
from codecov_cli.helpers.args import get_cli_args
@@ -26,14 +27,16 @@ def empty_upload(
2627
git_service: typing.Optional[str],
2728
fail_on_error: typing.Optional[bool],
2829
):
29-
enterprise_url = ctx.obj.get("enterprise_url")
30-
args = get_cli_args(ctx)
31-
logger.debug(
32-
"Starting empty upload process",
33-
extra=dict(
34-
extra_log_attributes=args,
35-
),
36-
)
37-
return empty_upload_logic(
38-
commit_sha, slug, token, git_service, enterprise_url, fail_on_error, force, args
39-
)
30+
with sentry_sdk.start_transaction(op="task", name="Empty Upload"):
31+
with sentry_sdk.start_span(name="empty_upload"):
32+
enterprise_url = ctx.obj.get("enterprise_url")
33+
args = get_cli_args(ctx)
34+
logger.debug(
35+
"Starting empty upload process",
36+
extra=dict(
37+
extra_log_attributes=args,
38+
),
39+
)
40+
return empty_upload_logic(
41+
commit_sha, slug, token, git_service, enterprise_url, fail_on_error, force, args
42+
)

codecov_cli/commands/get_report_results.py

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import logging
22

33
import click
4+
import sentry_sdk
45

56
from codecov_cli.fallbacks import CodecovOption, FallbackFieldEnum
67
from codecov_cli.helpers.args import get_cli_args
@@ -29,21 +30,23 @@ def get_report_results(
2930
token: str,
3031
fail_on_error: bool,
3132
):
32-
enterprise_url = ctx.obj.get("enterprise_url")
33-
args = get_cli_args(ctx)
34-
logger.debug(
35-
"Getting report results",
36-
extra=dict(
37-
extra_log_attributes=args,
38-
),
39-
)
40-
encoded_slug = encode_slug(slug)
41-
send_reports_result_get_request(
42-
commit_sha=commit_sha,
43-
report_code=code,
44-
encoded_slug=encoded_slug,
45-
service=git_service,
46-
token=token,
47-
enterprise_url=enterprise_url,
48-
fail_on_error=fail_on_error,
49-
)
33+
with sentry_sdk.start_transaction(op="task", name="Get Report Results"):
34+
with sentry_sdk.start_span(name="get_report_results"):
35+
enterprise_url = ctx.obj.get("enterprise_url")
36+
args = get_cli_args(ctx)
37+
logger.debug(
38+
"Getting report results",
39+
extra=dict(
40+
extra_log_attributes=args,
41+
),
42+
)
43+
encoded_slug = encode_slug(slug)
44+
send_reports_result_get_request(
45+
commit_sha=commit_sha,
46+
report_code=code,
47+
encoded_slug=encoded_slug,
48+
service=git_service,
49+
token=token,
50+
enterprise_url=enterprise_url,
51+
fail_on_error=fail_on_error,
52+
)

0 commit comments

Comments
 (0)