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

[wip] add support for console/otlp metric exporter #7644

Conversation

codeboten
Copy link
Contributor

This is a prototype for adding support for metric readers to service.telemetry.metrics. The parsing code was generated using the json schema generator go-jsonschema, with the source schema in this PR: open-telemetry/opentelemetry-configuration#15

There are many open questions still. For this to move forward, i propose it should be behind a separate feature gate to allow users who want to experiment with it to do so.

Fix #7641

Alex Boten added 2 commits May 15, 2023 11:26
This is a prototype for adding support for metric readers to service.telemetry.metrics. The parsing code was generated using
the json schema generator go-jsonschema, with the source schema in this PR: open-telemetry/opentelemetry-configuration#15

There are many open questions still. For this to move forward, i propose it should be behind a separate feature gate to allow
users who want to experiment with it to do so.

Signed-off-by: Alex Boten <aboten@lightstep.com>
Signed-off-by: Alex Boten <aboten@lightstep.com>
@codeboten codeboten force-pushed the codeboten/add-otlp-metric-exporter branch from 84767ea to 27f1b28 Compare May 15, 2023 18:26
Alex Boten added 2 commits May 15, 2023 12:02
Signed-off-by: Alex Boten <aboten@lightstep.com>
Signed-off-by: Alex Boten <aboten@lightstep.com>
Copy link
Member

@TylerHelmuth TylerHelmuth left a comment

Choose a reason for hiding this comment

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

I think the pattern in proctelemetry is reasonable given the Go SDK doesn't support this type of configuration input yet. For our implementation of the mapping maybe generics could be used somewhere, but it probably isn't worth it.

Comment on lines +109 to +110
if len(cfg.Metrics.Address) > 0 {
settings.Logger.Warn("service.telemetry.metrics.address is being deprecated in favor of service.telemetry.metrics.metric_readers")
Copy link
Member

Choose a reason for hiding this comment

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

Do we need to somehow feature gate this behavior where the user has enabled the UseOTel feature gate but hasn't started using the Reader config yet? Sounds like we eventually we want users to configure the Readers and won't support address, but that would be a breaking change.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yup, I'm planning on putting this all behind this feature gate: #7678

Comment on lines +87 to +89
case "certificate":
case "client_key":
case "client_certificate":
Copy link
Member

Choose a reason for hiding this comment

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

Do we need these cases if we don't do anything with them?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

These were here as a reminder we need to do something with them :) once i split this PR into smaller ones, i'll fill in these details

func newOTLPGRPCMetricExporter(ctx context.Context, args map[string]interface{}) (sdkmetric.Exporter, error) {
opts := []otlpmetricgrpc.Option{}
for k, v := range args {
switch k {
Copy link
Member

Choose a reason for hiding this comment

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

IDK what the configuration file spec looks like, but if a user configures an unsupported value should we error?

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 think it would make sense for an error to be returned for unsupported values

service/telemetry/generated_schema.go Show resolved Hide resolved
Copy link
Contributor

@MovieStoreGuy MovieStoreGuy left a comment

Choose a reason for hiding this comment

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

Just a few comments from me.

func toStringMap(in map[string]interface{}) map[string]string {
out := map[string]string{}
for k, v := range in {
out[k] = fmt.Sprintf("%v", v)
Copy link
Contributor

Choose a reason for hiding this comment

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

Would it be easier to call fmt.Sprint instead?

case "client_key":
case "client_certificate":
case "compression":
switch fmt.Sprintf("%s", v) {
Copy link
Contributor

Choose a reason for hiding this comment

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

At this point you can't assert that v is a string due to args being a map of string to any, switching to fmt.Sprint should work without issue here.

case "timeout":
timeout, ok := v.(int)
if !ok {
return nil, fmt.Errorf("invalid timeout for otlp exporter: %s", v)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
return nil, fmt.Errorf("invalid timeout for otlp exporter: %s", v)
return nil, fmt.Errorf("invalid timeout for otlp exporter: %v", v)

_, err := tel.initPrometheus(res, settings.Logger, cfg.Metrics.Address, cfg.Metrics.Level, asyncErrorChannel)
if err != nil {
return err
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this return in general instead of just if an error occurred?

codeboten pushed a commit that referenced this pull request May 16, 2023
This adds the feature-gate telemetry.useOtelWithExtendedConfigurationForInternalTelemetry to start adding support for additional exporters for the collector's internal telemetry.

This is part of of #7644
---------

Signed-off-by: Alex Boten <aboten@lightstep.com>
@github-actions
Copy link
Contributor

This PR was marked stale due to lack of activity. It will be closed in 14 days.

@github-actions github-actions bot added the Stale label May 31, 2023
@codeboten codeboten removed the Stale label May 31, 2023
@github-actions
Copy link
Contributor

This PR was marked stale due to lack of activity. It will be closed in 14 days.

@github-actions
Copy link
Contributor

github-actions bot commented Jul 2, 2023

This PR was marked stale due to lack of activity. It will be closed in 14 days.

@github-actions github-actions bot added the Stale label Jul 2, 2023
@mx-psi mx-psi removed the Stale label Jul 3, 2023
Copy link
Contributor Author

@codeboten codeboten left a comment

Choose a reason for hiding this comment

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

Superseeded by #8094 & #8097

@codeboten codeboten closed this Jul 17, 2023
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.

Support additional exporters for exporting collector metrics
4 participants