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

profiler: use functional options instead of config object #792

Closed
derekperkins opened this issue Oct 19, 2017 · 2 comments
Closed

profiler: use functional options instead of config object #792

derekperkins opened this issue Oct 19, 2017 · 2 comments
Assignees
Labels
api: cloudprofiler Issues related to the Cloud Profiler API. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.

Comments

@derekperkins
Copy link
Contributor

I'm not a huge fan of config objects, and functional options are used in many other places in these packages. It'd be easier to maintain backwards compatibility. There are already functional options for ClientOption, which could either be applied as a part of a ProfilerOption or sent through on a start func.

func NewProfiler(opts ...ProfilerOption) (*Profiler, error) {
	...
}

func (p *Profiler) Start(opts ...ClientOption) error {
	...
}
@anthmgoogle anthmgoogle added api: cloudprofiler Issues related to the Cloud Profiler API. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design. labels Nov 10, 2017
@jba
Copy link
Contributor

jba commented Nov 28, 2017

It's partly because of ClientOption that we decided to use a config struct here. We couldn't come up with a nice way for particular clients to add their own ClientOptions.

I've come to dislike options for other reasons: they clutter the surface, they are hard to recognize as options (godoc doesn't group them together), and they have package-level names so the names have to be long enough to be unambiguous. ClientOption doesn't have these problems, because it lives in its own package, but client-specific options would.

The only real downside to a config object is that you may have to write an empty one, which is unattractive, but not otherwise harmful.

I don't think a config object hinders backwards compatibility. Adding a field to a struct is backwards-compatible.

@jba jba closed this as completed Nov 28, 2017
@derekperkins
Copy link
Contributor Author

👍

gcf-owl-bot bot added a commit that referenced this issue Apr 6, 2023
Note: manually updated proto file, but it yields the same result of the new disco-converter would generate.

Fixes: #7345
Source-Link: googleapis/googleapis@59828ba

Source-Link: googleapis/googleapis-gen@2649582
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMjY0OTU4MjU3YzUzNTJkYjBiYzkxMGMwMGYxNDdiODIxYjAxMDYzNiJ9
gcf-owl-bot bot added a commit that referenced this issue Apr 10, 2023
feat: support per-entity search and autocomplete
feat: support new filter syntax for recommendation
feat: expose A/B experiment info in search response
docs: keep the API doc up-to-date with recent changes

PiperOrigin-RevId: 522675951

Source-Link: googleapis/googleapis@f149e91

Source-Link: googleapis/googleapis-gen@c4538a8
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYzQ1MzhhODg4ZDJlYzEzY2U3MTljMWExYWE5ZGM3ZGU1YjE3Mzc1YSJ9

feat: support per-entity search and autocomplete
feat: add model get API
feat: support new filter syntax for recommendation
feat: expose A/B experiment info in search response
docs: keep the API doc up-to-date with recent changes

PiperOrigin-RevId: 522675546

Source-Link: googleapis/googleapis@81b0808

Source-Link: googleapis/googleapis-gen@e950439
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiZTk1MDQzOWNkMGQ0ODZhYjhkMmIzMjY3MmI1NGMwYTZiNjQ1MTQyMCJ9

feat: Add support for updating additional pod IPv4 ranges for Standard and Autopilot clusters

Users can append more pod ranges by name to an existing cluster at the cluster level. When users or Node Auto-provisioning create new node pools, GKE will select the most available pod range and assign it to the node pool. These pod ranges can be removed once no node pool is using it.

PiperOrigin-RevId: 522620935

Source-Link: googleapis/googleapis@2ddfcb8

Source-Link: googleapis/googleapis-gen@8c7eccd
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiOGM3ZWNjZDA5N2I3OTg5ZDcyY2FlOTU1ZmFmNWVkOGUzZmRjYmM3NSJ9

chore: disable Go compute targets (#794)

Source-Link: googleapis/googleapis@cc293c6

Source-Link: googleapis/googleapis-gen@6bb5382
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNmJiNTM4MmFiM2NkMzIyY2MxMjI4ZWI1ODdhZGI1ZTEyMzVjNWJkMyJ9

fix: add diregapic flag for compute (#793)

Source-Link: googleapis/googleapis@f9702dc

Source-Link: googleapis/googleapis-gen@2d6c055
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMmQ2YzA1NWYwMTY0NmMxNjM5MTAwZDk5MjJiMjdhOTg5MGJmMmM2NiJ9

chore: add Go build targets for compute (#792)

Note: manually updated proto file, but it yields the same result of the new disco-converter would generate.

Fixes: #7345
Source-Link: googleapis/googleapis@59828ba

Source-Link: googleapis/googleapis-gen@2649582
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMjY0OTU4MjU3YzUzNTJkYjBiYzkxMGMwMGYxNDdiODIxYjAxMDYzNiJ9

chore: update gapic-generator-go version to 0.35.4
chore: add snippets to BUILD.bazel go_gapic_assembly_pkg

PiperOrigin-RevId: 522373543

Source-Link: googleapis/googleapis@130f097

Source-Link: googleapis/googleapis-gen@7d1457a
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiN2QxNDU3YWJlYzJmMGQyMDVmZGE2NzNhNGU2NTA4YjQxZGMxZTYzMSJ9

feat: Launch UploadConversation endpoint

PiperOrigin-RevId: 522129764

Source-Link: googleapis/googleapis@dabc235

Source-Link: googleapis/googleapis-gen@5609ad0
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNTYwOWFkMDg4Y2NmMTVhMWMyMmRmN2FhZWIzMTMzZmJlYTU2Nzk5ZSJ9

feat: add support for disabling pod IP cidr overprovision

This feature requires special allowlisting for the projects.

PiperOrigin-RevId: 522103451

Source-Link: googleapis/googleapis@013b597

Source-Link: googleapis/googleapis-gen@2fe6962
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMmZlNjk2MmY5YzhlNzcwMzk2ZGNmYzg4ZTEwNGU1ZDcxM2MyZTY2ZSJ9

feat: added ignore_dependent_resources to DeleteCaPoolRequest, DeleteCertificateAuthorityRequest, DisableCertificateAuthorityRequest

PiperOrigin-RevId: 522096199

Source-Link: googleapis/googleapis@d9592ed

Source-Link: googleapis/googleapis-gen@0ab428e
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMGFiNDI4ZTM5MzQ5ODFkYjljOGM3YmYxN2IxZmVhNWQ3NDY4MmFmYiJ9
gcf-owl-bot bot added a commit that referenced this issue Apr 10, 2023
feat: support per-entity search and autocomplete
feat: support new filter syntax for recommendation
feat: expose A/B experiment info in search response
docs: keep the API doc up-to-date with recent changes

PiperOrigin-RevId: 522675951

Source-Link: googleapis/googleapis@f149e91

Source-Link: googleapis/googleapis-gen@c4538a8
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYzQ1MzhhODg4ZDJlYzEzY2U3MTljMWExYWE5ZGM3ZGU1YjE3Mzc1YSJ9

feat: support per-entity search and autocomplete
feat: add model get API
feat: support new filter syntax for recommendation
feat: expose A/B experiment info in search response
docs: keep the API doc up-to-date with recent changes

PiperOrigin-RevId: 522675546

Source-Link: googleapis/googleapis@81b0808

Source-Link: googleapis/googleapis-gen@e950439
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiZTk1MDQzOWNkMGQ0ODZhYjhkMmIzMjY3MmI1NGMwYTZiNjQ1MTQyMCJ9

feat: Add support for updating additional pod IPv4 ranges for Standard and Autopilot clusters

Users can append more pod ranges by name to an existing cluster at the cluster level. When users or Node Auto-provisioning create new node pools, GKE will select the most available pod range and assign it to the node pool. These pod ranges can be removed once no node pool is using it.

PiperOrigin-RevId: 522620935

Source-Link: googleapis/googleapis@2ddfcb8

Source-Link: googleapis/googleapis-gen@8c7eccd
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiOGM3ZWNjZDA5N2I3OTg5ZDcyY2FlOTU1ZmFmNWVkOGUzZmRjYmM3NSJ9

chore: disable Go compute targets (#794)

Source-Link: googleapis/googleapis@cc293c6

Source-Link: googleapis/googleapis-gen@6bb5382
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNmJiNTM4MmFiM2NkMzIyY2MxMjI4ZWI1ODdhZGI1ZTEyMzVjNWJkMyJ9

fix: add diregapic flag for compute (#793)

Source-Link: googleapis/googleapis@f9702dc

Source-Link: googleapis/googleapis-gen@2d6c055
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMmQ2YzA1NWYwMTY0NmMxNjM5MTAwZDk5MjJiMjdhOTg5MGJmMmM2NiJ9

chore: add Go build targets for compute (#792)

Note: manually updated proto file, but it yields the same result of the new disco-converter would generate.

Fixes: #7345
Source-Link: googleapis/googleapis@59828ba

Source-Link: googleapis/googleapis-gen@2649582
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMjY0OTU4MjU3YzUzNTJkYjBiYzkxMGMwMGYxNDdiODIxYjAxMDYzNiJ9

chore: update gapic-generator-go version to 0.35.4
chore: add snippets to BUILD.bazel go_gapic_assembly_pkg

PiperOrigin-RevId: 522373543

Source-Link: googleapis/googleapis@130f097

Source-Link: googleapis/googleapis-gen@7d1457a
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiN2QxNDU3YWJlYzJmMGQyMDVmZGE2NzNhNGU2NTA4YjQxZGMxZTYzMSJ9

feat: Launch UploadConversation endpoint

PiperOrigin-RevId: 522129764

Source-Link: googleapis/googleapis@dabc235

Source-Link: googleapis/googleapis-gen@5609ad0
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNTYwOWFkMDg4Y2NmMTVhMWMyMmRmN2FhZWIzMTMzZmJlYTU2Nzk5ZSJ9

feat: add support for disabling pod IP cidr overprovision

This feature requires special allowlisting for the projects.

PiperOrigin-RevId: 522103451

Source-Link: googleapis/googleapis@013b597

Source-Link: googleapis/googleapis-gen@2fe6962
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMmZlNjk2MmY5YzhlNzcwMzk2ZGNmYzg4ZTEwNGU1ZDcxM2MyZTY2ZSJ9

feat: added ignore_dependent_resources to DeleteCaPoolRequest, DeleteCertificateAuthorityRequest, DisableCertificateAuthorityRequest

PiperOrigin-RevId: 522096199

Source-Link: googleapis/googleapis@d9592ed

Source-Link: googleapis/googleapis-gen@0ab428e
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMGFiNDI4ZTM5MzQ5ODFkYjljOGM3YmYxN2IxZmVhNWQ3NDY4MmFmYiJ9
codyoss pushed a commit that referenced this issue Apr 10, 2023
feat: support per-entity search and autocomplete
feat: support new filter syntax for recommendation
feat: expose A/B experiment info in search response
docs: keep the API doc up-to-date with recent changes

PiperOrigin-RevId: 522675951

Source-Link: googleapis/googleapis@f149e91

Source-Link: googleapis/googleapis-gen@c4538a8
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYzQ1MzhhODg4ZDJlYzEzY2U3MTljMWExYWE5ZGM3ZGU1YjE3Mzc1YSJ9
BEGIN_NESTED_COMMIT
feat(retail): support per-entity search and autocomplete
feat: add model get API
feat: support new filter syntax for recommendation
feat: expose A/B experiment info in search response
docs: keep the API doc up-to-date with recent changes

PiperOrigin-RevId: 522675546

Source-Link: googleapis/googleapis@81b0808

Source-Link: googleapis/googleapis-gen@e950439
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiZTk1MDQzOWNkMGQ0ODZhYjhkMmIzMjY3MmI1NGMwYTZiNjQ1MTQyMCJ9
END_NESTED_COMMIT
BEGIN_NESTED_COMMIT
feat(container): Add support for updating additional pod IPv4 ranges for Standard and Autopilot clusters

Users can append more pod ranges by name to an existing cluster at the cluster level. When users or Node Auto-provisioning create new node pools, GKE will select the most available pod range and assign it to the node pool. These pod ranges can be removed once no node pool is using it.

PiperOrigin-RevId: 522620935

Source-Link: googleapis/googleapis@2ddfcb8

Source-Link: googleapis/googleapis-gen@8c7eccd
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiOGM3ZWNjZDA5N2I3OTg5ZDcyY2FlOTU1ZmFmNWVkOGUzZmRjYmM3NSJ9
END_NESTED_COMMIT
BEGIN_NESTED_COMMIT
chore(compute): disable Go compute targets (#794)

Source-Link: googleapis/googleapis@cc293c6

Source-Link: googleapis/googleapis-gen@6bb5382
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNmJiNTM4MmFiM2NkMzIyY2MxMjI4ZWI1ODdhZGI1ZTEyMzVjNWJkMyJ9
END_NESTED_COMMIT
BEGIN_NESTED_COMMIT
fix(compute): add diregapic flag for compute (#793)

Source-Link: googleapis/googleapis@f9702dc

Source-Link: googleapis/googleapis-gen@2d6c055
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMmQ2YzA1NWYwMTY0NmMxNjM5MTAwZDk5MjJiMjdhOTg5MGJmMmM2NiJ9
END_NESTED_COMMIT
BEGIN_NESTED_COMMIT
chore(compute): add Go build targets for compute (#792)

Note: manually updated proto file, but it yields the same result of the new disco-converter would generate.

Fixes: #7345
Source-Link: googleapis/googleapis@59828ba

Source-Link: googleapis/googleapis-gen@2649582
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMjY0OTU4MjU3YzUzNTJkYjBiYzkxMGMwMGYxNDdiODIxYjAxMDYzNiJ9
END_NESTED_COMMIT
BEGIN_NESTED_COMMIT
chore(workflows): update gapic-generator-go version to 0.35.4
chore: add snippets to BUILD.bazel go_gapic_assembly_pkg

PiperOrigin-RevId: 522373543

Source-Link: googleapis/googleapis@130f097

Source-Link: googleapis/googleapis-gen@7d1457a
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiN2QxNDU3YWJlYzJmMGQyMDVmZGE2NzNhNGU2NTA4YjQxZGMxZTYzMSJ9
END_NESTED_COMMIT
BEGIN_NESTED_COMMIT
feat(contactcenterinsights): Launch UploadConversation endpoint

PiperOrigin-RevId: 522129764

Source-Link: googleapis/googleapis@dabc235

Source-Link: googleapis/googleapis-gen@5609ad0
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNTYwOWFkMDg4Y2NmMTVhMWMyMmRmN2FhZWIzMTMzZmJlYTU2Nzk5ZSJ9
END_NESTED_COMMIT
BEGIN_NESTED_COMMIT
feat(container): add support for disabling pod IP cidr overprovision

This feature requires special allowlisting for the projects.

PiperOrigin-RevId: 522103451

Source-Link: googleapis/googleapis@013b597

Source-Link: googleapis/googleapis-gen@2fe6962
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMmZlNjk2MmY5YzhlNzcwMzk2ZGNmYzg4ZTEwNGU1ZDcxM2MyZTY2ZSJ9
END_NESTED_COMMIT
BEGIN_NESTED_COMMIT
feat(security/privateca): added ignore_dependent_resources to DeleteCaPoolRequest, DeleteCertificateAuthorityRequest, DisableCertificateAuthorityRequest

PiperOrigin-RevId: 522096199

Source-Link: googleapis/googleapis@d9592ed

Source-Link: googleapis/googleapis-gen@0ab428e
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMGFiNDI4ZTM5MzQ5ODFkYjljOGM3YmYxN2IxZmVhNWQ3NDY4MmFmYiJ9
END_NESTED_COMMIT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: cloudprofiler Issues related to the Cloud Profiler API. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.
Projects
None yet
Development

No branches or pull requests

3 participants