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 #2209

Merged

Commits on Oct 17, 2021

  1. Demonstrate how to set the Resource for LogEmitterProvider

    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
    ```
    tigrannajaryan committed Oct 17, 2021
    Configuration menu
    Copy the full SHA
    4feede9 View commit details
    Browse the repository at this point in the history
  2. Fix linting

    tigrannajaryan committed Oct 17, 2021
    Configuration menu
    Copy the full SHA
    2568d5c View commit details
    Browse the repository at this point in the history