Skip to content
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

Demonstrate how to set the Resource for LogEmitterProvider #2206

Closed
wants to merge 0 commits into from

Conversation

tigrannajaryan
Copy link
Member

Description

Added a Resource to the logs example to make it more complete.
Previously it was using the built-in Resource. Now it adds the
service.name and service.instance.id attributes.

The resulting emitted log records look like this:

Resource labels:
     -> telemetry.sdk.language: STRING(python)
     -> telemetry.sdk.name: STRING(opentelemetry)
     -> telemetry.sdk.version: STRING(1.5.0)
     -> service.name: STRING(shoppingcart)
     -> service.instance.id: STRING(instance-12)
InstrumentationLibraryLogs #0
InstrumentationLibrary __main__ 0.1
LogRecord #0
Timestamp: 2021-10-14 18:33:43.425820928 +0000 UTC
Severity: ERROR
ShortName:
Body: Hyderabad, we have a major problem.
Trace ID: ce1577e4a703f42d569e72593ad71888
Span ID: f8908ac4258ceff6
Flags: 1

Type of change

Please delete options that are not relevant.

  • New feature (non-breaking change which adds functionality)

How Has This Been Tested?

Run the example and watch the Collector's logging exporter output.

Does This PR Require a Contrib Repo Change?

  • Yes. - Link to PR:
  • No.

Checklist:

  • Followed the style guidelines of this project
  • Changelogs have been updated Not needed
  • Unit tests have been added Not applicable. Example.
  • Documentation has been updated

@tigrannajaryan tigrannajaryan requested a review from a team as a code owner October 14, 2021 18:54
@tigrannajaryan
Copy link
Member Author

@open-telemetry/python-approvers while trying to fix the lint error I accidentally pushed the commit in this PR to the logs branch directly. Can someone please revert so that this undergoes a proper review first? Apologies for the trouble.

@tigrannajaryan
Copy link
Member Author

Let me know if you prefer me to submit a PR that reverts this one first and then create a new PR to review this change properly.

@codeboten
Copy link
Contributor

🤔 i'm surprised branch protection didn't prevent that. @lzchen @ocelotl @owais

@NathanielRN
Copy link
Contributor

Yeah we probably need to edit the **/** rule to make branches that match this to be "protected" @ocelotl

@lzchen
Copy link
Contributor

lzchen commented Oct 14, 2021

@tigrannajaryan
Did you force push directly to the log branch in origin?

@tigrannajaryan
Copy link
Member Author

Did you force push directly to the log branch in origin?

Yes, instead of pushing to my fork I accidentally pushed to the origin.

@lzchen
Copy link
Contributor

lzchen commented Oct 14, 2021

@tigrannajaryan
Weird, even I'm not able to force push as a python maintainer, maybe you have some super power xD.

That being said, I'm disabling it temporarily to revert the change you pushed. Feel free to send another PR for the original issue.

@tigrannajaryan
Copy link
Member Author

@lzchen sorry for mess and thanks for fixing. I created a new PR: #2209

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.

None yet

4 participants