OTLP Log Parser (Go) - Dash0

I chose to keep the provided scaffolding, and add the logic for counting the attributes in a separate type.

Running

$ go mod tidy
# run the sampler for 10s at a time, looking at the "foo" attributes
# -quiet removes the output of all OTel resources
$ go run ./ -duration 10s -attribute foo -quiet true

Requirements

The goal of this assignment is to build a simple backend application that receives log records on a gRPC endpoint and processes them. Based on a configurable attribute key and duration, the application has to keep counts of the number of unique log records per distinct attribute value.

And within each window (configurable duration) print / log these delta counts to stdout. Note that the configurable attribute may appear either on Resource, Scope or Log level.

Pseudo example:

  • "my log body 1" - {"foo":"bar", "baz":"qux"}
  • "my log body 2" - {"foo":"qux", "baz":"qux"}
  • "my log body 3" - {"baz":"qux"}
  • "my log body 4" - {"foo":"baz"}
  • "my log body 5" - {"foo":"baz", "baz":"qux"}

For example for configured attribute key "foo" it should report:

  • "bar" - 1
  • "qux" - 1
  • "baz" - 2
  • unknown - 1

Your solution should take into account high throughput, both in number of messages and the number of records per message.

Feel free to use the existing scaffoling in this folder, for example by fleshing out the implementation of the Export method in logs_service.go. Of course, you can also change anything else as you see fit.