Skip to content

Commit

Permalink
Merge branch 'main' into chore/weekly-report-gen
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinslin authored Sep 19, 2023
2 parents f6a8605 + 12760ab commit 53f77c6
Show file tree
Hide file tree
Showing 30 changed files with 870 additions and 95 deletions.
17 changes: 17 additions & 0 deletions .chloggen/add_multiline_pattern_omit_config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
change_type: enhancement

# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver)
component: pkg/stanza

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: Add 'omit_pattern' setting to `split.Config`.

# One or more tracking issues related to the change
issues: [26381]

# (Optional) One or more lines of additional information to render under the primary note.
# These lines will be padded with 2 spaces and then inserted directly into the document.
# Use pipe (|) for multiline entries.
subtext: |
This can be used omit the start or end pattern from a log entry.
27 changes: 27 additions & 0 deletions .chloggen/awsemf_dropnan.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Use this changelog template to create an entry for release notes.

# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
change_type: bug_fix

# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver)
component: awsemfexporter

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: AWS EMF Exporter will not drop any metrics that contain NaN values to avoid JSON marshal errors.

# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists.
issues: [26267]

# (Optional) One or more lines of additional information to render under the primary note.
# These lines will be padded with 2 spaces and then inserted directly into the document.
# Use pipe (|) for multiline entries.
subtext:

# If your change doesn't affect end users or the exported elements of any package,
# you should instead start your pull request title with [chore] or use the "Skip Changelog" label.
# Optional: The change log or logs in which this entry should be included.
# e.g. '[user]' or '[user, api]'
# Include 'user' if the change is relevant to end users.
# Include 'api' if there is a change to a library API.
# Default: '[user]'
change_logs: [user]
27 changes: 27 additions & 0 deletions .chloggen/use-envmap-awscontainerinsightsreceiver.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Use this changelog template to create an entry for release notes.

# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
change_type: enhancement

# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver)
component: receiver/awscontainerinsightsreceiver

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: Remove the need to set an env var in the receiver to get CPU and memory info

# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists.
issues: [24777]

# (Optional) One or more lines of additional information to render under the primary note.
# These lines will be padded with 2 spaces and then inserted directly into the document.
# Use pipe (|) for multiline entries.
subtext:

# If your change doesn't affect end users or the exported elements of any package,
# you should instead start your pull request title with [chore] or use the "Skip Changelog" label.
# Optional: The change log or logs in which this entry should be included.
# e.g. '[user]' or '[user, api]'
# Include 'user' if the change is relevant to end users.
# Include 'api' if there is a change to a library API.
# Default: '[user]'
change_logs: []
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ examples/demo/ @open-te

exporter/alibabacloudlogserviceexporter/ @open-telemetry/collector-contrib-approvers @shabicheng @kongluoxing @qiansheng91
exporter/awscloudwatchlogsexporter/ @open-telemetry/collector-contrib-approvers @boostchicken @bryan-aguilar @rapphil
exporter/awsemfexporter/ @open-telemetry/collector-contrib-approvers @Aneurysm9 @shaochengwang @mxiamxia
exporter/awsemfexporter/ @open-telemetry/collector-contrib-approvers @Aneurysm9 @shaochengwang @mxiamxia @bryan-aguilar
exporter/awskinesisexporter/ @open-telemetry/collector-contrib-approvers @Aneurysm9 @MovieStoreGuy
exporter/awss3exporter/ @open-telemetry/collector-contrib-approvers @atoulme @pdelewski
exporter/awsxrayexporter/ @open-telemetry/collector-contrib-approvers @wangzlei @srprash
Expand Down
1 change: 0 additions & 1 deletion cmd/checkapi/allowlist.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ exporter/dynatraceexporter
exporter/f5cloudexporter
exporter/kafkaexporter
exporter/kineticaexporter
exporter/loadbalancingexporter
exporter/logzioexporter
exporter/lokiexporter
exporter/pulsarexporter
Expand Down
2 changes: 1 addition & 1 deletion cmd/opampsupervisor/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ require (
github.com/knadh/koanf/providers/rawbytes v0.1.0
github.com/knadh/koanf/v2 v2.0.1
github.com/oklog/ulid/v2 v2.1.0
github.com/open-telemetry/opamp-go v0.6.0
github.com/open-telemetry/opamp-go v0.8.0
go.opentelemetry.io/collector/config/configtls v0.85.0
go.uber.org/zap v1.26.0
)
Expand Down
4 changes: 2 additions & 2 deletions cmd/opampsupervisor/go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion exporter/awsemfexporter/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ and then sends them directly to CloudWatch Logs using the
[PutLogEvents](https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_PutLogEvents.html) API.

## Data Conversion
Convert OpenTelemetry ```Int64DataPoints```, ```DoubleDataPoints```, ```SummaryDataPoints``` metrics datapoints into CloudWatch ```EMF``` structured log formats and send it to CloudWatch. Logs and Metrics will be displayed in CloudWatch console.
Convert OpenTelemetry ```Int64DataPoints```, ```DoubleDataPoints```, ```SummaryDataPoints``` metrics datapoints into
CloudWatch ```EMF``` structured log formats and send it to CloudWatch. Logs and Metrics will be displayed in
CloudWatch console. NaN values are not supported by CloudWatch EMF and will be dropped by the exporter.

## Exporter Configuration

Expand Down
51 changes: 51 additions & 0 deletions exporter/awsemfexporter/datapoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ type dataPoints interface {
// retained: indicates whether the data point is valid for further process
// NOTE: It is an expensive call as it calculates the metric value.
CalculateDeltaDatapoints(i int, instrumentationScopeName string, detailedMetrics bool, calculators *emfCalculators) (dataPoint []dataPoint, retained bool)
// IsStaleOrNaN returns true if metric value has NoRecordedValue flag set or if any metric value contains a NaN.
// When return value is true, IsStaleOrNaN also returns the attributes attached to the metric which can be used for
// logging purposes.
IsStaleOrNaN(i int) (bool, pcommon.Map)
}

// deltaMetricMetadata contains the metadata required to perform rate/delta calculation
Expand Down Expand Up @@ -145,6 +149,17 @@ func (dps numberDataPointSlice) CalculateDeltaDatapoints(i int, instrumentationS
return []dataPoint{{name: dps.metricName, value: metricVal, labels: labels, timestampMs: timestampMs}}, retained
}

func (dps numberDataPointSlice) IsStaleOrNaN(i int) (bool, pcommon.Map) {
metric := dps.NumberDataPointSlice.At(i)
if metric.Flags().NoRecordedValue() {
return true, metric.Attributes()
}
if metric.ValueType() == pmetric.NumberDataPointValueTypeDouble {
return math.IsNaN(metric.DoubleValue()), metric.Attributes()
}
return false, pcommon.Map{}
}

// CalculateDeltaDatapoints retrieves the HistogramDataPoint at the given index.
func (dps histogramDataPointSlice) CalculateDeltaDatapoints(i int, instrumentationScopeName string, _ bool, _ *emfCalculators) ([]dataPoint, bool) {
metric := dps.HistogramDataPointSlice.At(i)
Expand All @@ -164,6 +179,17 @@ func (dps histogramDataPointSlice) CalculateDeltaDatapoints(i int, instrumentati
}}, true
}

func (dps histogramDataPointSlice) IsStaleOrNaN(i int) (bool, pcommon.Map) {
metric := dps.HistogramDataPointSlice.At(i)
if metric.Flags().NoRecordedValue() {
return true, metric.Attributes()
}
if math.IsNaN(metric.Max()) || math.IsNaN(metric.Sum()) || math.IsNaN(metric.Min()) {
return true, metric.Attributes()
}
return false, pcommon.Map{}
}

// CalculateDeltaDatapoints retrieves the ExponentialHistogramDataPoint at the given index.
func (dps exponentialHistogramDataPointSlice) CalculateDeltaDatapoints(idx int, instrumentationScopeName string, _ bool, _ *emfCalculators) ([]dataPoint, bool) {
metric := dps.ExponentialHistogramDataPointSlice.At(idx)
Expand Down Expand Up @@ -246,6 +272,20 @@ func (dps exponentialHistogramDataPointSlice) CalculateDeltaDatapoints(idx int,
}}, true
}

func (dps exponentialHistogramDataPointSlice) IsStaleOrNaN(i int) (bool, pcommon.Map) {
metric := dps.ExponentialHistogramDataPointSlice.At(i)
if metric.Flags().NoRecordedValue() {
return true, metric.Attributes()
}
if math.IsNaN(metric.Max()) ||
math.IsNaN(metric.Min()) ||
math.IsNaN(metric.Sum()) {
return true, metric.Attributes()
}

return false, pcommon.Map{}
}

// CalculateDeltaDatapoints retrieves the SummaryDataPoint at the given index and perform calculation with sum and count while retain the quantile value.
func (dps summaryDataPointSlice) CalculateDeltaDatapoints(i int, instrumentationScopeName string, detailedMetrics bool, calculators *emfCalculators) ([]dataPoint, bool) {
metric := dps.SummaryDataPointSlice.At(i)
Expand Down Expand Up @@ -303,6 +343,17 @@ func (dps summaryDataPointSlice) CalculateDeltaDatapoints(i int, instrumentation
return datapoints, retained
}

func (dps summaryDataPointSlice) IsStaleOrNaN(i int) (bool, pcommon.Map) {
metric := dps.SummaryDataPointSlice.At(i)
if metric.Flags().NoRecordedValue() {
return true, metric.Attributes()
}
if math.IsNaN(metric.Sum()) {
return true, metric.Attributes()
}
return false, metric.Attributes()
}

// createLabels converts OTel AttributesMap attributes to a map
// and optionally adds in the OTel instrumentation library name
func createLabels(attributes pcommon.Map, instrLibName string) map[string]string {
Expand Down
Loading

0 comments on commit 53f77c6

Please sign in to comment.