Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move validate_custom_event validators into validators directory #1089

Merged
merged 13 commits into from
Apr 16, 2024
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
2 changes: 2 additions & 0 deletions tests/agent_features/test_custom_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
function_not_called,
override_application_settings,
reset_core_stats_engine,
)
from testing_support.validators.validate_custom_event import (
validate_custom_event_count,
validate_custom_event_in_application_stats_engine,
)
Expand Down
4 changes: 3 additions & 1 deletion tests/agent_features/test_high_security_mode.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,11 @@
override_generic_settings,
reset_core_stats_engine,
validate_attributes_complete,
validate_request_params_omitted,
)
from testing_support.validators.validate_custom_event import (
validate_custom_event_count,
validate_custom_event_in_application_stats_engine,
validate_request_params_omitted,
)
from testing_support.validators.validate_custom_parameters import (
validate_custom_parameters,
Expand Down
6 changes: 2 additions & 4 deletions tests/agent_features/test_record_llm_feedback_event.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from testing_support.fixtures import (
reset_core_stats_engine,
validate_custom_event_count,
)
from testing_support.fixtures import reset_core_stats_engine
from testing_support.validators.validate_custom_event import validate_custom_event_count
from testing_support.validators.validate_custom_events import validate_custom_events

from newrelic.api.background_task import background_task
Expand Down
2 changes: 1 addition & 1 deletion tests/external_botocore/test_bedrock_chat_completion.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
override_llm_token_callback_settings,
reset_core_stats_engine,
validate_attributes,
validate_custom_event_count,
)
from testing_support.ml_testing_utils import ( # noqa: F401
add_token_count_to_events,
Expand All @@ -49,6 +48,7 @@
llm_token_count_callback,
set_trace_info,
)
from testing_support.validators.validate_custom_event import validate_custom_event_count
from testing_support.validators.validate_custom_events import validate_custom_events
from testing_support.validators.validate_error_trace_attributes import (
validate_error_trace_attributes,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,9 @@
chat_completion_langchain_expected_streaming_events,
)
from conftest import BOTOCORE_VERSION # pylint: disable=E0611
from testing_support.fixtures import (
reset_core_stats_engine,
validate_attributes,
validate_custom_event_count,
)
from testing_support.fixtures import reset_core_stats_engine, validate_attributes
from testing_support.ml_testing_utils import set_trace_info # noqa: F401
from testing_support.validators.validate_custom_event import validate_custom_event_count
from testing_support.validators.validate_custom_events import validate_custom_events
from testing_support.validators.validate_transaction_metrics import (
validate_transaction_metrics,
Expand Down
2 changes: 1 addition & 1 deletion tests/external_botocore/test_bedrock_embeddings.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
override_llm_token_callback_settings,
reset_core_stats_engine,
validate_attributes,
validate_custom_event_count,
)
from testing_support.ml_testing_utils import ( # noqa: F401
add_token_count_to_events,
Expand All @@ -41,6 +40,7 @@
llm_token_count_callback,
set_trace_info,
)
from testing_support.validators.validate_custom_event import validate_custom_event_count
from testing_support.validators.validate_custom_events import validate_custom_events
from testing_support.validators.validate_error_trace_attributes import (
validate_error_trace_attributes,
Expand Down
7 changes: 2 additions & 5 deletions tests/mlmodel_langchain/test_chain.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,14 @@
from langchain.prompts import ChatPromptTemplate
from langchain.schema import BaseOutputParser
from mock import patch
from testing_support.fixtures import (
reset_core_stats_engine,
validate_attributes,
validate_custom_event_count,
)
from testing_support.fixtures import reset_core_stats_engine, validate_attributes
from testing_support.ml_testing_utils import ( # noqa: F401
disabled_ai_monitoring_record_content_settings,
disabled_ai_monitoring_settings,
events_sans_content,
set_trace_info,
)
from testing_support.validators.validate_custom_event import validate_custom_event_count
from testing_support.validators.validate_custom_events import validate_custom_events
from testing_support.validators.validate_error_trace_attributes import (
validate_error_trace_attributes,
Expand Down
7 changes: 2 additions & 5 deletions tests/mlmodel_langchain/test_tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,13 @@
import pytest
from langchain.tools import tool
from mock import patch
from testing_support.fixtures import (
reset_core_stats_engine,
validate_attributes,
validate_custom_event_count,
)
from testing_support.fixtures import reset_core_stats_engine, validate_attributes
from testing_support.ml_testing_utils import ( # noqa: F401
disabled_ai_monitoring_record_content_settings,
disabled_ai_monitoring_settings,
set_trace_info,
)
from testing_support.validators.validate_custom_event import validate_custom_event_count
from testing_support.validators.validate_custom_events import validate_custom_events
from testing_support.validators.validate_error_trace_attributes import (
validate_error_trace_attributes,
Expand Down
7 changes: 2 additions & 5 deletions tests/mlmodel_langchain/test_vectorstore.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,13 @@
import pytest
from langchain_community.document_loaders import PyPDFLoader
from langchain_community.vectorstores.faiss import FAISS
from testing_support.fixtures import (
reset_core_stats_engine,
validate_attributes,
validate_custom_event_count,
)
from testing_support.fixtures import reset_core_stats_engine, validate_attributes
from testing_support.ml_testing_utils import ( # noqa: F401
disabled_ai_monitoring_record_content_settings,
disabled_ai_monitoring_settings,
set_trace_info,
)
from testing_support.validators.validate_custom_event import validate_custom_event_count
from testing_support.validators.validate_custom_events import validate_custom_events
from testing_support.validators.validate_error_trace_attributes import (
validate_error_trace_attributes,
Expand Down
2 changes: 1 addition & 1 deletion tests/mlmodel_openai/test_chat_completion.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
override_llm_token_callback_settings,
reset_core_stats_engine,
validate_attributes,
validate_custom_event_count,
)
from testing_support.ml_testing_utils import ( # noqa: F401
add_token_count_to_events,
Expand All @@ -29,6 +28,7 @@
llm_token_count_callback,
set_trace_info,
)
from testing_support.validators.validate_custom_event import validate_custom_event_count
from testing_support.validators.validate_custom_events import validate_custom_events
from testing_support.validators.validate_transaction_metrics import (
validate_transaction_metrics,
Expand Down
2 changes: 1 addition & 1 deletion tests/mlmodel_openai/test_chat_completion_error.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
dt_enabled,
override_llm_token_callback_settings,
reset_core_stats_engine,
validate_custom_event_count,
)
from testing_support.ml_testing_utils import ( # noqa: F401
add_token_count_to_events,
Expand All @@ -28,6 +27,7 @@
llm_token_count_callback,
set_trace_info,
)
from testing_support.validators.validate_custom_event import validate_custom_event_count
from testing_support.validators.validate_custom_events import validate_custom_events
from testing_support.validators.validate_error_trace_attributes import (
validate_error_trace_attributes,
Expand Down
2 changes: 1 addition & 1 deletion tests/mlmodel_openai/test_chat_completion_error_v1.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
dt_enabled,
override_llm_token_callback_settings,
reset_core_stats_engine,
validate_custom_event_count,
)
from testing_support.ml_testing_utils import ( # noqa: F401
add_token_count_to_events,
Expand All @@ -27,6 +26,7 @@
llm_token_count_callback,
set_trace_info,
)
from testing_support.validators.validate_custom_event import validate_custom_event_count
from testing_support.validators.validate_custom_events import validate_custom_events
from testing_support.validators.validate_error_trace_attributes import (
validate_error_trace_attributes,
Expand Down
2 changes: 1 addition & 1 deletion tests/mlmodel_openai/test_chat_completion_stream.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
override_llm_token_callback_settings,
reset_core_stats_engine,
validate_attributes,
validate_custom_event_count,
)
from testing_support.ml_testing_utils import ( # noqa: F401
add_token_count_to_events,
Expand All @@ -29,6 +28,7 @@
llm_token_count_callback,
set_trace_info,
)
from testing_support.validators.validate_custom_event import validate_custom_event_count
from testing_support.validators.validate_custom_events import validate_custom_events
from testing_support.validators.validate_transaction_metrics import (
validate_transaction_metrics,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
dt_enabled,
override_llm_token_callback_settings,
reset_core_stats_engine,
validate_custom_event_count,
)
from testing_support.ml_testing_utils import ( # noqa: F401
add_token_count_to_events,
Expand All @@ -28,6 +27,7 @@
llm_token_count_callback,
set_trace_info,
)
from testing_support.validators.validate_custom_event import validate_custom_event_count
from testing_support.validators.validate_custom_events import validate_custom_events
from testing_support.validators.validate_error_trace_attributes import (
validate_error_trace_attributes,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
dt_enabled,
override_llm_token_callback_settings,
reset_core_stats_engine,
validate_custom_event_count,
)
from testing_support.ml_testing_utils import ( # noqa: F401
add_token_count_to_events,
Expand All @@ -28,6 +27,7 @@
llm_token_count_callback,
set_trace_info,
)
from testing_support.validators.validate_custom_event import validate_custom_event_count
from testing_support.validators.validate_custom_events import validate_custom_events
from testing_support.validators.validate_error_trace_attributes import (
validate_error_trace_attributes,
Expand Down
2 changes: 1 addition & 1 deletion tests/mlmodel_openai/test_chat_completion_stream_v1.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
override_llm_token_callback_settings,
reset_core_stats_engine,
validate_attributes,
validate_custom_event_count,
)
from testing_support.ml_testing_utils import ( # noqa: F401
add_token_count_to_events,
Expand All @@ -29,6 +28,7 @@
llm_token_count_callback,
set_trace_info,
)
from testing_support.validators.validate_custom_event import validate_custom_event_count
from testing_support.validators.validate_custom_events import validate_custom_events
from testing_support.validators.validate_transaction_metrics import (
validate_transaction_metrics,
Expand Down
2 changes: 1 addition & 1 deletion tests/mlmodel_openai/test_chat_completion_v1.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
override_llm_token_callback_settings,
reset_core_stats_engine,
validate_attributes,
validate_custom_event_count,
)
from testing_support.ml_testing_utils import ( # noqa: F401
add_token_count_to_events,
Expand All @@ -29,6 +28,7 @@
llm_token_count_callback,
set_trace_info,
)
from testing_support.validators.validate_custom_event import validate_custom_event_count
from testing_support.validators.validate_custom_events import validate_custom_events
from testing_support.validators.validate_transaction_metrics import (
validate_transaction_metrics,
Expand Down
2 changes: 1 addition & 1 deletion tests/mlmodel_openai/test_embeddings.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
override_llm_token_callback_settings,
reset_core_stats_engine,
validate_attributes,
validate_custom_event_count,
)
from testing_support.ml_testing_utils import ( # noqa: F401
add_token_count_to_events,
Expand All @@ -27,6 +26,7 @@
llm_token_count_callback,
set_trace_info,
)
from testing_support.validators.validate_custom_event import validate_custom_event_count
from testing_support.validators.validate_custom_events import validate_custom_events
from testing_support.validators.validate_transaction_metrics import (
validate_transaction_metrics,
Expand Down
2 changes: 1 addition & 1 deletion tests/mlmodel_openai/test_embeddings_error.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
dt_enabled,
override_llm_token_callback_settings,
reset_core_stats_engine,
validate_custom_event_count,
)
from testing_support.ml_testing_utils import ( # noqa: F401
add_token_count_to_events,
Expand All @@ -27,6 +26,7 @@
llm_token_count_callback,
set_trace_info,
)
from testing_support.validators.validate_custom_event import validate_custom_event_count
from testing_support.validators.validate_custom_events import validate_custom_events
from testing_support.validators.validate_error_trace_attributes import (
validate_error_trace_attributes,
Expand Down
2 changes: 1 addition & 1 deletion tests/mlmodel_openai/test_embeddings_error_v1.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
dt_enabled,
override_llm_token_callback_settings,
reset_core_stats_engine,
validate_custom_event_count,
)
from testing_support.ml_testing_utils import ( # noqa: F401
add_token_count_to_events,
Expand All @@ -29,6 +28,7 @@
llm_token_count_callback,
set_trace_info,
)
from testing_support.validators.validate_custom_event import validate_custom_event_count
from testing_support.validators.validate_custom_events import validate_custom_events
from testing_support.validators.validate_error_trace_attributes import (
validate_error_trace_attributes,
Expand Down
6 changes: 2 additions & 4 deletions tests/mlmodel_openai/test_embeddings_stream_v1.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,9 @@

import pytest
from conftest import get_openai_version # pylint: disable=E0611
from testing_support.fixtures import (
reset_core_stats_engine,
validate_custom_event_count,
)
from testing_support.fixtures import reset_core_stats_engine
from testing_support.ml_testing_utils import set_trace_info # noqa: F401
from testing_support.validators.validate_custom_event import validate_custom_event_count

from newrelic.api.background_task import background_task

Expand Down
2 changes: 1 addition & 1 deletion tests/mlmodel_openai/test_embeddings_v1.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
override_llm_token_callback_settings,
reset_core_stats_engine,
validate_attributes,
validate_custom_event_count,
)
from testing_support.ml_testing_utils import ( # noqa: F401
add_token_count_to_events,
Expand All @@ -27,6 +26,7 @@
llm_token_count_callback,
set_trace_info,
)
from testing_support.validators.validate_custom_event import validate_custom_event_count
from testing_support.validators.validate_custom_events import validate_custom_events
from testing_support.validators.validate_transaction_metrics import (
validate_transaction_metrics,
Expand Down
Loading
Loading