Skip to content
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

New component: Signal to metrics connector #35930

Open
lahsivjar opened this issue Oct 22, 2024 · 6 comments
Open

New component: Signal to metrics connector #35930

lahsivjar opened this issue Oct 22, 2024 · 6 comments
Assignees
Labels
Accepted Component New component has been sponsored

Comments

@lahsivjar
Copy link
Member

lahsivjar commented Oct 22, 2024

The purpose and use-cases of the new component

Signal to metrics connector can produce metrics from all signal types (logs, metrics, and traces).

The currently available connectors like countconnector, spanmetricsconnector, sumconnector can perform specific tasks and become a bit hard to use with evolving use-cases. Signal to metrics connector will utilize OTTL expressions to make data manipulation from the incoming signals configurable, thus allowing the component to serve a wider range of use-cases.

The OTTL expressions can be configured depending on the metric types. For example: for histograms and exponential histograms, count and value could be retrieved based on separate OTTL expressions whereas, for sum metric the value could be retrieved from a single value OTTL expression.

Example configuration for the component

Generic configuration

signaltometrics:
  spans:
    - name: span.duration
      description: Span duration as exponential histogram
      unit: us
      attributes: # categorize by attributes
        - key: attribute.foo
      exponential_histogram:
        count: Int(AdjustedCount()) # Adjusted count here is calculated as a custom OTTL converter
        value: Microseconds(end_time - start_time)
  datapoints:
    - name: datapoint.count
      description: Sum all the attribute value on the datapoint with name datapoint.foo
      conditions:
        - IsDouble(attributes["datapoint.foo"]) or IsInt(attributes["datapoint.foo"]) # only evaluate if datapoint.foo is a number
      sum:
        value: Double(attributes["datapoint.foo"])
  logs:
    - name: logrecord.count
      description: Count of log records
      sum:
        value: "1" # increment by 1 for each log record

Count connector use-cases

signaltometrics:
  spans:
    - name: trace.span.count
      description: Counts all spans
      sum:
        value: "1" # count each span as 1
  datapoints:
    - name: metric.datapoint.count
      description: Count of datapoints
      sum:
        value: "1" # count each datapoint as 1
  logs:
    - name: log.record.count
      description: Count of log records
      sum:
        value: "1" # count each log record as 1

Sum connector use-cases

signaltometrics:
  logs:
    - name: my.example.metric.name
      description: Sum of all attribute values with key attribute.with.numerical.value
      sum:
        value: Double(attributes["attribute.with.numerical.value"])

Span metrics connector use-cases

signaltometrics:
  spans:
    - name: calls
      description: Counts all spans
      attributes:
        - key: span.name
        - key: span.kind
        - key: status.code
      sum:
        value: "1" # count each span as 1
    - name: duration
      description: Counts all spans
      attributes:
        - key: span.name
        - key: span.kind
        - key: status.code
      unit: us
      exponential_histogram:
        value: Microseconds(end_time - start_time)

Convert a gauge metric to a histogram

signaltometrics:
  datapoints:
    - name: gauge.to.exphistogram
      description: An exponential histogram created from gague values
      include_resource_attributes:
        - key: resource.foo
      attributes:
        - key: datapoint.foo
      conditions:
        - metric.type == 1 # select all gauges
      exponential_histogram:
        count: "1" # 1 count for each datapoint
        value: Double(value_int) + value_double # handle both int and double

Telemetry data types supported

traces, metrics, and logs

Is this a vendor-specific component?

NO

Code Owner(s)

@lahsivjar

Sponsor (optional)

@ChrsMark

Additional context

We, at Elastic, have a working version of this component with a lot of the features for spans, datapoints, and, logrecords already developed and we would like to contribute the component upstream as we believe it could be useful to the community.

@djaglowski
Copy link
Member

I think this is a great idea. Am I correct in understanding that it depends on #35621?

@lahsivjar
Copy link
Member Author

lahsivjar commented Nov 14, 2024

Am I correct in understanding that it depends on #35621?

Partially. In our current implementation, we have circumvented this by an internal get editor function which we use to create OTTL statement from data expressions - so not exactly a blocker.

@ChrsMark
Copy link
Member

I'm willing to sponsor this.

@ChrsMark ChrsMark added Accepted Component New component has been sponsored and removed Sponsor Needed New component seeking sponsor labels Nov 20, 2024
andrzej-stencel pushed a commit that referenced this issue Nov 25, 2024
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
#### Description

Adds boilerplate code for a new signal to metrics connector.

<!-- Issue number (e.g. #1234) or full URL to issue, if applicable. -->
#### Link to tracking issue
Part of
#35930

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

Unit tests provided as required.

<!--Describe the documentation added.-->
#### Documentation

Added basic README. Will add more details with future commits.
<!--Please delete paragraphs that you did not use before submitting.-->


CC: @ChrsMark

---------

Co-authored-by: Christos Markou <[email protected]>
shivanthzen pushed a commit to shivanthzen/opentelemetry-collector-contrib that referenced this issue Dec 5, 2024
…elemetry#36454)

<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
#### Description

Adds boilerplate code for a new signal to metrics connector.

<!-- Issue number (e.g. open-telemetry#1234) or full URL to issue, if applicable. -->
#### Link to tracking issue
Part of
open-telemetry#35930

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

Unit tests provided as required.

<!--Describe the documentation added.-->
#### Documentation

Added basic README. Will add more details with future commits.
<!--Please delete paragraphs that you did not use before submitting.-->


CC: @ChrsMark

---------

Co-authored-by: Christos Markou <[email protected]>
ZenoCC-Peng pushed a commit to ZenoCC-Peng/opentelemetry-collector-contrib that referenced this issue Dec 6, 2024
…elemetry#36454)

<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
#### Description

Adds boilerplate code for a new signal to metrics connector.

<!-- Issue number (e.g. open-telemetry#1234) or full URL to issue, if applicable. -->
#### Link to tracking issue
Part of
open-telemetry#35930

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

Unit tests provided as required.

<!--Describe the documentation added.-->
#### Documentation

Added basic README. Will add more details with future commits.
<!--Please delete paragraphs that you did not use before submitting.-->


CC: @ChrsMark

---------

Co-authored-by: Christos Markou <[email protected]>
@jluncc
Copy link

jluncc commented Dec 13, 2024

hi, can it use log convert to gauge? if not, is there any way to do that ?

@lahsivjar
Copy link
Member Author

hi, can it use log convert to gauge? if not, is there any way to do that ?

👋 @jluncc , The component will be able to produce counters or histograms using log records, some examples are available here. Can you elaborate on your exact usage scenario?

@jluncc
Copy link

jluncc commented Dec 13, 2024

hi, can it use log convert to gauge? if not, is there any way to do that ?

👋 @jluncc , The component will be able to produce counters or histograms using log records, some examples are available here. Can you elaborate on your exact usage scenario?

@lahsivjar thanks your reply

i have another issue here show more detail: #36710

andrzej-stencel pushed a commit that referenced this issue Dec 16, 2024
#36671)

<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
#### Description

Adds config validation logic and custom OTTL functions required for
signal to metrics connector.

<!-- Issue number (e.g. #1234) or full URL to issue, if applicable. -->
#### Link to tracking issue
Related to:
#35930

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

<!--Describe the documentation added.-->
#### Documentation
N/A
<!--Please delete paragraphs that you did not use before submitting.-->

---------

Co-authored-by: Christos Markou <[email protected]>
sbylica-splunk pushed a commit to sbylica-splunk/opentelemetry-collector-contrib that referenced this issue Dec 17, 2024
…elemetry#36454)

<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
#### Description

Adds boilerplate code for a new signal to metrics connector.

<!-- Issue number (e.g. open-telemetry#1234) or full URL to issue, if applicable. -->
#### Link to tracking issue
Part of
open-telemetry#35930

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

Unit tests provided as required.

<!--Describe the documentation added.-->
#### Documentation

Added basic README. Will add more details with future commits.
<!--Please delete paragraphs that you did not use before submitting.-->


CC: @ChrsMark

---------

Co-authored-by: Christos Markou <[email protected]>
sbylica-splunk pushed a commit to sbylica-splunk/opentelemetry-collector-contrib that referenced this issue Dec 17, 2024
open-telemetry#36671)

<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
#### Description

Adds config validation logic and custom OTTL functions required for
signal to metrics connector.

<!-- Issue number (e.g. open-telemetry#1234) or full URL to issue, if applicable. -->
#### Link to tracking issue
Related to:
open-telemetry#35930

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

<!--Describe the documentation added.-->
#### Documentation
N/A
<!--Please delete paragraphs that you did not use before submitting.-->

---------

Co-authored-by: Christos Markou <[email protected]>
mterhar pushed a commit to mterhar/opentelemetry-collector-contrib that referenced this issue Dec 19, 2024
open-telemetry#36671)

<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
#### Description

Adds config validation logic and custom OTTL functions required for
signal to metrics connector.

<!-- Issue number (e.g. open-telemetry#1234) or full URL to issue, if applicable. -->
#### Link to tracking issue
Related to:
open-telemetry#35930

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

<!--Describe the documentation added.-->
#### Documentation
N/A
<!--Please delete paragraphs that you did not use before submitting.-->

---------

Co-authored-by: Christos Markou <[email protected]>
andrzej-stencel pushed a commit that referenced this issue Jan 9, 2025
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
#### Description

Adding core logic for the signal to metrics connector.

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

Related to
#35930

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

Unit tests added

<!--Describe the documentation added.-->
#### Documentation

Documentation is already added in README.
<!--Please delete paragraphs that you did not use before submitting.-->

---------

Co-authored-by: Christos Markou <[email protected]>
AkhigbeEromo pushed a commit to sematext/opentelemetry-collector-contrib that referenced this issue Jan 13, 2025
…elemetry#36454)

<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
#### Description

Adds boilerplate code for a new signal to metrics connector.

<!-- Issue number (e.g. open-telemetry#1234) or full URL to issue, if applicable. -->
#### Link to tracking issue
Part of
open-telemetry#35930

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

Unit tests provided as required.

<!--Describe the documentation added.-->
#### Documentation

Added basic README. Will add more details with future commits.
<!--Please delete paragraphs that you did not use before submitting.-->


CC: @ChrsMark

---------

Co-authored-by: Christos Markou <[email protected]>
AkhigbeEromo pushed a commit to sematext/opentelemetry-collector-contrib that referenced this issue Jan 13, 2025
open-telemetry#36671)

<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
#### Description

Adds config validation logic and custom OTTL functions required for
signal to metrics connector.

<!-- Issue number (e.g. open-telemetry#1234) or full URL to issue, if applicable. -->
#### Link to tracking issue
Related to:
open-telemetry#35930

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

<!--Describe the documentation added.-->
#### Documentation
N/A
<!--Please delete paragraphs that you did not use before submitting.-->

---------

Co-authored-by: Christos Markou <[email protected]>
AkhigbeEromo pushed a commit to sematext/opentelemetry-collector-contrib that referenced this issue Jan 13, 2025
…telemetry#36852)

<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
#### Description

Adding core logic for the signal to metrics connector.

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

Related to
open-telemetry#35930

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

Unit tests added

<!--Describe the documentation added.-->
#### Documentation

Documentation is already added in README.
<!--Please delete paragraphs that you did not use before submitting.-->

---------

Co-authored-by: Christos Markou <[email protected]>
andrzej-stencel pushed a commit that referenced this issue Jan 14, 2025
#37117)

<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
#### Description
Update signal to metrics connector to add resource attribute from
telemetry settings. More information can be perused here:
https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/connector/signaltometricsconnector/README.md#single-writer

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

<!--Describe what testing was performed and which tests were added.-->
#### Testing
Unit tests added
<!--Describe the documentation added.-->
#### Documentation
Documentation is already added in README as part of the initial PR:
https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/connector/signaltometricsconnector/README.md#single-writer
<!--Please delete paragraphs that you did not use before submitting.-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Accepted Component New component has been sponsored
Projects
None yet
Development

No branches or pull requests

5 participants