diff --git a/CHANGELOG.md b/CHANGELOG.md index 275e9bc5acd8..ee1274f06c82 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,8 @@ Main (unreleased) - Upgrade the embedded windows_exporter to commit 79781c6. (@jkroepke) - Prometheus exporters in Flow mode now set the `instance` label to a value similar to the one they used to have in Static mode ( by default, customized by some integrations). (@jcreixell) + +- `phlare.scrape` and `phlare.write` have been renamed to `pyroscope.scrape` and `pyroscope.scrape`. (@korniltsev) ### Features diff --git a/component/all/all.go b/component/all/all.go index cd545336ccef..2abb4db92811 100644 --- a/component/all/all.go +++ b/component/all/all.go @@ -58,8 +58,6 @@ import ( _ "github.com/grafana/agent/component/otelcol/receiver/otlp" // Import otelcol.receiver.otlp _ "github.com/grafana/agent/component/otelcol/receiver/prometheus" // Import otelcol.receiver.prometheus _ "github.com/grafana/agent/component/otelcol/receiver/zipkin" // Import otelcol.receiver.zipkin - _ "github.com/grafana/agent/component/phlare/scrape" // Import phlare.scrape - _ "github.com/grafana/agent/component/phlare/write" // Import phlare.write _ "github.com/grafana/agent/component/prometheus/exporter/apache" // Import prometheus.exporter.apache _ "github.com/grafana/agent/component/prometheus/exporter/blackbox" // Import prometheus.exporter.blackbox _ "github.com/grafana/agent/component/prometheus/exporter/consul" // Import prometheus.exporter.consul @@ -82,6 +80,8 @@ import ( _ "github.com/grafana/agent/component/prometheus/relabel" // Import prometheus.relabel _ "github.com/grafana/agent/component/prometheus/remotewrite" // Import prometheus.remote_write _ "github.com/grafana/agent/component/prometheus/scrape" // Import prometheus.scrape + _ "github.com/grafana/agent/component/pyroscope/scrape" // Import pyroscope.scrape + _ "github.com/grafana/agent/component/pyroscope/write" // Import pyroscope.write _ "github.com/grafana/agent/component/remote/http" // Import remote.http _ "github.com/grafana/agent/component/remote/s3" // Import remote.s3 _ "github.com/grafana/agent/component/remote/vault" // Import remote.vault diff --git a/component/phlare/appender.go b/component/pyroscope/appender.go similarity index 96% rename from component/phlare/appender.go rename to component/pyroscope/appender.go index 9bce62b8c010..2863b94579e7 100644 --- a/component/phlare/appender.go +++ b/component/pyroscope/appender.go @@ -1,4 +1,4 @@ -package phlare +package pyroscope import ( "context" @@ -40,8 +40,8 @@ type Fanout struct { // NewFanout creates a fanout appendable. func NewFanout(children []Appendable, componentID string, register prometheus.Registerer) *Fanout { wl := prometheus.NewHistogram(prometheus.HistogramOpts{ - Name: "phlare_fanout_latency", - Help: "Write latency for sending to phlare profiles", + Name: "pyroscope_fanout_latency", + Help: "Write latency for sending to pyroscope profiles", }) _ = register.Register(wl) return &Fanout{ diff --git a/component/phlare/appender_test.go b/component/pyroscope/appender_test.go similarity index 98% rename from component/phlare/appender_test.go rename to component/pyroscope/appender_test.go index 65b251bf2fb1..390014bb44bb 100644 --- a/component/phlare/appender_test.go +++ b/component/pyroscope/appender_test.go @@ -1,4 +1,4 @@ -package phlare +package pyroscope import ( "context" diff --git a/component/phlare/scrape/manager.go b/component/pyroscope/scrape/manager.go similarity index 96% rename from component/phlare/scrape/manager.go rename to component/pyroscope/scrape/manager.go index 8bae81fc02e6..6d370131c70c 100644 --- a/component/phlare/scrape/manager.go +++ b/component/pyroscope/scrape/manager.go @@ -7,9 +7,8 @@ import ( "github.com/go-kit/log" "github.com/go-kit/log/level" + "github.com/grafana/agent/component/pyroscope" "github.com/prometheus/prometheus/discovery/targetgroup" - - "github.com/grafana/agent/component/phlare" ) var reloadInterval = 5 * time.Second @@ -18,7 +17,7 @@ type Manager struct { logger log.Logger graceShut chan struct{} - appendable phlare.Appendable + appendable pyroscope.Appendable mtxScrape sync.Mutex // Guards the fields below. config Arguments @@ -28,7 +27,7 @@ type Manager struct { triggerReload chan struct{} } -func NewManager(appendable phlare.Appendable, logger log.Logger) *Manager { +func NewManager(appendable pyroscope.Appendable, logger log.Logger) *Manager { if logger == nil { logger = log.NewNopLogger() } diff --git a/component/phlare/scrape/manager_test.go b/component/pyroscope/scrape/manager_test.go similarity index 90% rename from component/phlare/scrape/manager_test.go rename to component/pyroscope/scrape/manager_test.go index bdb4dafadbbe..3345425c4962 100644 --- a/component/phlare/scrape/manager_test.go +++ b/component/pyroscope/scrape/manager_test.go @@ -5,7 +5,7 @@ import ( "testing" "time" - "github.com/grafana/agent/component/phlare" + "github.com/grafana/agent/component/pyroscope" "github.com/grafana/agent/pkg/util" "github.com/prometheus/common/model" "github.com/prometheus/prometheus/discovery/targetgroup" @@ -16,7 +16,7 @@ import ( func TestManager(t *testing.T) { reloadInterval = time.Millisecond - m := NewManager(phlare.AppendableFunc(func(ctx context.Context, labels labels.Labels, samples []*phlare.RawSample) error { + m := NewManager(pyroscope.AppendableFunc(func(ctx context.Context, labels labels.Labels, samples []*pyroscope.RawSample) error { return nil }), util.TestLogger(t)) diff --git a/component/phlare/scrape/scrape.go b/component/pyroscope/scrape/scrape.go similarity index 97% rename from component/phlare/scrape/scrape.go rename to component/pyroscope/scrape/scrape.go index 4329b463218e..d19efb1e2d11 100644 --- a/component/phlare/scrape/scrape.go +++ b/component/pyroscope/scrape/scrape.go @@ -8,13 +8,13 @@ import ( "time" "github.com/go-kit/log/level" + "github.com/grafana/agent/component/pyroscope" "github.com/prometheus/common/model" "github.com/prometheus/prometheus/discovery/targetgroup" "github.com/grafana/agent/component" component_config "github.com/grafana/agent/component/common/config" "github.com/grafana/agent/component/discovery" - "github.com/grafana/agent/component/phlare" "github.com/grafana/agent/component/prometheus/scrape" ) @@ -29,7 +29,7 @@ const ( func init() { component.Register(component.Registration{ - Name: "phlare.scrape", + Name: "pyroscope.scrape", Args: Arguments{}, Build: func(opts component.Options, args component.Arguments) (component.Component, error) { @@ -41,8 +41,8 @@ func init() { // Arguments holds values which are used to configure the pprof.scrape // component. type Arguments struct { - Targets []discovery.Target `river:"targets,attr"` - ForwardTo []phlare.Appendable `river:"forward_to,attr"` + Targets []discovery.Target `river:"targets,attr"` + ForwardTo []pyroscope.Appendable `river:"forward_to,attr"` // The job name to override the job label with. JobName string `river:"job_name,attr,optional"` @@ -218,14 +218,14 @@ type Component struct { mut sync.RWMutex args Arguments scraper *Manager - appendable *phlare.Fanout + appendable *pyroscope.Fanout } var _ component.Component = (*Component)(nil) // New creates a new pprof.scrape component. func New(o component.Options, args Arguments) (*Component, error) { - flowAppendable := phlare.NewFanout(args.ForwardTo, o.ID, o.Registerer) + flowAppendable := pyroscope.NewFanout(args.ForwardTo, o.ID, o.Registerer) scraper := NewManager(flowAppendable, o.Logger) c := &Component{ opts: o, diff --git a/component/phlare/scrape/scrape_loop.go b/component/pyroscope/scrape/scrape_loop.go similarity index 94% rename from component/phlare/scrape/scrape_loop.go rename to component/pyroscope/scrape/scrape_loop.go index 756e8a3f6585..c142d7e4f1a0 100644 --- a/component/phlare/scrape/scrape_loop.go +++ b/component/pyroscope/scrape/scrape_loop.go @@ -12,12 +12,12 @@ import ( "github.com/go-kit/log" "github.com/go-kit/log/level" + "github.com/grafana/agent/component/pyroscope" commonconfig "github.com/prometheus/common/config" "github.com/prometheus/prometheus/discovery/targetgroup" "github.com/prometheus/prometheus/util/pool" "golang.org/x/net/context/ctxhttp" - "github.com/grafana/agent/component/phlare" "github.com/grafana/agent/pkg/build" ) @@ -31,14 +31,14 @@ type scrapePool struct { logger log.Logger scrapeClient *http.Client - appendable phlare.Appendable + appendable pyroscope.Appendable mtx sync.RWMutex activeTargets map[uint64]*scrapeLoop droppedTargets []*Target } -func newScrapePool(cfg Arguments, appendable phlare.Appendable, logger log.Logger) (*scrapePool, error) { +func newScrapePool(cfg Arguments, appendable pyroscope.Appendable, logger log.Logger) (*scrapePool, error) { scrapeClient, err := commonconfig.NewClientFromConfig(*cfg.HTTPClientConfig.Convert(), cfg.JobName) if err != nil { return nil, err @@ -164,7 +164,7 @@ type scrapeLoop struct { lastScrapeSize int scrapeClient *http.Client - appendable phlare.Appendable + appendable pyroscope.Appendable req *http.Request logger log.Logger @@ -174,7 +174,7 @@ type scrapeLoop struct { wg sync.WaitGroup } -func newScrapeLoop(t *Target, scrapeClient *http.Client, appendable phlare.Appendable, interval, timeout time.Duration, logger log.Logger) *scrapeLoop { +func newScrapeLoop(t *Target, scrapeClient *http.Client, appendable pyroscope.Appendable, interval, timeout time.Duration, logger log.Logger) *scrapeLoop { return &scrapeLoop{ Target: t, logger: logger, @@ -238,7 +238,7 @@ func (t *scrapeLoop) scrape() { if len(b) > 0 { t.lastScrapeSize = len(b) } - if err := t.appendable.Appender().Append(context.Background(), t.labels, []*phlare.RawSample{{RawProfile: b}}); err != nil { + if err := t.appendable.Appender().Append(context.Background(), t.labels, []*pyroscope.RawSample{{RawProfile: b}}); err != nil { level.Error(t.logger).Log("msg", "push failed", "labels", t.Labels().String(), "err", err) t.updateTargetStatus(start, err) return diff --git a/component/phlare/scrape/scrape_loop_test.go b/component/pyroscope/scrape/scrape_loop_test.go similarity index 96% rename from component/phlare/scrape/scrape_loop_test.go rename to component/pyroscope/scrape/scrape_loop_test.go index c480e310fc84..cc61f5bd5be8 100644 --- a/component/phlare/scrape/scrape_loop_test.go +++ b/component/pyroscope/scrape/scrape_loop_test.go @@ -11,7 +11,7 @@ import ( "time" "github.com/grafana/agent/component/discovery" - "github.com/grafana/agent/component/phlare" + "github.com/grafana/agent/component/pyroscope" "github.com/grafana/agent/pkg/util" "github.com/prometheus/common/model" "github.com/prometheus/prometheus/discovery/targetgroup" @@ -32,8 +32,8 @@ func TestScrapePool(t *testing.T) { args.ProfilingConfig.Goroutine.Enabled = false args.ProfilingConfig.Memory.Enabled = false - p, err := newScrapePool(args, phlare.AppendableFunc( - func(ctx context.Context, labels labels.Labels, samples []*phlare.RawSample) error { + p, err := newScrapePool(args, pyroscope.AppendableFunc( + func(ctx context.Context, labels labels.Labels, samples []*pyroscope.RawSample) error { return nil }), util.TestLogger(t)) @@ -180,7 +180,7 @@ func TestScrapeLoop(t *testing.T) { "seconds": []string{"1"}, }), server.Client(), - phlare.AppendableFunc(func(_ context.Context, labels labels.Labels, samples []*phlare.RawSample) error { + pyroscope.AppendableFunc(func(_ context.Context, labels labels.Labels, samples []*pyroscope.RawSample) error { appendTotal.Inc() require.Equal(t, []byte("ok"), samples[0].RawProfile) return nil diff --git a/component/phlare/scrape/scrape_test.go b/component/pyroscope/scrape/scrape_test.go similarity index 98% rename from component/phlare/scrape/scrape_test.go rename to component/pyroscope/scrape/scrape_test.go index ef9e5bb36195..62c5d7c50c57 100644 --- a/component/phlare/scrape/scrape_test.go +++ b/component/pyroscope/scrape/scrape_test.go @@ -11,8 +11,8 @@ import ( "github.com/grafana/agent/component" "github.com/grafana/agent/component/discovery" - "github.com/grafana/agent/component/phlare" "github.com/grafana/agent/component/prometheus/scrape" + "github.com/grafana/agent/component/pyroscope" "github.com/grafana/agent/pkg/cluster" "github.com/grafana/agent/pkg/river" "github.com/grafana/agent/pkg/util" @@ -46,7 +46,7 @@ func TestComponent(t *testing.T) { require.Empty(t, c.appendable.Children()) require.Empty(t, c.DebugInfo().(scrape.ScraperStatus).TargetStatus) - arg.ForwardTo = []phlare.Appendable{phlare.NoopAppendable} + arg.ForwardTo = []pyroscope.Appendable{pyroscope.NoopAppendable} arg.Targets = []discovery.Target{ { model.AddressLabel: "foo", diff --git a/component/phlare/scrape/target.go b/component/pyroscope/scrape/target.go similarity index 100% rename from component/phlare/scrape/target.go rename to component/pyroscope/scrape/target.go diff --git a/component/phlare/scrape/target_test.go b/component/pyroscope/scrape/target_test.go similarity index 100% rename from component/phlare/scrape/target_test.go rename to component/pyroscope/scrape/target_test.go diff --git a/component/phlare/write/metrics.go b/component/pyroscope/write/metrics.go similarity index 64% rename from component/phlare/write/metrics.go rename to component/pyroscope/write/metrics.go index 50de7c823b74..b7f50021a496 100644 --- a/component/phlare/write/metrics.go +++ b/component/pyroscope/write/metrics.go @@ -13,24 +13,24 @@ type metrics struct { func newMetrics(reg prometheus.Registerer) *metrics { m := &metrics{ sentBytes: prometheus.NewCounterVec(prometheus.CounterOpts{ - Name: "phlare_write_sent_bytes_total", - Help: "Total number of compressed bytes sent to Phlare.", + Name: "pyroscope_write_sent_bytes_total", + Help: "Total number of compressed bytes sent to Pyroscope.", }, []string{"endpoint"}), droppedBytes: prometheus.NewCounterVec(prometheus.CounterOpts{ - Name: "phlare_write_dropped_bytes_total", - Help: "Total number of compressed bytes dropped by Phlare.", + Name: "pyroscope_write_dropped_bytes_total", + Help: "Total number of compressed bytes dropped by Pyroscope.", }, []string{"endpoint"}), sentProfiles: prometheus.NewCounterVec(prometheus.CounterOpts{ - Name: "phlare_write_sent_profiles_total", - Help: "Total number of profiles sent to Phlare.", + Name: "pyroscope_write_sent_profiles_total", + Help: "Total number of profiles sent to Pyroscope.", }, []string{"endpoint"}), droppedProfiles: prometheus.NewCounterVec(prometheus.CounterOpts{ - Name: "phlare_write_dropped_profiles_total", - Help: "Total number of profiles dropped by Phlare.", + Name: "pyroscope_write_dropped_profiles_total", + Help: "Total number of profiles dropped by Pyroscope.", }, []string{"endpoint"}), retries: prometheus.NewCounterVec(prometheus.CounterOpts{ - Name: "phlare_write_retries_total", - Help: "Total number of retries to Phlare.", + Name: "pyroscope_write_retries_total", + Help: "Total number of retries to Pyroscope.", }, []string{"endpoint"}), } diff --git a/component/phlare/write/write.go b/component/pyroscope/write/write.go similarity index 93% rename from component/phlare/write/write.go rename to component/pyroscope/write/write.go index 0814955e5cbb..d75c8b103201 100644 --- a/component/phlare/write/write.go +++ b/component/pyroscope/write/write.go @@ -9,6 +9,7 @@ import ( "github.com/bufbuild/connect-go" "github.com/go-kit/log/level" + "github.com/grafana/agent/component/pyroscope" "github.com/oklog/run" commonconfig "github.com/prometheus/common/config" "github.com/prometheus/common/model" @@ -17,7 +18,6 @@ import ( "github.com/grafana/agent/component" "github.com/grafana/agent/component/common/config" - "github.com/grafana/agent/component/phlare" "github.com/grafana/agent/pkg/build" "github.com/grafana/dskit/backoff" pushv1 "github.com/grafana/phlare/api/gen/proto/go/push/v1" @@ -35,7 +35,7 @@ var ( func init() { component.Register(component.Registration{ - Name: "phlare.write", + Name: "pyroscope.write", Args: Arguments{}, Exports: Exports{}, Build: func(o component.Options, c component.Arguments) (component.Component, error) { @@ -44,7 +44,7 @@ func init() { }) } -// Arguments represents the input state of the phlare.write +// Arguments represents the input state of the pyroscope.write // component. type Arguments struct { ExternalLabels map[string]string `river:"external_labels,attr,optional"` @@ -60,7 +60,7 @@ func (rc *Arguments) UnmarshalRiver(f func(interface{}) error) error { } // EndpointOptions describes an individual location for where profiles -// should be delivered to using the Phlare push API. +// should be delivered to using the Pyroscope push API. type EndpointOptions struct { Name string `river:"name,attr,optional"` URL string `river:"url,attr"` @@ -102,19 +102,19 @@ func (r *EndpointOptions) UnmarshalRiver(f func(v interface{}) error) error { return nil } -// Component is the phlare.write component. +// Component is the pyroscope.write component. type Component struct { opts component.Options cfg Arguments metrics *metrics } -// Exports are the set of fields exposed by the phlare.write component. +// Exports are the set of fields exposed by the pyroscope.write component. type Exports struct { - Receiver phlare.Appendable `river:"receiver,attr"` + Receiver pyroscope.Appendable `river:"receiver,attr"` } -// NewComponent creates a new phlare.write component. +// NewComponent creates a new pyroscope.write component. func NewComponent(o component.Options, c Arguments) (*Component, error) { metrics := newMetrics(o.Registerer) receiver, err := NewFanOut(o, c, metrics) @@ -142,7 +142,7 @@ func (c *Component) Run(ctx context.Context) error { // Update implements Component. func (c *Component) Update(newConfig component.Arguments) error { c.cfg = newConfig.(Arguments) - level.Debug(c.opts.Logger).Log("msg", "updating phlare.write config", "old", c.cfg, "new", newConfig) + level.Debug(c.opts.Logger).Log("msg", "updating pyroscope.write config", "old", c.cfg, "new", newConfig) receiver, err := NewFanOut(c.opts, newConfig.(Arguments), c.metrics) if err != nil { return err @@ -269,13 +269,13 @@ func requestSize(req *connect.Request[pushv1.PushRequest]) (int64, int64) { return size, profiles } -// Append implements the phlare.Appendable interface. -func (f *fanOutClient) Appender() phlare.Appender { +// Append implements the pyroscope.Appendable interface. +func (f *fanOutClient) Appender() pyroscope.Appender { return f } // Append implements the Appender interface. -func (f *fanOutClient) Append(ctx context.Context, lbs labels.Labels, samples []*phlare.RawSample) error { +func (f *fanOutClient) Append(ctx context.Context, lbs labels.Labels, samples []*pyroscope.RawSample) error { // todo(ctovena): we should probably pool the label pair arrays and label builder to avoid allocs. var ( protoLabels = make([]*typesv1.LabelPair, 0, len(lbs)+len(f.config.ExternalLabels)) diff --git a/component/phlare/write/write_test.go b/component/pyroscope/write/write_test.go similarity index 96% rename from component/phlare/write/write_test.go rename to component/pyroscope/write/write_test.go index ea78901d5385..75bc2f51f82b 100644 --- a/component/phlare/write/write_test.go +++ b/component/pyroscope/write/write_test.go @@ -11,7 +11,7 @@ import ( "github.com/bufbuild/connect-go" "github.com/grafana/agent/component" - "github.com/grafana/agent/component/phlare" + "github.com/grafana/agent/component/pyroscope" "github.com/grafana/agent/pkg/river" "github.com/grafana/agent/pkg/util" pushv1 "github.com/grafana/phlare/api/gen/proto/go/push/v1" @@ -79,7 +79,7 @@ func Test_Write_FanOut(t *testing.T) { s.Close() } }() - createReceiver := func(t *testing.T, arg Arguments) phlare.Appendable { + createReceiver := func(t *testing.T, arg Arguments) pyroscope.Appendable { t.Helper() var wg sync.WaitGroup wg.Add(1) @@ -110,7 +110,7 @@ func Test_Write_FanOut(t *testing.T) { "__type__": "type", "job": "foo", "foo": "bar", - }), []*phlare.RawSample{ + }), []*pyroscope.RawSample{ {RawProfile: []byte("pprofraw")}, }) require.EqualErrorf(t, err, "unknown: test", "expected error to be test") @@ -126,7 +126,7 @@ func Test_Write_FanOut(t *testing.T) { "__type__": "type", "job": "foo", "foo": "bar", - }), []*phlare.RawSample{ + }), []*pyroscope.RawSample{ {RawProfile: []byte("pprofraw")}, }) require.NoError(t, err) @@ -143,7 +143,7 @@ func Test_Write_FanOut(t *testing.T) { "__type__": "type", "job": "foo", "foo": "bar", - }), []*phlare.RawSample{ + }), []*pyroscope.RawSample{ {RawProfile: []byte("pprofraw")}, }) require.Error(t, err) @@ -177,7 +177,7 @@ func Test_Write_Update(t *testing.T) { // First one is a noop err = export.Receiver.Appender().Append(context.Background(), labels.FromMap(map[string]string{ "__name__": "test", - }), []*phlare.RawSample{ + }), []*pyroscope.RawSample{ {RawProfile: []byte("pprofraw")}, }) require.NoError(t, err) @@ -201,7 +201,7 @@ func Test_Write_Update(t *testing.T) { wg.Wait() err = export.Receiver.Appender().Append(context.Background(), labels.FromMap(map[string]string{ "__name__": "test", - }), []*phlare.RawSample{ + }), []*pyroscope.RawSample{ {RawProfile: []byte("pprofraw")}, }) require.NoError(t, err) diff --git a/docs/developer/writing-flow-component-documentation.md b/docs/developer/writing-flow-component-documentation.md index eccd839a42c5..e95baa8e88cf 100644 --- a/docs/developer/writing-flow-component-documentation.md +++ b/docs/developer/writing-flow-component-documentation.md @@ -137,7 +137,7 @@ For example: ## Usage ```river -phlare.scrape "LABEL" { +pyroscope.scrape "LABEL" { targets = TARGET_LIST forward_to = RECEIVER_LIST } diff --git a/docs/sources/flow/reference/components/phlare.scrape.md b/docs/sources/flow/reference/components/pyroscope.scrape.md similarity index 92% rename from docs/sources/flow/reference/components/phlare.scrape.md rename to docs/sources/flow/reference/components/pyroscope.scrape.md index 97784e0ce074..314d0f89bd19 100644 --- a/docs/sources/flow/reference/components/phlare.scrape.md +++ b/docs/sources/flow/reference/components/pyroscope.scrape.md @@ -1,23 +1,23 @@ --- -title: phlare.scrape +title: pyroscope.scrape labels: stage: beta --- -# phlare.scrape +# pyroscope.scrape {{< docs/shared lookup="flow/stability/beta.md" source="agent" >}} -`phlare.scrape` configures a [pprof] scraping job for a given set of +`pyroscope.scrape` configures a [pprof] scraping job for a given set of `targets`. The scraped performance profiles are forwarded to the list of receivers passed in `forward_to`. -Multiple `phlare.scrape` components can be specified by giving them different labels. +Multiple `pyroscope.scrape` components can be specified by giving them different labels. ## Usage ```river -phlare.scrape "LABEL" { +pyroscope.scrape "LABEL" { targets = TARGET_LIST forward_to = RECEIVER_LIST } @@ -67,7 +67,7 @@ Name | Type | Description | Default | Required ## Blocks -The following blocks are supported inside the definition of `phlare.scrape`: +The following blocks are supported inside the definition of `pyroscope.scrape`: Hierarchy | Block | Description | Required --------- | ----- | ----------- | -------- @@ -258,7 +258,7 @@ Name | Type | Description | Default | Required `enabled` | `bool` | Enables sharing targets with other cluster nodes. | `false` | yes When the agent is running in [clustered mode][], and `enabled` is set to true, -then this `phlare.scrape` component instance opts-in to participating in the +then this `pyroscope.scrape` component instance opts-in to participating in the cluster to distribute scrape load between all cluster nodes. Clustering causes the set of targets to be locally filtered down to a unique @@ -276,26 +276,26 @@ If the agent is _not_ running in clustered mode, this block is a no-op. ## Exported fields -`phlare.scrape` does not export any fields that can be referenced by other +`pyroscope.scrape` does not export any fields that can be referenced by other components. ## Component health -`phlare.scrape` is only reported as unhealthy if given an invalid +`pyroscope.scrape` is only reported as unhealthy if given an invalid configuration. ## Debug information -`phlare.scrape` reports the status of the last scrape for each configured +`pyroscope.scrape` reports the status of the last scrape for each configured scrape job on the component's debug endpoint. ## Debug metrics -* `phlare_fanout_latency` (histogram): Write latency for sending to direct and indirect components. +* `pyroscope_fanout_latency` (histogram): Write latency for sending to direct and indirect components. ## Scraping behavior -The `phlare.scrape` component borrows the scraping behavior of Prometheus. +The `pyroscope.scrape` component borrows the scraping behavior of Prometheus. Prometheus, and by extension, this component, uses a pull model for scraping profiles from a given set of _targets_. Each scrape target is defined as a set of key-value pairs called _labels_. @@ -318,7 +318,7 @@ to each receiver listed in the component's `forward_to` argument. Labels coming from targets, that start with a double underscore `__` are treated as _internal_, and are removed prior to scraping. -The `phlare.scrape` component regards a scrape as successful if it +The `pyroscope.scrape` component regards a scrape as successful if it responded with an HTTP `200 OK` status code and returned a body of valid [pprof] profile. If the scrape request fails, the component's debug UI section contains more @@ -335,16 +335,16 @@ instance | The `__address__` or `:` of the scrape targe ## Example -The following example sets up the scrape job with certain attributes (profiling config, targets) and lets it scrape two local applications (the Agent itself and Phlare). +The following example sets up the scrape job with certain attributes (profiling config, targets) and lets it scrape two local applications (the Agent itself and Pyroscope). The exposed profiles are sent over to the provided list of receivers, as defined by other components. ```river -phlare.scrape "local" { +pyroscope.scrape "local" { targets = [ - {"__address__" = "localhost:4100", "app"="phlare"}, + {"__address__" = "localhost:4100", "app"="pyroscope"}, {"__address__" = "localhost:12345", "app"="agent"}, ] - forward_to = [phlare.write.local.receiver] + forward_to = [pyroscope.write.local.receiver] profiling_config { profile.fgprof { enabled = true diff --git a/docs/sources/flow/reference/components/phlare.write.md b/docs/sources/flow/reference/components/pyroscope.write.md similarity index 84% rename from docs/sources/flow/reference/components/phlare.write.md rename to docs/sources/flow/reference/components/pyroscope.write.md index 763c9751ee05..9af4cd0cb46a 100644 --- a/docs/sources/flow/reference/components/phlare.write.md +++ b/docs/sources/flow/reference/components/pyroscope.write.md @@ -1,25 +1,25 @@ --- -title: phlare.write +title: pyroscope.write labels: stage: beta --- -# phlare.write +# pyroscope.write {{< docs/shared lookup="flow/stability/beta.md" source="agent" >}} -`phlare.write` receives performance profiles from other components and forwards them -to a series of user-supplied endpoints using [Phlare' Push API](https://grafana.com/oss/phlare/). +`pyroscope.write` receives performance profiles from other components and forwards them +to a series of user-supplied endpoints using [Pyroscope' Push API](https://grafana.com/oss/phlare/). -Multiple `phlare.write` components can be specified by giving them +Multiple `pyroscope.write` components can be specified by giving them different labels. ## Usage ```river -phlare.write "LABEL" { +pyroscope.write "LABEL" { endpoint { - url = PHLARE_URL + url = PYROSCOPE_URL ... } @@ -39,7 +39,7 @@ Name | Type | Description | Default | Required ## Blocks The following blocks are supported inside the definition of -`phlare.write`: +`pyroscope.write`: Hierarchy | Block | Description | Required --------- | ----- | ----------- | -------- @@ -119,22 +119,22 @@ Name | Type | Description ## Component health -`phlare.write` is only reported as unhealthy if given an invalid +`pyroscope.write` is only reported as unhealthy if given an invalid configuration. In those cases, exported fields are kept at their last healthy values. ## Debug information -`phlare.write` does not expose any component-specific debug +`pyroscope.write` does not expose any component-specific debug information. ## Example ```river -phlare.write "staging" { - // Send metrics to a locally running Phlare instance. +pyroscope.write "staging" { + // Send metrics to a locally running Pyroscope instance. endpoint { - url = "http://phlare:4100" + url = "http://pyroscope:4100" headers = { "X-Scope-Org-ID" = "squad-1", } @@ -145,11 +145,11 @@ phlare.write "staging" { } -phlare.scrape "default" { +pyroscope.scrape "default" { targets = [ - {"__address__" = "phlare:4100", "app"="phlare"}, + {"__address__" = "pyroscope:4100", "app"="pyroscope"}, {"__address__" = "agent:12345", "app"="agent"}, ] - forward_to = [phlare.write.staging.receiver] + forward_to = [pyroscope.write.staging.receiver] } ``` diff --git a/docs/sources/flow/upgrade-guide.md b/docs/sources/flow/upgrade-guide.md index e0095618f23a..5b8a69fd021f 100644 --- a/docs/sources/flow/upgrade-guide.md +++ b/docs/sources/flow/upgrade-guide.md @@ -18,6 +18,44 @@ Grafana Agent Flow. > [upgrade-guide-static]: {{< relref "../static/upgrade-guide.md" >}} > [upgrade-guide-operator]: {{< relref "../operator/upgrade-guide.md" >}} +## v0.34 + +### Breaking change: `phlare.scrape` and `phlare.write` have been renamed to `pyroscope.scrape` and `pyroscope.scrape` + +Old configuration example: + +```river +phlare.write "staging" { + endpoint { + url = "http://phlare:4100" + } +} + +phlare.scrape "default" { + targets = [ + {"__address__" = "agent:12345", "app"="agent"}, + ] + forward_to = [phlare.write.staging.receiver] +} +``` + +New configuration example: + +```river +pyroscope.write "staging" { + endpoint { + url = "http://pyroscope:4100" + } +} + +pyroscope.scrape "default" { + targets = [ + {"__address__" = "agent:12345", "app"="agent"}, + ] + forward_to = [pyroscope.write.staging.receiver] +} +``` + ## v0.33 ### Symbolic links in Docker containers removed