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
21 changes: 19 additions & 2 deletions .github/workflows/fr-pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,25 @@ jobs:

echo "No hardcoded secrets or credentials detected."

fr-tests:
fr-modification-notices:
needs: secret-scan
name: FR Modification Notice Check
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}

- name: Run notice script unit tests
run: python3 ./scripts/test-apply-fr-modification-notices.py

- name: Check modified-file notices
run: python3 ./scripts/apply-fr-modification-notices.py --check --base-ref "${{ github.base_ref }}"

fr-tests:
needs: [secret-scan, fr-modification-notices]
name: FR Tests (py${{ matrix.python-version }})
runs-on: ubuntu-latest
timeout-minutes: 45
Expand Down Expand Up @@ -80,7 +97,7 @@ jobs:
if-no-files-found: ignore

non-fr-tests:
needs: secret-scan
needs: [secret-scan, fr-modification-notices]
name: Non-FR Tests (py${{ matrix.python-version }})
runs-on: ubuntu-latest
timeout-minutes: 60
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# NOTE:
# This file has been modified by FortifyRoot.
# Original source: https://github.com/traceloop/openllmetry

"""OpenTelemetry Aleph Alpha instrumentation"""

import logging
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# NOTE:
# This file has been modified by FortifyRoot.
# Original source: https://github.com/traceloop/openllmetry

[project]
name = "opentelemetry-instrumentation-alephalpha"
version = "0.52.6"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# NOTE:
# This file has been modified by FortifyRoot.
# Original source: https://github.com/traceloop/openllmetry

"""OpenTelemetry Anthropic instrumentation"""

import asyncio # FR: async safety
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# NOTE:
# This file has been modified by FortifyRoot.
# Original source: https://github.com/traceloop/openllmetry

import logging
import time
from typing import Optional
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# NOTE:
# This file has been modified by FortifyRoot.
# Original source: https://github.com/traceloop/openllmetry

import asyncio
import json
import logging
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# NOTE:
# This file has been modified by FortifyRoot.
# Original source: https://github.com/traceloop/openllmetry

[project]
name = "opentelemetry-instrumentation-anthropic"
version = "0.52.6"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# NOTE:
# This file has been modified by FortifyRoot.
# Original source: https://github.com/traceloop/openllmetry

"""Unit tests configuration module."""

import os
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# NOTE:
# This file has been modified by FortifyRoot.
# Original source: https://github.com/traceloop/openllmetry

from opentelemetry.semconv._incubating.attributes import (
gen_ai_attributes as GenAIAttributes,
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# NOTE:
# This file has been modified by FortifyRoot.
# Original source: https://github.com/traceloop/openllmetry

"""OpenTelemetry Bedrock instrumentation"""

import json
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# NOTE:
# This file has been modified by FortifyRoot.
# Original source: https://github.com/traceloop/openllmetry

from enum import Enum
from opentelemetry.semconv._incubating.attributes import (
gen_ai_attributes as GenAIAttributes,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
# NOTE:
# This file has been modified by FortifyRoot.
# Original source: https://github.com/traceloop/openllmetry

import json
import logging
import time

import anthropic
from opentelemetry.instrumentation.bedrock.config import Config
from opentelemetry.instrumentation.bedrock.utils import should_send_prompts
from opentelemetry.semconv._incubating.attributes import (
Expand Down Expand Up @@ -325,9 +329,10 @@ def _count_anthropic_tokens(messages: list[str]):
# Lazy initialization of the Anthropic client
if anthropic_client is None:
try:
import anthropic

anthropic_client = anthropic.Anthropic()
except Exception as e:
import logging
logger = logging.getLogger(__name__)
logger.debug(f"Failed to initialize Anthropic client for token counting: {e}")
# Return 0 if we can't create the client
Expand All @@ -338,7 +343,6 @@ def _count_anthropic_tokens(messages: list[str]):
for message in messages:
count += anthropic_client.count_tokens(text=message)
except Exception as e:
import logging
logger = logging.getLogger(__name__)
logger.debug(f"Failed to count tokens with Anthropic client: {e}")
return 0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# NOTE:
# This file has been modified by FortifyRoot.
# Original source: https://github.com/traceloop/openllmetry

import json

from opentelemetry.instrumentation.bedrock.utils import (
Expand Down
4 changes: 4 additions & 0 deletions packages/opentelemetry-instrumentation-bedrock/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# NOTE:
# This file has been modified by FortifyRoot.
# Original source: https://github.com/traceloop/openllmetry

[project]
name = "opentelemetry-instrumentation-bedrock"
version = "0.52.6"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# NOTE:
# This file has been modified by FortifyRoot.
# Original source: https://github.com/traceloop/openllmetry

import json

import pytest
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# NOTE:
# This file has been modified by FortifyRoot.
# Original source: https://github.com/traceloop/openllmetry

import json

import pytest
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
"""Tests for optional dependency behavior."""

from __future__ import annotations

import builtins
import importlib
import sys


def test_bedrock_span_utils_import_without_anthropic(monkeypatch):
"""Bedrock instrumentation import should not require the Anthropic package."""
module_name = "opentelemetry.instrumentation.bedrock.span_utils"
sys.modules.pop(module_name, None)
sys.modules.pop("anthropic", None)

original_import = builtins.__import__

def import_without_anthropic(name, *args, **kwargs):
if name == "anthropic":
raise ModuleNotFoundError("No module named 'anthropic'")
return original_import(name, *args, **kwargs)

monkeypatch.setattr(builtins, "__import__", import_without_anthropic)

module = importlib.import_module(module_name)

assert module is not None
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# NOTE:
# This file has been modified by FortifyRoot.
# Original source: https://github.com/traceloop/openllmetry

import json

import pytest
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# NOTE:
# This file has been modified by FortifyRoot.
# Original source: https://github.com/traceloop/openllmetry

"""OpenTelemetry Cohere instrumentation"""

import asyncio # FR: async safety
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# NOTE:
# This file has been modified by FortifyRoot.
# Original source: https://github.com/traceloop/openllmetry

import copy # FR: needed for deepcopy fix

from opentelemetry.instrumentation.cohere.event_emitter import emit_response_events
Expand Down
4 changes: 4 additions & 0 deletions packages/opentelemetry-instrumentation-cohere/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# NOTE:
# This file has been modified by FortifyRoot.
# Original source: https://github.com/traceloop/openllmetry

[project]
name = "opentelemetry-instrumentation-cohere"
version = "0.52.6"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# NOTE:
# This file has been modified by FortifyRoot.
# Original source: https://github.com/traceloop/openllmetry

"""OpenTelemetry Google Generative AI API instrumentation"""

import asyncio # FR: async safety
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# NOTE:
# This file has been modified by FortifyRoot.
# Original source: https://github.com/traceloop/openllmetry

from typing import Callable, Optional


Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# NOTE:
# This file has been modified by FortifyRoot.
# Original source: https://github.com/traceloop/openllmetry

import json
import base64
import logging
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# NOTE:
# This file has been modified by FortifyRoot.
# Original source: https://github.com/traceloop/openllmetry

[project]
name = "opentelemetry-instrumentation-google-generativeai"
version = "0.52.6"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# NOTE:
# This file has been modified by FortifyRoot.
# Original source: https://github.com/traceloop/openllmetry

"""Unit tests configuration module."""

import os
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# NOTE:
# This file has been modified by FortifyRoot.
# Original source: https://github.com/traceloop/openllmetry


import pytest
from opentelemetry.trace import StatusCode, SpanKind
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# NOTE:
# This file has been modified by FortifyRoot.
# Original source: https://github.com/traceloop/openllmetry

"""OpenTelemetry Groq instrumentation"""

import asyncio # FR: async safety
Expand Down
4 changes: 4 additions & 0 deletions packages/opentelemetry-instrumentation-groq/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# NOTE:
# This file has been modified by FortifyRoot.
# Original source: https://github.com/traceloop/openllmetry

[project]
name = "opentelemetry-instrumentation-groq"
version = "0.52.6"
Expand Down
4 changes: 4 additions & 0 deletions packages/opentelemetry-instrumentation-lancedb/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# NOTE:
# This file has been modified by FortifyRoot.
# Original source: https://github.com/traceloop/openllmetry

[project]
name = "opentelemetry-instrumentation-lancedb"
version = "0.52.6"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# NOTE:
# This file has been modified by FortifyRoot.
# Original source: https://github.com/traceloop/openllmetry

import lancedb
import pytest
from opentelemetry.semconv_ai import SpanAttributes
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# NOTE:
# This file has been modified by FortifyRoot.
# Original source: https://github.com/traceloop/openllmetry

"""OpenTelemetry Langchain instrumentation"""

import inspect
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# NOTE:
# This file has been modified by FortifyRoot.
# Original source: https://github.com/traceloop/openllmetry

import json
import time
from typing import Any, Dict, List, Optional, Type, Union
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# NOTE:
# This file has been modified by FortifyRoot.
# Original source: https://github.com/traceloop/openllmetry

import json
import time
from dataclasses import dataclass, field
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# NOTE:
# This file has been modified by FortifyRoot.
# Original source: https://github.com/traceloop/openllmetry

[project]
name = "opentelemetry-instrumentation-langchain"
version = "0.52.6"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# NOTE:
# This file has been modified by FortifyRoot.
# Original source: https://github.com/traceloop/openllmetry

"""Unit tests configuration module."""

import os
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# NOTE:
# This file has been modified by FortifyRoot.
# Original source: https://github.com/traceloop/openllmetry

"""OpenTelemetry LlamaIndex instrumentation"""

import logging
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# NOTE:
# This file has been modified by FortifyRoot.
# Original source: https://github.com/traceloop/openllmetry

import inspect
import json
import re
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# NOTE:
# This file has been modified by FortifyRoot.
# Original source: https://github.com/traceloop/openllmetry

from llama_index.core.base.llms.types import MessageRole
from opentelemetry.instrumentation.llamaindex.utils import (
dont_throw,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# NOTE:
# This file has been modified by FortifyRoot.
# Original source: https://github.com/traceloop/openllmetry

[project]
name = "opentelemetry-instrumentation-llamaindex"
version = "0.52.6"
Expand Down
Loading
Loading