DataDog / datadog-for-intellij-platform

Datadog for IntelliJ IDEA
https://docs.datadoghq.com/developers/ide_integrations/idea/
Other
5 stars 0 forks source link

[FEATURE] Kotlin Support #24

Open jasonmcaffee opened 10 months ago

jasonmcaffee commented 10 months ago

Is your feature request related to a problem? Please describe.

I would love to be able to use features like View Logs from our Kotlin projects.

Additional context

We have a lot of Kotlin services and are looking to move our logging to Datadog.

abrooksv commented 10 months ago

We currently do strive to have support for the log links in Kotlin code, but we do have a known bug related to IntelliJ 2023.3 where the links are not showing up and are hoping to have a fix out very soon.

abrooksv commented 10 months ago

Hey @jasonmcaffee, we have uploaded version 1.2.2 to Github with the bug fix. The update is pending JetBrains approval for in-IDE updates but the zip can be installed manually through Settings->Plugins->Gear Icon->Install from disk

Let us know if you have any issues

jasonmcaffee commented 10 months ago

Wow, thanks for such a quick turnaround! Yes, after updating Intellij, I was able to install from disk, then View Logs started showing up in Kotlin!

One issue is that it's incorrectly filtering the logger name.

slf4j code:

private val log = LoggerFactory.getLogger(Redacted::class.java)

If I click on View Logs, the datadog log filter is @logger.name:com.redacted.controller.Redacted, and that yields no results. If I remove ".name", it works as expected.

The event attributes just have logger: com.redacted.controller.Redacted, but not logger.name

bric3 commented 10 months ago

@jasonmcaffee Thanks for the feedback. I'm not exactly sure could this come from

  1. The logs ingestion configuration, maybe they are specific rules that maps the logger name to logger. I don't think the IDE has access to these rules at this time.

  2. The logs implementation is configured to emit the logger name as logger.

Maybe you can share some details ?


EDIT: fixed a typo (wrote "I'm exactly sure" while I meant "I'm not exactly sure")

jfree commented 10 months ago

Let's find a solution to this. The logger.name used in the IDE is based on the documentation here: https://docs.datadoghq.com/logs/log_configuration/attributes_naming_convention/#source-code So the ideal solution would be to amend the tagging on the client system. However, if that is not possible for whatever reason, we should consider adding an override in the IDE settings.