-
Notifications
You must be signed in to change notification settings - Fork 834
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* chore: removing submodule protos from exporter-collector * chore: adding submodule opentelemetry-proto to exporter collector * chore: fixing submodule path * chore: updating proto to version v0.4.0 * chore: splitting exporter collector into 3 packages - depending on transport layer, updated examples, fixed the metrics collector for proto, fixed bug for label * chore: fixing bug with controller when shutting down * chore: ignored files * chore: fixing submodule links * chore: lint fixes - seems like some latest updates forcing extend to be in new line * chore: lint space * chore: fixing test when waiting to load proto files
- Loading branch information
Showing
101 changed files
with
4,172 additions
and
1,789 deletions.
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 |
---|---|---|
|
@@ -78,3 +78,7 @@ package.json.lerna_backup | |
|
||
# VsCode configs | ||
.vscode/ | ||
|
||
#IDEA | ||
.idea | ||
*.iml |
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 |
---|---|---|
@@ -1,3 +1,6 @@ | ||
[submodule "packages/opentelemetry-exporter-collector/src/platform/node/protos"] | ||
path = packages/opentelemetry-exporter-collector/src/platform/node/protos | ||
[submodule "packages/opentelemetry-exporter-collector-grpc/protos"] | ||
path = packages/opentelemetry-exporter-collector-grpc/protos | ||
url = /~https://github.com/open-telemetry/opentelemetry-proto.git | ||
[submodule "packages/opentelemetry-exporter-collector-proto/protos"] | ||
path = packages/opentelemetry-exporter-collector-proto/protos | ||
url = /~https://github.com/open-telemetry/opentelemetry-proto.git |
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
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
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
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,36 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
|
||
<head> | ||
<meta charset="utf-8"> | ||
<title>Metrics Example</title> | ||
<base href="/"> | ||
|
||
<!-- | ||
https://www.w3.org/TR/trace-context/ | ||
Set the `traceparent` in the server's HTML template code. It should be | ||
dynamically generated server side to have the server's request trace Id, | ||
a parent span Id that was set on the server's request span, and the trace | ||
flags to indicate the server's sampling decision | ||
(01 = sampled, 00 = notsampled). | ||
'{version}-{traceId}-{spanId}-{sampleDecision}' | ||
--> | ||
<!-- <meta name="traceparent" content="00-ab42124a3c573678d4d8b21ba52df3bf-d21f7bc17caa5aba-01">--> | ||
|
||
<meta name="viewport" content="width=device-width, initial-scale=1"> | ||
</head> | ||
|
||
<body> | ||
Example of using metrics with Collector Exporter | ||
<script type="text/javascript" src="metrics.js"></script> | ||
<br/> | ||
<button id="startBtn">Start metrics</button> | ||
<button id="stopBtn">Stop metrics</button> | ||
<br/> | ||
|
||
If you run the collector from example "opentelemetry-exporter-collector" you should see traces at: <br/> | ||
<a href="http://localhost:9090/graph?g0.range_input=1m&g0.expr=requests&g0.tab=0/" target="_blank">http://localhost:9090/</a> | ||
|
||
</body> | ||
|
||
</html> |
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,51 @@ | ||
'use strict'; | ||
|
||
const { ConsoleLogger, LogLevel } = require('@opentelemetry/core'); | ||
const { CollectorMetricExporter } = require('@opentelemetry/exporter-collector'); | ||
const { MeterProvider } = require('@opentelemetry/metrics'); | ||
|
||
const metricExporter = new CollectorMetricExporter({ | ||
serviceName: 'basic-metric-service', | ||
logger: new ConsoleLogger(LogLevel.DEBUG), | ||
}); | ||
|
||
let interval; | ||
let meter; | ||
|
||
function stopMetrics() { | ||
console.log('STOPPING METRICS'); | ||
clearInterval(interval); | ||
meter.shutdown(); | ||
} | ||
|
||
function startMetrics() { | ||
console.log('STARTING METRICS'); | ||
meter = new MeterProvider({ | ||
exporter: metricExporter, | ||
interval: 1000, | ||
}).getMeter('example-exporter-collector'); | ||
|
||
const requestCounter = meter.createCounter('requests', { | ||
description: 'Example of a Counter', | ||
}); | ||
|
||
const upDownCounter = meter.createUpDownCounter('test_up_down_counter', { | ||
description: 'Example of a UpDownCounter', | ||
}); | ||
|
||
const labels = { pid: process.pid, environment: 'staging' }; | ||
|
||
interval = setInterval(() => { | ||
requestCounter.bind(labels).add(1); | ||
upDownCounter.bind(labels).add(Math.random() > 0.5 ? 1 : -1); | ||
}, 1000); | ||
} | ||
|
||
const addClickEvents = () => { | ||
const startBtn = document.getElementById('startBtn'); | ||
const stopBtn = document.getElementById('stopBtn'); | ||
startBtn.addEventListener('click', startMetrics); | ||
stopBtn.addEventListener('click', stopMetrics); | ||
}; | ||
|
||
window.addEventListener('load', addClickEvents); |
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
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
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
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
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
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 @@ | ||
build |
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 @@ | ||
module.exports = { | ||
"env": { | ||
"mocha": true, | ||
"commonjs": true, | ||
"node": true, | ||
}, | ||
...require('../../eslint.config.js') | ||
} |
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,4 @@ | ||
/bin | ||
/coverage | ||
/doc | ||
/test |
Oops, something went wrong.