Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Scrubbing sensitive content#2014

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged

Conversation

adtyavrdhn
Copy link
Contributor

@adtyavrdhnadtyavrdhn commentedJun 18, 2025
edited
Loading

Fixes#1571

Adds include_content flag in InstrumentationSettings, default set to True

Adds include_tool_args to remove the arguments from the running tool spans when incude_content is set to False

Adds example in logfire docs

@hyperlint-aiHyperlint AI
Copy link
Contributor

PR Change Summary

Introduced a new flag to manage sensitive content in instrumentation settings and updated documentation accordingly.

  • Added include_sensitive_content flag in InstrumentationSettings, default set to True
  • Implemented guard clauses to scrub sensitive content while retaining the event
  • Updated logfire documentation with an example for excluding sensitive content

Modified Files

  • docs/logfire.md

How can I customize these reviews?

Check out theHyperlint AI Reviewer docs for more information on how to customize the review.

If you just want to ignore it on this PR, you can add thehyperlint-ignore label to the PR. Future changes won't trigger a Hyperlint review.

Note specifically for link checks, we only check the first 30 links in a file and we cache the results for several hours (for instance, if you just added a page, you might experience this). Our recommendation is to addhyperlint-ignore to the PR to ignore the link check for this PR.

Copy link
Contributor

@alexmojakialexmojaki left a comment

Choose a reason for hiding this comment

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

Tool call arguments also need to be omitted.

@alexmojaki
Copy link
Contributor

The tool call arguments also need to be excluded from the 'running tool' span.

Copy link
Contributor

@alexmojakialexmojaki left a comment

Choose a reason for hiding this comment

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

Reminder: The tool call arguments also need to be excluded from the 'running tool' span.

Comment on lines 692 to +695
if body.get('content'):
body = new_event_body()
body['content'] = part.content
if settings.include_content:
body['content'] = part.content
Copy link
Contributor

Choose a reason for hiding this comment

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

This implies that the number of events produced will depend on whether content is included if multiple tool calls are made in a single message.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Trying to understand what you mean exactly

Would you say the below test captures what you are trying to imply:

def test_otel_events_consistency_with_include_content():    """Test that the number of OpenTelemetry events is consistent regardless of include_content setting."""    # Create a response with multiple tool calls followed by text    response = ModelResponse(parts=[        ToolCallPart('tool1', {'arg1': 'value1'}, 'call_1'),        ToolCallPart('tool2', {'arg2': 'value2'}, 'call_2'),        TextPart('Some text response')    ])    settings_with_content = InstrumentationSettings(include_content=True)    events_with_content = response.otel_events(settings_with_content)    settings_without_content = InstrumentationSettings(include_content=False)    events_without_content = response.otel_events(settings_without_content)    assert len(events_with_content) == len(events_without_content), (        f"Event count differs: with_content={len(events_with_content)}, "        f"without_content={len(events_without_content)}"    )

Copy link
Contributor

@alexmojakialexmojakiJun 23, 2025
edited
Loading

Choose a reason for hiding this comment

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

sorry, i didn't think this through properly. the difference would be if a message had multiple text parts. but i don't think this happens in practice, so it isn't worth worrying about.

Choose a reason for hiding this comment

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

the difference would be if a message had multiple text parts. but i don't think this happens in practice

I'm not caught up on this whole conversation, but I do think a message with multiple text parts could be realistic. For example, multiple text parts could be used to separate different inputs:

  • text part: compare these two paragraphs, which is better?
  • text part: paragraph 1
  • text part: paragraph 2

Of course this could be done by concatenating all text into a single part.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Yep, I get it. Something like this would cause this issue.

    response = ModelResponse(parts=[        TextPart('Some text response'),        ToolCallPart('tool2', {'arg2': 'value2'}, 'call_2'),        TextPart('Some more text response'),        ToolCallPart('tool1', {'arg1': 'value1'}, 'call_1'),        TextPart('Even more text response'),    ])

@alexmojaki
Copy link
Contributor

Thanks!

adtyavrdhn reacted with heart emoji

@alexmojakialexmojaki merged commitcbe0a92 intopydantic:mainJun 25, 2025
19 checks passed
@adtyavrdhnadtyavrdhn deleted the scrubbing_sensitive_content branchJune 25, 2025 13:54
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@dhimmeldhimmeldhimmel left review comments

@alexmojakialexmojakialexmojaki requested changes

@KludexKludexKludex left review comments

Assignees

@alexmojakialexmojaki

Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

Add a setting to remove prompts and completions from tracing
4 participants
@adtyavrdhn@alexmojaki@dhimmel@Kludex

[8]ページ先頭

©2009-2025 Movatter.jp