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

[Monitor Opentelemetry] Duplicated dependencies span when enabling azure-sdk + http instrumentation #31694

Open
1 of 6 tasks
Apokalypt opened this issue Nov 8, 2024 · 0 comments
Assignees
Labels
Client This issue points to a problem in the data-plane of the library. customer-reported Issues that are reported by GitHub users external to the Azure organization. Monitor - Exporter Monitor OpenTelemetry Exporter question The issue doesn't require a change to the product in order to be resolved. Most issues start as that

Comments

@Apokalypt
Copy link

Apokalypt commented Nov 8, 2024

  • Package Name: @azure/monitor-opentelemetry
  • Package Version: 1.8.0
  • Operating system: MacOS + Windows
  • nodejs
    • version: 18.20.4 + 20.17.0 + 22.9.0
  • browser
    • name/version:
  • typescript
    • version:
  • Is the bug related to documentation in

Describe the bug
Since the migration to OpenTelemetry with @azure/opentelemetry-instrumentation-azure-sdk + @opentelemetry/instrumentation-http we are seing duplicated span when an HTTP call is emitted from an azure SDK libraries :

  • First one is created from the tracingPolicy of the package @azure/core-rest-pipeline
  • Second one is created from the @opentelemetry/instrumentation-http which offer better customisation for outgoing request (ignore or not, custom attributes from headers, .......)

To Reproduce
Steps to reproduce the behavior:

  1. Run the below code
const { useAzureMonitor } = require('@azure/monitor-opentelemetry')

useAzureMonitor({
    instrumentationOptions: {
        http: { enabled: true },
        azureSdk: { enabled: true },

        mongoDb: { enabled: false },
        redis4: { enabled: false },
        mySql: { enabled: false },
        redis: { enabled: false },
        bunyan: { enabled: false },
        winston: { enabled: false },
        postgreSql: { enabled: false }
    },
    browserSdkLoaderOptions: { enabled: false }
})

const { DefaultAzureCredential } = require('@azure/identity')
const { SecretClient } = require('@azure/keyvault-secrets')
const { trace } = require('@opentelemetry/api')

const client = new SecretClient(`https://${process.env.KEYVAULT_NAME}.vault.azure.net`, new DefaultAzureCredential())

trace.getTracer('name', 'version').startActiveSpan('test_duplicated_span', async (span) => {
    console.warn('Getting secret key...', span.spanContext().traceId)

    const key = 'StorageConfName'
    const result = await client.getSecret(key)
    console.log(result)
})

setTimeout(() => {
    console.log('Waiting for everything to be sent to Application Insights...')
}, 100_000)

Expected behavior
Only one span should be created for an HTTP call even if he the request goes through the tracing policy. For that there is different possibilities :

  • Azure tracing policy should not generate a span for HTTP calls when @opentelemetry/instrumentation-http is enabled
  • Azure Monitor + @azure/opentelemetry-instrumentation-azure-sdk should expose options to indicate if HTTP calls should be tracked or not
  • Azure tracing policy should be compliant with @opentelemetry/instrumentation-http in terms of property/status/... If that's the case we can easily ignore request emitted from Azure SDK libraries while being able to keep all features (custom span attributes, ignore some requests, ....)

Screenshots
Image

Additional context
Add any other context about the problem here.

@github-actions github-actions bot added customer-reported Issues that are reported by GitHub users external to the Azure organization. needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that labels Nov 8, 2024
@JacksonWeber JacksonWeber self-assigned this Nov 12, 2024
@xirzec xirzec added Monitor - Exporter Monitor OpenTelemetry Exporter Client This issue points to a problem in the data-plane of the library. labels Nov 13, 2024
@github-actions github-actions bot removed the needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. label Nov 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Client This issue points to a problem in the data-plane of the library. customer-reported Issues that are reported by GitHub users external to the Azure organization. Monitor - Exporter Monitor OpenTelemetry Exporter question The issue doesn't require a change to the product in order to be resolved. Most issues start as that
Projects
None yet
Development

No branches or pull requests

3 participants