Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/shuttle-hq/athenametricsencodingextension

An extension to OpenTelemetry Collector for writing metrics in flat JSON format
https://github.com/shuttle-hq/athenametricsencodingextension

open-telemetry opentelemetry

Last synced: about 20 hours ago
JSON representation

An extension to OpenTelemetry Collector for writing metrics in flat JSON format

Awesome Lists containing this project

README

        

# Athena metrics JSON encoding extension

| Status | |
| ------------- |-----------|
| Stability | [alpha] |
| Distributions | [] |
| Issues | [![Open issues](https://img.shields.io/github/issues-search/open-telemetry/opentelemetry-collector-contrib?query=is%3Aissue%20is%3Aopen%20label%3Aextension%2Fathenametricsencoding%20&label=open&color=orange&logo=opentelemetry)](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues?q=is%3Aopen+is%3Aissue+label%3Aextension%2Fathenametricsencoding) [![Closed issues](https://img.shields.io/github/issues-search/open-telemetry/opentelemetry-collector-contrib?query=is%3Aissue%20is%3Aclosed%20label%3Aextension%2Fathenametricsencoding%20&label=closed&color=blue&logo=opentelemetry)](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues?q=is%3Aclosed+is%3Aissue+label%3Aextension%2Fathenametricsencoding) |
| [Code Owners](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/CONTRIBUTING.md#becoming-a-code-owner) | [@sergei-ivanov](https://www.github.com/sergei-ivanov) |

[alpha]: https://github.com/open-telemetry/opentelemetry-collector/blob/main/docs/component-stability.md#alpha

The `athena_metrics_encoding` extension is an encoding extension that can marshal metrics.

The extension requires no configuration.

When marshaling the metrics, the extension will output JSON lines (one line per resource metric),
separated by a Unix new line (`\n`). Each JSON line will be a flat map of key-value pairs,
where the keys are the names of either attributes or scope metrics, and the values are
their respective values.

For example:
```json lines
{"aws.ecs.cluster.name":"production-user-cluster-fargate-1","aws.ecs.task.id":"4b8146f69b564bebadf89b47b904325b","ecs.task.cpu.utilized":9.833394491064633,"ecs.task.memory.utilized":22,"timestamp":1734959017836}
{"aws.ecs.cluster.name":"production-user-cluster-fargate-1","aws.ecs.task.id":"fa83a50c8a2b29b15492f1667e194b74","ecs.task.cpu.utilized":207.4615648942136,"ecs.task.memory.utilized":87,"timestamp":1734959017836}
```

When exported to S3 using [S3 exporter][1], the resulting files can be easily ingested by Athena and Glue ETL jobs.

Here is the default configuration:
```yaml
extensions:
athena_metrics_encoding:
```

[1]: https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/exporter/awss3exporter