Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .chloggen/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ components:
- connector/roundrobin
- connector/routing
- connector/servicegraph
- connector/signaltometrics
- connector/signal_to_metrics
- connector/slowsql
- connector/spanmetrics
- connector/sum
Expand Down
27 changes: 27 additions & 0 deletions .chloggen/rename-signal-to-metrics.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: deprecation

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

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: Rename `signaltometrics` connector to `signal_to_metrics` and add deprecated alias `signal_to_metrics`

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

# (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: []
18 changes: 9 additions & 9 deletions connector/signaltometricsconnector/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Signal to metrics connector produces metrics from all signal types (traces, logs
| ------------- |-----------|
| Distributions | [contrib] |
| Issues | [![Open issues](https://img.shields.io/github/issues-search/open-telemetry/opentelemetry-collector-contrib?query=is%3Aissue%20is%3Aopen%20label%3Aconnector%2Fsignaltometrics%20&label=open&color=orange&logo=opentelemetry)](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues?q=is%3Aopen+is%3Aissue+label%3Aconnector%2Fsignaltometrics) [![Closed issues](https://img.shields.io/github/issues-search/open-telemetry/opentelemetry-collector-contrib?query=is%3Aissue%20is%3Aclosed%20label%3Aconnector%2Fsignaltometrics%20&label=closed&color=blue&logo=opentelemetry)](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues?q=is%3Aclosed+is%3Aissue+label%3Aconnector%2Fsignaltometrics) |
| Code coverage | [![codecov](https://codecov.io/github/open-telemetry/opentelemetry-collector-contrib/graph/main/badge.svg?component=connector_signaltometrics)](https://app.codecov.io/gh/open-telemetry/opentelemetry-collector-contrib/tree/main/?components%5B0%5D=connector_signaltometrics&displayType=list) |
| Code coverage | [![codecov](https://codecov.io/github/open-telemetry/opentelemetry-collector-contrib/graph/main/badge.svg?component=connector_signal_to_metrics)](https://app.codecov.io/gh/open-telemetry/opentelemetry-collector-contrib/tree/main/?components%5B0%5D=connector_signal_to_metrics&displayType=list) |
| [Code Owners](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/CONTRIBUTING.md#becoming-a-code-owner) | [@ChrsMark](https://www.github.com/ChrsMark), [@lahsivjar](https://www.github.com/lahsivjar) |

[alpha]: https://github.com/open-telemetry/opentelemetry-collector/blob/main/docs/component-stability.md#alpha
Expand Down Expand Up @@ -38,7 +38,7 @@ structure. For example, the below configuration will produce delta temporality c
for counting number of events for each of the configured signals:

```yaml
signaltometrics:
signal_to_metrics:
spans:
- name: span.count
description: Count of spans
Expand All @@ -63,7 +63,7 @@ signaltometrics:

### Metrics types

`signaltometrics` produces a variety of metric types by utilizing [OTTL](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/pkg/ottl/README.md)
`signal_to_metrics` produces a variety of metric types by utilizing [OTTL](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/pkg/ottl/README.md)
to extract the relevant data for a metric type from the incoming data. The
component can produce the following metric types for each signal type:

Expand Down Expand Up @@ -110,7 +110,7 @@ gauge:

_Logs (with Grok pattern):_
```yaml
signaltometrics:
signal_to_metrics:
logs:
- name: logs.memory_mb
description: Extract memory_mb from log records
Expand All @@ -120,7 +120,7 @@ signaltometrics:

_Traces:_
```yaml
signaltometrics:
signal_to_metrics:
spans:
- name: span.duration.gauge
description: Span duration as gauge
Expand Down Expand Up @@ -229,7 +229,7 @@ Conditions are an optional list of OTTL conditions that are evaluated on the inc
data and are ORed together. For example:

```yaml
signaltometrics:
signal_to_metrics:
datapoints:
- name: datapoint.bar.sum
description: Count total number of datapoints as per datapoint.bar attribute
Expand All @@ -246,7 +246,7 @@ OR `bar` resource attribute defined.
Conditions can also be ANDed together, for example:

```yaml
signaltometrics:
signal_to_metrics:
datapoints:
- name: gauge.to.exphistogram
conditions:
Expand Down Expand Up @@ -292,14 +292,14 @@ resource attributes:
### Single writer

Metrics data streams MUST obey [single-writer](https://opentelemetry.io/docs/specs/otel/metrics/data-model/#single-writer)
principle. However, since `signaltometrics` component produces metrics from all signal
principle. However, since `signal_to_metrics` component produces metrics from all signal
types and also allows customizing the resource attributes, there is a possibility
of violating the single-writer principle. To keep the single-writer principle intact,
the component adds collector instance information as resource attributes. The following
resource attribute is added to each produced metric:

```yaml
signaltometrics.service.instance.id: <service_instance_id_of_the_otel_collector>
signal_to_metrics.service.instance.id: <service_instance_id_of_the_otel_collector>
```

### Custom OTTL functions
Expand Down
2 changes: 1 addition & 1 deletion connector/signaltometricsconnector/connector_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ func telemetryResource(t *testing.T) pcommon.Resource {

r := pcommon.NewResource()
r.Attributes().PutStr("service.instance.id", "627cc493-f310-47de-96bd-71410b7dec09")
r.Attributes().PutStr("service.name", "signaltometrics")
r.Attributes().PutStr("service.name", "signal_to_metrics")
r.Attributes().PutStr("service.namespace", "test")
return r
}
Expand Down
1 change: 1 addition & 0 deletions connector/signaltometricsconnector/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ func NewFactory() connector.Factory {
xconnector.WithMetricsToMetrics(createMetricsToMetrics, metadata.MetricsToMetricsStability),
xconnector.WithLogsToMetrics(createLogsToMetrics, metadata.LogsToMetricsStability),
xconnector.WithProfilesToMetrics(createProfilesToMetrics, metadata.ProfilesToMetricsStability),
xconnector.WithDeprecatedTypeAlias(component.MustNewType("signaltometrics")),
)
}

Expand Down

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

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

Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ func TestCollectorInstanceInfo(t *testing.T) {
expected: func() pcommon.Map {
m := pcommon.NewMap()
m.PutStr(
"signaltometrics."+"service.instance.id",
"signal_to_metrics."+"service.instance.id",
"627cc493-f310-47de-96bd-71410b7dec09",
)
return m
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func TestFilterResourceAttributes(t *testing.T) {
"key.3": int64(11),
"key.4": "val.4",
// Collector instance info will be added
"signaltometrics.service.instance.id": testServiceInstanceID,
"signal_to_metrics.service.instance.id": testServiceInstanceID,
},
},
{
Expand Down Expand Up @@ -74,7 +74,7 @@ func TestFilterResourceAttributes(t *testing.T) {
// Resource attributes with default values are added
"key.302": "anything",
// Collector instance info will be added
"signaltometrics.service.instance.id": testServiceInstanceID,
"signal_to_metrics.service.instance.id": testServiceInstanceID,
},
},
} {
Expand Down
10 changes: 8 additions & 2 deletions connector/signaltometricsconnector/metadata.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
type: signaltometrics
type: signal_to_metrics
display_name: Signal to Metrics Connector
description: Signal to metrics connector produces metrics from all signal types (traces, logs, or metrics).

status:
class: connector
stability:
alpha: [traces_to_metrics, logs_to_metrics, metrics_to_metrics, profiles_to_metrics]
alpha:
[
traces_to_metrics,
logs_to_metrics,
metrics_to_metrics,
profiles_to_metrics,
]
distributions: [contrib]
codeowners:
active: [ChrsMark, lahsivjar]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
signaltometrics:
signal_to_metrics:
spans:
- name: span.sum
attributes:
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
signaltometrics: {}
signal_to_metrics: {}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
signaltometrics:
signal_to_metrics:
spans:
- name: span.sum
attributes:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
signaltometrics:
signal_to_metrics:
logs:
- name: logs.memory_mb
description: Extract memory_mb from log records
description: Extract memory_mb from log records
gauge:
value: ExtractGrokPatterns(body, "Memory usage %{NUMBER:memory_mb:int}MB")
value: ExtractGrokPatterns(body, "Memory usage %{NUMBER:memory_mb:int}MB")

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
signaltometrics:
signal_to_metrics:
spans:
- name: span.sum
attributes:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
signaltometrics:
signal_to_metrics:
spans:
- name: span.sum
attributes:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
signaltometrics:
signal_to_metrics:
spans:
- name: span.sum
attributes:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
signaltometrics:
signal_to_metrics:
spans:
- name: span.sum
attributes:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
signaltometrics:
signal_to_metrics:
spans:
- name: span.sum
attributes:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
signaltometrics:
signal_to_metrics:
spans:
- name: span.sum
attributes:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
signaltometrics:
signal_to_metrics:
spans:
- name: span.exp_histogram
description: Exponential histogram
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
signaltometrics:
signal_to_metrics:
spans:
- name: span.sum
attributes:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
signaltometrics:
signal_to_metrics:
spans:
- sum:
value: "1"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
signaltometrics:
signal_to_metrics:
logs:
- name: total.logrecords.exphistogram
description: Logrecords as exponential histogram with log.duration from attributes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ resourceMetrics:
- key: resource.foo
value:
stringValue: foo
- key: signaltometrics.service.instance.id
- key: signal_to_metrics.service.instance.id
value:
stringValue: 627cc493-f310-47de-96bd-71410b7dec09
scopeMetrics:
Expand Down Expand Up @@ -330,7 +330,7 @@ resourceMetrics:
- key: resource.foo
value:
stringValue: foo
- key: signaltometrics.service.instance.id
- key: signal_to_metrics.service.instance.id
value:
stringValue: 627cc493-f310-47de-96bd-71410b7dec09
scopeMetrics:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
signaltometrics:
signal_to_metrics:
logs:
- name: logs.memory_mb
description: Extract memory_mb from log records
description: Extract memory_mb from log records
gauge:
value: ExtractGrokPatterns(body, "Memory usage %{NUMBER:memory_mb:int}MB")["memory_mb"]
- name: logs.cpu
description: Extract cpu from log records
description: Extract cpu from log records
gauge:
value: ExtractGrokPatterns(body, "CPU usage %{NUMBER:cpu:float}")["cpu"]
- name: logs.foo.memory_mb
Expand Down Expand Up @@ -34,4 +34,5 @@ signaltometrics:
attributes:
- key: log.bar
gauge:
value: ExtractGrokPatterns(body, "Memory usage %{NUMBER:memory_mb:int}MB")["memory_mb"]
value: ExtractGrokPatterns(body, "Memory usage %{NUMBER:memory_mb:int}MB")["memory_mb"]

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
resourceMetrics:
resourceMetrics:
- resource:
attributes:
- key: resource.foo
Expand All @@ -7,25 +7,25 @@ resourceMetrics:
- key: resource.bar
value:
stringValue: bar
- key: signaltometrics.service.instance.id
- key: signal_to_metrics.service.instance.id
value:
stringValue: 627cc493-f310-47de-96bd-71410b7dec09
scopeMetrics:
- metrics:
- description: Extract memory_mb from log records
name: logs.memory_mb
gauge:
dataPoints:
- asInt: 22
dataPoints:
- asInt: 22
- description: Extract cpu from log records
name: logs.cpu
gauge:
dataPoints:
dataPoints:
- asDouble: 0.55
- description: Extract memory_mb from log records with attribute bar and conditions
name: logs.bar.memory_mb
gauge:
dataPoints:
dataPoints:
- asDouble: 340.0
attributes:
- key: log.bar
Expand All @@ -45,20 +45,20 @@ resourceMetrics:
- key: resource.foo
value:
stringValue: foo
- key: signaltometrics.service.instance.id
- key: signal_to_metrics.service.instance.id
value:
stringValue: 627cc493-f310-47de-96bd-71410b7dec09
scopeMetrics:
- metrics:
- description: Extract memory_mb from log records with attribute foo
name: logs.foo.memory_mb
gauge:
dataPoints:
dataPoints:
- asInt: 600
attributes:
- key: log.foo
value:
stringValue: foo
stringValue: foo
- asInt: 612
attributes:
- key: log.foo
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
signaltometrics:
signal_to_metrics:
logs:
- name: total.logrecords.histogram
description: Logrecords as histogram with log.duration from attributes
Expand Down
Loading