Skip to content

Conversation

@xrmx
Copy link
Member

@xrmx xrmx commented Nov 12, 2024

What does this pull request do?

Add support for tracing openai embeddings sync and async api. Traces will be something like:

    {
        "name": "embeddings all-minilm:33m",
        "context": {
            "trace_id": "0x34b6f145212c169ea39a980ff670dee3",
            "span_id": "0x74b9bd94f2ea6f31",
            "trace_state": "[]"
        },
        "kind": "SpanKind.CLIENT",
        "parent_id": null,
        "start_time": "2024-09-27T14:55:13.104397Z",
        "end_time": "2024-09-27T14:55:13.261547Z",
        "status": {
            "status_code": "UNSET"
        },
        "attributes": {
            "gen_ai.operation.name": "embeddings",
            "gen_ai.request.model": "all-minilm:33m",
            "gen_ai.system": "openai",
            "server.address": "localhost",
            "server.port": 11434,
            "gen_ai.request.encoding_format": "float",
            "gen_ai.response.model": "all-minilm:33m",
            "gen_ai.usage.input_tokens": 9
        },
        "events": [],
        "links": [],
        "resource": {
            "attributes": {
                "telemetry.sdk.language": "python",
                "telemetry.sdk.name": "opentelemetry",
                "telemetry.sdk.version": "1.27.0",
                "telemetry.distro.name": "elastic",
                "telemetry.distro.version": "0.2.0",
                "process.runtime.description": "3.10.12 (main, Sep 11 2024, 15:47:36) [GCC 11.4.0]",
                "process.runtime.name": "cpython",
                "process.runtime.version": "3.10.12",
                "os.type": "linux",
                "os.version": "6.1.0-1034-oem",
                "telemetry.auto.version": "0.48b0",
                "service.name": "unknown_service"
            },
            "schema_url": ""
        }
    }

Related issues

… embeddings calls

    {
        "name": "embeddings all-minilm:33m",
        "context": {
            "trace_id": "0x34b6f145212c169ea39a980ff670dee3",
            "span_id": "0x74b9bd94f2ea6f31",
            "trace_state": "[]"
        },
        "kind": "SpanKind.CLIENT",
        "parent_id": null,
        "start_time": "2024-09-27T14:55:13.104397Z",
        "end_time": "2024-09-27T14:55:13.261547Z",
        "status": {
            "status_code": "UNSET"
        },
        "attributes": {
            "gen_ai.operation.name": "embeddings",
            "gen_ai.request.model": "all-minilm:33m",
            "gen_ai.system": "openai",
            "server.address": "localhost",
            "server.port": 11434,
            "gen_ai.request.encoding_format": "float",
            "gen_ai.response.model": "all-minilm:33m",
            "gen_ai.usage.input_tokens": 9
        },
        "events": [],
        "links": [],
        "resource": {
            "attributes": {
                "telemetry.sdk.language": "python",
                "telemetry.sdk.name": "opentelemetry",
                "telemetry.sdk.version": "1.27.0",
                "telemetry.distro.name": "elastic",
                "telemetry.distro.version": "0.2.0",
                "process.runtime.description": "3.10.12 (main, Sep 11 2024, 15:47:36) [GCC 11.4.0]",
                "process.runtime.name": "cpython",
                "process.runtime.version": "3.10.12",
                "os.type": "linux",
                "os.version": "6.1.0-1034-oem",
                "telemetry.auto.version": "0.48b0",
                "service.name": "unknown_service"
            },
            "schema_url": ""
        }
    }
@xrmx xrmx requested a review from trentm November 12, 2024 16:48
@xrmx xrmx merged commit e02823b into main Nov 13, 2024
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants