-
Notifications
You must be signed in to change notification settings - Fork 622
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
docs: adds an otelcollector example #2277
Open
petethepig
wants to merge
4
commits into
next
Choose a base branch
from
collector
base: next
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+1,272
−0
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# Grafana Agent pull mode integration | ||
|
||
This example demonstrates how you can use Grafana Agent with Grafana Pyroscope to profile otel collector. | ||
|
||
### 1. Configure Grafana agent | ||
|
||
For Grafana Alloy to pull profiles from your application, configure the agent for things like profiling configuration, targets, and possibly authentication. | ||
|
||
You can find a list of [arguments](https://grafana.com/docs/agent/next/flow/reference/components/pyroscope.scrape/#arguments) and [supported blocks](https://grafana.com/docs/agent/next/flow/reference/components/pyroscope.scrape/#blocks) in the [Grafana Agent documentation for Pyroscope](https://grafana.com/docs/agent/next/flow/reference/components/pyroscope.scrape/) | ||
|
||
Refer to [config file](./agent/config/config.river) to see an example of how to configure Grafana Agent to send profiling data to Pyroscope. | ||
|
||
### 2. Run Grafana agent, Grafana, and Pyroscope | ||
|
||
```shell | ||
docker-compose up -d | ||
``` | ||
|
||
### 3. Observe profiling data | ||
|
||
Now that everything is set up, you can browse profiling data via [Grafana UI](http://localhost:3000). | ||
|
||
#### Explore view | ||
For showing profiling data alongside traces | ||
![image](https://github.com/grafana/pyroscope/assets/23323466/a9c2f28c-d35a-49b0-a3bc-678d3fbdd321) | ||
|
||
#### Dashboard | ||
For showing real-time overview of profiling data | ||
![image](https://github.com/grafana/pyroscope/assets/23323466/59a84d0c-87d2-4cfc-8e34-b54576cb6540) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
server: | ||
log_level: info |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
logging { | ||
level = "debug" | ||
format = "logfmt" | ||
} | ||
|
||
pyroscope.write "example" { | ||
// Send metrics to a locally running Phlare instance. | ||
endpoint { | ||
url = "http://pyroscope:4040" | ||
|
||
// To send data to Grafana Cloud you'll need to provide username and password. | ||
// basic_auth { | ||
// username = "myuser" | ||
// password = "mypassword" | ||
// } | ||
} | ||
external_labels = { | ||
"env" = "example", | ||
} | ||
} | ||
|
||
|
||
pyroscope.scrape "default" { | ||
targets = [ | ||
{"__address__" = "otelcollector:6060", "service_name"="otelcollector"}, | ||
] | ||
forward_to = [pyroscope.write.example.receiver] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
version: '3.9' | ||
services: | ||
grafana: | ||
image: grafana/grafana:latest | ||
volumes: | ||
- ./grafana-provisioning:/etc/grafana/provisioning | ||
- ./grafana/grafana.ini:/etc/grafana/grafana.ini | ||
- ./grafana/home.json:/default-dashboard.json | ||
ports: | ||
- 3000:3000 | ||
|
||
pyroscope: | ||
image: 'grafana/pyroscope:1.0.0-rc.0' | ||
ports: | ||
- 4040:4040 | ||
command: -config.file=/etc/pyroscope/config.yaml | ||
volumes: | ||
- ./pyroscope/config.yaml:/etc/pyroscope/config.yaml | ||
|
||
agent: | ||
image: grafana/agent:latest | ||
volumes: | ||
- ./agent/config:/etc/agent-config | ||
command: | ||
- run | ||
- /etc/agent-config/config.river | ||
- --server.http.listen-addr=0.0.0.0:12345 | ||
environment: | ||
HOSTNAME: agent | ||
AGENT_MODE: flow | ||
ports: | ||
- "12345:12345" | ||
|
||
otelcollector: | ||
image: otel/opentelemetry-collector:0.67.0 | ||
restart: always | ||
command: ["--config=/etc/otelcollector.yaml"] | ||
volumes: | ||
- ./otelcollector.yaml:/etc/otelcollector.yaml | ||
ports: | ||
- "6060:6060" # pprof extension |
71 changes: 71 additions & 0 deletions
71
examples/otelcollector/grafana-provisioning/dashboards/main.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
{ | ||
"annotations": { | ||
"list": [] | ||
}, | ||
"editable": true, | ||
"fiscalYearStartMonth": 0, | ||
"graphTooltip": 1, | ||
"links": [], | ||
"liveNow": false, | ||
"panels": [ | ||
{ | ||
"datasource": { | ||
"type": "phlare", | ||
"uid": "pyroscope" | ||
}, | ||
"gridPos": { | ||
"h": 19, | ||
"w": 24, | ||
"x": 0, | ||
"y": 0 | ||
}, | ||
"id": 1, | ||
"targets": [ | ||
{ | ||
"datasource": { | ||
"type": "phlare", | ||
"uid": "pyroscope" | ||
}, | ||
"groupBy": [], | ||
"labelSelector": "{}", | ||
"profileTypeId": "process_cpu:cpu:nanoseconds:cpu:nanoseconds", | ||
"queryType": "profile", | ||
"refId": "A" | ||
} | ||
], | ||
"title": "Panel Title", | ||
"type": "flamegraph" | ||
} | ||
], | ||
"refresh": "5s", | ||
"schemaVersion": 38, | ||
"style": "dark", | ||
"tags": [], | ||
"templating": { | ||
"list": [] | ||
}, | ||
"time": { | ||
"from": "now-15m", | ||
"to": "now" | ||
}, | ||
"timepicker": { | ||
"refresh_intervals": [ | ||
"5s", | ||
"10s", | ||
"30s", | ||
"1m", | ||
"5m", | ||
"15m", | ||
"30m", | ||
"1h", | ||
"2h", | ||
"1d" | ||
], | ||
"time_options": ["5m", "15m", "1h", "6h", "12h", "24h", "2d", "7d", "30d"] | ||
}, | ||
"timezone": "browser", | ||
"title": "main", | ||
"uid": "65gjqY3Mk", | ||
"version": 1, | ||
"weekStart": "" | ||
} |
8 changes: 8 additions & 0 deletions
8
examples/otelcollector/grafana-provisioning/dashboards/main.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
apiVersion: 1 | ||
|
||
providers: | ||
- name: dashboards | ||
type: file | ||
updateIntervalSeconds: 5 | ||
options: | ||
path: /etc/grafana/provisioning/dashboards |
12 changes: 12 additions & 0 deletions
12
examples/otelcollector/grafana-provisioning/datasources/datasources.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
--- | ||
apiVersion: 1 | ||
datasources: | ||
- name: Pyroscope | ||
orgId: 1 | ||
uid: pyroscope | ||
type: 'phlare' | ||
access: 'proxy' | ||
grafanaOrgId: 1 | ||
url: http://pyroscope:4040 | ||
isDefault: true | ||
editable: true |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you usingAlloy or Agent for this example? The links and text all point to Agent.