Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
- **[FEATURE]**: feat(capture): add support for capture tracepoints [#34](https://github.com/intergral/deep/pull/34) [@Umaaz](https://github.com/Umaaz)
- **[BUGFIX]**: fix(duration): snapshot duration not set [#37](https://github.com/intergral/deep/pull/37) [@Umaaz](https://github.com/Umaaz)
- **[BUGFIX]**: fix(attributes): snapshot attributes not set [#38](https://github.com/intergral/deep/pull/38) [@Umaaz](https://github.com/Umaaz)
- **[BUGFIX]**: fix(resource): discovered resources overwriting each other [#41](https://github.com/intergral/deep/pull/41) [@Umaaz](https://github.com/Umaaz)

# 1.1.0 (06/02/2024)

Expand Down
2 changes: 1 addition & 1 deletion src/deep/api/plugin/otel.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ def resource(self) -> Optional[Resource]:
# noinspection PyUnresolvedReferences
resource = provider.resource
attributes = dict(resource.attributes)
return Resource.create(attributes=attributes)
return Resource(attributes=attributes)
return None

def decorate(self, snapshot_id: str, context: ActionContext) -> Optional[BoundedAttributes]:
Expand Down
2 changes: 1 addition & 1 deletion src/deep/api/plugin/python.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def resource(self) -> Optional[Resource]:

:return: the provided resource
"""
return Resource.create({
return Resource({
"python_version": platform.python_version(),
})

Expand Down
2 changes: 2 additions & 0 deletions tests/unit_tests/api/plugin/test_otel.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
from opentelemetry.sdk.trace import TracerProvider

from deep.api.plugin.otel import OTelPlugin
from deep.api.resource import TELEMETRY_SDK_NAME


class TestOtel(unittest.TestCase):
Expand All @@ -35,6 +36,7 @@ def test_load_plugin(self):
load_plugin = plugin.resource()
self.assertIsNotNone(load_plugin)
self.assertEqual("your-service-name", load_plugin.attributes.get(SERVICE_NAME))
self.assertIsNone(load_plugin.attributes.get(TELEMETRY_SDK_NAME))

def test_collect_attributes(self):
with trace.get_tracer_provider().get_tracer("test").start_as_current_span("test-span"):
Expand Down
9 changes: 9 additions & 0 deletions tests/unit_tests/api/resource/test_resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,15 @@ def setUp(self) -> None:
def tearDown(self) -> None:
environ.pop(DEEP_RESOURCE_ATTRIBUTES)

def test_merge(self):
create = Resource.create()
new_resource = Resource.create({SERVICE_NAME: 'test'})
self.assertEqual("unknown_service:python", create.attributes[SERVICE_NAME])
self.assertEqual("test", new_resource.attributes[SERVICE_NAME])

merge = create.merge(new_resource)
self.assertEqual("test", merge.attributes[SERVICE_NAME])

def test_create(self):
attributes = {
"service": "ui",
Expand Down