Instrument SLF4J's addKeyValue(key, value) method from fluent API
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 38/100
- Tipo de issue
- Nueva funcionalidad
- Claridad
- Bastante claro
- Estado de actividad
- Estancado
- Stack tecnológico
- azure, java
- Área
- observability
Línea de trabajo
Comienza localizando la instrumentación existente de fwi_java para SLF4J MDC.put y compárala con la API fluent addKeyValue(key, value) de SLF4J. Rastrea cómo llegan los metadatos de los logs a customDimensions de Application Insights y, después, verifica que una llamada de log fluent produzca la entrada de clave-valor en la tabla traces.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
At our project we have a bunch of azure function written in java. Those functions are connected to the application insight through the following env variables
APPLICATIONINSIGHTS_CONNECTION_STRING=...
APPLICATIONINSIGHTS_ENABLE_AGENT=true
In java code we use SLF4J and Logback libraries for logging. We often need to attach some metadata to our logs so it appears in customDimensions field in the traces table in application insights.
So far we have been doing this by using MDC from SLF4J, so the code is something alone these lines
MDC.put("key1", "val1");
log.info("my log message");
MDC.remove("key1");
The code above makes "my log message" having "key1" field in customDimensions field in traces table in application insights. Fine. That means that MDC.put() has been properly instrumented.
But recently we discovered more convenient way to attach those additional fields to the log message.
SLF4J provides fluent api https://www.slf4j.org/manual.html#fluent which exposes addKeyValue(key, val) method for doing that (instead of putting those key+val in MDC)
So the code above can be rewritten as following:
log.atInfo()
.addKeyValue("key1", "val1")
.log("my log message");
Looks much cleaner, doesn't it?
Unfortunately, in this case key1="val1" entry does not appear in the customDimensions of this log message in traces table in the application insights. That means fwi_java SDK does not instrument this addKeyValue() as it does for MDC.put().
From my point of view making .addKeyValue(key, val) instrumented similarly to MDC.put(key, val) would be the right move. They both have very similar semantics, but .addKeyValue(key, val) makes the code much cleaner.
- Lenguaje dominante
- Java
- Estrellas
- 327
- Forks
- 222
- Merge medio
- 22 h 34 min
- PR fusionados (30 d)
- 14
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de microsoft/ApplicationInsights-Java
-
microsoft/ApplicationInsights-Java#4851 · 1 asignado ·
-
Dificultad 4/5 3-5 días Aptitud para principiantes 45/100
microsoft/ApplicationInsights-Java#4817 · 1 comentario ·
-
Dificultad 4/5 3-5 días Aptitud para principiantes 42/100
microsoft/ApplicationInsights-Java#4770 · 2 comentarios ·
-
Support for tail based sampling? Abierto
Dificultad 5/5 Más de una semana Aptitud para principiantes 30/100
microsoft/ApplicationInsights-Java#4769 · 2 comentarios ·
-
Dificultad 4/5 3-5 días Aptitud para principiantes 35/100
microsoft/ApplicationInsights-Java#4729 · 121 comentarios ·
Todos los issues de microsoft/ApplicationInsights-Java
Issues similares
-
documentation
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
inu-appcenter/memorIN-backend#288 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
-
frontend maui-pilot pilot-ask question
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
-
executions.Query — startDate and timeRange filters are sent with inverted comparison operators Abiertoarea/plugin
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
kestra-io/plugin-kestra#190 ·