diff --git a/docs/aws-lambda.mdx b/docs/aws-lambda.mdx index 8c54313f..3ceb869d 100644 --- a/docs/aws-lambda.mdx +++ b/docs/aws-lambda.mdx @@ -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 | @@ -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="" +PYROSCOPE_BASIC_AUTH_USER="" +PYROSCOPE_BASIC_AUTH_PASSWORD="" +PYROSCOPE_SCOPE_ORGID="" +``` + +To configure AWS Lambda Extension to send data to Phlare, replace the `` 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 `` with your grafana.com stack user and `` with your grafana.com API key. + +If your Phlare server has multi-tenancy enabled, you'll need to configure a tenant ID. Replace `` with your Phlare tenant ID. + diff --git a/docs/integration-dotnet.mdx b/docs/integration-dotnet.mdx index 2bf2dd2d..5525f26b 100644 --- a/docs/integration-dotnet.mdx +++ b/docs/integration-dotnet.mdx @@ -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 @@ -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= +export PYROSCOPE_BASIC_AUTH_USER= +export PYROSCOPE_BASIC_AUTH_PASSWORD= +export PYROSCOPE_SCOPE_ORGID= +``` + +To configure .NET integration to send data to Phlare, replace the `` 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 `` with your grafana.com stack user and `` with your grafana.com API key. + +If your Phlare server has multi-tenancy enabled, you'll need to configure a tenant ID. Replace `` with your Phlare tenant ID. diff --git a/docs/integration-ebpf.mdx b/docs/integration-ebpf.mdx index 86d2b1ae..6c35e7b1 100644 --- a/docs/integration-ebpf.mdx +++ b/docs/integration-ebpf.mdx @@ -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= \ + --basic-auth-user="" \ + --basic-auth-password="" \ + --scope-org-id= \ +``` + +To configure eBPF integration to send data to Phlare, replace the `` 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 `` with your grafana.com stack user and `` with your grafana.com API key. + +If your Phlare server has multi-tenancy enabled, you'll need to configure a tenant ID. Replace `` with your Phlare tenant ID. + + ### Example Check out the following resources to learn more about eBPF profiling: diff --git a/docs/integration-golang.mdx b/docs/integration-golang.mdx index 2b66d938..9e0c8cf4 100644 --- a/docs/integration-golang.mdx +++ b/docs/integration-golang.mdx @@ -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: "", + // Optional HTTP Basic authentication + BasicAuthUser: "", + BasicAuthPassword: "", + // Optional Phlare tenant ID + ScopeOrgID: "", + 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 `` 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 `` with your grafana.com stack user and `` with your grafana.com API key. + +If your Phlare server has multi-tenancy enabled, you'll need to configure a tenant ID. Replace `` with your Phlare tenant ID. + + ### Golang profiling examples Check out the following resources to learn more about Golang profiling: diff --git a/docs/integration-java.mdx b/docs/integration-java.mdx index fd4b790c..d8df9ee9 100644 --- a/docs/integration-java.mdx +++ b/docs/integration-java.mdx @@ -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'; @@ -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. @@ -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. + + + + {examplePhlareJavaCode} + + + {examplePhlareJavaagent} + + + +To configure java integration to send data to Phlare, replace the `` 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 `` with your grafana.com stack user and `` with your grafana.com API key. + +If your Phlare server has multi-tenancy enabled, you'll need to configure a tenant ID. Replace `` with your Phlare tenant ID. + ### Java profiling examples diff --git a/docs/integration-python.mdx b/docs/integration-python.mdx index f55dd749..78ac28aa 100644 --- a/docs/integration-python.mdx +++ b/docs/integration-python.mdx @@ -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 = "", + basic_auth_username='', + basic_auth_password='', + scope_org_id="", +) +``` + +To configure Python integration to send data to Phlare, replace the `` 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 `` with your grafana.com stack user and `` with your grafana.com API key. + +If your Phlare server has multi-tenancy enabled, you'll need to configure a tenant ID. Replace `` with your Phlare tenant ID. + + ### Python profiling examples Check out the following resources to learn more about Python profiling: diff --git a/docs/integration-ruby.mdx b/docs/integration-ruby.mdx index 0c944bf0..f4c0f580 100644 --- a/docs/integration-ruby.mdx +++ b/docs/integration-ruby.mdx @@ -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 = "" + config.basic_auth_username='' + config.basic_auth_password='' + config.scope_org_id='' +end +``` + +To configure Ruby integration to send data to Phlare, replace the `` 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 `` with your grafana.com stack user and `` with your grafana.com API key. + +If your Phlare server has multi-tenancy enabled, you'll need to configure a tenant ID. Replace `` with your Phlare tenant ID. + + ### Ruby profiling examples Check out the following resources to learn more about Ruby profiling: diff --git a/docs/remote-write.mdx b/docs/remote-write.mdx index a12c83f6..b0f35bc0 100644 --- a/docs/remote-write.mdx +++ b/docs/remote-write.mdx @@ -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: "" + basic-auth-user: "" + basic-auth-password: "" + scope-org-id: "" ``` +To configure .NET integration to send data to Phlare, replace the `` 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 `` with your grafana.com stack user and `` with your grafana.com API key. + +If your Phlare server has multi-tenancy enabled, you'll need to configure a tenant ID. Replace `` with your Phlare tenant ID. + ### Metrics diff --git a/src/javaCodeBlocks.js b/src/javaCodeBlocks.js index e7ce0c6e..a0b0d586 100644 --- a/src/javaCodeBlocks.js +++ b/src/javaCodeBlocks.js @@ -37,4 +37,29 @@ public void init() { // .setProfilingAlloc("0") .build() ); -}` \ No newline at end of file +}` + +export const examplePhlareJavaCode = `PyroscopeAgent.start( + new Config.Builder() + .setApplicationName("phlare.java.app") + .setFormat(Format.JFR) + .setServerAddress("") + // Optional HTTP Basic authentication + .setBasicAuthUser("") + .setBasicAuthPassword("") + // Optional Phlare tenant ID + .setScopeOrgID("") + .build() +); +` + +export const examplePhlareJavaagent = `export PYROSCOPE_APPLICATION_NAME=phlare.java.app +export PYROSCOPE_FORMAT=JFR +export PYROSCOPE_SERVER_ADDRESS= +# Optional HTTP Basic authentication +export PYROSCOPE_BASIC_AUTH_USER= +export PYROSCOPE_BASIC_AUTH_PASSWORD= +# Optional Phlare tenant ID +export PYROSCOPE_SCOPE_ORGID= +java -javaagent:pyroscope.jar -jar app.jar +` \ No newline at end of file