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

Add simplified constructor for simple metric SDK setup: stdout exporter. #343

Closed
jmacd opened this issue Nov 22, 2019 · 5 comments · Fixed by #395
Closed

Add simplified constructor for simple metric SDK setup: stdout exporter. #343

jmacd opened this issue Nov 22, 2019 · 5 comments · Fixed by #395
Assignees
Labels
area:metrics Part of OpenTelemetry Metrics good first issue Good for newcomers
Milestone

Comments

@jmacd
Copy link
Contributor

jmacd commented Nov 22, 2019

It takes about 15 lines of code to setup an exporter. This is because the complete export pipeline has a number of various configurations possible, but it confuses most users who do not care to change the standard configuration.

Each exporter should provide a simple method to set it up using a recommended setup. For example, the stdout exporter should by default (IMO) use: the inexpensive measure option, the ungrouped batcher (stateful), and a push controller, e.g., the code snippet below.

	selector := simple.NewWithInexpensiveMeasure()
	exporter, err := metricstdout.New(options)
	if err != nil {
		return nil
	}
	batcher := ungrouped.New(selector, metricsdk.NewDefaultLabelEncoder(), true)
	pusher := push.New(batcher, exporter, time.Second)
	pusher.Start()
         return pusher
@iredelmeier
Copy link
Member

Assigned to @matej-g (can't currently pick in the assignees list)

@matej-g
Copy link
Contributor

matej-g commented Dec 5, 2019

@iredelmeier yes, thank you, I'll be glad to take this!

@matej-g
Copy link
Contributor

matej-g commented Dec 16, 2019

So I have been looking at this task and reading through spec / documentation,
but I guess I have still some questions, as a newcomer I want to make sure I understand:

  • The terminology is not entirely clear to me - the issues description speaks of setting up an exporter, although it seems like exporter is actually one of the stages in the pipeline which we want to construct. Should I understand the task as setting up the whole exporter pipeline (i.e. aggregation selector, batcher, exporter and controller), in this case with default, recommended configuration? Is this process synonymous with setting up an exporter?

  • From the point of the code organization, I'm not sure where would these recommended pipeline setups fit the best; should they be included in a new package under /otel/sdk/metric/?

@jmacd
Copy link
Contributor Author

jmacd commented Dec 16, 2019

Should I understand the task as setting up the whole exporter pipeline

Yes, that was the intent of this issue. We want to simplify the default setup.

I would put this in the stdout directory, so the signature might be:

func NewExportPipeline(config Config) (metric.Provider, io.Closer)

and to install one of these:

   provider, closer := stdout.NewExportPipeline(...)
   defer closer.Close()
   global.SetMeterProvider(provider)

(Note: I invented the name Config above. It's actually named Options, but there's a growing consensus in this code base to use Config for the name of a config struct and Option as the name of the functional option type. I would like to rename this Options type to Config.)

@matej-g
Copy link
Contributor

matej-g commented Dec 21, 2019

@jmacd Thank you for the guidance, I tried my hand at a solution in #395

@jmacd jmacd closed this as completed in #395 Jan 2, 2020
hstan referenced this issue in hstan/opentelemetry-go Oct 15, 2020
#343)

* Bump github.com/golangci/golangci-lint from 1.30.0 to 1.31.0 in /tools

Bumps [github.com/golangci/golangci-lint](https://github.com/golangci/golangci-lint) from 1.30.0 to 1.31.0.
- [Release notes](https://github.com/golangci/golangci-lint/releases)
- [Changelog](https://github.com/golangci/golangci-lint/blob/master/CHANGELOG.md)
- [Commits](golangci/golangci-lint@v1.30.0...v1.31.0)

Signed-off-by: dependabot[bot] <[email protected]>

* Auto-fix go.sum changes in dependent modules

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: dependabot[bot] <dependabot[bot]@users.noreply.github.com>
@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
area:metrics Part of OpenTelemetry Metrics good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants