Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

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

Abierto
#4,049 8 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 2 días

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
35/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Estancado
Stack tecnológico
azure, java

Línea de trabajo

Comienza reproduciendo las cinco configuraciones con el Java agent en Tomcat 10.1.33, utilizando las dos rutas de contexto /OsaEcommerceServerBE y /OsaEcommerceServerNL. Traza cómo se interpretan preview.connectionStringOverrides y connectionString de nivel superior. Se considera terminado cuando cada ruta dirige la telemetría a su recurso configurado y el agente se comporta según la documentación cuando falta la connection string de nivel superior.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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

Lenguaje dominante
Java
Estrellas
327
Forks
222
Merge medio
1 d 3 h
PR fusionados (30 d)
12

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de microsoft/ApplicationInsights-Java

Todos los issues de microsoft/ApplicationInsights-Java

Issues similares

Más issues de Java

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.