Skip to content

Commit

Permalink
fix: add more data to opentelem (#600)
Browse files Browse the repository at this point in the history
* fix: add more data to opentelem

* fix: tests

* fix: update all other commands
  • Loading branch information
thomasrockhu-codecov authored Jan 21, 2025
1 parent eb24fb1 commit dca7a65
Show file tree
Hide file tree
Showing 25 changed files with 779 additions and 792 deletions.
31 changes: 17 additions & 14 deletions codecov_cli/commands/base_picking.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import typing

import click
import sentry_sdk

from codecov_cli.fallbacks import CodecovOption, FallbackFieldEnum
from codecov_cli.helpers.args import get_cli_args
Expand Down Expand Up @@ -54,19 +55,21 @@ def pr_base_picking(
token: typing.Optional[str],
service: typing.Optional[str],
):
enterprise_url = ctx.obj.get("enterprise_url")
args = get_cli_args(ctx)
logger.debug(
"Starting base picking process",
extra=dict(
extra_log_attributes=args,
),
)
with sentry_sdk.start_transaction(op="task", name="Base Picking"):
with sentry_sdk.start_span(name="base_picking"):
enterprise_url = ctx.obj.get("enterprise_url")
args = get_cli_args(ctx)
logger.debug(
"Starting base picking process",
extra=dict(
extra_log_attributes=args,
),
)

if slug_without_subgroups_is_invalid(slug):
logger.error(
"Slug is invalid. Slug should be in the form of owner_username/repo_name"
)
return
if slug_without_subgroups_is_invalid(slug):
logger.error(
"Slug is invalid. Slug should be in the form of owner_username/repo_name"
)
return

base_picking_logic(base_sha, pr, slug, token, service, enterprise_url, args)
base_picking_logic(base_sha, pr, slug, token, service, enterprise_url, args)
43 changes: 23 additions & 20 deletions codecov_cli/commands/commit.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import typing

import click
import sentry_sdk

from codecov_cli.fallbacks import CodecovOption, FallbackFieldEnum
from codecov_cli.helpers.args import get_cli_args
Expand Down Expand Up @@ -47,23 +48,25 @@ def create_commit(
git_service: typing.Optional[str],
fail_on_error: bool,
):
enterprise_url = ctx.obj.get("enterprise_url")
args = get_cli_args(ctx)
logger.debug(
"Starting create commit process",
extra=dict(
extra_log_attributes=args,
),
)
create_commit_logic(
commit_sha,
parent_sha,
pull_request_number,
branch,
slug,
token,
git_service,
enterprise_url,
fail_on_error,
args,
)
with sentry_sdk.start_transaction(op="task", name="Create Commit"):
with sentry_sdk.start_span(name="create_commit"):
enterprise_url = ctx.obj.get("enterprise_url")
args = get_cli_args(ctx)
logger.debug(
"Starting create commit process",
extra=dict(
extra_log_attributes=args,
),
)
create_commit_logic(
commit_sha,
parent_sha,
pull_request_number,
branch,
slug,
token,
git_service,
enterprise_url,
fail_on_error,
args,
)
25 changes: 14 additions & 11 deletions codecov_cli/commands/create_report_result.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import logging

import click
import sentry_sdk

from codecov_cli.helpers.args import get_cli_args
from codecov_cli.helpers.options import global_options
Expand All @@ -25,14 +26,16 @@ def create_report_results(
token: str,
fail_on_error: bool,
):
enterprise_url = ctx.obj.get("enterprise_url")
args = get_cli_args(ctx)
logger.debug(
"Creating report results",
extra=dict(
extra_log_attributes=args,
),
)
create_report_results_logic(
commit_sha, code, slug, git_service, token, enterprise_url, fail_on_error, args
)
with sentry_sdk.start_transaction(op="task", name="Create Report Result"):
with sentry_sdk.start_span(name="create_report_result"):
enterprise_url = ctx.obj.get("enterprise_url")
args = get_cli_args(ctx)
logger.debug(
"Creating report results",
extra=dict(
extra_log_attributes=args,
),
)
create_report_results_logic(
commit_sha, code, slug, git_service, token, enterprise_url, fail_on_error, args
)
25 changes: 14 additions & 11 deletions codecov_cli/commands/empty_upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import typing

import click
import sentry_sdk

from codecov_cli.fallbacks import CodecovOption, FallbackFieldEnum
from codecov_cli.helpers.args import get_cli_args
Expand All @@ -26,14 +27,16 @@ def empty_upload(
git_service: typing.Optional[str],
fail_on_error: typing.Optional[bool],
):
enterprise_url = ctx.obj.get("enterprise_url")
args = get_cli_args(ctx)
logger.debug(
"Starting empty upload process",
extra=dict(
extra_log_attributes=args,
),
)
return empty_upload_logic(
commit_sha, slug, token, git_service, enterprise_url, fail_on_error, force, args
)
with sentry_sdk.start_transaction(op="task", name="Empty Upload"):
with sentry_sdk.start_span(name="empty_upload"):
enterprise_url = ctx.obj.get("enterprise_url")
args = get_cli_args(ctx)
logger.debug(
"Starting empty upload process",
extra=dict(
extra_log_attributes=args,
),
)
return empty_upload_logic(
commit_sha, slug, token, git_service, enterprise_url, fail_on_error, force, args
)
39 changes: 21 additions & 18 deletions codecov_cli/commands/get_report_results.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import logging

import click
import sentry_sdk

from codecov_cli.fallbacks import CodecovOption, FallbackFieldEnum
from codecov_cli.helpers.args import get_cli_args
Expand Down Expand Up @@ -29,21 +30,23 @@ def get_report_results(
token: str,
fail_on_error: bool,
):
enterprise_url = ctx.obj.get("enterprise_url")
args = get_cli_args(ctx)
logger.debug(
"Getting report results",
extra=dict(
extra_log_attributes=args,
),
)
encoded_slug = encode_slug(slug)
send_reports_result_get_request(
commit_sha=commit_sha,
report_code=code,
encoded_slug=encoded_slug,
service=git_service,
token=token,
enterprise_url=enterprise_url,
fail_on_error=fail_on_error,
)
with sentry_sdk.start_transaction(op="task", name="Get Report Results"):
with sentry_sdk.start_span(name="get_report_results"):
enterprise_url = ctx.obj.get("enterprise_url")
args = get_cli_args(ctx)
logger.debug(
"Getting report results",
extra=dict(
extra_log_attributes=args,
),
)
encoded_slug = encode_slug(slug)
send_reports_result_get_request(
commit_sha=commit_sha,
report_code=code,
encoded_slug=encoded_slug,
service=git_service,
token=token,
enterprise_url=enterprise_url,
fail_on_error=fail_on_error,
)
Loading

0 comments on commit dca7a65

Please sign in to comment.