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

Allow Heroku logs containing dyno metrics to be transformed into useable attributes #35804

Open
jdeff opened this issue Oct 15, 2024 · 4 comments
Labels
enhancement New feature or request needs triage New item requiring triage pkg/ottl processor/transform Transform processor

Comments

@jdeff
Copy link

jdeff commented Oct 15, 2024

Component(s)

OTTL

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

Heroku emits log lines containing metrics data for the various dyno instances running for an application. These log lines look similar to:

source=web.1 dyno=heroku.1234-5678-9012-3456 sample#memory_total=10917.88MB sample#memory_rss=10849.69MB sample#memory_cache=68.20MB sample#memory_swap=0.00MB sample#memory_pgpgin=3384pages sample#memory_pgpgout=82pages sample#memory_quota=14336.00MB

Using the syslog_receiver and key_value_parser you can get something almost useable. However, the values are still strings of human readable byte sizes (e.g. "68.20MB") and need to converted to an integer number of bytes in order for them to be useable.

Describe the solution you'd like

I would like to be able to parse these byte size values using the transformprocessor, which I am already using to shape other values, and convert them to an integer value of bytes. I propose adding a ParseBytes function to OTTL in the same vain as ParseJson and ParseCsv. This could be used with the following config:

processors:
    transform:
      log_statements:
        - context: log
          statements:
            - replace_all_patterns(attributes, "key", "sample#memory-total", "system.memory.usage.used")
            - set(attributes["system.memory.usage.used"], ParseBytes(attributes["system.memory.usage.used"])) where attributes["system.memory.usage.used"] != nil

Describe alternatives you've considered

I've looked at simply striping the units from these values, but the units are not guaranteed to be the same.

ParseBytes may be an ambiguous or confusing name (though it is what is used by go-humanize). Something like ParsePrettyByteSize or ParseHumanizedByteString might be clearer.

Additional context

No response

@jdeff jdeff added enhancement New feature or request needs triage New item requiring triage labels Oct 15, 2024
@jdeff
Copy link
Author

jdeff commented Oct 15, 2024

cc @TylerHelmuth

@atoulme atoulme added processor/transform Transform processor pkg/ottl labels Oct 16, 2024
Copy link
Contributor

Pinging code owners for processor/transform: @TylerHelmuth @kentquirk @bogdandrutu @evan-bradley. See Adding Labels via Comments if you do not have permissions to add labels yourself.

Copy link
Contributor

Pinging code owners for pkg/ottl: @TylerHelmuth @kentquirk @bogdandrutu @evan-bradley. See Adding Labels via Comments if you do not have permissions to add labels yourself.

@atoulme
Copy link
Contributor

atoulme commented Oct 16, 2024

Do you want those logs to be transformed into metric data?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request needs triage New item requiring triage pkg/ottl processor/transform Transform processor
Projects
None yet
Development

No branches or pull requests

2 participants