{"id":16027744,"url":"https://github.com/followtheprocess/metrics","last_synced_at":"2025-09-15T14:13:50.008Z","repository":{"id":205446388,"uuid":"714256143","full_name":"FollowTheProcess/metrics","owner":"FollowTheProcess","description":"Go library for publishing AWS CloudWatch Embedded Metrics Format (EMF) logs","archived":false,"fork":false,"pushed_at":"2025-09-10T21:08:32.000Z","size":94,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-09-10T23:36:14.268Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/FollowTheProcess.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2023-11-04T11:28:52.000Z","updated_at":"2025-09-10T21:08:35.000Z","dependencies_parsed_at":null,"dependency_job_id":"ed065910-6d2f-4667-830d-832e4f469827","html_url":"https://github.com/FollowTheProcess/metrics","commit_stats":{"total_commits":36,"total_committers":3,"mean_commits":12.0,"dds":0.5833333333333333,"last_synced_commit":"2bad1ace902263b912838094a592eedeea91d239"},"previous_names":["followtheprocess/emf","followtheprocess/metrics"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/FollowTheProcess/metrics","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FollowTheProcess%2Fmetrics","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FollowTheProcess%2Fmetrics/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FollowTheProcess%2Fmetrics/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FollowTheProcess%2Fmetrics/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/FollowTheProcess","download_url":"https://codeload.github.com/FollowTheProcess/metrics/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FollowTheProcess%2Fmetrics/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":275267461,"owners_count":25434632,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-15T02:00:09.272Z","response_time":75,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-08T20:23:20.368Z","updated_at":"2025-09-15T14:13:49.967Z","avatar_url":"https://github.com/FollowTheProcess.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Metrics\n\n[![License](https://img.shields.io/github/license/FollowTheProcess/metrics)](https://github.com/FollowTheProcess/metrics)\n[![Go Reference](https://pkg.go.dev/badge/github.com/FollowTheProcess/metrics.svg)](https://pkg.go.dev/github.com/FollowTheProcess/metrics)\n[![Go Report Card](https://goreportcard.com/badge/github.com/FollowTheProcess/metrics)](https://goreportcard.com/report/github.com/FollowTheProcess/metrics)\n[![GitHub](https://img.shields.io/github/v/release/FollowTheProcess/metrics?logo=github\u0026sort=semver)](https://github.com/FollowTheProcess/metrics)\n[![CI](https://github.com/FollowTheProcess/metrics/workflows/CI/badge.svg)](https://github.com/FollowTheProcess/metrics/actions?query=workflow%3ACI)\n[![codecov](https://codecov.io/gh/FollowTheProcess/metrics/branch/main/graph/badge.svg)](https://codecov.io/gh/FollowTheProcess/metrics)\n\nGo library for publishing AWS CloudWatch Embedded Metrics Format (EMF) logs 📈\n\n## Project Description\n\nAWS CloudWatch allows publishing of metrics using a special format known as [Embedded Metrics Format] (EMF), which involves printing specially formatted JSON messages to stdout\nfrom inside a Lambda function. CloudWatch then scans for these messages in the logs, parses them and publishes the metrics behind the scenes.\n\nThe primary advantage being this can be done without having to make a HTTP call to the CloudWatch API through AWS client libraries, which means it's much faster and your metrics\ncan be gathered up asynchronously by CloudWatch in the background.\n\n### EMF JSON\n\nAn EMF JSON blob looks like this:\n\n```json\n{\n  \"_aws\": {\n    \"Timestamp\": 1574109732004,\n    \"CloudWatchMetrics\": [\n      {\n        \"Namespace\": \"lambda-function-metrics\",\n        \"Dimensions\": [[\"functionVersion\"]],\n        \"Metrics\": [\n          {\n            \"Name\": \"time\",\n            \"Unit\": \"Milliseconds\",\n            \"StorageResolution\": 60\n          }\n        ]\n      }\n    ]\n  },\n  \"functionVersion\": \"$LATEST\",\n  \"time\": 100,\n  \"requestId\": \"989ffbf8-9ace-4817-a57c-e4dd734019ee\"\n}\n```\n\n## Installation\n\n```shell\ngo get go.followtheprocess.codes/metrics@latest\n```\n\n## Quickstart\n\nThe library exposes a `Logger` type that accumulates metrics during your application and can be flushed to stdout on command, although typical usage will `defer` the call\nto `Flush`:\n\n```go\nimport (\n    \"go.followtheprocess.codes/metrics\"\n    \"go.followtheprocess.codes/metrics/unit\"\n)\n// Assuming you're inside a lambda handler\n\n// Get a new Logger\nm := metrics.New()\n\n// Something happened 10 times!\nm.Count(\"something\", 10, metrics.StandardResolution)\n\n// Add new dimensions\nm.Dimension(\"MyDimension\", \"value\")\n\n// Generic metrics, and configurable resolution\nm.Add(\"Foo\", 27, unit.Percent, metrics.HighResolution)\n\n// Set namespaces\nm.Namespace(\"MyNameSpace\").Add(\"Foo\", 27, unit.Percent, metrics.StandardResolution)\n\n// Just before you return, flush the Logger so CloudWatch can scan your metrics\ndefer m.Flush()\n\n// Beware, `Flush()` returns an error which you should handle...\ndefer func() {\n    err = m.Flush()\n}()\n```\n\n### Credits\n\nThis package was created with [copier] and the [FollowTheProcess/go_copier] project template.\n\n[copier]: https://copier.readthedocs.io/en/stable/\n[FollowTheProcess/go_copier]: https://github.com/FollowTheProcess/go_copier\n[Embedded Metrics Format]: https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch_Embedded_Metric_Format_Specification.html\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffollowtheprocess%2Fmetrics","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffollowtheprocess%2Fmetrics","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffollowtheprocess%2Fmetrics/lists"}