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

opentelemetry collector trace exporter #497

Merged
merged 8 commits into from
Mar 7, 2020

Conversation

rghetia
Copy link
Contributor

@rghetia rghetia commented Feb 27, 2020

fixes #376

This is largely taken from ocagent exporter.

Few items are still missing

  • resources.
  • load tests

test-386 is skipped for Mac OS 10.15.x (Catalina and upwards).

Makefile Outdated Show resolved Hide resolved
exporter/trace/otelcol/README.md Outdated Show resolved Hide resolved
exporter/trace/otelcol/options.go Outdated Show resolved Hide resolved
exporter/trace/otelcol/options.go Outdated Show resolved Hide resolved
exporter/trace/otelcol/otelcol.go Outdated Show resolved Hide resolved
exporter/trace/otelcol/otelcol.go Outdated Show resolved Hide resolved
exporter/trace/otelcol/otelcol.go Outdated Show resolved Hide resolved
out = append(out, &commonpb.AttributeKeyValue{
Key: string(v.Key),
Type: commonpb.AttributeKeyValue_INT,
IntValue: v.Value.AsInt64(),
Copy link
Member

Choose a reason for hiding this comment

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

I don't really know if this isn't going to trip us in some way if type is, for example, core.INT32. The value contains uint64 containing int32 and we are returning it as uint64 without any cast. This might work by accident.

Just a note: AsInt64 does not do any coercion. It interprets the bits in value as integral 64-bit value.

Copy link
Contributor

Choose a reason for hiding this comment

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

This looks OK to me, because when the Value is constructed for a int32 value, we call

func int32ToRaw(i int32) uint64 {
	return uint64(i)
}

exporter/trace/otelcol/transform_spans.go Outdated Show resolved Hide resolved
exporter/trace/otelcol/transform_spans.go Outdated Show resolved Hide resolved
@@ -0,0 +1,24 @@
# OpenTelemetry Collector Go Exporter
Copy link
Contributor

Choose a reason for hiding this comment

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

Did you consider naming this "otlp"? It seems like the term we've used for this protocol everywhere.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll change this to otlp inline with receiver in opentelemetry-collector.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

exporter/trace/otelcol/options.go Outdated Show resolved Hide resolved
out = append(out, &commonpb.AttributeKeyValue{
Key: string(v.Key),
Type: commonpb.AttributeKeyValue_INT,
IntValue: v.Value.AsInt64(),
Copy link
Contributor

Choose a reason for hiding this comment

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

This looks OK to me, because when the Value is constructed for a int32 value, we call

func int32ToRaw(i int32) uint64 {
	return uint64(i)
}

exporter/trace/otelcol/transform_spans.go Outdated Show resolved Hide resolved
@MrAlias
Copy link
Contributor

MrAlias commented Mar 4, 2020

I've been prototyping the metrics version of this exporter (#377) and realize there is going to be a fair amount of repeated code for that Exporter (setup/teardown to the collector, configuration, value parsing, ...). I'm wondering, given this will be the first exporter included in the project that will export both Spans and Metrics, if we want to locate this somewhere else.

I think if we moved all exporters up one level, removed the trace, metric directories, and added a README.md/docs.go file to the exporters directory cataloging the included exporters and any other useful docs. This move would also allow the project to grow into exporters supporting multiple telemetry types (including possibly logs(?)).

If that option doesn't sit well, we could also possibly move this only to in the exporters directory, or maybe build a base struct to abstract common functionality between the exporters? Or, none of the above and just have repeated code with possibly divergent Exporters?

@rghetia
Copy link
Contributor Author

rghetia commented Mar 4, 2020

Moving one level up is fine. If there is a need for a separate exporter package then we can always create
exporter//trace OR
exporter//metrics

exporter/trace/otelcol/README.md Outdated Show resolved Hide resolved
exporter/trace/otelcol/connection.go Outdated Show resolved Hide resolved
exporter/trace/otelcol/doc.go Outdated Show resolved Hide resolved
@rghetia rghetia force-pushed the opentelemetry-exporter branch from f7c392e to a10e2c4 Compare March 5, 2020 00:34
Makefile Outdated Show resolved Hide resolved
exporters/otlp/go.mod Outdated Show resolved Hide resolved
exporters/otlp/options.go Outdated Show resolved Hide resolved
exporters/otlp/options.go Outdated Show resolved Hide resolved
exporters/otlp/options.go Outdated Show resolved Hide resolved
exporters/otlp/otlp.go Show resolved Hide resolved
exporters/otlp/otlp.go Outdated Show resolved Hide resolved
Makefile Outdated Show resolved Hide resolved
@rghetia
Copy link
Contributor Author

rghetia commented Mar 5, 2020

@MrAlias if you don't mind can you please review this?

gianarb pushed a commit to profefe/kube-profefe that referenced this pull request Mar 6, 2020
Fixed #12

- [x] Bootstrap opentelemetry
- [x] By default export json
- [x] Root trace is the cmd.Execute
- [x] One span for every goroutine (measure concurrency) *
- [ ] Allow to export to collector (blocked by
open-telemetry/opentelemetry-go#497)
- [ ] Find a way to trace kubernetes client-go
- [ ] Trace http.Client that makes requests to profefe API

* In order to get the gathering of the profile efficient I use a channel
that spread the work across many goroutine (atm fixed to 10). The root
span has a child for any goroutine.

Signed-off-by: Gianluca Arbezzano <[email protected]>
Copy link
Contributor

@MrAlias MrAlias left a comment

Choose a reason for hiding this comment

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

Looks good 👍

I like the suggestion @krnowak made about passing context and included a few comments myself. Nothing blocking though.

exporters/otlp/otlp.go Show resolved Hide resolved
exporters/otlp/transform_spans.go Show resolved Hide resolved
@rghetia rghetia force-pushed the opentelemetry-exporter branch from 241940a to e6adf8f Compare March 7, 2020 05:53
@rghetia rghetia merged commit 5850278 into open-telemetry:master Mar 7, 2020
MikeGoldsmith pushed a commit to MikeGoldsmith/opentelemetry-go that referenced this pull request Mar 13, 2020
* opentelemetry collector exporter

- missing load test
- missing resources

* fix review comments.

* add test for each SpanKind and Attribute Type.

* rename otelcol to otlp

* move exporter/trace/otlp to exporters/otlp

* more review comments.

* add alignment test.

* pass context to uploadSpans
@pellared pellared added this to the untracked milestone Nov 8, 2024
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.

Add open-telmetry collector/agent trace exporter.
6 participants