grafana / grafana/pyroscope-java

Be able to set an agent log format with a configuration option

Ouverte
#147 1 commentaire 4 réactions 0 personnes assignées Voir sur GitHub
Langage dominant
Java
Étoiles
126
Forks
48
Merge moyen
4 j 14 h
PR mergées (30 j)
5

Description

### Our scenario

Hello. We are using docker as the underlying technology to deploy apps and the observability stack. For all the logs we decide to use JSON format that is sent to our Loki backend.
We are trying to adopt the pyroscope Java Otel extension (that implicitly has the Java Agent) to send profiling data to our Pyroscope server.

### The issue

During our testing, when we are sending the Pyroscope backend server down, all Java apps using the extension are producing lot of logs that don't align with the rest of echosystem. In our case is JSON.
This is the kind of output we are getting from the agent logger in the docker console:

```
2024-03-21 11:37:15.292 [ERROR] Error uploading snapshot: 502
502 Bad Gateway

502 Bad Gateway



nginx

```

Currently the agent only has this log parameter `PYROSCOPE_LOG_LEVEL` which is not enough for this case.

### Possible solutions

- As discussed in this [thread](https://app.slack.com/client/T05675Y01/C049PLMV8TB) a custom logger interface implementation can be done:

[https://github.com/grafana/pyroscope-java/blob/f73ebfaae1fcdfdf61d3418a78807c5b2b0[…]/agent/src/main/java/io/pyroscope/javaagent/PyroscopeAgent.java](https://github.com/grafana/pyroscope-java/blob/f73ebfaae1fcdfdf61d3418a78807c5b2b0e869d/agent/src/main/java/io/pyroscope/javaagent/PyroscopeAgent.java#L98)
[https://github.com/grafana/pyroscope-java/blob/82b1daba0dc05b1851e6b96f2d760ab7901[…]0c49/agent/src/main/java/io/pyroscope/javaagent/api/Logger.java](https://github.com/grafana/pyroscope-java/blob/82b1daba0dc05b1851e6b96f2d760ab790120c49/agent/src/main/java/io/pyroscope/javaagent/api/Logger.java#L3)

However, that would require initializing the profiler outside the otel extension, and this is not available when it's running as a javagent.

- Add a flag `PYROSCOPE_LOG_FORMAT` to set the logger format. it could be JSON or LOGFTM to align with rest of Grafana stack.

Guide de contribution

Aucun guide de contribution indexé pour ce dépôt

Piste de recherche

Commencez par agent/src/main/java/io/pyroscope/javaagent/PyroscopeAgent.java et agent/src/main/java/io/pyroscope/javaagent/api/Logger.java, les points d’entrée liés dans l’issue. Suivez la manière dont le logger de l’agent est initialisé et examinez la configuration PYROSCOPE_LOG_LEVEL existante. Le travail est considéré comme terminé lorsque l’agent expose l’option de format de log demandée et produit le format sélectionné pour sa sortie, avec une couverture des formats pris en charge.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
java
Domaine
observability
Type d'issue
Fonctionnalité
Difficulté
3/5
Temps estimé
1-2 jours
Activité
À l'abandon
Clarté
Plutôt claire
Accessibilité débutants
42/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.