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

SC-20508 #2

Closed
wants to merge 41 commits into from
Closed

SC-20508 #2

wants to merge 41 commits into from

Conversation

ghost
Copy link

@ghost ghost commented Oct 7, 2024

This PR adds metrics support for Sematext exporter

@ghost ghost marked this pull request as ready for review October 8, 2024 21:56
@otisg
Copy link
Member

otisg commented Oct 9, 2024

@Eromosele-SM "This branch has conflicts that must be resolved"

exporter/sematextexporter/config.go Outdated Show resolved Hide resolved
cmd/otelcontribcol/go.mod Outdated Show resolved Hide resolved
exporter/sematextexporter/Makefile Outdated Show resolved Hide resolved
exporter/sematextexporter/config.go Outdated Show resolved Hide resolved
exporter/sematextexporter/config.go Show resolved Hide resolved
exporter/sematextexporter/writer.go Show resolved Hide resolved
exporter/sematextexporter/writer.go Outdated Show resolved Hide resolved
exporter/sematextexporter/writer.go Outdated Show resolved Hide resolved
exporter/sematextexporter/writer_test.go Outdated Show resolved Hide resolved
exporter/sematextexporter/writer_test.go Show resolved Hide resolved
@ghost ghost force-pushed the add-sematext-exporter branch from bf683ff to 2146176 Compare October 9, 2024 11:35
@otisg
Copy link
Member

otisg commented Oct 9, 2024

FWIW I saw 2 instances of the following in your merge of main into your fork:
c64a75e [chore] [exporter/sumologic] Use NewDefaultClientConfig instead of manually creating struct (open-telemetry#35547)

(this one for SL, and another for Mezmo)
Maybe something new to look into/use?

@ghost
Copy link
Author

ghost commented Oct 9, 2024

FWIW I saw 2 instances of the following in your merge of main into your fork: c64a75e [chore] [exporter/sumologic] Use NewDefaultClientConfig instead of manually creating struct (open-telemetry#35547)

(this one for SL, and another for Mezmo) Maybe something new to look into/use?

Their createDefaultClientConfig() function returns a confighttp.ClientConfig but what our createDefaultClientConfig() function returns is a component.Config and there is no default for it

Copy link

@jackgopack4 jackgopack4 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see any major issues here, some small suggestions. Make sure you get some pipelines/checks set up (you may be able to piggyback on upstream CI if you open a draft PR on open-telemetry/opentelemetry-collector-contrib

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no specific comments on any of your tests, but it might be useful to open up a draft pr on the contrib repo to benefit from their pipelines they have set up for linting, test coverage, etc.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah i will, once i am done with the logs support

exporter/sematextexporter/writer_test.go Outdated Show resolved Hide resolved
@ghost ghost changed the title Add sematext exporter SC:20508 Add sematext exporter Oct 14, 2024
* `endpoint` (required) HTTP/S destination for metric receivers. It is dependent on the region:
- US: `spm-receiver.sematext.com`
- EU: `spm-receiver.eu.sematext.com`
* `timeout` (default = 5s) Timeout for requests
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Eromosele-SM make it match STA timeout?

* `US`
* `EU`
* `payload_max_lines` (default = 10_000) Maximum number of lines allowed per HTTP POST request
* `payload_max_bytes` (default = 10_000_000) Maximum number of bytes allowed per HTTP POST request
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Eromosele-SM I'd check these defaults internally with Sematext first.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's the suggest for custom metrics. I'd ask STA devs what STA uses.

* `payload_max_bytes` (default = 10_000_000) Maximum number of bytes allowed per HTTP POST request
* `metrics_schema` (default = telegraf-prometheus-v2) The chosen metrics schema to write; must be one of:
* `otel-v1`
* `telegraf-prometheus-v2`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Eromosele-SM probably only one schema in the end. Also, this Exporter will end up shipping telemetry other than metrics. So maybe you want to structure the README in preparation for that. For example, this particular schema will be only for metrics.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can always edit the readme when we have logs support ready?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ofc. I hope the YAML is also structured in anticipation of Exporter sending other telemetry later (so other App tokens, other endpoints, although the region could probably remain general).

Copy link
Member

@otisg otisg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few suggestions made...

@ghost
Copy link
Author

ghost commented Oct 30, 2024

@boratanrikulu @otisg
Can you please take a look?
I made some changes

@ghost ghost requested review from otisg, jackgopack4 and boratanrikulu October 30, 2024 22:49
Copy link
Member

@otisg otisg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just did a quick skip over the surface stuff, not actual code.

exporter/sematextexporter/README.md Outdated Show resolved Hide resolved
exporter/sematextexporter/config.go Outdated Show resolved Hide resolved

// Validate checks for invalid or missing entries in the configuration.
func (cfg *Config) Validate() error {
if strings.ToLower(cfg.Region) != "eu" && strings.ToLower(cfg.Region) != "us" && strings.ToLower(cfg.Region) != "custom"{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still not sure what "custom" is for. Esp. since in the line below you say only US and EU are allowed.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The custom is so that we can run tests on the exporter with a mockserver

@AkhigbeEromo AkhigbeEromo changed the title SC-20508 Add sematext exporter SC-20508 Dec 18, 2024
AkhigbeEromo pushed a commit that referenced this pull request Jan 13, 2025
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
#### Description
Generates simple histograms using telemetrygen
<!-- Issue number (e.g. open-telemetry#1234) or full URL to issue, if applicable. -->
#### Link to tracking issue
Fixes

<!--Describe what testing was performed and which tests were added.-->
#### Testing
Test with a local otel collector with debug output

```
bin/telemetrygen metrics --metrics 5  --otlp-http --otlp-endpoint "localhost:4318"    --metric-type Histogram --otlp-insecure 
```
Output from debug Exporter: 
```
Resource SchemaURL: https://opentelemetry.io/schemas/1.13.0
ScopeMetrics #0
ScopeMetrics SchemaURL:
InstrumentationScope
Metric #0
Descriptor:
     -> Name: gen
     -> Description:
     -> Unit:
     -> DataType: Histogram
     -> AggregationTemporality: Cumulative
HistogramDataPoints #0
StartTimestamp: 2024-11-13 16:22:50.633365 +0000 UTC
Timestamp: 2024-11-13 16:22:51.633367 +0000 UTC
Count: 0
Sum: 0.000000
ExplicitBounds #0: 0.000000
ExplicitBounds #1: 1.000000
ExplicitBounds #2: 2.000000
ExplicitBounds #3: 3.000000
ExplicitBounds #4: 4.000000
Buckets #0, Count: 0
Buckets #1, Count: 0
Buckets #2, Count: 0
Buckets #3, Count: 0
Buckets #4, Count: 0
ResourceMetrics #1
Resource SchemaURL: https://opentelemetry.io/schemas/1.13.0
ScopeMetrics #0
ScopeMetrics SchemaURL:
InstrumentationScope
Metric #0
Descriptor:
     -> Name: gen
     -> Description:
     -> Unit:
     -> DataType: Histogram
     -> AggregationTemporality: Cumulative
HistogramDataPoints #0
StartTimestamp: 2024-11-13 16:22:50.639942 +0000 UTC
Timestamp: 2024-11-13 16:22:51.639942 +0000 UTC
Count: 1
Sum: 1.000000
ExplicitBounds #0: 0.000000
ExplicitBounds #1: 1.000000
ExplicitBounds #2: 2.000000
ExplicitBounds #3: 3.000000
ExplicitBounds #4: 4.000000
Buckets #0, Count: 0
Buckets #1, Count: 1
Buckets #2, Count: 0
Buckets #3, Count: 0
Buckets #4, Count: 0
ResourceMetrics #2
Resource SchemaURL: https://opentelemetry.io/schemas/1.13.0
ScopeMetrics #0
ScopeMetrics SchemaURL:
InstrumentationScope
Metric #0
Descriptor:
     -> Name: gen
     -> Description:
     -> Unit:
     -> DataType: Histogram
     -> AggregationTemporality: Cumulative
HistogramDataPoints #0
StartTimestamp: 2024-11-13 16:22:50.6404 +0000 UTC
Timestamp: 2024-11-13 16:22:51.640401 +0000 UTC
Count: 2
Sum: 4.000000
ExplicitBounds #0: 0.000000
ExplicitBounds #1: 1.000000
ExplicitBounds #2: 2.000000
ExplicitBounds #3: 3.000000
ExplicitBounds #4: 4.000000
Buckets #0, Count: 0
Buckets #1, Count: 1
Buckets #2, Count: 0
Buckets #3, Count: 1
Buckets #4, Count: 0
ResourceMetrics #3
Resource SchemaURL: https://opentelemetry.io/schemas/1.13.0
ScopeMetrics #0
ScopeMetrics SchemaURL:
InstrumentationScope
Metric #0
Descriptor:
     -> Name: gen
     -> Description:
     -> Unit:
     -> DataType: Histogram
     -> AggregationTemporality: Cumulative
HistogramDataPoints #0
StartTimestamp: 2024-11-13 16:22:50.640729 +0000 UTC
Timestamp: 2024-11-13 16:22:51.640729 +0000 UTC
Count: 3
Sum: 3.000000
ExplicitBounds #0: 0.000000
ExplicitBounds #1: 1.000000
ExplicitBounds #2: 2.000000
ExplicitBounds #3: 3.000000
ExplicitBounds #4: 4.000000
Buckets #0, Count: 1
Buckets #1, Count: 1
Buckets #2, Count: 1
Buckets #3, Count: 0
Buckets #4, Count: 0
ResourceMetrics #4
Resource SchemaURL: https://opentelemetry.io/schemas/1.13.0
ScopeMetrics #0
ScopeMetrics SchemaURL:
InstrumentationScope
Metric #0
Descriptor:
     -> Name: gen
     -> Description:
     -> Unit:
     -> DataType: Histogram
     -> AggregationTemporality: Cumulative
HistogramDataPoints #0
StartTimestamp: 2024-11-13 16:22:50.641073 +0000 UTC
Timestamp: 2024-11-13 16:22:51.641073 +0000 UTC
Count: 4
Sum: 12.000000
ExplicitBounds #0: 0.000000
ExplicitBounds #1: 1.000000
ExplicitBounds #2: 2.000000
ExplicitBounds #3: 3.000000
ExplicitBounds #4: 4.000000
Buckets #0, Count: 0
Buckets #1, Count: 0
Buckets #2, Count: 1
Buckets #3, Count: 2
Buckets #4, Count: 1
        {"kind": "exporter", "data_type": "metrics", "name": "debug"}
```
<!--Describe the documentation added.-->
#### Documentation

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

---------

Co-authored-by: Pablo Baeyens <pbaeyens31+github@gmail.com>
AkhigbeEromo pushed a commit that referenced this pull request Jan 13, 2025
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
#### Description
Generates simple histograms using telemetrygen
<!-- Issue number (e.g. open-telemetry#1234) or full URL to issue, if applicable. -->
#### Link to tracking issue
Fixes

<!--Describe what testing was performed and which tests were added.-->
#### Testing
Test with a local otel collector with debug output

```
bin/telemetrygen metrics --metrics 5  --otlp-http --otlp-endpoint "localhost:4318"    --metric-type Histogram --otlp-insecure 
```
Output from debug Exporter: 
```
Resource SchemaURL: https://opentelemetry.io/schemas/1.13.0
ScopeMetrics #0
ScopeMetrics SchemaURL:
InstrumentationScope
Metric #0
Descriptor:
     -> Name: gen
     -> Description:
     -> Unit:
     -> DataType: Histogram
     -> AggregationTemporality: Cumulative
HistogramDataPoints #0
StartTimestamp: 2024-11-13 16:22:50.633365 +0000 UTC
Timestamp: 2024-11-13 16:22:51.633367 +0000 UTC
Count: 0
Sum: 0.000000
ExplicitBounds #0: 0.000000
ExplicitBounds #1: 1.000000
ExplicitBounds #2: 2.000000
ExplicitBounds #3: 3.000000
ExplicitBounds #4: 4.000000
Buckets #0, Count: 0
Buckets #1, Count: 0
Buckets #2, Count: 0
Buckets #3, Count: 0
Buckets #4, Count: 0
ResourceMetrics #1
Resource SchemaURL: https://opentelemetry.io/schemas/1.13.0
ScopeMetrics #0
ScopeMetrics SchemaURL:
InstrumentationScope
Metric #0
Descriptor:
     -> Name: gen
     -> Description:
     -> Unit:
     -> DataType: Histogram
     -> AggregationTemporality: Cumulative
HistogramDataPoints #0
StartTimestamp: 2024-11-13 16:22:50.639942 +0000 UTC
Timestamp: 2024-11-13 16:22:51.639942 +0000 UTC
Count: 1
Sum: 1.000000
ExplicitBounds #0: 0.000000
ExplicitBounds #1: 1.000000
ExplicitBounds #2: 2.000000
ExplicitBounds #3: 3.000000
ExplicitBounds #4: 4.000000
Buckets #0, Count: 0
Buckets #1, Count: 1
Buckets #2, Count: 0
Buckets #3, Count: 0
Buckets #4, Count: 0
ResourceMetrics #2
Resource SchemaURL: https://opentelemetry.io/schemas/1.13.0
ScopeMetrics #0
ScopeMetrics SchemaURL:
InstrumentationScope
Metric #0
Descriptor:
     -> Name: gen
     -> Description:
     -> Unit:
     -> DataType: Histogram
     -> AggregationTemporality: Cumulative
HistogramDataPoints #0
StartTimestamp: 2024-11-13 16:22:50.6404 +0000 UTC
Timestamp: 2024-11-13 16:22:51.640401 +0000 UTC
Count: 2
Sum: 4.000000
ExplicitBounds #0: 0.000000
ExplicitBounds #1: 1.000000
ExplicitBounds #2: 2.000000
ExplicitBounds #3: 3.000000
ExplicitBounds #4: 4.000000
Buckets #0, Count: 0
Buckets #1, Count: 1
Buckets #2, Count: 0
Buckets #3, Count: 1
Buckets #4, Count: 0
ResourceMetrics #3
Resource SchemaURL: https://opentelemetry.io/schemas/1.13.0
ScopeMetrics #0
ScopeMetrics SchemaURL:
InstrumentationScope
Metric #0
Descriptor:
     -> Name: gen
     -> Description:
     -> Unit:
     -> DataType: Histogram
     -> AggregationTemporality: Cumulative
HistogramDataPoints #0
StartTimestamp: 2024-11-13 16:22:50.640729 +0000 UTC
Timestamp: 2024-11-13 16:22:51.640729 +0000 UTC
Count: 3
Sum: 3.000000
ExplicitBounds #0: 0.000000
ExplicitBounds #1: 1.000000
ExplicitBounds #2: 2.000000
ExplicitBounds #3: 3.000000
ExplicitBounds #4: 4.000000
Buckets #0, Count: 1
Buckets #1, Count: 1
Buckets #2, Count: 1
Buckets #3, Count: 0
Buckets #4, Count: 0
ResourceMetrics #4
Resource SchemaURL: https://opentelemetry.io/schemas/1.13.0
ScopeMetrics #0
ScopeMetrics SchemaURL:
InstrumentationScope
Metric #0
Descriptor:
     -> Name: gen
     -> Description:
     -> Unit:
     -> DataType: Histogram
     -> AggregationTemporality: Cumulative
HistogramDataPoints #0
StartTimestamp: 2024-11-13 16:22:50.641073 +0000 UTC
Timestamp: 2024-11-13 16:22:51.641073 +0000 UTC
Count: 4
Sum: 12.000000
ExplicitBounds #0: 0.000000
ExplicitBounds #1: 1.000000
ExplicitBounds #2: 2.000000
ExplicitBounds #3: 3.000000
ExplicitBounds #4: 4.000000
Buckets #0, Count: 0
Buckets #1, Count: 0
Buckets #2, Count: 1
Buckets #3, Count: 2
Buckets #4, Count: 1
        {"kind": "exporter", "data_type": "metrics", "name": "debug"}
```
<!--Describe the documentation added.-->
#### Documentation

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

---------

Co-authored-by: Pablo Baeyens <pbaeyens31+github@gmail.com>
AkhigbeEromo pushed a commit that referenced this pull request Jan 28, 2025
#### Description

Vulnerability #1: GO-2025-3420
Sensitive headers incorrectly sent after cross-domain redirect in
net/http
  More info: https://pkg.go.dev/vuln/GO-2025-3420
  Standard library
    Found in: net/http@go1.22.8
    Fixed in: net/http@go1.22.11
    Example traces found:
Error: #1: codeowners.go:212:55:
githubgen.codeownersGenerator.getGithubMembers calls
github.OrganizationsService.ListMembers, which eventually calls
http.Client.Do

Vulnerability #2:
GO-[20](https://github.com/open-telemetry/opentelemetry-collector-contrib/actions/runs/13003223509/job/36265594395?pr=37492#step:6:21)25-3373
Usage of IPv6 zone IDs can bypass URI name constraints in crypto/x509
  More info: https://pkg.go.dev/vuln/GO-2025-3373
  Standard library
Found in:
crypto/x509@go1.[22](https://github.com/open-telemetry/opentelemetry-collector-contrib/actions/runs/13003223509/job/36265594395?pr=37492#step:6:23).8
    Fixed in: crypto/x509@go1.22.11
    Example traces found:

Related:
open-telemetry/opentelemetry-collector#12197
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants