# Unable to report Event in extensions: report\_dt\_event()

**URL:** <https://community.dynatrace.com/t/unable-to-report-event-in-extensions-report-dt-event/49411>\
**Category:** Extensions\
**Tags:** metric-events, events, extensions\
**Created:** [December 18, 2024, 12:06pm UTC](https://community.dynatrace.com/t/unable-to-report-event-in-extensions-report-dt-event/49411 "2024-12-18T12:06:36Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![guptasahil942](https://avatars.discourse-cdn.com/v4/letter/g/e274bd/32.png) [@guptasahil942](https://community.dynatrace.com/u/guptasahil942)\
**Post date:** [December 18, 2024, 12:06pm UTC](https://community.dynatrace.com/t/unable-to-report-event-in-extensions-report-dt-event/49411/1 "2024-12-18T12:06:36Z")

</div>

I have an entity&nbsp;custom:host&nbsp; , which is mapped to Host entity so that data can be displayed on OOTB Host screen .

I am unable to report the event using below code for&nbsp;self.report\_dt\_event()

host\_entity\_id = data[‘dt.entity.host’]self.report\_dt\_event(description=“One or more processes are unavailable”, title=“Test Host Unhealthy”, entity\_selector= f"type(test:host),entityID(\“{host\_entity\_id}\”)")types:&nbsp; &nbsp; - name: test:host&nbsp; &nbsp; &nbsp; displayName: Test&nbsp;Host&nbsp; &nbsp; &nbsp; rules:&nbsp; &nbsp; &nbsp; &nbsp; - idPattern: Test\_host\_{host}&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; instanceNamePattern: “{host}”&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; iconPattern: host&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; attributes:&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; - key: test\_host&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; displayName: Test\_Host&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; pattern: “{host}”&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; - key: test\_host\_id&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; displayName: Test\_Host\_ID&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; pattern: “{host\_id}”&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sources:&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; - sourceType: Metrics&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; condition: $prefix(test.)relationships:&nbsp; &nbsp; - sources:&nbsp; &nbsp; &nbsp; - sourceType: Metrics&nbsp; &nbsp; &nbsp; &nbsp; condition: $prefix(test.)&nbsp; &nbsp; &nbsp; fromType: test:host&nbsp; &nbsp; &nbsp; toType: host&nbsp; &nbsp; &nbsp; typeOfRelation: SAME\_AS&nbsp; &nbsp; - sources:&nbsp; &nbsp; &nbsp; &nbsp; - sourceType: Entities&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; mappingRules:&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; - sourceProperty: test\_host\_id&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sourceTransformation: To lower case&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; destinationProperty: entityId&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; destinationTransformation: To lower case&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; - sourceProperty: test\_host&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sourceTransformation: To lower case&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; destinationProperty: displayName&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; destinationTransformation: To lower case&nbsp; &nbsp; &nbsp; fromType: test:host&nbsp; &nbsp; &nbsp; typeOfRelation: SAME\_AS&nbsp; &nbsp; &nbsp; toType: hostAlso, for an event, do we need to make an entry in extension.yaml too ?

---

<div class="post-metadata">

**Author:** ![JamesKitson](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/jameskitson/32/22460_2.png) [@JamesKitson](https://community.dynatrace.com/u/JamesKitson)\
**Post date:** [December 26, 2024, 3:27pm UTC](https://community.dynatrace.com/t/unable-to-report-event-in-extensions-report-dt-event/49411/2 "2024-12-26T15:27:36Z")

</div>

I can’t tell everything from your post, but it seems like you’re trying to use the entity ID of the built-in host entity type as a filter on your custom host entity in the selector which will not work. Having a ‘same as’ relationship won’t allow you to automatically be able to use the attributes of that other entity. For attributes only the attributes on your custom entity would be available.

You can use relationships as filters in entity selectors too so if you have the relationship working and showing up properly you could use that: [Environment API v2 - Entity selector — Dynatrace Docs](https://docs.dynatrace.com/docs/discover-dynatrace/references/dynatrace-api/environment-api/entity-v2/entity-selector#relationships)

Lastly, if this is a local activation of an extension running on a OneAgent monitored host there shouldn’t be any need for this extra entity type. You’d be able to report all this directly to the OA monitored host. We only do something like this for remote activations of extension.
