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

Allow connectionString to be overridden multiple times without restarting the AppInsights Agent

Abierto
#3,473 5 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
5/5
Tiempo estimado
Más de una semana
Aptitud para principiantes
25/100
Tipo de issue
Nueva funcionalidad
Claridad
Bastante claro
Estado de actividad
Estancado
Stack tecnológico
java, spring-boot

Línea de trabajo

Comienza con BytecodeUtilImpl.java alrededor de las líneas 70-73 para entender por qué ConnectionString.configure() actualmente solo se ejecuta una vez; después, inspecciona InheritedConnectionStringSpanProcessor.java alrededor de las líneas 58-62 y la documentación enlazada sobre la sobrescritura de connection strings. Traza cómo se asocian los connection strings con los spans y los destinos de telemetría. Se consideraría completado cuando exista un diseño compatible para cambiar los destinos durante el ciclo de vida de la aplicación o para distintos spans personalizados.

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

Descripción

Needs: Attention :wave:

Is your feature request related to a problem? Please describe.
As per your documentation, it's possible to override connection strings per each httpPathPrefix:
https://learn.microsoft.com/en-us/azure/azure-monitor/app/java-standalone-config#connection-string-overrides-preview

{
  "preview": {
    "connectionStringOverrides": [
      {
        "httpPathPrefix": "/myapp1",
        "connectionString": "..."
      },
      {
        "httpPathPrefix": "/myapp2",
        "connectionString": "..."
      }
    ]
  }
}

This config is being processed in the following class of AppInsights Agent: InheritedConnectionStringSpanProcessor.java:L58-L62

I understand that this feature is geared towards a use-case where an app being instrumented with AppInsights is an MVC app, and a connectionStringOverride is applied at a Controller method level, where each Controller method has a different PathPrefix. I.e. this use-case is described in OpenTelemetryAPI documentation as creating a custom span per controller method:
https://opentelemetry.io/docs/instrumentation/java/manual/#create-spans

Describe the solution you would like
We are looking for a way to change connectionString multiple times throughout application lifecycle, not per httpPathPrefix

Ideally we would be able to run ConnectionString.configure() and change to a desired connectionString, and ApplicationInsight agent taking that into account, and posting metrics to a newly specified location.

com.microsoft.applicationinsights.connectionstring.ConnectionString.configure(CONNECTION_STRING)

Currently ConnectionString.configure(CONNECTION_STRING) can be run only once to set ConnectionString:
https://github.com/microsoft/ApplicationInsights-Java/blob/main/agent/agent-tooling/src/main/java/com/microsoft/applicationinsights/agent/internal/classicsdk/BytecodeUtilImpl.java#L70-L73

We need a way to determine custom OpenTelemetry spans, and have a different ConnectionString per each of these spans.

Describe alternatives you have considered
Describe any alternative solutions or features you've considered.

Additional context
Our app is not Spring MVC app that has different httpPathPrefix, but is rather a SpringBoot cron-executed org.springframework.boot.CommandLineRunner task, that runs periodically, and needs to send AppInsights telemetry to 3 different AppInsights containers.

Lenguaje dominante
Java
Estrellas
327
Forks
222
Merge medio
22 h 34 min
PR fusionados (30 d)
14

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.