Skip to content

Commit 18f8a78

Browse files
authored
Rename service_name to service in the exposure payload (#6825)
1 parent 8c6c04e commit 18f8a78

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

integration-tests/openfeature/openfeature-exposure-events.spec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ describe('OpenFeature Remote Config and Exposure Events Integration', () => {
7575
agent.on('exposures', ({ payload, headers }) => {
7676
assert.property(payload, 'context')
7777
assert.property(payload, 'exposures')
78-
assert.equal(payload.context.service_name, 'ffe-test-service')
78+
assert.equal(payload.context.service, 'ffe-test-service')
7979
assert.equal(payload.context.version, '1.2.3')
8080
assert.equal(payload.context.env, 'test')
8181

@@ -159,7 +159,7 @@ describe('OpenFeature Remote Config and Exposure Events Integration', () => {
159159
agent.on('exposures', ({ payload }) => {
160160
assert.property(payload, 'context')
161161
assert.property(payload, 'exposures')
162-
assert.equal(payload.context.service_name, 'ffe-test-service')
162+
assert.equal(payload.context.service, 'ffe-test-service')
163163
assert.equal(payload.context.version, '1.2.3')
164164
assert.equal(payload.context.env, 'test')
165165

packages/dd-trace/src/openfeature/writers/exposures.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ const {
2727

2828
/**
2929
* @typedef {Object} ExposureContext
30-
* @property {string} service_name - Service name
30+
* @property {string} service - Service name
3131
* @property {string} [version] - Service version
3232
* @property {string} [env] - Service environment
3333
*/
@@ -127,7 +127,7 @@ class ExposuresWriter extends BaseFFEWriter {
127127
*/
128128
_buildContext () {
129129
const context = {
130-
service_name: this._config.service || 'unknown'
130+
service: this._config.service || 'unknown'
131131
}
132132

133133
// Only include version and env if they are defined

packages/dd-trace/test/openfeature/writers/exposures.spec.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ describe('OpenFeature Exposures Writer', () => {
178178
const payload = writer.makePayload(events)
179179

180180
expect(payload.context).to.deep.equal({
181-
service_name: 'test-service',
181+
service: 'test-service',
182182
version: '1.0.0',
183183
env: 'test'
184184
})
@@ -213,7 +213,7 @@ describe('OpenFeature Exposures Writer', () => {
213213
const payload = writerWithoutOptionals.makePayload(events)
214214

215215
expect(payload.context).to.deep.equal({
216-
service_name: 'test-service'
216+
service: 'test-service'
217217
})
218218
expect(payload.context).to.not.have.property('version')
219219
expect(payload.context).to.not.have.property('env')
@@ -279,7 +279,7 @@ describe('OpenFeature Exposures Writer', () => {
279279
expect(parsedPayload).to.have.property('exposures')
280280
expect(parsedPayload.exposures).to.be.an('array').with.length(1)
281281
expect(parsedPayload.exposures[0].timestamp).to.exist
282-
expect(parsedPayload.context.service_name).to.equal('test-service')
282+
expect(parsedPayload.context.service).to.equal('test-service')
283283
})
284284

285285
it('should empty buffer after flushing', () => {

0 commit comments

Comments
 (0)