Skip to content

Commit b6cb5dd

Browse files
committed
Remove tag helpers.
1 parent bebc809 commit b6cb5dd

File tree

5 files changed

+24
-127
lines changed

5 files changed

+24
-127
lines changed

agentops/helpers/__init__.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
from .version import get_agentops_version, check_agentops_update
2121
from .debug import debug_print_function_params
2222
from .env import get_env_bool, get_env_int, get_env_list
23-
from .config import get_config, get_tags_from_config
2423

2524
__all__ = [
2625
"get_ISO_time",
@@ -46,6 +45,5 @@
4645
"get_env_bool",
4746
"get_env_int",
4847
"get_env_list",
49-
"get_config",
5048
"get_tags_from_config",
5149
]

agentops/helpers/config.py

Lines changed: 0 additions & 31 deletions
This file was deleted.

agentops/instrumentation/common/attributes.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"""
2222
from typing import Dict, Any, Optional, List
2323
from agentops.logging import logger
24-
from agentops.helpers import safe_serialize, get_agentops_version, get_tags_from_config
24+
from agentops.helpers import safe_serialize, get_agentops_version
2525
from agentops.semconv import (
2626
CoreAttributes,
2727
InstrumentationAttributes,
@@ -99,8 +99,15 @@ def get_base_trace_attributes(trace: Any) -> AttributeMap:
9999
}
100100

101101
# Add tags from the config to the trace attributes (these should only be added to the trace)
102-
if tags := get_tags_from_config():
103-
attributes[CoreAttributes.TAGS] = tags
102+
from agentops import get_client
103+
104+
config = get_client().config
105+
tags = []
106+
if config.default_tags:
107+
# `default_tags` can either be a `set` or a `list`
108+
tags = list(config.default_tags)
109+
110+
attributes[CoreAttributes.TAGS] = tags
104111

105112
return attributes
106113

tests/unit/helpers/test_helpers.py

Lines changed: 0 additions & 73 deletions
This file was deleted.

tests/unit/instrumentation/common/test_attributes.py

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -142,24 +142,20 @@ def __init__(self):
142142
# Mock the common attributes and tags functions
143143
with patch("agentops.instrumentation.common.attributes.get_common_attributes",
144144
return_value={InstrumentationAttributes.NAME: "agentops", InstrumentationAttributes.VERSION: "0.1.2"}):
145-
with patch("agentops.instrumentation.common.attributes.get_tags_from_config",
146-
return_value={"tag1": "value1", "tag2": "value2"}):
147-
# Get base trace attributes
148-
attributes = get_base_trace_attributes(mock_trace)
149-
150-
# Verify attributes
151-
assert CoreAttributes.TRACE_ID in attributes
152-
assert attributes[CoreAttributes.TRACE_ID] == "test_trace_id"
153-
assert WorkflowAttributes.WORKFLOW_NAME in attributes
154-
assert attributes[WorkflowAttributes.WORKFLOW_NAME] == "test_trace_name"
155-
assert WorkflowAttributes.WORKFLOW_STEP_TYPE in attributes
156-
assert attributes[WorkflowAttributes.WORKFLOW_STEP_TYPE] == "trace"
157-
assert InstrumentationAttributes.NAME in attributes
158-
assert attributes[InstrumentationAttributes.NAME] == "agentops"
159-
assert InstrumentationAttributes.VERSION in attributes
160-
assert attributes[InstrumentationAttributes.VERSION] == "0.1.2"
161-
assert CoreAttributes.TAGS in attributes
162-
assert attributes[CoreAttributes.TAGS] == {"tag1": "value1", "tag2": "value2"}
145+
# Get base trace attributes
146+
attributes = get_base_trace_attributes(mock_trace)
147+
148+
# Verify attributes
149+
assert CoreAttributes.TRACE_ID in attributes
150+
assert attributes[CoreAttributes.TRACE_ID] == "test_trace_id"
151+
assert WorkflowAttributes.WORKFLOW_NAME in attributes
152+
assert attributes[WorkflowAttributes.WORKFLOW_NAME] == "test_trace_name"
153+
assert WorkflowAttributes.WORKFLOW_STEP_TYPE in attributes
154+
assert attributes[WorkflowAttributes.WORKFLOW_STEP_TYPE] == "trace"
155+
assert InstrumentationAttributes.NAME in attributes
156+
assert attributes[InstrumentationAttributes.NAME] == "agentops"
157+
assert InstrumentationAttributes.VERSION in attributes
158+
assert attributes[InstrumentationAttributes.VERSION] == "0.1.2"
163159

164160
def test_get_base_trace_attributes_with_invalid_trace(self):
165161
"""Test getting base trace attributes with an invalid trace (missing trace_id)."""

0 commit comments

Comments
 (0)