Skip to content

Update trace-agents-sdk.md #512

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

Lin-ux-404
Copy link
Contributor

Updated telemetry documentation reference

Replaced incorrect usage of a non-existent method get_connection_string() with the correct get_application_insights_connection_string() when retrieving the Application Insights connection string.


Context

I initially followed the docs:

project = AIProjectClient(
    credential=DefaultAzureCredential(),
    endpoint=os.getenv("AZURE_AI_FOUNDRY_ENDPOINT"),
)
tracer = trace.get_tracer(__name__)
connection_string = project.telemetry.get_connection_string()
configure_azure_monitor(connection_string=connection_string)

This resulted in the following error:

Traceback (most recent call last):  line 21, in <module>
    connection_string = project.telemetry.get_connection_string()
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'TelemetryOperations' object has no attribute 'get_connection_string'. Did you mean: '_connection_string'?

Investigation

I checked the source code of the SDK and found this in the TelemetryOperations class:

class TelemetryOperations:
    """
    .. warning::
        **DO NOT** instantiate this class directly.

        Instead, you should access the following operations through
        :class:`~azure.ai.projects.AIProjectClient`'s
        :attr:`telemetry` attribute.
    """

    _connection_string: Optional[str] = None

    def __init__(self, outer_instance: "azure.ai.projects.AIProjectClient") -> None:  # type: ignore[name-defined]
        self._outer_instance = outer_instance

    @distributed_trace
    def get_application_insights_connection_string(self) -> str:  # pylint: disable=name-too-long

Resolution

Switching to the correct method resolved the issue:

project = AIProjectClient(
    credential=DefaultAzureCredential(),
    endpoint=os.getenv("AZURE_AI_FOUNDRY_ENDPOINT"),
)

tracer = trace.get_tracer(__name__)

connection_string = project.telemetry.get_application_insights_connection_string()
configure_azure_monitor(connection_string=connection_string)

Updated documentation reference for connection string, replacing non-existent 'get_connection_string()' with 'get_application_insights_connection_string()' attribute.
Copy link
Contributor

@Lin-ux-404 : Thanks for your contribution! The author(s) and reviewer(s) have been notified to review your proposed change.

Copy link
Contributor

Learn Build status updates of commit df733ce:

✅ Validation status: passed

File Status Preview URL Details
articles/ai-foundry/how-to/develop/trace-agents-sdk.md ✅Succeeded

For more details, please refer to the build report.

@v-dirichards
Copy link
Contributor

@lgayhardt

Can you review the proposed changes?

Important: When the changes are ready for publication, adding a #sign-off comment is the best way to signal that the PR is ready for the review team to merge.

#label:"aq-pr-triaged"
@MicrosoftDocs/public-repo-pr-review-team

@prmerger-automator prmerger-automator bot added the aq-pr-triaged C+L Pull Request Review Team label label Aug 4, 2025
@prmerger-automator prmerger-automator bot reopened this Aug 12, 2025
Copy link
Contributor

Learn Build status updates of commit df733ce:

❌ Validation status: errors

Please follow instructions here which may help to resolve issue.

File Status Preview URL Details
❌Error Details

  • [Error: CannotMergeCommit] Cannot merge commit df733ce4b8eca40711e812d7c3c49048366509a3 in branch patch-1 of repository https://github.com/Lin-ux-404/azure-ai-docs into branch main (commit c84ae8380200f0fd61b22dd599b4666f29ed99c9). Please follow this documentation: https://help.github.com/articles/resolving-a-merge-conflict-using-the-command-line/ to use git.exe to resolve you content conflicts locally and then push to remote.

For more details, please refer to the build report.

Note: Your PR may contain errors or warnings or suggestions unrelated to the files you changed. This happens when external dependencies like GitHub alias, Microsoft alias, cross repo links are updated. Please use these instructions to resolve them.

@lgayhardt
Copy link
Contributor

Thank you! However this change was made by one of our engineers last week. #please-close

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants