Skip to content

Commit 92f00a2

Browse files
committed
Moving VCS info to resource attributes
1 parent 7ada9fa commit 92f00a2

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

middleware/distro.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -244,8 +244,6 @@ def custom_record_exception(span: Span, exc: Exception):
244244
"exception.language": "python",
245245
"exception.stacktrace": traceback.format_exc(),
246246
"exception.escaped": exception_escaped,
247-
"exception.vcs.commit_sha": mw_vcs_commit_sha or "",
248-
"exception.vcs.repository_url": mw_vcs_repository_url or "",
249247
"exception.stack_details": stack_info_str, # Attach full stacktrace details
250248
}
251249
)

middleware/resource.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
from middleware.detectors.detector import process_detector_input, get_detectors
1313
from middleware.version import __version__
1414
import typing
15+
import os
1516

1617
_logger = getLogger(__name__)
1718

@@ -54,6 +55,14 @@ def create_resource(options: MWOptions):
5455
"Skipped Custom attributes: parsing error expected format `abcd=1234,wxyz=5678`"
5556
)
5657

58+
mw_vcs_repository_url = os.getenv("MW_VCS_REPOSITORY_URL")
59+
mw_vcs_commit_sha = os.getenv("MW_VCS_COMMIT_SHA")
60+
61+
if mw_vcs_repository_url:
62+
attributes["vcs.repository_url"] = mw_vcs_repository_url
63+
if mw_vcs_commit_sha:
64+
attributes["vcs.commit_sha"] = mw_vcs_commit_sha
65+
5766
detectors: typing.List["ResourceDetector"] = [
5867
OTELResourceDetector(),
5968
ProcessResourceDetector(),

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "middleware-io"
7-
version = "2.2.1"
7+
version = "2.2.2rc1"
88
requires-python = ">=3.8"
99
description = "Middleware's APM tool enables Python developers to effortlessly monitor their applications, gathering distributed tracing, metrics, logs, and profiling data for valuable insights and performance optimization."
1010
authors = [{ name = "middleware-dev" }]

0 commit comments

Comments
 (0)