## Specifying the receiver's capabilities

A receiver component can process traces, metrics, and logs. The receiver's
factory is responsible for specifying the capabilities that the receiver would
provide.

Given that tracing is the subject of this tutorial, we will enable the
`tailtracer` receiver to work with traces only. The `receiver` package provides
the following function and type to help the factory describe the trace
processing capabilities:

```go
func WithTraces(createTracesReceiver CreateTracesFunc, sl component.StabilityLevel) FactoryOption
```

The `receiver.WithTraces()` instantiates and returns a `receiver.FactoryOption`
and it requires the following parameters:

- `createTracesReceiver`: A reference to a function that matches the
  `receiver.CreateTracesFunc` type. The `receiver.CreateTracesFunc` type is a
  pointer to a function that is responsible for instantiating and returning a
  `receiver.Traces` instance, and it requires the following parameters:
  - `context.Context`: the reference to the Collector `context.Context`, so your
    trace receiver can properly manage its execution context.
  - `receiver.Settings`: the reference to some of the Collector settings under
    which your receiver is created.
  - `component.Config`: the reference for the receiver config settings passed by
    the Collector to the factory so it can properly read its settings from the
    Collector config.
  - `consumer.Traces`: the reference to the next `consumer.Traces` in the
    pipeline, which is where received traces will go. This is either a processor
    or an exporter.

Start by adding the bootstrap code to properly implement the
`receiver.CreateTracesFunc` function pointer. Go ahead and add the following
code to your `factory.go` file:

```go
func createTracesReceiver(_ context.Context, params receiver.Settings, baseCfg component.Config, consumer consumer.Traces) (receiver.Traces, error) {
	return nil, nil
}
```

You now have all the necessary components to successfully instantiate your
receiver factory using the `receiver.NewFactory` function. Go ahead and update
your `NewFactory()` function in the `factory.go` file as follows:

```go
// NewFactory creates a factory for tailtracer receiver.
func NewFactory() receiver.Factory {
	return receiver.NewFactory(
		typeStr,
		createDefaultConfig,
		receiver.WithTraces(createTracesReceiver, component.StabilityLevelAlpha))
}
```

After these changes, you will notice a few imports are missing, so here is what
your `factory.go` file should look like with the proper imports:

> tailtracer/factory.go

```go
package tailtracer

import (
	"context"
	"time"

	"go.opentelemetry.io/collector/component"
	"go.opentelemetry.io/collector/consumer"
	"go.opentelemetry.io/collector/receiver"
)

var (
	typeStr         = component.MustNewType("tailtracer")
)

const (
	defaultInterval = 1 * time.Minute
)

func createDefaultConfig() component.Config {
	return &Config{
		Interval: string(defaultInterval),
	}
}

func createTracesReceiver(_ context.Context, params receiver.Settings, baseCfg component.Config, consumer consumer.Traces) (receiver.Traces, error) {
	return nil, nil
}

// NewFactory creates a factory for tailtracer receiver.
func NewFactory() receiver.Factory {
	return receiver.NewFactory(
		typeStr,
		createDefaultConfig,
		receiver.WithTraces(createTracesReceiver, component.StabilityLevelAlpha))
}
```

> [!NOTE] Check your work
>
> - Imported the `context` package to support the `context.Context` type
>   referenced in the `createTracesReceiver` function.
> - Imported the `go.opentelemetry.io/collector/consumer` package to support the
>   `consumer.Traces` type referenced in the `createTracesReceiver` function.
> - Updated the `NewFactory()` function so it returns the `receiver.Factory`
>   generated by the `receiver.NewFactory()` call with the required parameters.
>   The generated receiver factory will be capable of processing traces via the
>   call to
>   `receiver.WithTraces(createTracesReceiver, component.StabilityLevelAlpha)`