awslabs / awslabs/aws-embedded-metrics-node

Support for default dimensions

Open
#147 1 comment 0 reactions 1 assignee Claimed by @markkuhn View on GitHub
question
Dominant language
TypeScript
Stars
263
Forks
39
PR merge metrics
No merged PRs in 30d

Description

Hi, sorry in advance if this is already something supported by the library and I couldn't find it.

## What?

I'm trying to override the default dimensions to remove things that aren't useful to me, such as LogGroup and ServiceType.

I can't find a way to actually do this. I see from the Configuration in the README that I can set [namespace](https://github.com/awslabs/aws-embedded-metrics-node/blob/master/README.md?plain=1#L379-L395) which is also useful, but not enough.

I thought there'd be a similar way to handle Dimensions, but there aren't. Ideally, I'd like to be able to create a single MetricsLogger in my application and wire it in as needed. That logger should always have the dimensions I want as baseline, and some methods might add more.

I recognize that this wouldn't work for an environment variable configuration, but how about something like:

```js
const { Configuration } = require("aws-embedded-metrics");

Configuration.dimensions = [{
version: 'N+1' // Latest Lambda Version specific
},
{} // Whole fleet metrics
];
```

This would allow me to alarm on both the "latest" Lambda version specific metrics, and the fleet as a whole as I'd be emitting metrics for both at the same rate. This is especially useful during deployments as I want to see how the newest version is doing.

An alternative would be to open up the [constructor of the MetricsLogger](https://github.com/awslabs/aws-embedded-metrics-node/blob/master/src/logger/MetricsLogger.ts#L33-L37). I see that it is technically public today, but we don't have access to the EnvironmentProvider (again, as far as I am able to tell).

Let me know what you think, and if there's already a way to do this I apologize in advance.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.