-
Notifications
You must be signed in to change notification settings - Fork 804
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add prometheus exporter (#483)
* fix(http-plugin): move node-sdk to dev deps * feat: update dependencies * feat: server implementation and tests * fix: remove console logger * fix: add types * feat(prometheus-exporter): counter and gauge * feat(prometheus-exporter): implement counter and gauge * feat(prometheus-exporter): export configuration interface * fix: linting * fix: typo Co-Authored-By: Mayur Kale <mayurkale@google.com> * chore: document ExporterConfig * fix: dependencies * fix: typo Co-Authored-By: Mayur Kale <mayurkale@google.com> * chore: document sanitize method and make behavior more strict * chore: do not use global prom-client registry * chore: add defaults to description and metric endpoint * test: export couter, gauge, multiple, and none * test: sanitize prom metric names * fix: typo Co-Authored-By: Mayur Kale <mayurkale@google.com> * chore: make _server read only * test: add tests for prom export configuration * style: make comments descriptive * test: update tests for label sets * fix: lint
- Loading branch information
1 parent
39732fa
commit 460d986
Showing
6 changed files
with
838 additions
and
4 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
53 changes: 53 additions & 0 deletions
53
packages/opentelemetry-exporter-prometheus/src/export/types.ts
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,53 @@ | ||
/*! | ||
* Copyright 2019, OpenTelemetry Authors | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
import * as types from '@opentelemetry/types'; | ||
|
||
/** | ||
* Configuration interface for prometheus exporter | ||
*/ | ||
export interface ExporterConfig { | ||
/** | ||
* App prefix for metrics, if needed | ||
* | ||
* @default '' | ||
* */ | ||
prefix?: string; | ||
|
||
/** | ||
* Endpoint the metrics should be exposed at with preceeding slash | ||
* @default '/metrics' | ||
*/ | ||
endpoint?: string; | ||
|
||
/** | ||
* Port number for Prometheus exporter server | ||
* | ||
* Default registered port is 9464: | ||
* https://github.com/prometheus/prometheus/wiki/Default-port-allocations | ||
* @default 9464 | ||
*/ | ||
port?: number; | ||
|
||
/** | ||
* Define if the Prometheus exporter server will be started | ||
* @default false | ||
*/ | ||
startServer?: boolean; | ||
|
||
/** Standard logging interface */ | ||
logger?: types.Logger; | ||
} |
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 |
---|---|---|
|
@@ -14,4 +14,5 @@ | |
* limitations under the License. | ||
*/ | ||
|
||
// | ||
export * from './prometheus'; | ||
export * from './export/types'; |
Oops, something went wrong.