Skip to content

Commit 392395c

Browse files
committed
Add OpenAITelemetryPlugin snippets. Closes #260
1 parent 0935d2f commit 392395c

File tree

5 files changed

+68
-1
lines changed

5 files changed

+68
-1
lines changed

CHANGELOG.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
> **Note**: odd version numbers, for example, `0.13.0`, are not included in this changelog. They are used to test the new features and fixes before the final release.
99
10-
## [0.23.4] - Unreleased
10+
## [0.23.5] - Unreleased
1111

1212
### Added:
1313

1414
- Support for using Dev Proxy Beta with commands
1515
- Command: `dev-proxy-toolkit.discover-urls-to-watch` - Start Dev Proxy in discovery mode
16+
- Snippets: Added `devproxy-plugin-openai-telemetry` - OpenAITelemetryPlugin instance
17+
- Snippets: Added `devproxy-plugin-openai-telemetry-config` - OpenAITelemetryPlugin config section
18+
- Snippets: Added `devproxy-plugin-prices-file` - OpenAITelemetryPlugin telemetry prices file
19+
- Snippets: Added `devproxy-plugin-price` - OpenAITelemetryPlugin telemetry model price
1620

1721
### Changed:
1822

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,8 @@ Shown when the active document is a Dev Proxy configuration file
7070

7171
### Snippets
7272

73+
| Prefix | Description |
74+
| ------ | ----------- |
7375
| Prefix | Description |
7476
| ------ | ----------- |
7577
| `devproxy-config-file` | Dev Proxy config file |
@@ -78,6 +80,8 @@ Shown when the active document is a Dev Proxy configuration file
7880
| `devproxy-mocks-file` | Dev Proxy mocks file |
7981
| `devproxy-mocks-file-schema` | Dev Proxy mocks file schema |
8082
| `devproxy-mock` | Dev Proxy mock |
83+
| `devproxy-prices-file` | Dev Proxy prices file |
84+
| `devproxy-price` | Dev Proxy price |
8185
| `devproxy-request` | Dev Proxy request |
8286
| `devproxy-response` | Dev Proxy response |
8387
| `devproxy-response-header` | Dev Proxy response header |
@@ -139,6 +143,8 @@ Shown when the active document is a Dev Proxy configuration file
139143
| `devproxy-plugin-odata-paging-guidance` | ODataPagingGuidancePlugin instance |
140144
| `devproxy-plugin-graph-odsp-search-guidance` | ODSPSearchGuidancePlugin instance |
141145
| `devproxy-plugin-openai-mock-response` | OpenAIMockResponsePlugin instance |
146+
| `devproxy-plugin-openai-telemetry` | OpenAITelemetryPlugin instance |
147+
| `devproxy-plugin-openai-telemetry-config` | OpenAITelemetryPlugin config section |
142148
| `devproxy-plugin-open-api-spec-generator` | OpenApiSpecGeneratorPlugin instance |
143149
| `devproxy-plugin-open-api-spec-generator-config` | OpenApiSpecGeneratorPlugin config section |
144150
| `devproxy-plugin-rate-limiting` | MockResponsePlugin instance |

src/constants.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,13 @@ export const pluginSnippets: PluginSnippets = {
165165
OpenAIMockResponsePlugin: {
166166
instance: 'devproxy-plugin-openai-mock-response',
167167
},
168+
OpenAITelemetryPlugin: {
169+
instance: 'devproxy-plugin-openai-telemetry',
170+
config: {
171+
name: 'devproxy-plugin-openai-telemetry-config',
172+
required: true,
173+
}
174+
},
168175
OpenApiSpecGeneratorPlugin: {
169176
instance: 'devproxy-plugin-open-api-spec-generator',
170177
config: {
@@ -323,6 +330,10 @@ export const pluginDocs: PluginDocs = {
323330
name: 'OpenAI Mock Response Plugin',
324331
url: 'https://learn.microsoft.com/microsoft-cloud/dev/dev-proxy/technical-reference/openaimockresponseplugin',
325332
},
333+
OpenAITelemetryPlugin: {
334+
name: 'OpenAI Telemetry Plugin',
335+
url: 'https://learn.microsoft.com/microsoft-cloud/dev/dev-proxy/technical-reference/openaitelemetryplugin',
336+
},
326337
OpenApiSpecGeneratorPlugin: {
327338
name: 'Open API Spec Generator Plugin',
328339
url: 'https://learn.microsoft.com/microsoft-cloud/dev/dev-proxy/technical-reference/openapispecgeneratorplugin',

src/snippets.json

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,28 @@
7171
],
7272
"description": "Dev Proxy mock"
7373
},
74+
"PricesFile": {
75+
"prefix": "devproxy-prices-file",
76+
"body": [
77+
"{",
78+
"\t\"\\$schema\": \"https://raw.githubusercontent.com/dotnet/dev-proxy/main/schemas/v0.28.0/openaitelemetryplugin.pricesfile.schema.json\",",
79+
"\t\"prices\": {",
80+
"\t\t$1",
81+
"\t}",
82+
"}"
83+
],
84+
"description": "Dev Proxy prices file"
85+
},
86+
"Price": {
87+
"prefix": "devproxy-price",
88+
"body": [
89+
"\"gpt-4\": {",
90+
"\t\"input\": 0.03,",
91+
"\t\"output\": 0.06",
92+
"}"
93+
],
94+
"description": "Dev Proxy price"
95+
},
7496
"Request": {
7597
"prefix": "devproxy-request",
7698
"body": [
@@ -855,6 +877,30 @@
855877
],
856878
"description": "OpenAIMockResponsePlugin instance"
857879
},
880+
"OpenAITelemetryPlugin": {
881+
"prefix": "devproxy-plugin-openai-telemetry",
882+
"body": [
883+
"{",
884+
"\t\"name\": \"OpenAITelemetryPlugin\",",
885+
"\t\"enabled\": true,",
886+
"\t\"pluginPath\": \"~appFolder/plugins/dev-proxy-plugins.dll\",",
887+
"\t\"configSection\": \"openAITelemetryPlugin\"",
888+
"}"
889+
],
890+
"description": "OpenAITelemetryPlugin instance"
891+
},
892+
"OpenAITelemetryPluginConfig": {
893+
"prefix": "devproxy-plugin-openai-telemetry-config",
894+
"body": [
895+
"\"openAITelemetryPlugin\": {",
896+
"\t\"\\$schema\": \"https://raw.githubusercontent.com/dotnet/dev-proxy/main/schemas/v0.28.0/openaitelemetryplugin.schema.json\",",
897+
"\t\"application\": \"My app\",",
898+
"\t\"includeCosts\": true,",
899+
"\t\"pricesFile\": \"prices.json\"",
900+
"}"
901+
],
902+
"description": "OpenAITelemetryPlugin config section"
903+
},
858904
"OpenApiSpecGeneratorPlugin": {
859905
"prefix": "devproxy-plugin-open-api-spec-generator",
860906
"body": [

src/test/examples/prices.json

Whitespace-only changes.

0 commit comments

Comments
 (0)