Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

java year-service using honeycomb-opentelemetry-sdk #969

Closed
Tracked by #965
VinozzZ opened this issue Mar 7, 2024 · 0 comments · Fixed by #990
Closed
Tracked by #965

java year-service using honeycomb-opentelemetry-sdk #969

VinozzZ opened this issue Mar 7, 2024 · 0 comments · Fixed by #990
Assignees

Comments

@VinozzZ
Copy link

VinozzZ commented Mar 7, 2024

update java year service to use vanilla otel and add logs

@JamieDanielson JamieDanielson changed the title year-service using honeycomb-opentelemetry-skd java year-service using honeycomb-opentelemetry-sdk Mar 11, 2024
@JamieDanielson JamieDanielson self-assigned this Mar 11, 2024
JamieDanielson added a commit that referenced this issue Mar 28, 2024
## Which problem is this PR solving?

- closes #969 
- close a buncha dependabots

## Short description of the changes

- update all deps in java services
- update java year to use vanilla otel, specifically the java agent
- update java year to use log4j logs
- update `docker-compose.java.yml` to include `OTEL_LOGS_EXPORTER=otlp`

Some findings:
- Using java agent <2.x, set `OTEL_LOGS_EXPORTER=otlp`
- Using java agent >=2.x, exporter is enabled by default
- For more fine-tuning, use `log4j2.xml` or in this specific service
that uses Springboot, use `log4j2-spring.xml`. Some instructions are
[here](https://docs.spring.io/spring-boot/docs/1.2.x-SNAPSHOT/reference/html/howto-logging.html#howto-configure-log4j-for-logging)
and
[here](https://www.baeldung.com/spring-boot-logback-log4j2#log4j2-extensions).
- I tried getting a better JSON-formatted log but it didn't quite look
as I wanted and so I wasn't sure it was worth it to add here (would be
included in above step). I tried both
[JSONLayout](https://logging.apache.org/log4j/2.x/manual/layouts.html#JSONLayout)
(deprecated) and
[JsonTemplateLayout](https://logging.apache.org/log4j/2.x/manual/json-template-layout.html).
- Also for the log itself, the `MapMessage` showed up in Honeycomb as an
empty string `""`, whereas `ObjectMessage` showed `{selected_year=2015}`
which is why I went with it. Maybe that's something to look further
into, as MapMessage seems like it might be a nicer format.

## How to verify this has the expected result

From the root directory run `tilt up java`, or from the java year
service set env vars including `OTEL_LOGS_EXPORTER=otlp` then `./gradlew
build` and `./gradlew bootRun`... and curl the endpoint `curl
localhost:6001/year`.

The log for selected year should show up in Honeycomb on the
`YearService.getYear` span
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants