Skip to content

Commit 93d11a1

Browse files
authored
feat(apm): Add markers to be used for inline tracing docs for the product (#1784)
1 parent c4ff69a commit 93d11a1

File tree

7 files changed

+77
-13
lines changed

7 files changed

+77
-13
lines changed

__tests__/__snapshots__/documentation.js.snap

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ Array [
3535
"_platforms/node/connect.json",
3636
"_platforms/node/express.json",
3737
"_platforms/node/koa.json",
38+
"_platforms/node/tracing.json",
3839
"_platforms/objc.json",
3940
"_platforms/php.json",
4041
"_platforms/php/laravel.json",
@@ -56,6 +57,7 @@ Array [
5657
"_platforms/python/rq.json",
5758
"_platforms/python/sanic.json",
5859
"_platforms/python/tornado.json",
60+
"_platforms/python/tracing.json",
5961
"_platforms/python/tryton.json",
6062
"_platforms/python/wsgi.json",
6163
"_platforms/react-native.json",
@@ -276,6 +278,8 @@ Array [
276278
"meta/ip-ranges/index.html",
277279
"meta/soc2/index.html",
278280
"meta/terms/index.html",
281+
"performance-monitoring/configuration/node/index.html",
282+
"performance-monitoring/configuration/python/index.html",
279283
"performance-monitoring/discover-queries/index.html",
280284
"performance-monitoring/discover-queries/query-builder/index.html",
281285
"performance-monitoring/distributed-tracing/index.html",

src/_data/platforms.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
-
2+
slug: tracing
3+
support_level: production
4+
type: framework
5+
name: Node.js
6+
doc_link: /performance-monitoring/setup/?platform=node
7+
wizard_parent: node
8+
wizard:
9+
- _documentation/performance-monitoring/configuration/node.md#node-tracing
110
-
211
slug: koa
312
support_level: production
@@ -141,6 +150,15 @@
141150
doc_link: /clients/python/
142151
case_style: snake_case
143152
superseded_by: python
153+
-
154+
slug: tracing
155+
support_level: production
156+
type: language
157+
name: Python
158+
doc_link: /performance-monitoring/setup/?platform=python
159+
wizard_parent: python
160+
wizard:
161+
- _documentation/performance-monitoring/configuration/python.md#python-tracing
144162
-
145163
slug: pyramid
146164
support_level: production

src/_includes/components/platform_content.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@
9898
{% include_relative {{ __relative_path }} %}
9999
{%- endcapture -%}
100100
<div class="tab-pane{% if __is_default %} show active{% endif %}" id="{{ __uniq }}-{{ __slug }}" data-slug="{{ __slug }}" role="tabpanel" aria-labelledby="{{ __uniq }}-{{ __slug }}-tab">
101-
{{ __content | markdownify }}
101+
{{ __content | strip_front_matter | markdownify }}
102102
</div>
103103
{%- endfor -%}
104104
</div>

src/_plugins/document_path_tree.rb

Lines changed: 28 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,15 @@ def sort_key(item)
66
[100, "zzzzz"]
77
end
88
end
9-
9+
10+
def show_item(item)
11+
if !item["document"].nil?
12+
!item["document"].data["hide_from_sidebar"]
13+
else
14+
true
15+
end
16+
end
17+
1018
def tree_for(docs, root)
1119
tree = []
1220

@@ -33,30 +41,39 @@ def tree_for(docs, root)
3341

3442
items = new_root.nil? ? nil : tree_for(docs_without_index, new_root)
3543

44+
should_hide_from_sidebar = false
45+
3646
if !items.nil?
3747
items.sort_by! { |i| sort_key(i) }
48+
49+
num_of_items_before = items.length()
50+
items.select! { |i| show_item(i) }
51+
52+
should_hide_from_sidebar = items.length() < num_of_items_before && items.length() == 0
3853
end
3954

40-
hash = {
41-
"slug" => name,
42-
"name" => document.nil? ? name : document.data["title"],
43-
"document" => document.nil? ? nil : document,
44-
"items" => items,
45-
"parent_path" => new_root
46-
}
55+
if !should_hide_from_sidebar
56+
hash = {
57+
"slug" => name,
58+
"name" => document.nil? ? name : document.data["title"],
59+
"document" => document.nil? ? nil : document,
60+
"items" => items,
61+
"parent_path" => new_root
62+
}
4763

48-
tree.push hash
64+
tree.push hash
65+
end
4966
end
5067
tree
5168
end
52-
69+
5370
def sort_tree(node)
5471
if !node["items"].nil?
5572
node["items"].sort_by! { |i| sort_key(i) }
5673
node["items"].each { |n| sort_tree(n) }
5774
end
5875
end
59-
76+
6077
mapped = site.collections.map {|c| c[1].docs}
6178
documents = mapped.flatten()
6279
tree = tree_for(documents, "")

src/_plugins/strip_front_matter.rb

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
module Jekyll
2+
module StripFrontMatter
3+
def strip_front_matter(input)
4+
input.to_s.gsub(/^---\n.*\n---/, '')
5+
end
6+
end
7+
end
8+
9+
Liquid::Template.register_filter(Jekyll::StripFrontMatter)

src/collections/_documentation/performance-monitoring/configuration/node.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
---
2+
hide_from_sidebar: true
3+
---
4+
15
To access our tracing features, you will need to install our Tracing integration.
26

37
**Node**
@@ -64,6 +68,8 @@ Spans are instrumented for the following operations within a transaction:
6468

6569
**Manual Instrumentation**
6670

71+
<!-- WIZARD node-tracing -->
72+
6773
To manually instrument a specific region of your code, you can create a transaction to capture it.
6874

6975
The following example creates a transaction for a part of the code that contains an expensive operation (for example, `processItem`), and sends the result to Sentry:
@@ -82,4 +88,6 @@ app.use(function processItems(req, res, next) {
8288
next();
8389
})
8490
});
85-
```
91+
```
92+
93+
<!-- ENDWIZARD -->

src/collections/_documentation/performance-monitoring/configuration/python.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
---
2+
hide_from_sidebar: true
3+
---
4+
15
To get started with performance monitoring using Sentry's Python SDK, first install the `@sentry/apm` package:
26

37
```
@@ -59,6 +63,8 @@ sentry_sdk.init(
5963

6064
**Manual Instrumentation**
6165

66+
<!-- WIZARD python-tracing -->
67+
6268
To manually instrument certain regions of your code, you can create a transaction to capture them.
6369

6470
The following example creates a transaction for a scope that contains an expensive operation (for example, `process_item`), and sends the result to Sentry:
@@ -91,3 +97,5 @@ def process_item(item):
9197
span.set_tag("http.status_code", response.status_code)
9298
span.set_data("http.foobarsessionid", get_foobar_sessionid())
9399
```
100+
101+
<!-- ENDWIZARD -->

0 commit comments

Comments
 (0)