Skip to content

Commit

Permalink
[chore][connector/sum] graduate sumconnector to alpha (#35985)
Browse files Browse the repository at this point in the history
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
#### Description
- This PR changes stability to `alpha`
- Updates README.md for more clarity and detailed config


<!-- Issue number (e.g. #1234) or full URL to issue, if applicable. -->
#### Link to tracking issue
[#32669]

<!--Describe what testing was performed and which tests were added.-->
#### Testing
No additional testing needed

<!--Describe the documentation added.-->
#### Documentation
Adds clarification of config, additional detail to detailed config, and
notes about when and how to use which telemetry type.

<!--Please delete paragraphs that you did not use before submitting.-->

---------

Co-authored-by: jeremyh <jeremyh@splunk.com>
  • Loading branch information
1 parent 6917453 commit 08b9552
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 13 deletions.
2 changes: 2 additions & 0 deletions cmd/otelcontribcol/builder-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,7 @@ connectors:
- gomod: github.com/open-telemetry/opentelemetry-collector-contrib/connector/routingconnector v0.112.0
- gomod: github.com/open-telemetry/opentelemetry-collector-contrib/connector/servicegraphconnector v0.112.0
- gomod: github.com/open-telemetry/opentelemetry-collector-contrib/connector/spanmetricsconnector v0.112.0
- gomod: github.com/open-telemetry/opentelemetry-collector-contrib/connector/sumconnector v0.112.0

providers:
- gomod: go.opentelemetry.io/collector/confmap/provider/envprovider v1.18.0
Expand Down Expand Up @@ -462,6 +463,7 @@ replaces:
- github.com/open-telemetry/opentelemetry-collector-contrib/connector/routingconnector => ../../connector/routingconnector
- github.com/open-telemetry/opentelemetry-collector-contrib/connector/servicegraphconnector => ../../connector/servicegraphconnector
- github.com/open-telemetry/opentelemetry-collector-contrib/connector/spanmetricsconnector => ../../connector/spanmetricsconnector
- github.com/open-telemetry/opentelemetry-collector-contrib/connector/sumconnector => ../../connector/sumconnector
- github.com/openshift/api v3.9.0+incompatible => github.com/openshift/api v0.0.0-20180801171038-322a19404e37
- github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/azure => ../../pkg/translator/azure
- github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/azurelogs => ../../pkg/translator/azurelogs
Expand Down
30 changes: 21 additions & 9 deletions connector/sumconnector/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@
| Issues | [![Open issues](https://img.shields.io/github/issues-search/open-telemetry/opentelemetry-collector-contrib?query=is%3Aissue%20is%3Aopen%20label%3Aconnector%2Fsum%20&label=open&color=orange&logo=opentelemetry)](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues?q=is%3Aopen+is%3Aissue+label%3Aconnector%2Fsum) [![Closed issues](https://img.shields.io/github/issues-search/open-telemetry/opentelemetry-collector-contrib?query=is%3Aissue%20is%3Aclosed%20label%3Aconnector%2Fsum%20&label=closed&color=blue&logo=opentelemetry)](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues?q=is%3Aclosed+is%3Aissue+label%3Aconnector%2Fsum) |
| [Code Owners](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/CONTRIBUTING.md#becoming-a-code-owner) | [@greatestusername](https://www.github.com/greatestusername), [@shalper2](https://www.github.com/shalper2), [@crobert-1](https://www.github.com/crobert-1) |

[development]: https://github.com/open-telemetry/opentelemetry-collector#development
[alpha]: https://github.com/open-telemetry/opentelemetry-collector#alpha

## Supported Pipeline Types

| [Exporter Pipeline Type] | [Receiver Pipeline Type] | [Stability Level] |
| ------------------------ | ------------------------ | ----------------- |
| traces | metrics | [development] |
| metrics | metrics | [development] |
| logs | metrics | [development] |
| traces | metrics | [alpha] |
| metrics | metrics | [alpha] |
| logs | metrics | [alpha] |

[Exporter Pipeline Type]: https://github.com/open-telemetry/opentelemetry-collector/blob/main/connector/README.md#exporter-pipeline-type
[Receiver Pipeline Type]: https://github.com/open-telemetry/opentelemetry-collector/blob/main/connector/README.md#receiver-pipeline-type
Expand All @@ -29,7 +29,7 @@ If you are not already familiar with connectors, you may find it helpful to firs

### Basic configuration

This configuration will sum numerical values found within the attribute `attribute.with.numerical.value` of any log telemetry routed to the connector. It will then output a metric time series with the name `my.example.metric.name` with those summed values.
This example configuration will sum numerical values found within the attribute `attribute.with.numerical.value` of any span telemetry routed to the connector. It will then output a metric time series with the name `my.example.metric.name` with those summed values.

Note: Values found within an attribute will be converted into a float regardless of their original type before being summed and output as a metric value. Non-convertible strings will be dropped and not included.

Expand All @@ -38,7 +38,7 @@ receivers:
foo:
connectors:
sum:
logs:
spans:
my.example.metric.name:
source_attribute: attribute.with.numerical.value
exporters:
Expand All @@ -49,7 +49,7 @@ service:
metrics/sum:
receivers: [sum]
exporters: [bar]
logs:
traces:
receivers: [foo]
exporters: [sum]
```
Expand All @@ -59,7 +59,9 @@ service:
The sum connector has three required configuration settings and numerous optional settings
- Telemetry type: Nested below the `sum:` connector declaration. Declared as `logs:` in the [Basic Example](#basic-configuration).
- Can be any of `spans`, `spanevents`, `metrics`, `datapoints`, or `logs`.
- Can be any of `spans`, `spanevents`, `datapoints`, or `logs`.
- For metrics use `datapoints`
- For traces use `spans` or `spanevents`
- Metric name: Nested below the telemetry type; this is the metric name the sum connector will output summed values to. Declared as `my.example.metric.name` in the [Basic Example](#basic-configuration)
- `source_attribute`: A specific attribute to search for within the source telemetry being fed to the connector. This attribute is where the connector will look for numerical values to sum into the output metric value. Declared as `attribute.with.numerical.value` in the [Basic Example](#basic-configuration)

Expand All @@ -70,7 +72,7 @@ The sum connector has three required configuration settings and numerous optiona
- `key`: (required for `attributes`) the attribute name to match against
- `default_value`: (optional for `attributes`) a default value for the attribute when no matches are found. The `default_value` value can be of type string, integer, or float.

#### Detailed Example Configuration
### Detailed Example Configuration

This example declares that the `sum` connector is going to be ingesting `logs` and creating an output metric named `checkout.total` with numerical values found in the `source_attribute` `total.payment`.

Expand Down Expand Up @@ -102,4 +104,14 @@ service:
exporters: [sum]
```

**Note for Log to Metrics:** If your logs contain all values in their `body` rather than in attributes (E.G. JSON payload) use a transform processor in your pipeline to upsert [parsed key/value pairs](https://github.com/open-telemetry/opentelemetry-log-collection/tree/main/docs/operators) (in this case from JSON) into attributes attached to the log.
```yaml
processors:
transform/logs:
log_statements:
- context: log
statements:
- merge_maps(attributes, ParseJSON(body), "upsert")
```

[Connectors README]: https://github.com/open-telemetry/opentelemetry-collector/blob/main/connector/README.md
6 changes: 3 additions & 3 deletions connector/sumconnector/internal/metadata/generated_status.go

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

2 changes: 1 addition & 1 deletion connector/sumconnector/metadata.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ type: sum
status:
class: connector
stability:
development: [traces_to_metrics, metrics_to_metrics, logs_to_metrics]
alpha: [traces_to_metrics, metrics_to_metrics, logs_to_metrics]
distributions: []
codeowners:
active: [greatestusername, shalper2, crobert-1]
Expand Down

0 comments on commit 08b9552

Please sign in to comment.