codecov-cli 9.1.1__tar.gz → 10.0.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (105) hide show
  1. {codecov-cli-9.1.1/codecov_cli.egg-info → codecov-cli-10.0.0}/PKG-INFO +3 -3
  2. {codecov-cli-9.1.1 → codecov-cli-10.0.0}/README.md +1 -1
  3. codecov-cli-10.0.0/codecov_cli/commands/upload_coverage.py +180 -0
  4. {codecov-cli-9.1.1 → codecov-cli-10.0.0}/codecov_cli/helpers/ci_adapters/azure_pipelines.py +1 -1
  5. {codecov-cli-9.1.1 → codecov-cli-10.0.0}/codecov_cli/main.py +8 -0
  6. codecov-cli-10.0.0/codecov_cli/opentelemetry.py +32 -0
  7. {codecov-cli-9.1.1 → codecov-cli-10.0.0}/codecov_cli/plugins/__init__.py +1 -1
  8. {codecov-cli-9.1.1 → codecov-cli-10.0.0}/codecov_cli/plugins/compress_pycoverage_contexts.py +4 -1
  9. {codecov-cli-9.1.1 → codecov-cli-10.0.0}/codecov_cli/plugins/gcov.py +4 -0
  10. {codecov-cli-9.1.1 → codecov-cli-10.0.0}/codecov_cli/plugins/pycoverage.py +6 -1
  11. {codecov-cli-9.1.1 → codecov-cli-10.0.0}/codecov_cli/plugins/xcode.py +4 -0
  12. {codecov-cli-9.1.1 → codecov-cli-10.0.0}/codecov_cli/runners/pytest_standard_runner.py +2 -2
  13. {codecov-cli-9.1.1 → codecov-cli-10.0.0}/codecov_cli/services/commit/__init__.py +1 -1
  14. {codecov-cli-9.1.1 → codecov-cli-10.0.0}/codecov_cli/services/upload/__init__.py +2 -2
  15. {codecov-cli-9.1.1 → codecov-cli-10.0.0}/codecov_cli/services/upload/file_finder.py +6 -0
  16. {codecov-cli-9.1.1 → codecov-cli-10.0.0}/codecov_cli/services/upload/legacy_upload_sender.py +4 -0
  17. {codecov-cli-9.1.1 → codecov-cli-10.0.0}/codecov_cli/services/upload/upload_collector.py +6 -2
  18. {codecov-cli-9.1.1 → codecov-cli-10.0.0}/codecov_cli/services/upload/upload_sender.py +71 -55
  19. {codecov-cli-9.1.1 → codecov-cli-10.0.0/codecov_cli.egg-info}/PKG-INFO +3 -3
  20. {codecov-cli-9.1.1 → codecov-cli-10.0.0}/codecov_cli.egg-info/SOURCES.txt +1 -0
  21. {codecov-cli-9.1.1 → codecov-cli-10.0.0}/codecov_cli.egg-info/requires.txt +2 -0
  22. {codecov-cli-9.1.1 → codecov-cli-10.0.0}/setup.py +4 -2
  23. codecov-cli-9.1.1/codecov_cli/commands/upload_coverage.py +0 -175
  24. {codecov-cli-9.1.1 → codecov-cli-10.0.0}/LICENSE +0 -0
  25. {codecov-cli-9.1.1 → codecov-cli-10.0.0}/MANIFEST.in +0 -0
  26. {codecov-cli-9.1.1 → codecov-cli-10.0.0}/codecov_cli/__init__.py +0 -0
  27. {codecov-cli-9.1.1 → codecov-cli-10.0.0}/codecov_cli/commands/__init__.py +0 -0
  28. {codecov-cli-9.1.1 → codecov-cli-10.0.0}/codecov_cli/commands/base_picking.py +0 -0
  29. {codecov-cli-9.1.1 → codecov-cli-10.0.0}/codecov_cli/commands/commit.py +0 -0
  30. {codecov-cli-9.1.1 → codecov-cli-10.0.0}/codecov_cli/commands/create_report_result.py +0 -0
  31. {codecov-cli-9.1.1 → codecov-cli-10.0.0}/codecov_cli/commands/empty_upload.py +0 -0
  32. {codecov-cli-9.1.1 → codecov-cli-10.0.0}/codecov_cli/commands/get_report_results.py +0 -0
  33. {codecov-cli-9.1.1 → codecov-cli-10.0.0}/codecov_cli/commands/labelanalysis.py +0 -0
  34. {codecov-cli-9.1.1 → codecov-cli-10.0.0}/codecov_cli/commands/process_test_results.py +0 -0
  35. {codecov-cli-9.1.1 → codecov-cli-10.0.0}/codecov_cli/commands/report.py +0 -0
  36. {codecov-cli-9.1.1 → codecov-cli-10.0.0}/codecov_cli/commands/send_notifications.py +0 -0
  37. {codecov-cli-9.1.1 → codecov-cli-10.0.0}/codecov_cli/commands/staticanalysis.py +0 -0
  38. {codecov-cli-9.1.1 → codecov-cli-10.0.0}/codecov_cli/commands/upload.py +0 -0
  39. {codecov-cli-9.1.1 → codecov-cli-10.0.0}/codecov_cli/commands/upload_process.py +0 -0
  40. {codecov-cli-9.1.1 → codecov-cli-10.0.0}/codecov_cli/fallbacks.py +0 -0
  41. {codecov-cli-9.1.1 → codecov-cli-10.0.0}/codecov_cli/helpers/__init__.py +0 -0
  42. {codecov-cli-9.1.1 → codecov-cli-10.0.0}/codecov_cli/helpers/args.py +0 -0
  43. {codecov-cli-9.1.1 → codecov-cli-10.0.0}/codecov_cli/helpers/ci_adapters/__init__.py +0 -0
  44. {codecov-cli-9.1.1 → codecov-cli-10.0.0}/codecov_cli/helpers/ci_adapters/appveyor_ci.py +0 -0
  45. {codecov-cli-9.1.1 → codecov-cli-10.0.0}/codecov_cli/helpers/ci_adapters/base.py +0 -0
  46. {codecov-cli-9.1.1 → codecov-cli-10.0.0}/codecov_cli/helpers/ci_adapters/bitbucket_ci.py +0 -0
  47. {codecov-cli-9.1.1 → codecov-cli-10.0.0}/codecov_cli/helpers/ci_adapters/bitrise_ci.py +0 -0
  48. {codecov-cli-9.1.1 → codecov-cli-10.0.0}/codecov_cli/helpers/ci_adapters/buildkite.py +0 -0
  49. {codecov-cli-9.1.1 → codecov-cli-10.0.0}/codecov_cli/helpers/ci_adapters/circleci.py +0 -0
  50. {codecov-cli-9.1.1 → codecov-cli-10.0.0}/codecov_cli/helpers/ci_adapters/cirrus_ci.py +0 -0
  51. {codecov-cli-9.1.1 → codecov-cli-10.0.0}/codecov_cli/helpers/ci_adapters/cloudbuild.py +0 -0
  52. {codecov-cli-9.1.1 → codecov-cli-10.0.0}/codecov_cli/helpers/ci_adapters/codebuild.py +0 -0
  53. {codecov-cli-9.1.1 → codecov-cli-10.0.0}/codecov_cli/helpers/ci_adapters/droneci.py +0 -0
  54. {codecov-cli-9.1.1 → codecov-cli-10.0.0}/codecov_cli/helpers/ci_adapters/github_actions.py +0 -0
  55. {codecov-cli-9.1.1 → codecov-cli-10.0.0}/codecov_cli/helpers/ci_adapters/gitlab_ci.py +0 -0
  56. {codecov-cli-9.1.1 → codecov-cli-10.0.0}/codecov_cli/helpers/ci_adapters/heroku.py +0 -0
  57. {codecov-cli-9.1.1 → codecov-cli-10.0.0}/codecov_cli/helpers/ci_adapters/jenkins.py +0 -0
  58. {codecov-cli-9.1.1 → codecov-cli-10.0.0}/codecov_cli/helpers/ci_adapters/local.py +0 -0
  59. {codecov-cli-9.1.1 → codecov-cli-10.0.0}/codecov_cli/helpers/ci_adapters/teamcity.py +0 -0
  60. {codecov-cli-9.1.1 → codecov-cli-10.0.0}/codecov_cli/helpers/ci_adapters/travis_ci.py +0 -0
  61. {codecov-cli-9.1.1 → codecov-cli-10.0.0}/codecov_cli/helpers/ci_adapters/woodpeckerci.py +0 -0
  62. {codecov-cli-9.1.1 → codecov-cli-10.0.0}/codecov_cli/helpers/config.py +0 -0
  63. {codecov-cli-9.1.1 → codecov-cli-10.0.0}/codecov_cli/helpers/encoder.py +0 -0
  64. {codecov-cli-9.1.1 → codecov-cli-10.0.0}/codecov_cli/helpers/folder_searcher.py +0 -0
  65. {codecov-cli-9.1.1 → codecov-cli-10.0.0}/codecov_cli/helpers/git.py +0 -0
  66. {codecov-cli-9.1.1 → codecov-cli-10.0.0}/codecov_cli/helpers/git_services/__init__.py +0 -0
  67. {codecov-cli-9.1.1 → codecov-cli-10.0.0}/codecov_cli/helpers/git_services/github.py +0 -0
  68. {codecov-cli-9.1.1 → codecov-cli-10.0.0}/codecov_cli/helpers/logging_utils.py +0 -0
  69. {codecov-cli-9.1.1 → codecov-cli-10.0.0}/codecov_cli/helpers/options.py +0 -0
  70. {codecov-cli-9.1.1 → codecov-cli-10.0.0}/codecov_cli/helpers/request.py +0 -0
  71. {codecov-cli-9.1.1 → codecov-cli-10.0.0}/codecov_cli/helpers/validators.py +0 -0
  72. {codecov-cli-9.1.1 → codecov-cli-10.0.0}/codecov_cli/helpers/versioning_systems.py +0 -0
  73. {codecov-cli-9.1.1 → codecov-cli-10.0.0}/codecov_cli/plugins/types.py +0 -0
  74. {codecov-cli-9.1.1 → codecov-cli-10.0.0}/codecov_cli/runners/__init__.py +0 -0
  75. {codecov-cli-9.1.1 → codecov-cli-10.0.0}/codecov_cli/runners/dan_runner.py +0 -0
  76. {codecov-cli-9.1.1 → codecov-cli-10.0.0}/codecov_cli/runners/types.py +0 -0
  77. {codecov-cli-9.1.1 → codecov-cli-10.0.0}/codecov_cli/services/__init__.py +0 -0
  78. {codecov-cli-9.1.1 → codecov-cli-10.0.0}/codecov_cli/services/commit/base_picking.py +0 -0
  79. {codecov-cli-9.1.1 → codecov-cli-10.0.0}/codecov_cli/services/empty_upload/__init__.py +0 -0
  80. {codecov-cli-9.1.1 → codecov-cli-10.0.0}/codecov_cli/services/report/__init__.py +0 -0
  81. {codecov-cli-9.1.1 → codecov-cli-10.0.0}/codecov_cli/services/staticanalysis/__init__.py +0 -0
  82. {codecov-cli-9.1.1 → codecov-cli-10.0.0}/codecov_cli/services/staticanalysis/analyzers/__init__.py +0 -0
  83. {codecov-cli-9.1.1 → codecov-cli-10.0.0}/codecov_cli/services/staticanalysis/analyzers/general.py +0 -0
  84. {codecov-cli-9.1.1 → codecov-cli-10.0.0}/codecov_cli/services/staticanalysis/analyzers/javascript_es6/__init__.py +0 -0
  85. {codecov-cli-9.1.1 → codecov-cli-10.0.0}/codecov_cli/services/staticanalysis/analyzers/javascript_es6/node_wrappers.py +0 -0
  86. {codecov-cli-9.1.1 → codecov-cli-10.0.0}/codecov_cli/services/staticanalysis/analyzers/python/__init__.py +0 -0
  87. {codecov-cli-9.1.1 → codecov-cli-10.0.0}/codecov_cli/services/staticanalysis/analyzers/python/node_wrappers.py +0 -0
  88. {codecov-cli-9.1.1 → codecov-cli-10.0.0}/codecov_cli/services/staticanalysis/exceptions.py +0 -0
  89. {codecov-cli-9.1.1 → codecov-cli-10.0.0}/codecov_cli/services/staticanalysis/finders.py +0 -0
  90. {codecov-cli-9.1.1 → codecov-cli-10.0.0}/codecov_cli/services/staticanalysis/types.py +0 -0
  91. {codecov-cli-9.1.1 → codecov-cli-10.0.0}/codecov_cli/services/upload/network_finder.py +0 -0
  92. {codecov-cli-9.1.1 → codecov-cli-10.0.0}/codecov_cli/services/upload_completion/__init__.py +0 -0
  93. {codecov-cli-9.1.1 → codecov-cli-10.0.0}/codecov_cli/services/upload_coverage/__init__.py +0 -0
  94. {codecov-cli-9.1.1 → codecov-cli-10.0.0}/codecov_cli/types.py +0 -0
  95. {codecov-cli-9.1.1 → codecov-cli-10.0.0}/codecov_cli.egg-info/dependency_links.txt +0 -0
  96. {codecov-cli-9.1.1 → codecov-cli-10.0.0}/codecov_cli.egg-info/entry_points.txt +0 -0
  97. {codecov-cli-9.1.1 → codecov-cli-10.0.0}/codecov_cli.egg-info/top_level.txt +0 -0
  98. {codecov-cli-9.1.1 → codecov-cli-10.0.0}/languages/languages.c +0 -0
  99. {codecov-cli-9.1.1 → codecov-cli-10.0.0}/languages/treesitterjavascript/src/parser.c +0 -0
  100. {codecov-cli-9.1.1 → codecov-cli-10.0.0}/languages/treesitterjavascript/src/scanner.c +0 -0
  101. {codecov-cli-9.1.1 → codecov-cli-10.0.0}/languages/treesitterjavascript/src/tree_sitter/parser.h +0 -0
  102. {codecov-cli-9.1.1 → codecov-cli-10.0.0}/languages/treesitterpython/src/parser.c +0 -0
  103. {codecov-cli-9.1.1 → codecov-cli-10.0.0}/languages/treesitterpython/src/scanner.cc +0 -0
  104. {codecov-cli-9.1.1 → codecov-cli-10.0.0}/languages/treesitterpython/src/tree_sitter/parser.h +0 -0
  105. {codecov-cli-9.1.1 → codecov-cli-10.0.0}/setup.cfg +0 -0
@@ -1,10 +1,10 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: codecov-cli
3
- Version: 9.1.1
3
+ Version: 10.0.0
4
4
  Summary: Codecov Command Line Interface
5
5
  Author: Codecov
6
6
  Author-email: support@codecov.io
7
- Requires-Python: >=3.8
7
+ Requires-Python: >=3.9
8
8
  Description-Content-Type: text/markdown
9
9
  License-File: LICENSE
10
10
 
@@ -293,7 +293,7 @@ The CLI can perform basic static analysis on Python code today. This static anal
293
293
 
294
294
  # Contributions
295
295
 
296
- This repository, like all of Codecov's repositories, strives to follow our general [Contributing guidlines](https://github.com/codecov/contributing). If you're considering making a contribution to this repository, we encourage review of our Contributing guidelines first.
296
+ This repository, like all of Codecov's repositories, strives to follow our general [Contributing guidelines](https://github.com/codecov/contributing). If you're considering making a contribution to this repository, we encourage review of our Contributing guidelines first.
297
297
 
298
298
  ## Requirements
299
299
 
@@ -283,7 +283,7 @@ The CLI can perform basic static analysis on Python code today. This static anal
283
283
 
284
284
  # Contributions
285
285
 
286
- This repository, like all of Codecov's repositories, strives to follow our general [Contributing guidlines](https://github.com/codecov/contributing). If you're considering making a contribution to this repository, we encourage review of our Contributing guidelines first.
286
+ This repository, like all of Codecov's repositories, strives to follow our general [Contributing guidelines](https://github.com/codecov/contributing). If you're considering making a contribution to this repository, we encourage review of our Contributing guidelines first.
287
287
 
288
288
  ## Requirements
289
289
 
@@ -0,0 +1,180 @@
1
+ import logging
2
+ import pathlib
3
+ import typing
4
+
5
+ import click
6
+ from opentelemetry import trace
7
+
8
+ from codecov_cli.commands.commit import create_commit
9
+ from codecov_cli.commands.report import create_report
10
+ from codecov_cli.commands.upload import do_upload, global_upload_options
11
+ from codecov_cli.helpers.args import get_cli_args
12
+ from codecov_cli.helpers.options import global_options
13
+ from codecov_cli.opentelemetry import close_telem
14
+ from codecov_cli.services.upload_coverage import upload_coverage_logic
15
+ from codecov_cli.types import CommandContext
16
+
17
+ logger = logging.getLogger("codecovcli")
18
+ tracer = trace.get_tracer(__name__)
19
+
20
+
21
+ # These options are the combined options of commit, report and upload commands
22
+ @click.command()
23
+ @global_options
24
+ @global_upload_options
25
+ @click.option(
26
+ "--parent-sha",
27
+ help="SHA (with 40 chars) of what should be the parent of this commit",
28
+ )
29
+ @click.pass_context
30
+ def upload_coverage(
31
+ ctx: CommandContext,
32
+ branch: typing.Optional[str],
33
+ build_code: typing.Optional[str],
34
+ build_url: typing.Optional[str],
35
+ commit_sha: str,
36
+ disable_file_fixes: bool,
37
+ disable_search: bool,
38
+ dry_run: bool,
39
+ env_vars: typing.Dict[str, str],
40
+ fail_on_error: bool,
41
+ files_search_exclude_folders: typing.List[pathlib.Path],
42
+ files_search_explicitly_listed_files: typing.List[pathlib.Path],
43
+ files_search_root_folder: pathlib.Path,
44
+ flags: typing.List[str],
45
+ gcov_args: typing.Optional[str],
46
+ gcov_executable: typing.Optional[str],
47
+ gcov_ignore: typing.Optional[str],
48
+ gcov_include: typing.Optional[str],
49
+ git_service: typing.Optional[str],
50
+ handle_no_reports_found: bool,
51
+ job_code: typing.Optional[str],
52
+ name: typing.Optional[str],
53
+ network_filter: typing.Optional[str],
54
+ network_prefix: typing.Optional[str],
55
+ network_root_folder: pathlib.Path,
56
+ parent_sha: typing.Optional[str],
57
+ plugin_names: typing.List[str],
58
+ pull_request_number: typing.Optional[str],
59
+ report_code: str,
60
+ report_type: str,
61
+ slug: typing.Optional[str],
62
+ swift_project: typing.Optional[str],
63
+ token: typing.Optional[str],
64
+ use_legacy_uploader: bool,
65
+ ):
66
+ with tracer.start_as_current_span("upload_coverage"):
67
+ args = get_cli_args(ctx)
68
+ logger.debug(
69
+ "Starting upload coverage",
70
+ extra=dict(
71
+ extra_log_attributes=args,
72
+ ),
73
+ )
74
+
75
+ if not use_legacy_uploader and report_type == "coverage":
76
+ versioning_system = ctx.obj["versioning_system"]
77
+ codecov_yaml = ctx.obj["codecov_yaml"] or {}
78
+ cli_config = codecov_yaml.get("cli", {})
79
+ ci_adapter = ctx.obj.get("ci_adapter")
80
+ enterprise_url = ctx.obj.get("enterprise_url")
81
+ args = get_cli_args(ctx)
82
+ ctx.invoke(
83
+ upload_coverage_logic,
84
+ cli_config,
85
+ versioning_system,
86
+ ci_adapter,
87
+ branch=branch,
88
+ build_code=build_code,
89
+ build_url=build_url,
90
+ commit_sha=commit_sha,
91
+ disable_file_fixes=disable_file_fixes,
92
+ disable_search=disable_search,
93
+ dry_run=dry_run,
94
+ enterprise_url=enterprise_url,
95
+ env_vars=env_vars,
96
+ fail_on_error=fail_on_error,
97
+ files_search_exclude_folders=files_search_exclude_folders,
98
+ files_search_explicitly_listed_files=files_search_explicitly_listed_files,
99
+ files_search_root_folder=files_search_root_folder,
100
+ flags=flags,
101
+ gcov_args=gcov_args,
102
+ gcov_executable=gcov_executable,
103
+ gcov_ignore=gcov_ignore,
104
+ gcov_include=gcov_include,
105
+ git_service=git_service,
106
+ handle_no_reports_found=handle_no_reports_found,
107
+ job_code=job_code,
108
+ name=name,
109
+ network_filter=network_filter,
110
+ network_prefix=network_prefix,
111
+ network_root_folder=network_root_folder,
112
+ parent_sha=parent_sha,
113
+ plugin_names=plugin_names,
114
+ pull_request_number=pull_request_number,
115
+ report_code=report_code,
116
+ slug=slug,
117
+ swift_project=swift_project,
118
+ token=token,
119
+ upload_file_type=report_type,
120
+ use_legacy_uploader=use_legacy_uploader,
121
+ args=args,
122
+ )
123
+ else:
124
+ ctx.invoke(
125
+ create_commit,
126
+ commit_sha=commit_sha,
127
+ parent_sha=parent_sha,
128
+ pull_request_number=pull_request_number,
129
+ branch=branch,
130
+ slug=slug,
131
+ token=token,
132
+ git_service=git_service,
133
+ fail_on_error=True,
134
+ )
135
+ if report_type == "coverage":
136
+ ctx.invoke(
137
+ create_report,
138
+ token=token,
139
+ code=report_code,
140
+ fail_on_error=True,
141
+ commit_sha=commit_sha,
142
+ slug=slug,
143
+ git_service=git_service,
144
+ )
145
+ ctx.invoke(
146
+ do_upload,
147
+ branch=branch,
148
+ build_code=build_code,
149
+ build_url=build_url,
150
+ commit_sha=commit_sha,
151
+ disable_file_fixes=disable_file_fixes,
152
+ disable_search=disable_search,
153
+ dry_run=dry_run,
154
+ env_vars=env_vars,
155
+ fail_on_error=fail_on_error,
156
+ files_search_exclude_folders=files_search_exclude_folders,
157
+ files_search_explicitly_listed_files=files_search_explicitly_listed_files,
158
+ files_search_root_folder=files_search_root_folder,
159
+ flags=flags,
160
+ gcov_args=gcov_args,
161
+ gcov_executable=gcov_executable,
162
+ gcov_ignore=gcov_ignore,
163
+ gcov_include=gcov_include,
164
+ git_service=git_service,
165
+ handle_no_reports_found=handle_no_reports_found,
166
+ job_code=job_code,
167
+ name=name,
168
+ network_filter=network_filter,
169
+ network_prefix=network_prefix,
170
+ network_root_folder=network_root_folder,
171
+ plugin_names=plugin_names,
172
+ pull_request_number=pull_request_number,
173
+ report_code=report_code,
174
+ report_type=report_type,
175
+ slug=slug,
176
+ swift_project=swift_project,
177
+ token=token,
178
+ use_legacy_uploader=use_legacy_uploader,
179
+ )
180
+ close_telem()
@@ -16,7 +16,7 @@ class AzurePipelinesCIAdapter(CIAdapterBase):
16
16
 
17
17
  def _get_build_url(self):
18
18
  if os.getenv("SYSTEM_TEAMPROJECT") and os.getenv("BUILD_BUILDID"):
19
- return f'{os.getenv("SYSTEM_TEAMFOUNDATIONCOLLECTIONURI")}{os.getenv("SYSTEM_TEAMPROJECT")}/_build/results?buildId={os.getenv("BUILD_BUILDID")}'
19
+ return f"{os.getenv('SYSTEM_TEAMFOUNDATIONCOLLECTIONURI')}{os.getenv('SYSTEM_TEAMPROJECT')}/_build/results?buildId={os.getenv('BUILD_BUILDID')}"
20
20
 
21
21
  def _get_build_code(self):
22
22
  return os.getenv("BUILD_BUILDNUMBER")
@@ -5,6 +5,7 @@ import typing
5
5
  import click
6
6
 
7
7
  from codecov_cli import __version__
8
+ from codecov_cli.opentelemetry import init_telem
8
9
  from codecov_cli.commands.base_picking import pr_base_picking
9
10
  from codecov_cli.commands.commit import create_commit
10
11
  from codecov_cli.commands.create_report_result import create_report_results
@@ -43,6 +44,9 @@ logger = logging.getLogger("codecovcli")
43
44
  "--enterprise-url", "--url", "-u", help="Change the upload host (Enterprise use)"
44
45
  )
45
46
  @click.option("-v", "--verbose", "verbose", help="Use verbose logging", is_flag=True)
47
+ @click.option(
48
+ "--disable-telem", help="Disable sending telemetry data to Codecov", is_flag=True
49
+ )
46
50
  @click.pass_context
47
51
  @click.version_option(__version__, prog_name="codecovcli")
48
52
  def cli(
@@ -51,6 +55,7 @@ def cli(
51
55
  codecov_yml_path: pathlib.Path,
52
56
  enterprise_url: str,
53
57
  verbose: bool = False,
58
+ disable_telem: bool = False,
54
59
  ):
55
60
  ctx.obj["cli_args"] = ctx.params
56
61
  ctx.obj["cli_args"]["version"] = f"cli-{__version__}"
@@ -65,6 +70,9 @@ def cli(
65
70
  ctx.default_map = {ctx.invoked_subcommand: {"token": token}}
66
71
  ctx.obj["enterprise_url"] = enterprise_url
67
72
 
73
+ if not disable_telem:
74
+ init_telem(__version__, enterprise_url)
75
+
68
76
 
69
77
  cli.add_command(do_upload)
70
78
  cli.add_command(create_commit)
@@ -0,0 +1,32 @@
1
+ import os
2
+ import time
3
+
4
+ from opentelemetry import trace
5
+ from opentelemetry.propagate import set_global_textmap
6
+ from opentelemetry.sdk.trace import TracerProvider
7
+ import sentry_sdk
8
+ from sentry_sdk.integrations.opentelemetry import SentrySpanProcessor, SentryPropagator
9
+
10
+
11
+ def init_telem(version, url):
12
+ if url: # dont run on dedicated cloud
13
+ return
14
+
15
+ if os.getenv("IS_CI", False):
16
+ return
17
+
18
+ sentry_sdk.init(
19
+ dsn="https://0bea75c61745c221a6ef1ac1709b1f4d@o26192.ingest.us.sentry.io/4508615876083713",
20
+ enable_tracing=True,
21
+ release=f"cli@{version}",
22
+ instrumenter="otel",
23
+ )
24
+
25
+ provider = TracerProvider()
26
+ provider.add_span_processor(SentrySpanProcessor())
27
+ trace.set_tracer_provider(provider)
28
+ set_global_textmap(SentryPropagator())
29
+
30
+
31
+ def close_telem():
32
+ sentry_sdk.flush()
@@ -58,7 +58,7 @@ def _load_plugin_from_yaml(plugin_dict: typing.Dict):
58
58
 
59
59
  except TypeError:
60
60
  click.secho(
61
- f"Unable to instantiate {class_obj} with provided parameters { plugin_dict.get('params', '') }",
61
+ f"Unable to instantiate {class_obj} with provided parameters {plugin_dict.get('params', '')}",
62
62
  err=True,
63
63
  )
64
64
  return NoopPlugin()
@@ -5,10 +5,12 @@ from decimal import Decimal
5
5
  from typing import Any, List
6
6
 
7
7
  import ijson
8
+ from opentelemetry import trace
8
9
 
9
10
  from codecov_cli.plugins.types import PreparationPluginReturn
10
11
 
11
12
  logger = logging.getLogger("codecovcli")
13
+ tracer = trace.get_tracer(__name__)
12
14
 
13
15
 
14
16
  class Encoder(json.JSONEncoder):
@@ -47,6 +49,7 @@ class CompressPycoverageContexts(object):
47
49
  str(self.file_to_compress).replace(".json", "") + ".codecov.json"
48
50
  )
49
51
 
52
+ @tracer.start_as_current_span("compress_pycoverage")
50
53
  def run_preparation(self, collector) -> PreparationPluginReturn:
51
54
  if not self.file_to_compress.exists():
52
55
  logger.warning(
@@ -120,7 +123,7 @@ class CompressPycoverageContexts(object):
120
123
  # Save the inverted index of labels table in the report
121
124
  # So when we are processing the result we have int -> label
122
125
  fd_out.write(
123
- f'"labels_table": {json.dumps({ value: key for key, value in labels_table.items() })}'
126
+ f'"labels_table": {json.dumps({value: key for key, value in labels_table.items()})}'
124
127
  )
125
128
 
126
129
  def _copy_file_details(self, file_name, file_details, fd_out) -> None:
@@ -5,10 +5,13 @@ import shutil
5
5
  import subprocess
6
6
  import typing
7
7
 
8
+ from opentelemetry import trace
9
+
8
10
  from codecov_cli.helpers.folder_searcher import globs_to_regex, search_files
9
11
  from codecov_cli.plugins.types import PreparationPluginReturn
10
12
 
11
13
  logger = logging.getLogger("codecovcli")
14
+ tracer = trace.get_tracer(__name__)
12
15
 
13
16
 
14
17
  class GcovPlugin(object):
@@ -28,6 +31,7 @@ class GcovPlugin(object):
28
31
  self.patterns_to_include = patterns_to_include or []
29
32
  self.project_root = project_root or pathlib.Path(os.getcwd())
30
33
 
34
+ @tracer.start_as_current_span("gcov")
31
35
  def run_preparation(self, collector) -> PreparationPluginReturn:
32
36
  logger.debug(
33
37
  f"Running {self.executable} plugin...",
@@ -6,11 +6,14 @@ import subprocess
6
6
  import typing
7
7
  from glob import iglob
8
8
 
9
+ from opentelemetry import trace
10
+
9
11
  from codecov_cli.helpers.folder_searcher import globs_to_regex, search_files
10
12
  from codecov_cli.plugins.types import PreparationPluginReturn
11
13
 
12
14
  coverage_files_regex = globs_to_regex([".coverage", ".coverage.*"])
13
15
  logger = logging.getLogger("codecovcli")
16
+ tracer = trace.get_tracer(__name__)
14
17
 
15
18
 
16
19
  class PycoverageConfig(dict):
@@ -53,6 +56,7 @@ class Pycoverage(object):
53
56
  def __init__(self, config: dict):
54
57
  self.config = PycoverageConfig(config)
55
58
 
59
+ @tracer.start_as_current_span("pycoverage")
56
60
  def run_preparation(self, collector) -> PreparationPluginReturn:
57
61
  if shutil.which("coverage") is None:
58
62
  logger.warning("coverage.py is not installed or can't be found.")
@@ -68,7 +72,8 @@ class Pycoverage(object):
68
72
  if self.config.report_type == "json":
69
73
  return self._generate_JSON_report(coverage_dir)
70
74
  return PreparationPluginReturn(
71
- success=False, messages=[f"report type {self.config.report_type} unknown"]
75
+ success=False,
76
+ messages=[f"report type {self.config.report_type} unknown"],
72
77
  )
73
78
 
74
79
  def _get_path_to_coverage(self) -> pathlib.Path:
@@ -7,10 +7,13 @@ import subprocess
7
7
  import typing
8
8
  from fnmatch import translate
9
9
 
10
+ from opentelemetry import trace
11
+
10
12
  from codecov_cli.helpers.folder_searcher import globs_to_regex, search_files
11
13
  from codecov_cli.plugins.types import PreparationPluginReturn
12
14
 
13
15
  logger = logging.getLogger("codecovcli")
16
+ tracer = trace.get_tracer(__name__)
14
17
 
15
18
 
16
19
  class XcodePlugin(object):
@@ -28,6 +31,7 @@ class XcodePlugin(object):
28
31
  # if empty the plugin will build reports for every xcode project it finds
29
32
  self.app_name = app_name or ""
30
33
 
34
+ @tracer.start_as_current_span("xcode")
31
35
  def run_preparation(self, collector) -> PreparationPluginReturn:
32
36
  logger.debug("Running xcode plugin...")
33
37
 
@@ -172,7 +172,7 @@ class PytestStandardRunner(LabelAnalysisRunnerInterface):
172
172
  logger.info(
173
173
  "Running tests. (run in verbose mode to get list of tests executed)"
174
174
  )
175
- logger.info(f" pytest options: \"{' '.join(default_options)}\"")
175
+ logger.info(f' pytest options: "{" ".join(default_options)}"')
176
176
  logger.info(f" executed tests: {len(tests_to_run)}")
177
177
  logger.debug(
178
178
  "List of tests executed",
@@ -180,5 +180,5 @@ class PytestStandardRunner(LabelAnalysisRunnerInterface):
180
180
  )
181
181
  output = self._execute_pytest(command_array, capture_output=False)
182
182
  logger.info(f"Finished running {len(tests_to_run)} tests successfully")
183
- logger.info(f" pytest options: \"{' '.join(default_options)}\"")
183
+ logger.info(f' pytest options: "{" ".join(default_options)}"')
184
184
  logger.debug(output)
@@ -65,7 +65,7 @@ def send_commit_data(
65
65
  f"Branch `{branch}` is protected but no token was provided\nFor information on Codecov upload tokens, see https://docs.codecov.com/docs/codecov-tokens"
66
66
  )
67
67
  else:
68
- logger.info("Using token to create a commit for protected branch `{branch}`")
68
+ logger.info(f"Using token to create a commit for protected branch `{branch}`")
69
69
 
70
70
  headers = get_token_header(token)
71
71
 
@@ -102,7 +102,7 @@ def do_upload_logic(
102
102
  except click.ClickException as exp:
103
103
  if handle_no_reports_found:
104
104
  logger.info(
105
- "No coverage reports found. Triggering notificaions without uploading."
105
+ "No coverage reports found. Triggering notifications without uploading."
106
106
  )
107
107
  upload_completion_logic(
108
108
  commit_sha=commit_sha,
@@ -116,7 +116,7 @@ def do_upload_logic(
116
116
  error=None,
117
117
  warnings=None,
118
118
  status_code=200,
119
- text="No coverage reports found. Triggering notificaions without uploading.",
119
+ text="No coverage reports found. Triggering notifications without uploading.",
120
120
  )
121
121
  else:
122
122
  raise exp
@@ -3,10 +3,14 @@ import os
3
3
  from pathlib import Path
4
4
  from typing import Iterable, List, Optional, Pattern
5
5
 
6
+ from opentelemetry import trace
7
+
6
8
  from codecov_cli.helpers.folder_searcher import globs_to_regex, search_files
7
9
  from codecov_cli.types import UploadCollectionResultFile
8
10
 
9
11
  logger = logging.getLogger("codecovcli")
12
+ tracer = trace.get_tracer(__name__)
13
+
10
14
 
11
15
  coverage_files_patterns = [
12
16
  "*.clover",
@@ -118,6 +122,7 @@ coverage_files_excluded_patterns = [
118
122
  "*.yaml",
119
123
  "*/classycle/report.xml",
120
124
  "*codecov.yml",
125
+ "codecov.yaml",
121
126
  "*~",
122
127
  ".*coveragerc",
123
128
  ".coverage*",
@@ -197,6 +202,7 @@ class FileFinder(object):
197
202
  self.disable_search = disable_search
198
203
  self.report_type = report_type
199
204
 
205
+ @tracer.start_as_current_span("find_files")
200
206
  def find_files(self) -> List[UploadCollectionResultFile]:
201
207
  if self.report_type == "coverage":
202
208
  files_excluded_patterns = coverage_files_excluded_patterns
@@ -2,12 +2,15 @@ import logging
2
2
  import typing
3
3
  from dataclasses import dataclass
4
4
 
5
+ from opentelemetry import trace
6
+
5
7
  from codecov_cli import __version__ as codecov_cli_version
6
8
  from codecov_cli.helpers.config import LEGACY_CODECOV_API_URL
7
9
  from codecov_cli.helpers.request import send_post_request, send_put_request
8
10
  from codecov_cli.types import UploadCollectionResult, UploadCollectionResultFile
9
11
 
10
12
  logger = logging.getLogger("codecovcli")
13
+ tracer = trace.get_tracer(__name__)
11
14
 
12
15
 
13
16
  @dataclass
@@ -32,6 +35,7 @@ class UploadSendingResult(object):
32
35
 
33
36
 
34
37
  class LegacyUploadSender(object):
38
+ @tracer.start_as_current_span("upload_legacy")
35
39
  def send_upload_data(
36
40
  self,
37
41
  upload_data: UploadCollectionResult,
@@ -7,6 +7,7 @@ from collections import namedtuple
7
7
  from fnmatch import fnmatch
8
8
 
9
9
  import click
10
+ from opentelemetry import trace
10
11
 
11
12
  from codecov_cli.services.upload.file_finder import FileFinder
12
13
  from codecov_cli.services.upload.network_finder import NetworkFinder
@@ -17,6 +18,7 @@ from codecov_cli.types import (
17
18
  )
18
19
 
19
20
  logger = logging.getLogger("codecovcli")
21
+ tracer = trace.get_tracer(__name__)
20
22
 
21
23
  fix_patterns_to_apply = namedtuple(
22
24
  "fix_patterns_to_apply", ["without_reason", "with_reason", "eof"]
@@ -148,13 +150,15 @@ class UploadCollector(object):
148
150
  path, fixed_lines_without_reason, fixed_lines_with_reason, eof
149
151
  )
150
152
 
153
+ @tracer.start_as_current_span("upload_collector")
151
154
  def generate_upload_data(self, report_type="coverage") -> UploadCollectionResult:
152
155
  for prep in self.preparation_plugins:
153
156
  logger.debug(f"Running preparation plugin: {type(prep)}")
154
157
  prep.run_preparation(self)
155
158
  logger.debug("Collecting relevant files")
156
- network = self.network_finder.find_files()
157
- report_files = self.file_finder.find_files()
159
+ with tracer.start_as_current_span("file_collector"):
160
+ network = self.network_finder.find_files()
161
+ report_files = self.file_finder.find_files()
158
162
  logger.info(f"Found {len(report_files)} {report_type} files to report")
159
163
  if not report_files:
160
164
  if report_type == "test_results":