-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Deprecate all Scraper helpers in scraperhelper #11732
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Deprecate all Scraper helpers in scraperhelper
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
- Loading branch information
commit c0fec8a83b678ac228b579a1844eb25212afda7b
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Use this changelog template to create an entry for release notes. | ||
|
||
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' | ||
change_type: deprecation | ||
|
||
# The name of the component, or a single word describing the area of concern, (e.g. otlpreceiver) | ||
component: scraperhelper | ||
|
||
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). | ||
note: Deprecate all Scraper helpers in scraperhelper | ||
|
||
# One or more tracking issues or pull requests related to the change | ||
issues: [11732] | ||
|
||
# (Optional) One or more lines of additional information to render under the primary note. | ||
# These lines will be padded with 2 spaces and then inserted directly into the document. | ||
# Use pipe (|) for multiline entries. | ||
subtext: Deprecate ScrapeFunc, ScraperOption, WithStart, WithShutdown in favor of equivalent funcs in scraper package. | ||
|
||
# Optional: The change log or logs in which this entry should be included. | ||
# e.g. '[user]' or '[user, api]' | ||
# Include 'user' if the change is relevant to end users. | ||
# Include 'api' if there is a change to a library API. | ||
# Default: '[user]' | ||
change_logs: [user] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,21 +9,15 @@ | |
|
||
"go.opentelemetry.io/collector/component" | ||
"go.opentelemetry.io/collector/pdata/pmetric" | ||
"go.opentelemetry.io/collector/scraper" | ||
) | ||
|
||
var errNilFunc = errors.New("nil scrape func") | ||
|
||
// ScrapeFunc scrapes metrics. | ||
// Deprecated: [v0.115.0] use scraper.ScrapeMetricsFunc. | ||
type ScrapeFunc func(context.Context) (pmetric.Metrics, error) | ||
|
||
func (sf ScrapeFunc) ScrapeMetrics(ctx context.Context) (pmetric.Metrics, error) { | ||
return sf(ctx) | ||
} | ||
|
||
// Deprecated: [v0.115.0] use ScrapeMetrics. | ||
func (sf ScrapeFunc) Scrape(ctx context.Context) (pmetric.Metrics, error) { | ||
return sf.ScrapeMetrics(ctx) | ||
return sf(ctx) | ||
} | ||
|
||
// Deprecated: [v0.115.0] use scraper.Metrics. | ||
|
@@ -32,7 +26,7 @@ | |
Scrape(context.Context) (pmetric.Metrics, error) | ||
} | ||
|
||
// ScraperOption apply changes to internal options. | ||
// Deprecated: [v0.115.0] use scraper.Option. | ||
type ScraperOption interface { | ||
apply(*baseScraper) | ||
} | ||
|
@@ -43,14 +37,14 @@ | |
of(e) | ||
} | ||
|
||
// WithStart sets the function that will be called on startup. | ||
// Deprecated: [v0.115.0] use scraper.WithStart. | ||
func WithStart(start component.StartFunc) ScraperOption { | ||
return scraperOptionFunc(func(o *baseScraper) { | ||
o.StartFunc = start | ||
}) | ||
} | ||
|
||
// WithShutdown sets the function that will be called on shutdown. | ||
// Deprecated: [v0.115.0] use scraper.WithShutdown. | ||
func WithShutdown(shutdown component.ShutdownFunc) ScraperOption { | ||
return scraperOptionFunc(func(o *baseScraper) { | ||
o.ShutdownFunc = shutdown | ||
|
@@ -63,14 +57,8 @@ | |
ScrapeFunc | ||
} | ||
|
||
// NewScraper creates a scraper.Metrics that calls ScrapeMetrics at the specified collection interval, | ||
// reports observability information, and passes the scraped metrics to the next consumer. | ||
func NewScraper(scrape ScrapeFunc, options ...ScraperOption) (scraper.Metrics, error) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not breaking change because not released yet. |
||
return newBaseScraper(scrape, options...) | ||
} | ||
|
||
// TODO: Remove this and embed into NewScraper when NewScraperWithoutType is removed. | ||
func newBaseScraper(scrape ScrapeFunc, options ...ScraperOption) (*baseScraper, error) { | ||
// Deprecated: [v0.115.0] use scraper.NewMetrics. | ||
func NewScraperWithoutType(scrape ScrapeFunc, options ...ScraperOption) (Scraper, error) { | ||
if scrape == nil { | ||
return nil, errNilFunc | ||
} | ||
|
@@ -83,8 +71,3 @@ | |
|
||
return bs, nil | ||
} | ||
|
||
// Deprecated: [v0.115.0] use NewScraper. | ||
func NewScraperWithoutType(scrape ScrapeFunc, options ...ScraperOption) (Scraper, error) { | ||
return newBaseScraper(scrape, options...) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not released.