Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 28 additions & 8 deletions docs/aws-lambda.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,17 @@ Next, set up a remote address via environment variables where the extension will

The extension is configured via Environment Variables:

| env var | default | description |
| -------------------------- | -------------------------------- | ---------------------------------------------- |
| `PYROSCOPE_REMOTE_ADDRESS` | `https://ingest.pyroscope.cloud` | the pyroscope instance data will be relayed to |
| `PYROSCOPE_AUTH_TOKEN` | `""` | authorization key (token authentication) |
| `PYROSCOPE_SELF_PROFILING` | `false` | whether to profile the extension itself or not |
| `PYROSCOPE_LOG_LEVEL` | `info` | `error` or `info` or `debug` or `trace` |
| `PYROSCOPE_TIMEOUT` | `10s` | http client timeout ([go duration format](https://pkg.go.dev/time#Duration)) |
| `PYROSCOPE_NUM_WORKERS` | `5` | num of relay workers, pick based on the number of profile types |
| env var | default | description |
| ------------------------------- | -------------------------------- | ---------------------------------------------- |
| `PYROSCOPE_REMOTE_ADDRESS` | `https://ingest.pyroscope.cloud` | the pyroscope instance data will be relayed to |
| `PYROSCOPE_AUTH_TOKEN` | `""` | authorization key (token authentication) |
| `PYROSCOPE_SELF_PROFILING` | `false` | whether to profile the extension itself or not |
| `PYROSCOPE_LOG_LEVEL` | `info` | `error` or `info` or `debug` or `trace` |
| `PYROSCOPE_TIMEOUT` | `10s` | http client timeout ([go duration format](https://pkg.go.dev/time#Duration)) |
| `PYROSCOPE_NUM_WORKERS` | `5` | num of relay workers, pick based on the number of profile types |
| `PYROSCOPE_SCOPE_ORGID` | `""` | phlare tenant ID, passed as X-Scope-OrgID http header |
| `PYROSCOPE_BASIC_AUTH_USER` | `""` | HTTP Basic authentication user |
| `PYROSCOPE_BASIC_AUTH_PASSWORD` | `""` | HTTP Basic authentication password |



Expand All @@ -59,3 +62,20 @@ func main() {
Once you've completed the above steps, you'll be able to use the Pyroscope UI to analyze data surrounding your lambda function and make optimizations accordingly.
To learn more about the use case for the extension, check out the [Pyroscope AWS Lambda Extension blogpost](/blog/profile-aws-lambda-functions).

## Sending data to Phlare with Pyroscope AWS Lambda Extension

Starting with [weekly-f8](https://hub.docker.com/r/grafana/phlare/tags) you can ingest pyroscope profiles directly to phlare.

```bash
PYROSCOPE_REMOTE_ADDRESS="<URL>"
PYROSCOPE_BASIC_AUTH_USER="<User>"
PYROSCOPE_BASIC_AUTH_PASSWORD="<Password>"
PYROSCOPE_SCOPE_ORGID="<TenantID>"
```

To configure AWS Lambda Extension to send data to Phlare, replace the `<URL>` placeholder with the appropriate server URL. This could be the grafana.com Phlare URL or your own custom Phlare server URL.

If you need to send data to grafana.com, you'll have to configure HTTP Basic authentication. Replace `<User>` with your grafana.com stack user and `<Password>` with your grafana.com API key.

If your Phlare server has multi-tenancy enabled, you'll need to configure a tenant ID. Replace `<TenantID>` with your Phlare tenant ID.

31 changes: 31 additions & 0 deletions docs/integration-dotnet.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,15 @@ Pyroscope.Profiler.Instance.SetContentionTrackingEnabled(enabled);
Pyroscope.Profiler.Instance.SetExceptionTrackingEnabled(enabled);
```

It is possible to dynamically change auth tokens.

```java
// Set Authorization Bearer token. Clear any previously set Authorization tokens.
Pyroscope.Profiler.Instance.SetAuthToken(token);
// Set Authorization Basic username and password. Clear any previously set Authorization tokens.
Pyroscope.Profiler.Instance.SetBasicAuth(basicAuthUser, BasicAuthPassword);
```

Here is a simple [example](https://github.com/grafana/pyroscope/blob/main/examples/dotnet/rideshare/example/Program.cs) exposing this APIs as an http endpoint.

### Configuration
Expand All @@ -157,3 +166,25 @@ Here is a simple [example](https://github.com/grafana/pyroscope/blob/main/exampl
3. Copy one of the keys
4. Add it to your .NET profiler configuration: `PYROSCOPE_AUTH_TOKEN="psx-..."`

### Sending data to Phlare with Pyroscope .NET integration

Starting with [weekly-f8](https://hub.docker.com/r/grafana/phlare/tags) you can ingest pyroscope profiles directly to phlare.

```bash
export CORECLR_ENABLE_PROFILING=1
export CORECLR_PROFILER={BD1A650D-AC5D-4896-B64F-D6FA25D6B26A}
export CORECLR_PROFILER_PATH=/dotnet/Pyroscope.Profiler.Native.so
export LD_PRELOAD=/dotnet/Pyroscope.Linux.ApiWrapper.x64.so
export PYROSCOPE_PROFILING_ENABLED=1
export PYROSCOPE_APPLICATION_NAME=phlare.dotnet.app
export PYROSCOPE_SERVER_ADDRESS=<URL>
export PYROSCOPE_BASIC_AUTH_USER=<User>
export PYROSCOPE_BASIC_AUTH_PASSWORD=<Password>
export PYROSCOPE_SCOPE_ORGID=<TenantID>
```

To configure .NET integration to send data to Phlare, replace the `<URL>` placeholder with the appropriate server URL. This could be the grafana.com Phlare URL or your own custom Phlare server URL.

If you need to send data to grafana.com, you'll have to configure HTTP Basic authentication. Replace `<User>` with your grafana.com stack user and `<Password>` with your grafana.com API key.

If your Phlare server has multi-tenancy enabled, you'll need to configure a tenant ID. Replace `<TenantID>` with your Phlare tenant ID.
20 changes: 20 additions & 0 deletions docs/integration-ebpf.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,26 @@ All parameters below are also supported as CLI arguments, a full list can be acc
| `PYROSCOPE_ONLY_SERVICES` | `false` | Ignore processes unknown to service discovery. In a Kubernetes cluster it ignores processes like `containerd, runc, kubelet` etc |
| `PYROSCOPE_SYMBOL_CACHE_SIZE` | `256` | Max size of symbols cache (1 entry per process). Change this value if you’re experiencing memory pressure or have many individual services. |

### Sending data to Phlare with Pyroscope eBPF integration

Starting with [weekly-f8](https://hub.docker.com/r/grafana/phlare/tags) you can ingest pyroscope profiles directly to phlare.

```bash
./pyroscope ebpf \
--application-name=phlare.ebpf.app \
--server-address=<URL> \
--basic-auth-user="<User>" \
--basic-auth-password="<Password>" \
--scope-org-id=<TenantID> \
```

To configure eBPF integration to send data to Phlare, replace the `<URL>` placeholder with the appropriate server URL. This could be the grafana.com Phlare URL or your own custom Phlare server URL.

If you need to send data to grafana.com, you'll have to configure HTTP Basic authentication. Replace `<User>` with your grafana.com stack user and `<Password>` with your grafana.com API key.

If your Phlare server has multi-tenancy enabled, you'll need to configure a tenant ID. Replace `<TenantID>` with your Phlare tenant ID.


### Example

Check out the following resources to learn more about eBPF profiling:
Expand Down
30 changes: 30 additions & 0 deletions docs/integration-golang.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,36 @@ runtime.SetBlockProfileRate(rate)

`rate` parameter controls the fraction of goroutine blocking events that are reported in the blocking profile. The profiler aims to sample an average of one blocking event per rate nanoseconds spent blocked.

## Sending data to Phlare with Pyroscope Golang integration

Starting with [weekly-f8](https://hub.docker.com/r/grafana/phlare/tags) you can ingest pyroscope profiles directly to phlare.

```go
pyroscope.Start(pyroscope.Config{
ApplicationName: "phlare.golang.app",
ServerAddress: "<URL>",
// Optional HTTP Basic authentication
BasicAuthUser: "<User>",
BasicAuthPassword: "<Password>",
// Optional Phlare tenant ID
ScopeOrgID: "<TenantID>",
ProfileTypes: []pyroscope.ProfileType{
pyroscope.ProfileCPU,
pyroscope.ProfileInuseObjects,
pyroscope.ProfileAllocObjects,
pyroscope.ProfileInuseSpace,
pyroscope.ProfileAllocSpace,
},
})
```

To configure the Golang integration to send data to Phlare, replace the `<URL>` placeholder with the appropriate server URL. This could be the grafana.com Phlare URL or your own custom Phlare server URL.

If you need to send data to grafana.com, you'll have to configure HTTP Basic authentication. Replace `<User>` with your grafana.com stack user and `<Password>` with your grafana.com API key.

If your Phlare server has multi-tenancy enabled, you'll need to configure a tenant ID. Replace `<TenantID>` with your Phlare tenant ID.


### Golang profiling examples

Check out the following resources to learn more about Golang profiling:
Expand Down
34 changes: 31 additions & 3 deletions docs/integration-java.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ keywords: [ pyroscope, java, javaspy, profiling, async-profiler ]

import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
import {exampleMaven, exampleGradle, examplePlainJava, exampleSpringFramework} from '../src/javaCodeBlocks';
import {exampleMaven, exampleGradle, examplePlainJava, exampleSpringFramework, examplePhlareJavaCode, examplePhlareJavaagent} from '../src/javaCodeBlocks';
import CodeBlock from '@theme/CodeBlock';


Expand Down Expand Up @@ -121,11 +121,15 @@ Java integration supports JFR format to be able to support multiple events (JFR
* `PYROSCOPE_PROFILER_EVENT` sets the profiler event. With JFR format enabled, this event refers to one of the possible CPU profiling events: `itimer`, `cpu`, `wall`. The default is `itimer`.
* `PYROSCOPE_PROFILER_ALLOC` sets the allocation threshold to register the events, in bytes (equivalent to `--alloc=` in `async-profiler`). The default value is "" - empty string, which means that allocation profiling is disabled. Setting it to `0` will register all the events.
* `PYROSCOPE_PROFILER_LOCK` sets the lock threshold to register the events, in nanoseconds (equivalent to `--lock=` in `async-profiler`). The default value is "" - empty string, which means that lock profiling is disabled. Setting it to `0` will register all the events.
* `PYROSCOPE_CONFIGURATION_FILE` sets an additional properties configuration file. The default value is `pyroscope.properties`.
* `PYROSCOPE_LABELS` sets static labels in the form of comma separated `key=value` pairs. The default value is `""` - enpty string, no labels.

There are some extra configuration options:

* `PYROSCOPE_CONFIGURATION_FILE` sets an additional properties configuration file. The default value is `pyroscope.properties`.
* `PYROSCOPE_BASIC_AUTH_USER` HTTP Basic authentication username. The default value is `""` - empty string, no authentication.
* `PYROSCOPE_BASIC_AUTH_PASSWORD` HTTP Basic authentication password. The default value is `""` - empty string, no authentication.
* `PYROSCOPE_SCOPE_ORGID` phlare tenant ID, passed as X-Scope-OrgID http header. The default value is `""` - empty string, no tenant ID.
* `PYROSCOPE_HTTP_HEADERS` extra http headers in json format, for example: `{"X-Header": "Value"}`. The default value is `{}` - no extra headers.
* `PYROSCOPE_LABELS` sets static labels in the form of comma separated `key=value` pairs. The default value is `""` - empty string, no labels.
* `PYROSCOPE_LOG_LEVEL` determines the level of verbosity for Pyroscope's logger. Available options include `debug`, `info`, `warn`, and `error`. The default value is set to `info`.
* `PYROSCOPE_PUSH_QUEUE_CAPACITY` specifies the size of the ingestion queue that temporarily stores profiling data in memory during network outages. It is recommended to keep this queue size reasonably small, and the default value is set to 8.
* `PYROSCOPE_INGEST_MAX_TRIES` sets the maximum number of times to retry an ingestion API call in the event of failure. A value of -1 indicates that the retries will continue indefinitely. The default value is set to 8.
Expand Down Expand Up @@ -156,6 +160,30 @@ PyroscopeAgent.start(new Config.Builder()
.build()
);
```
## Sending data to Phlare with Pyroscope java integration

Starting with [weekly-f8](https://hub.docker.com/r/grafana/phlare/tags) you can ingest pyroscope profiles directly to phlare.

<Tabs
defaultValue="code"
values={[
{label: 'From code', value: 'code'},
{label: 'As javaagent', value: 'javaagent'},
]}>
<TabItem value="code">
<CodeBlock className="language-java">{examplePhlareJavaCode}</CodeBlock>
</TabItem>
<TabItem value="javaagent">
<CodeBlock className="language-bash">{examplePhlareJavaagent}</CodeBlock>
</TabItem>
</Tabs>

To configure java integration to send data to Phlare, replace the `<URL>` placeholder with the appropriate server URL. This could be the grafana.com Phlare URL or your own custom Phlare server URL.

If you need to send data to grafana.com, you'll have to configure HTTP Basic authentication. Replace `<User>` with your grafana.com stack user and `<Password>` with your grafana.com API key.

If your Phlare server has multi-tenancy enabled, you'll need to configure a tenant ID. Replace `<TenantID>` with your Phlare tenant ID.


### Java profiling examples

Expand Down
23 changes: 23 additions & 0 deletions docs/integration-python.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,29 @@ with pyroscope.tag_wrapper({ "controller": "slow_controller_i_want_to_profile" }
slow_code()
```

### Sending data to Phlare with Pyroscope Python integration

Starting with [weekly-f8](https://hub.docker.com/r/grafana/phlare/tags) you can ingest pyroscope profiles directly to phlare.

```python
import pyroscope

pyroscope.configure(
application_name = "phlare.python.app",
server_address = "<URL>",
basic_auth_username='<User>',
basic_auth_password='<Password>',
scope_org_id="<TenantID>",
)
```

To configure Python integration to send data to Phlare, replace the `<URL>` placeholder with the appropriate server URL. This could be the grafana.com Phlare URL or your own custom Phlare server URL.

If you need to send data to grafana.com, you'll have to configure HTTP Basic authentication. Replace `<User>` with your grafana.com stack user and `<Password>` with your grafana.com API key.

If your Phlare server has multi-tenancy enabled, you'll need to configure a tenant ID. Replace `<TenantID>` with your Phlare tenant ID.


### Python profiling examples

Check out the following resources to learn more about Python profiling:
Expand Down
23 changes: 23 additions & 0 deletions docs/integration-ruby.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,29 @@ end

```

### Sending data to Phlare with Pyroscope Ruby integration

Starting with [weekly-f8](https://hub.docker.com/r/grafana/phlare/tags) you can ingest pyroscope profiles directly to phlare.

```ruby
require "pyroscope"

Pyroscope.configure do |config|
config.application_name = "phlare.ruby.app"
config.server_address = "<URL>"
config.basic_auth_username='<User>'
config.basic_auth_password='<Password>'
config.scope_org_id='<TenantID>'
end
```

To configure Ruby integration to send data to Phlare, replace the `<URL>` placeholder with the appropriate server URL. This could be the grafana.com Phlare URL or your own custom Phlare server URL.

If you need to send data to grafana.com, you'll have to configure HTTP Basic authentication. Replace `<User>` with your grafana.com stack user and `<Password>` with your grafana.com API key.

If your Phlare server has multi-tenancy enabled, you'll need to configure a tenant ID. Replace `<TenantID>` with your Phlare tenant ID.


### Ruby profiling examples

Check out the following resources to learn more about Ruby profiling:
Expand Down
20 changes: 10 additions & 10 deletions docs/remote-write.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -123,23 +123,23 @@ remote-write:
Starting with [weekly-f8](https://hub.docker.com/r/grafana/phlare/tags) you can ingest pyroscope profiles directly to phlare.
You can do remote write from pyroscope to phlare as well.

For phlare target address should end with `/pyroscope`.

You can add basic auth to remote write requests with either `user:pass@` in the target address url or with an extra `Authorization` header.

Multi-tenancy is also supported with a `X-Scope-OrgID` header.


```yaml
remote-write:
enabled: true
targets:
phlare:
address: http://user:pass@phlare:4100/pyroscope
headers:
X-Scope-OrgID: "..."
address: "<URL>"
basic-auth-user: "<User>"
basic-auth-password: "<Password>"
scope-org-id: "<TenantID>"
```

To configure .NET integration to send data to Phlare, replace the `<URL>` placeholder with the appropriate server URL. This could be the grafana.com Phlare URL or your own custom Phlare server URL.

If you need to send data to grafana.com, you'll have to configure HTTP Basic authentication. Replace `<User>` with your grafana.com stack user and `<Password>` with your grafana.com API key.

If your Phlare server has multi-tenancy enabled, you'll need to configure a tenant ID. Replace `<TenantID>` with your Phlare tenant ID.



### Metrics
Expand Down
27 changes: 26 additions & 1 deletion src/javaCodeBlocks.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,29 @@ public void init() {
// .setProfilingAlloc("0")
.build()
);
}`
}`

export const examplePhlareJavaCode = `PyroscopeAgent.start(
new Config.Builder()
.setApplicationName("phlare.java.app")
.setFormat(Format.JFR)
.setServerAddress("<URL>")
// Optional HTTP Basic authentication
.setBasicAuthUser("<User>")
.setBasicAuthPassword("<Password>")
// Optional Phlare tenant ID
.setScopeOrgID("<TenantID>")
.build()
);
`

export const examplePhlareJavaagent = `export PYROSCOPE_APPLICATION_NAME=phlare.java.app
export PYROSCOPE_FORMAT=JFR
export PYROSCOPE_SERVER_ADDRESS=<URL>
# Optional HTTP Basic authentication
export PYROSCOPE_BASIC_AUTH_USER=<User>
export PYROSCOPE_BASIC_AUTH_PASSWORD=<Password>
# Optional Phlare tenant ID
export PYROSCOPE_SCOPE_ORGID=<TenantID>
java -javaagent:pyroscope.jar -jar app.jar
`