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
6 changes: 3 additions & 3 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@ jobs:

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@9b3254085494b55a0f7c4c2b3d2d52cc712ce370 # v4.39.1
uses: github/codeql-action/init@33d7b85da1a04171e211befe2c739303b9a4c066 # v4.39.3
with:
languages: python

- name: Autobuild
uses: github/codeql-action/autobuild@9b3254085494b55a0f7c4c2b3d2d52cc712ce370 # v4.39.1
uses: github/codeql-action/autobuild@33d7b85da1a04171e211befe2c739303b9a4c066 # v4.39.3

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@9b3254085494b55a0f7c4c2b3d2d52cc712ce370 # v4.39.1
uses: github/codeql-action/analyze@33d7b85da1a04171e211befe2c739303b9a4c066 # v4.39.3
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,16 @@

from __future__ import annotations

import json
import os
from collections.abc import Iterator
from typing import Any

import pytest
from llama_index.core.instrumentation import get_dispatcher
from llama_index.core.instrumentation.span_handlers import SimpleSpanHandler
from llama_index.llms.openai import OpenAI
from vcr.request import Request

from opentelemetry.instrumentation.genai.llama_index import (
LlamaIndexInstrumentor,
Expand Down Expand Up @@ -70,10 +73,21 @@ def vcr_config():
"Set-Cookie": "test_set_cookie",
}
),
"match_on": ["method", "scheme", "host", "port", "path", "body"],
"match_on": ["method", "scheme", "host", "port", "path", "json_body"],
Comment thread
lmolkova marked this conversation as resolved.
Resolved
}


def _json_body(r1: Request, r2: Request) -> None:
assert json.loads(r1.body or "null") == json.loads(r2.body or "null")


# Recorded requests carry no content-type header, so vcrpy's built-in "body"
# matcher compares raw strings and breaks when the client reorders JSON keys.
@pytest.fixture(scope="module", autouse=True)
def register_json_body_matcher(vcr: Any) -> None:
vcr.register_matcher("json_body", _json_body)


@pytest.fixture
def instrument_llama_index(
tracer_provider,
Expand Down
Loading