Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Application Insights Java Agent: ConnectionStringOverrides Feature Fails to Route Telemetry as Expected

Aperta
#4,049 8 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
35/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
azure, java
Ambito
observability

Direzione di ricerca

Inizia riproducendo le cinque configurazioni con il Java agent su Tomcat 10.1.33, utilizzando i due context path /OsaEcommerceServerBE e /OsaEcommerceServerNL. Traccia il modo in cui vengono interpretati preview.connectionStringOverrides e il connectionString di primo livello. Il lavoro è completato quando ogni path instrada la telemetria verso la risorsa configurata e l’agent si comporta come documentato quando il connection string di primo livello è assente.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Expected behavior

I expected requests to be tracked in the respective Application Insights resources based on the httpPathPrefix defined in the configuration. Specifically:

  • Requests to /OsaEcommerceServerBE/ should be tracked in THE_ONE_BE.
  • Requests to /OsaEcommerceServerNL/ should be tracked in THE_ONE_NL.

Actual behavior

The behavior observed differs depending on the configuration JSON:

Case 1

Configuration:

{
  "role": {
    "name": "testrolename",
    "instance": "testroleinstance"
  },
  "sampling": {
    "percentage": 100
  },
  "preview": {
    "connectionStringOverrides": [
      {
        "httpPathPrefix": "/OsaEcommerceServerBE",
        "connectionString": "THE_ONE_BE"
      },
      {
        "httpPathPrefix": "/OsaEcommerceServerNL",
        "connectionString": "THE_ONE_NL"
      }
    ]
  },
  "connectionString": "THE_ONE_BE"
}

Observed Behavior:

  • /OsaEcommerceServerBE/ is tracked in THE_ONE_BE.
  • /OsaEcommerceServerNL/ is not tracked anywhere.

Case 2

Configuration:

{
  "role": {
    "name": "testrolename",
    "instance": "testroleinstance"
  },
  "sampling": {
    "percentage": 100
  },
  "preview": {
    "connectionStringOverrides": [
      {
        "httpPathPrefix": "/OsaEcommerceServerNL",
        "connectionString": "THE_ONE_BE"
      },
      {
        "httpPathPrefix": "/OsaEcommerceServerNL",
        "connectionString": "THE_ONE_NL"
      }
    ]
  },
  "connectionString": "THE_ONE_BE"
}

Observed Behavior:

  • Both /OsaEcommerceServerBE/ and /OsaEcommerceServerNL/ are tracked in THE_ONE_BE.

Case 3

Configuration:

{
  "role": {
    "name": "testrolename",
    "instance": "testroleinstance"
  },
  "sampling": {
    "percentage": 100
  },
  "preview": {
    "connectionStringOverrides": [
      {
        "httpPathPrefix": "/OsaEcommerceServerBE",
        "connectionString": "THE_ONE_BE"
      },
      {
        "httpPathPrefix": "/OsaEcommerceServerBE",
        "connectionString": "THE_ONE_NL"
      }
    ]
  },
  "connectionString": "THE_ONE_BE"
}

Observed Behavior:

  • /OsaEcommerceServerBE/ is tracked in THE_ONE_BE.
  • /OsaEcommerceServerNL/ is also tracked in THE_ONE_BE.

Case 4

Configuration:

{
  "role": {
    "name": "testrolename",
    "instance": "testroleinstance"
  },
  "sampling": {
    "percentage": 100
  },
  "preview": {
    "connectionStringOverrides": [
      {
        "httpPathPrefix": "/OsaEcommerceServerNL",
        "connectionString": "THE_ONE_BE"
      },
      {
        "httpPathPrefix": "/OsaEcommerceServerBE",
        "connectionString": "THE_ONE_NL"
      }
    ]
  },
  "connectionString": "THE_ONE_BE"
}

Observed Behavior:

  • /OsaEcommerceServerBE/ is not tracked anywhere.
  • /OsaEcommerceServerNL/ is tracked in THE_ONE_BE.

Case 5

Configuration:

{
  "role": {
    "name": "testrolename",
    "instance": "testroleinstance"
  },
  "sampling": {
    "percentage": 100
  },
  "preview": {
    "connectionStringOverrides": [
      {
        "httpPathPrefix": "/OsaEcommerceServerNL",
        "connectionString": "THE_ONE_BE"
      },
      {
        "httpPathPrefix": "/OsaEcommerceServerBE",
        "connectionString": "THE_ONE_NL"
      }
    ]
  }
}

Observed Behavior:

  • No requests are tracked at all.

Logs

When the connectionString field is not specified in the configuration, the Application Insights Java agent failed to start, citing that no connection string was provided. This indicates that the connectionStringOverrides feature does not work as expected without a main connectionString specified.


To Reproduce

  1. Set up a Tomcat server with two applications running on distinct context paths (/OsaEcommerceServerBE and /OsaEcommerceServerNL).
  2. Configure the Application Insights agent using the provided JSON configurations for each case.
  3. Make requests to http://localhost:8081/OsaEcommerceServerBE/ and http://localhost:8081/OsaEcommerceServerNL/.
  4. Observe the Application Insights telemetry data.

System information

  • SDK Version: 21
  • OS type and version: Windows 10
  • Application Server type and version: Apache Tomcat 10.1.33
  • Using spring-boot? Yes, version 3.1.5
  • Additional relevant libraries: None applicable

Lingua principale
Java
Stelle
327
Fork
222
Merge medio
22h 34m
PR unite (30g)
14

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di microsoft/ApplicationInsights-Java

Tutte le issue di microsoft/ApplicationInsights-Java

Issue simili

Altre issue su Java

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.