-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Enhance EMFExporter for Metrics Batching in AWS EMF Logs #2271
Conversation
@anuraaga PTAL - Thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
exporter/awsemfexporter/datapoint.go
Outdated
return | ||
} | ||
|
||
rateKeyParams := map[string]string{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like this should be a struct, not map
} | ||
cWNamespace := getNamespace(rm, config.Namespace) | ||
logGroup, logStream := getLogInfo(rm, cWNamespace, config) | ||
timestampMs := time.Now().UnixNano() / int64(time.Millisecond) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does time.Now() / time.Millisecond
work?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it looks not, time.Now()
returns Time
struct that can't be divided, and it seems timestampMs := time.Now().UnixNano() / int64(time.Millisecond)
is pretty common practice for getting current timestamp in MS. :)
"testing" | ||
"time" | ||
|
||
metricspb "github.com/census-instrumentation/opencensus-proto/gen-go/metrics/v1" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we still using opencensus somewhere?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, we still reply on opencensus
and internaldata.OCToMetrics(oc)
to generate OTel Metrics test data in some of metrics exporter test cases. We'll create a specific PR for the test data migration.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm a bit worried about going 1.0 with this, what if the metrics change drastically? I guess not but we need to confirm this is safe, or migrate soon. We probably were supposed to have been migrated a while ago really.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see. It'll be a problem If no one maintains internaldata.OCToMetrics(oc)
for the new Metrics updates. I see there are a few metrics components are creating test data in this way for unit tests. I can create an issue for it to call out the problem.
Codecov Report
@@ Coverage Diff @@
## main #2271 +/- ##
==========================================
+ Coverage 90.69% 90.72% +0.03%
==========================================
Files 399 400 +1
Lines 19802 19879 +77
==========================================
+ Hits 17959 18036 +77
Misses 1382 1382
Partials 461 461
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
The |
7dfd579
to
9437b09
Compare
Hi @tigrannajaryan @bogdandrutu , Please help to review and merge the changes. Thanks. |
Approved by codeowner, merging. |
We sent a large PR open-telemetry#1891 to support batching the metrics on the same dimensions for AWS EMF Log request to save the customers' billing cost and request throughput. At the same time, there was a fairly large code refactor on EMFExporter. For better code review purpose, I plan to split open-telemetry#1891 to 2 PRs. (This is PR#1) In this PR, We refactored EMFExporter without introducing any new feature. For each OTel metrics data point, we defined `DataPoint` file, it wraps `pdata.DataPointSlice` to the custom structures for each type of metric data point. we also moved the metric data handling functions - data conversion and rate calculation to `datapoint`. It also fixed the metric `timestamp` bug.
* move Descriptor to sdkapi, add test * rename Descriptor to sdkapi * precommit * Move the rest of the sdkapi * use alias for Observation and Measurement * Changelog * pr num * comment Measurement and Observation * swap comments * move->moved
Description:
We sent a large PR #1891 to support batching the metrics on the same dimensions for AWS EMF Log request to save the customers' billing cost and request throughput. At the same time, there was a fairly large code refactor on EMFExporter. For better code review purpose, I plan to split #1891 to 2 PRs. (This is PR#1)
In this PR, We refactored EMFExporter without introducing any new feature. For each OTel metrics data point, we defined
DataPoint
file, it wrapspdata.DataPointSlice
to the custom structures for each type of metric data point. we also moved the metric data handling functions - data conversion and rate calculation todatapoint
.It also fixed the metric
timestamp
bug.