Skip to content

ignore InProc sampling dependencies #3654

Open
@tomaszwasik

Description

@tomaszwasik

I do have a spring boot - web flux (java 17) application with dependencies like:

<parent>
    <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>3.2.4</version>
    <relativePath/>
</parent>
...
...
<dependencies>
    <dependency>
        <groupId>com.azure.spring</groupId>
        <artifactId>spring-cloud-azure-starter-keyvault-secrets</artifactId>
        <version>5.11.0</version>
    </dependency>
    <dependency>
        <groupId>com.microsoft.azure</groupId>
        <artifactId>applicationinsights-runtime-attach</artifactId>
        <version>3.5.1</version>
    </dependency>
    <dependency>
        <groupId>com.microsoft.azure</groupId>
        <artifactId>applicationinsights-core</artifactId>
        <version>3.5.1</version>
    </dependency>
</dependencies>

Last days we enabled Azure Monitor - Application Insights.
We want to limit traffic a bit so I added applicationinsights.json file:

{
  "instrumentation": {
    "logging": {
      "level": "INFO"
    },
    "micrometer": {
      "enabled": false
    }
  },
  "sampling": {
    "percentage": 10,
    "overrides": [
      {
        "telemetryType": "request",
        "attributes": [
          {
            "key": "url.path",
            "value": ".*/health/.*",
            "matchType": "regexp"
          }
        ],
        "percentage": 0
      },
      {
        "telemetryType": "request",
        "attributes": [
          {
            "key": "url.path",
            "value": ".*/management/.*",
            "matchType": "regexp"
          }
        ],
        "percentage": 0
      },
      {
        "telemetryType": "dependency",
        "attributes": [
          {
            "key": "url.full",
            "value": ".*/eureka/.*",
            "matchType": "regexp"
          }
        ],
        "percentage": 0
      }
    ]
  }
}

Everything is working as expected except InProc dependencies that are still visible.
Screenshot from 2024-04-18 22-16-19

Screenshot from 2024-04-18 22-17-37

Based on https://learn.microsoft.com/en-us/azure/azure-monitor/app/java-standalone-config#autocollect-inproc-dependencies-preview 'InProc' dependencies should be disabled by default.

From logs:

DEBUG c.m.a.a.i.exporter.AgentSpanExporter - exporting span: 
SpanData{spanContext=ImmutableSpanContext{traceId=57bb173a8a83c1bdf1bc4b0adeac7625, 
spanId=93aaf096f15a06aa, traceFlags=01, traceState=ArrayBasedTraceState{entries=[]}, remote=false, valid=true}, 
parentSpanContext=ImmutableSpanContext{traceId=00000000000000000000000000000000, 
spanId=0000000000000000, traceFlags=00, traceState=ArrayBasedTraceState{entries=[]}, remote=false, valid=false}, 
resource=Resource{schemaUrl=null, 
attributes={service.name="unknown_service:java", telemetry.sdk.language="java", telemetry.sdk.name="opentelemetry", telemetry.sdk.version="1.35.0"}},
instrumentationScopeInfo=InstrumentationScopeInfo{name=azure-security-keyvault-secrets, version=4.8.1, schemaUrl=https://opentelemetry.io/schemas/1.17.0, attributes={}}, 
name=SecretClient.getSecretSync, kind=INTERNAL, startEpochNanos=1713446188727211374, endEpochNanos=1713446188751113865, 
attributes=AttributesMap{data={thread.id=1, thread.name=main, applicationinsights.internal.item_count=5, az.namespace=Microsoft.KeyVault}, 
capacity=128, totalAddedValues=4}, totalAttributeCount=4, events=[], totalRecordedEvents=0, links=[], 
totalRecordedLinks=0, status=ImmutableStatusData{statusCode=UNSET, description=}, hasEnded=true}

I tried additionally few things, but it doesn't work:

      {
        "telemetryType": "dependency",
        "attributes": [
          {
            "key": "az.namespace",
            "value": "Microsoft.KeyVault",
            "matchType": "strict"
          }
        ],
        "percentage": 0
      },
      {
        "telemetryType": "dependency",
        "attributes": [
          {
            "key": "name",
            "value": "SecretClient.getSecretSync",
            "matchType": "regexp"
          }
        ],
        "percentage": 0
      },
      {
        "telemetryType": "dependency",
        "attributes": [
          {
            "key": "name",
            "value": ".*keyvault.*",
            "matchType": "regexp"
          }
        ],
        "percentage": 0
      }

Can you pls help me with that? Not sure if it is actually a bug or i am just doing something wrong. Thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions