Skip to content

Commit

Permalink
Merge pull request #41 from tomershafir/feat/grafana-pyroscope
Browse files Browse the repository at this point in the history
Add pyroscopereceiver and clickhouseprofileexporter READMEs
  • Loading branch information
akvlad authored Jan 3, 2024
2 parents 490afcf + 2f0dcc2 commit bc20882
Show file tree
Hide file tree
Showing 8 changed files with 86 additions and 12 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ processors:
new_name: traces_spanmetrics_latency
exporters:
qryn:
dsn: tcp://clickhouse-server:9000/cloki?username=default&password=*************
dsn: tcp://clickhouse-server:9000/qryn?username=default&password=*************
timeout: 10s
sending_queue:
queue_size: 100
Expand Down
4 changes: 2 additions & 2 deletions config/example-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ processors:

exporters:
qryn:
dsn: tcp://clickhouse-server:9000/cloki?username=qryn&password=demo
dsn: tcp://clickhouse-server:9000/qryn?username=qryn&password=demo
timeout: 10s
sending_queue:
queue_size: 100
Expand All @@ -64,7 +64,7 @@ exporters:
max_interval: 30s
max_elapsed_time: 300s
clickhouseprofileexporter:
dsn: tcp://0.0.0.0:9000/cloki
dsn: tcp://0.0.0.0:9000/qryn
timeout: 10s
sending_queue:
queue_size: 100
Expand Down
42 changes: 42 additions & 0 deletions exporter/clickhouseprofileexporter/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Clickhouse Profile Exporter

| Status | |
| ------------------------ |-----------------------|
| Stability | [beta] |
| Supported pipeline types | logs |

Exports conveyed OpenTelemetry logs backed IR for profiles into a Clickhouse cluster. See [Pyropscope Receiver](../../receiver/pyroscopereceiver), which can send compatible profiles.

## Configuration

- `dsn` (required): sets the ClickHouse server Data Source Name. For tcp protocol reference: [ClickHouse/clickhouse-go#dsn](https://github.com/ClickHouse/clickhouse-go#dsn). For http protocol reference: [mailru/go-clickhouse/#dsn](https://github.com/mailru/go-clickhouse/#dsn).

## Example

```yaml
receivers:
pyroscopereceiver:
protocols:
http:
endpoint: 0.0.0.0:8062
timeout: 30s

exporters:
clickhouseprofileexporter:
dsn: tcp://0.0.0.0:9000/qryn
timeout: 10s
sending_queue:
queue_size: 100
retry_on_failure:
enabled: true
initial_interval: 5s
max_interval: 30s
max_elapsed_time: 300s

service:
pipelines:
logs/profiles:
receivers: [pyroscopereceiver]
processors: [batch]
exporters: [clickhouseprofileexporter]
```
1 change: 0 additions & 1 deletion exporter/clickhouseprofileexporter/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ type Config struct {
exporterhelper.RetrySettings `mapstructure:"retry_on_failure"`
QueueSettings `mapstructure:"sending_queue"`

ClusteredClickhouse bool `mapstructure:"clustered_clickhouse"`
// DSN is the ClickHouse server Data Source Name.
// For tcp protocol reference: [ClickHouse/clickhouse-go#dsn](https://github.com/ClickHouse/clickhouse-go#dsn).
// For http protocol reference: [mailru/go-clickhouse/#dsn](https://github.com/mailru/go-clickhouse/#dsn).
Expand Down
2 changes: 1 addition & 1 deletion exporter/clickhouseprofileexporter/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
const (
typeStr = "clickhouseprofileexporter"

defaultDsn = "tcp://127.0.0.1:9000/cloki"
defaultDsn = "tcp://127.0.0.1:9000/qryn"
)

func createDefaultConfig() component.Config {
Expand Down
43 changes: 38 additions & 5 deletions receiver/pyroscopereceiver/README.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,52 @@
# pyroscope receiver
# Pyroscope Receiver

| Status | |
| ------------------------ |-----------------------|
| Stability | [alpha] |
| Stability | [beta] |
| Supported pipeline types | logs |

The pyroscope receiver implements the pyroscope ingest http api.
Implements the Pyroscope ingest protocol and conveys the accepted profiles as OpenTelemetry logs backed IR for further processing and export.

## Getting Started
## Configuration

- `protocols`: sets the application layer protocols that the receiver will serve. See [Supported Protocols](#supported-protocols). Default is http/s on 0.0.0.0:8062 with max request body size of: 5e6 + 1e6.
- `timeout`: sets the server reponse timeout. Default is 10 seconds.
- `request_body_size_expected_value`: sets the expected decompressed request body size in bytes to size pipeline buffers and optimize allocations. Default is 0.

## Example

Example:
```yaml
receivers:
pyroscopereceiver:
protocols:
http:
endpoint: 0.0.0.0:8062
timeout: 30s

exporters:
clickhouseprofileexporter:
dsn: tcp://0.0.0.0:9000/qryn
timeout: 10s
sending_queue:
queue_size: 100
retry_on_failure:
enabled: true
initial_interval: 5s
max_interval: 30s
max_elapsed_time: 300s

service:
pipelines:
logs/profiles:
receivers: [pyroscopereceiver]
processors: [batch]
exporters: [clickhouseprofileexporter]
```
## Supported Protocols
Http
## Supported Languages
Java
2 changes: 1 addition & 1 deletion receiver/pyroscopereceiver/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func (cfg *Config) Validate() error {
if cfg.Protocols.Http.MaxRequestBodySize < 1 {
return fmt.Errorf("max_request_body_size must be positive")
}
if cfg.DecompressedRequestBodySizeBytesExpectedValue < 1 {
if cfg.DecompressedRequestBodySizeBytesExpectedValue < 0 {
return fmt.Errorf("request_body_size_expected_value must be positive")
}
if cfg.DecompressedRequestBodySizeBytesExpectedValue > cfg.Protocols.Http.MaxRequestBodySize {
Expand Down
2 changes: 1 addition & 1 deletion receiver/pyroscopereceiver/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const (
defaultHttpAddr = "0.0.0.0:8062"
defaultMaxRequestBodySize = 5e6 + 1e6 // reserve for metadata
defaultTimeout = 10 * time.Second
defaultDecompressedRequestBodySizeBytesExpectedValue = 50e4 + 1e6 // reserve for metadata
defaultDecompressedRequestBodySizeBytesExpectedValue = 0
)

func createDefaultConfig() component.Config {
Expand Down

0 comments on commit bc20882

Please sign in to comment.