File tree Expand file tree Collapse file tree 8 files changed +56
-50
lines changed
example-exemplars-tail-sampling/config
example-exporter-opentelemetry/oats-tests/agent
prometheus-metrics-exporter-opentelemetry-otel-agent-resources/src/main/java/io/prometheus/otelagent Expand file tree Collapse file tree 8 files changed +56
-50
lines changed Original file line number Diff line number Diff line change 1- FILTER_REGEX_EXCLUDE = mvnw
1+ FILTER_REGEX_EXCLUDE = mvnw|src/main/generated/.*|docs/themes/.*
22IGNORE_GITIGNORED_FILES = true
33JAVA_FILE_NAME = google_checks.xml
44# disable kubernetes linter - complains about resource limits, etc
@@ -20,8 +20,6 @@ VALIDATE_JAVASCRIPT_STANDARD=false
2020VALIDATE_JSCPD = false
2121VALIDATE_PYTHON_PYLINT = false
2222
23- # FILTER_REGEX_EXCLUDE=src/main/generated/.*|docs/themes/.*
24-
2523FIX_ENV = true
2624FIX_GO = true
2725FIX_JAVASCRIPT_PRETTIER = true
Original file line number Diff line number Diff line change 1717 env :
1818 GPG_SIGNING_KEY : ${{ secrets.GPG_SIGNING_KEY }}
1919 run : |
20- echo "$GPG_SIGNING_KEY" | wc -c
21- echo "$GPG_SIGNING_KEY" | gpg --batch --import-options import-show --import
20+ echo "${ GPG_SIGNING_KEY} " | wc -c
21+ echo "${ GPG_SIGNING_KEY} " | gpg --batch --import-options import-show --import
2222 - name : Checkout Plugin Repository
2323 uses : actions/checkout@v4
2424 with :
Original file line number Diff line number Diff line change @@ -12,12 +12,12 @@ This will serve the docs on [http://localhost:1313](http://localhost:1313).
1212
1313## Deploy to GitHub Pages
1414
15- Changes to the ` main ` branch will be deployed automatically with GitHub actions .
15+ Changes to the ` main ` branch will be deployed automatically with GitHub Actions .
1616
1717## Update Javadoc
1818
1919Javadoc are not checked-in to the GitHub repository.
20- They are generated on the fly by GitHub actions when the docs are updated.
20+ They are generated on the fly by GitHub Actions when the docs are updated.
2121To view locally, run the following:
2222
2323```
Original file line number Diff line number Diff line change 204204 "exemplar" : false ,
205205 "expr" : " histogram_count(rate(request_duration_seconds{job=\" $instance\" }[5m]))" ,
206206 "instant" : true ,
207- "key" : " Q-ddf5e7ad-fa7a-4342-acf8-819848f226a3-0 " ,
207+ "key" : " key1 " ,
208208 "range" : true ,
209209 "refId" : " A"
210210 }
300300 "editorMode" : " code" ,
301301 "expr" : " rate(tempo_ingester_traces_created_total[5m])" ,
302302 "instant" : true ,
303- "key" : " Q-0e8731c6-7df2-47bc-a1a3-45dcb9f5e92d-0 " ,
303+ "key" : " key2 " ,
304304 "range" : true ,
305305 "refId" : " A"
306306 }
Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ docker-compose:
55 - ./docker-compose.yml
66expected :
77 custom-checks :
8- - script : ./service-instance-id-check .py
8+ - script : ./service_instance_id_check .py
99 metrics :
1010 - promql : " uptime_seconds_total{}"
1111 value : " >= 0"
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1+ #!/usr/bin/env python3
2+
3+ """This script is used to check if the service instance id is present in the exported data
4+ The script will return 0 if the service instance id is present in the exported data"""
5+
6+ import json
7+ import urllib .parse
8+ from urllib .request import urlopen
9+
10+ URL = " http://localhost:9090/api/v1/query?query=target_info"
11+ with urlopen (URL ) as response :
12+ # read the response
13+ res = response .read ()
14+ # decode the response
15+ res = res .decode ("utf-8" )
16+
17+ # uncomment the following line to use the local file instead of the url - for debugging
18+ # with open('example_target_info.json') as f:
19+ # res = json.load(f)
20+
21+ values = list (
22+ {
23+ r ["metric" ]["instance" ]
24+ for r in res ["data" ]["result" ]
25+ if not r ["metric" ]["service_name" ] == "otelcol-contrib"
26+ }
27+ )
28+ print (values )
29+
30+ # both the agent and the exporter should report the same instance id
31+ assert len (values ) == 1
32+
33+ path = f'target_info{{instance="{ values [0 ]} "}}'
34+ path = urllib .parse .quote_plus (path )
35+ URL = f"http://localhost:9090/api/v1/query?query={ path } "
36+ with urlopen (URL ) as response :
37+ # read the response
38+ res = response .read ()
39+ # decode the response
40+ res = res .decode ("utf-8" )
41+
42+ infos = res ["data" ]["result" ]
43+ print (infos )
44+
45+ # they should not have the same target info
46+ # e.g. only the agent has telemetry_distro_name
47+ assert len (infos ) == 2
Original file line number Diff line number Diff line change @@ -35,7 +35,7 @@ public class ResourceAttributesFromOtelAgent {
3535 * runtime dependency on any OTel version remains.
3636 *
3737 * <p>The test for this class is in
38- * examples/example-exporter-opentelemetry/oats-tests/agent/service-instance-id-check .py
38+ * examples/example-exporter-opentelemetry/oats-tests/agent/service_instance_id_check .py
3939 */
4040 public static Map <String , String > getResourceAttributes (String instrumentationScopeName ) {
4141 try {
You can’t perform that action at this time.
0 commit comments