Skip to content

Conversation

@hassiebp
Copy link
Contributor

@hassiebp hassiebp commented Oct 16, 2025

Important

Change HTTP headers from snake_case to dash-case in span_processor.py, request.py, and update tests accordingly.

  • Behavior:
    • Change HTTP headers from snake_case to dash-case in span_processor.py and request.py.
    • Headers affected: x_langfuse_sdk_name to x-langfuse-sdk-name, x_langfuse_sdk_version to x-langfuse-sdk-version.
  • Tests:
    • Update test_additional_headers_simple.py to check for dash-case headers instead of snake_case.

This description was created by Ellipsis for 47967b9. You can customize this summary. It will automatically update as commits are pushed.

Disclaimer: Experimental PR review

Greptile Overview

Updated On: 2025-10-16 15:53:24 UTC

Summary

This PR fixes HTTP header naming to follow the standard convention of using dashes instead of underscores. The changes update two SDK metadata headers (x-langfuse-sdk-name and x-langfuse-sdk-version) from snake_case to kebab-case in two core files and their corresponding tests.

Key Changes:

  • Updated x_langfuse_sdk_namex-langfuse-sdk-name in span_processor.py and request.py
  • Updated x_langfuse_sdk_versionx-langfuse-sdk-version in the same files
  • Updated test assertions to match the new header names

Issue Found:
The PR is incomplete - the third custom header x_langfuse_public_key was not updated to use dashes. This creates an inconsistent state where two headers follow HTTP standards (dashes) but one still uses underscores. All three headers should be updated together for consistency.

Confidence Score: 2/5

  • This PR has critical logical inconsistency that makes it unsafe to merge as-is
  • The PR correctly fixes 2 out of 3 custom HTTP headers but leaves the third header (x_langfuse_public_key) with underscores, creating an inconsistent state. This incomplete fix means the codebase will have mixed header naming conventions, which violates HTTP standards and could cause confusion. All three headers must be updated together for consistency.
  • All three files need attention: langfuse/_client/span_processor.py (line 88), langfuse/_utils/request.py (line 46), and tests/test_additional_headers_simple.py (lines 160, 183) need the x_langfuse_public_key header updated to x-langfuse-public-key

Important Files Changed

File Analysis

Filename Score Overview
langfuse/_client/span_processor.py 3/5 Fixed two HTTP headers to use dashes instead of underscores (x-langfuse-sdk-name, x-langfuse-sdk-version), but inconsistently left x_langfuse_public_key with underscores on line 88
langfuse/_utils/request.py 3/5 Fixed two HTTP headers to use dashes (x-langfuse-sdk-name, x-langfuse-sdk-version), but inconsistently left x_langfuse_public_key with underscores on line 46
tests/test_additional_headers_simple.py 3/5 Updated test assertions to check for dashed header names (x-langfuse-sdk-name), but inconsistently left x_langfuse_public_key with underscores on lines 160 and 183

Sequence Diagram

sequenceDiagram
    participant Client as Langfuse Client
    participant RM as ResourceManager
    participant SP as LangfuseSpanProcessor
    participant LC as LangfuseClient
    participant API as Langfuse API

    Note over Client,API: HTTP Header Flow

    Client->>RM: Initialize with credentials
    RM->>RM: Create Fern API Client<br/>with x-langfuse-* headers
    
    Client->>SP: Create SpanProcessor<br/>with additional_headers
    SP->>SP: Build default_headers dict<br/>x-langfuse-sdk-name (fixed)<br/>x-langfuse-sdk-version (fixed)<br/>x_langfuse_public_key (inconsistent)
    SP->>SP: Merge with additional_headers
    SP->>API: Export spans via OTLP<br/>with merged headers

    Client->>LC: Create LangfuseClient<br/>for batch requests
    LC->>LC: generate_headers()<br/>x-langfuse-sdk-name (fixed)<br/>x-langfuse-sdk-version (fixed)<br/>x_langfuse_public_key (inconsistent)
    LC->>API: POST to /api/public/ingestion<br/>with generated headers

    Note over SP,LC: Inconsistency: x_langfuse_public_key<br/>should use dashes like other headers
Loading

@hassiebp hassiebp enabled auto-merge (squash) October 16, 2025 15:50
@hassiebp hassiebp linked an issue Oct 16, 2025 that may be closed by this pull request
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

3 files reviewed, 4 comments

Edit Code Review Agent Settings | Greptile

hassiebp and others added 4 commits October 16, 2025 18:52
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
@hassiebp hassiebp disabled auto-merge October 17, 2025 07:59
@hassiebp hassiebp merged commit 1b61c36 into main Oct 17, 2025
11 checks passed
@hassiebp hassiebp deleted the header-to-dashes branch October 17, 2025 07:59
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.

Extra LangFuse headers should use - rather than _

2 participants